Skip to content

Commit 3bafa42

Browse files
danipaniiiPriebe Daniel
andauthored
Closes #1495 - improve the behavior when agent commands fail (or are not available) due to missing configuration - backend (#1527)
* DynamicallyActivatableServiceObserver is going ood * Improve behavior in the UI when agent commands fail (for log-preloading) * Improve behavior in the UI when agent commands fail (for downloading support archive) * Fixing HttpPropertySourceStateTest * Fixing checkMap Test * Fixing DASObserver Test as well as implementing requests from the review * Fixing HttpPropertySourceStateTest * Trying to fix eslint test * Trying to fix eslint test #2 * Fixing eslint test #3 Co-authored-by: Priebe Daniel <dpr@novatec-gmbh.de>
1 parent 5b0d734 commit 3bafa42

File tree

11 files changed

+16076
-11629
lines changed

11 files changed

+16076
-11629
lines changed

components/inspectit-ocelot-configurationserver-ui/.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"import/first": "error",
4747
"import/no-useless-path-segments": "error",
4848
"react/prop-types": "warn",
49-
"prettier/prettier": ["error", { "endOfLine": "auto" }]
49+
"prettier/prettier": ["error", { "endOfLine": "auto" }],
50+
"react/no-unknown-property": ["error", { "ignore": ["jsx", "global", "align"] }]
5051
}
5152
}
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules

components/inspectit-ocelot-configurationserver-ui/src/components/views/status/StatusTable.js

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ class StatusTable extends React.Component {
114114
const { agentVersion } = metaInformation;
115115

116116
const agentVersionTokens = agentVersion.split('.');
117-
let logAvailable = true;
117+
let logAvailable = false;
118+
let agentCommandsEnabled = false;
118119
if (agentVersionTokens.length == 2 || agentVersionTokens.length == 3) {
119120
const agentVersionNumber =
120121
agentVersionTokens[0] * 10000 + agentVersionTokens[1] * 100 + (agentVersionTokens.length == 3 ? agentVersionTokens[2] * 1 : 0);
@@ -130,6 +131,10 @@ class StatusTable extends React.Component {
130131
}
131132
agentId = metaInformation.agentId;
132133
agentIdElement = <span style={{ color: 'gray' }}>({agentId})</span>;
134+
135+
let settingStates = JSON.parse(metaInformation.settingStates);
136+
logAvailable = settingStates.LogPreloader;
137+
agentCommandsEnabled = settingStates.AgentCommandService;
133138
}
134139
return (
135140
<div className="this">
@@ -181,15 +186,18 @@ class StatusTable extends React.Component {
181186
tooltip="Show Configuration"
182187
tooltipOptions={{ showDelay: 500 }}
183188
/>
184-
{logAvailable && (
185-
<Button
186-
className="log-button"
187-
icon="pi pi-align-justify"
188-
onClick={() => onShowDownloadDialog(agentId, attributes, 'log')}
189-
tooltip="Show Logs"
190-
tooltipOptions={{ showDelay: 500 }}
191-
/>
192-
)}
189+
<Button
190+
className="log-button"
191+
icon="pi pi-align-justify"
192+
onClick={() => onShowDownloadDialog(agentId, attributes, 'log')}
193+
tooltip={
194+
logAvailable && agentCommandsEnabled
195+
? 'Show Logs'
196+
: "Please enable 'log-preloading' and 'agent-commands' in the config! Make sure to pass the right url for the agent commands!"
197+
}
198+
tooltipOptions={{ showDelay: 500 }}
199+
disabled={!logAvailable || !agentCommandsEnabled}
200+
/>
193201
</div>
194202
);
195203
};
@@ -226,6 +234,9 @@ class StatusTable extends React.Component {
226234
const { onShowDownloadDialog } = this.props;
227235
const { health, metaInformation } = rowData;
228236

237+
let settingStates = JSON.parse(metaInformation.settingStates);
238+
let agentCommandsEnabled = settingStates.AgentCommandService;
239+
229240
let healthInfo;
230241
let iconClass;
231242
let iconColor;
@@ -273,8 +284,13 @@ class StatusTable extends React.Component {
273284
className="archive-button"
274285
icon="pi pi-cloud-download"
275286
onClick={() => onShowDownloadDialog(metaInformation.agentId, metaInformation.agentVersion, 'archive')}
276-
tooltip="Download Support Archive"
287+
tooltip={
288+
agentCommandsEnabled
289+
? 'Download Support Archive'
290+
: "Make sure to enabled 'agent-commands' in the config and set the right URL!"
291+
}
277292
tooltipOptions={{ showDelay: 500 }}
293+
disabled={!agentCommandsEnabled}
278294
/>
279295
</div>
280296
) : (

0 commit comments

Comments
 (0)