Skip to content
Snippets Groups Projects
Verified Commit f4fb7959 authored by Alexander-Krause's avatar Alexander-Krause
Browse files

towards fieldings rest definition

parent 3033c373
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,9 @@ import layout from '../templates/components/agent-details'; ...@@ -3,6 +3,9 @@ import layout from '../templates/components/agent-details';
import { inject as service } from "@ember/service"; import { inject as service } from "@ember/service";
import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler';
// Declare globals
/*global $*/
export default Component.extend(AlertifyHandler, { export default Component.extend(AlertifyHandler, {
layout, layout,
......
...@@ -3,6 +3,9 @@ import layout from '../templates/components/procezz-details'; ...@@ -3,6 +3,9 @@ import layout from '../templates/components/procezz-details';
import { inject as service } from "@ember/service"; import { inject as service } from "@ember/service";
import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler';
// Declare globals
/*global $*/
export default Component.extend(AlertifyHandler, { export default Component.extend(AlertifyHandler, {
layout, layout,
...@@ -30,7 +33,7 @@ export default Component.extend(AlertifyHandler, { ...@@ -30,7 +33,7 @@ export default Component.extend(AlertifyHandler, {
this._super(...arguments); this._super(...arguments);
// Save the monitoring flag on component setup // Save the monitoring flag on component setup
// We can therefore use it to show a message for the user // We can therefore use it to show a message for the user
// (handleMessageForUser) // (showMessageForUser)
const monitoredFlag = this.get('procezz.monitoredFlag'); const monitoredFlag = this.get('procezz.monitoredFlag');
this.set('monitoredFlag', monitoredFlag); this.set('monitoredFlag', monitoredFlag);
}, },
...@@ -45,7 +48,7 @@ export default Component.extend(AlertifyHandler, { ...@@ -45,7 +48,7 @@ export default Component.extend(AlertifyHandler, {
this.get('procezz').save({include: 'agent'}).then(() => { this.get('procezz').save({include: 'agent'}).then(() => {
self.set('showSpinner', false); self.set('showSpinner', false);
self.handleMessageForUser(false); self.showMessageForUser(self.buildUpdateMessageForUser(true));
}) })
.catch((errorObject) => { .catch((errorObject) => {
...@@ -58,7 +61,7 @@ export default Component.extend(AlertifyHandler, { ...@@ -58,7 +61,7 @@ export default Component.extend(AlertifyHandler, {
self.errorHandling(errorObject); self.errorHandling(errorObject);
}); });
} else { } else {
self.handleMessageForUser(false); self.showMessageForUser(self.buildUpdateMessageForUser(false));
} }
}, },
...@@ -66,17 +69,19 @@ export default Component.extend(AlertifyHandler, { ...@@ -66,17 +69,19 @@ export default Component.extend(AlertifyHandler, {
const self = this; const self = this;
// this attribute will trigger the agent
// to restart the procezz
this.set('procezz.restart', true);
this.set('procezz.stopped', false);
this.set('showSpinner', true); this.set('showSpinner', true);
this.get('procezz').save({ this.get('procezz').save({
include: 'agent', include: 'agent'
adapterOptions: {
pathExtension: 'restart'
}
}) })
.then(() => { .then(() => {
self.set('showSpinner', false); self.set('showSpinner', false);
self.handleMessageForUser(true); self.showMessageForUser(self.buildRestartMessageForUser());
}) })
.catch((errorObject) => { .catch((errorObject) => {
self.get('procezz').rollbackAttributes(); self.get('procezz').rollbackAttributes();
...@@ -84,32 +89,71 @@ export default Component.extend(AlertifyHandler, { ...@@ -84,32 +89,71 @@ export default Component.extend(AlertifyHandler, {
// closure action from discovery controller // closure action from discovery controller
self.errorHandling(errorObject); self.errorHandling(errorObject);
}); });
}
}, },
handleMessageForUser(wasRestarted) { stopProcezz() {
let defaultMessage = "Procezz updated.";
let monitoringMessageForUser = ""; const self = this;
// this attribute will trigger the agent
// to stop the procezz
this.set('procezz.stopped', true);
this.set('procezz.restart', false);
this.set('showSpinner', true);
this.get('procezz').save({
include: 'agent'
})
.then(() => {
self.set('showSpinner', false);
self.showMessageForUser("Procezz was stopped.");
})
.catch((errorObject) => {
self.get('procezz').rollbackAttributes();
// closure action from discovery controller
self.errorHandling(errorObject);
});
}
},
if(wasRestarted) { buildRestartMessageForUser() {
defaultMessage = "Procezz restarted."; const mainMessage = "Procezz restarted.";
let monitoringMessage = "";
const monitoredFlag = this.get('procezz').get('monitoredFlag'); const monitoredFlag = this.get('procezz').get('monitoredFlag');
const oldMonitoredFlag = this.get('monitoredFlag'); const oldMonitoredFlag = this.get('monitoredFlag');
if(monitoredFlag !== oldMonitoredFlag && monitoredFlag) { if(monitoredFlag !== oldMonitoredFlag && monitoredFlag) {
// was set from off to on // was set from off to on
monitoringMessageForUser = "Monitoring was started."; monitoringMessage = "Monitoring was started.";
} }
else if(monitoredFlag !== oldMonitoredFlag && !monitoredFlag) { else if(monitoredFlag !== oldMonitoredFlag && !monitoredFlag) {
// was set from on to off // was set from on to off
monitoringMessageForUser = "Monitoring was stopped."; monitoringMessage = "Monitoring was stopped.";
} }
return `${mainMessage} ${monitoringMessage}`;
},
buildUpdateMessageForUser(hasDirtyAttributes) {
let mainMessage = "No change detected.";
if(hasDirtyAttributes) {
mainMessage = "Procezz updated.";
} }
return mainMessage;
},
showMessageForUser(message) {
this.set('monitoredFlag', this.get('procezz').get('monitoredFlag')); this.set('monitoredFlag', this.get('procezz').get('monitoredFlag'));
this.showAlertifyMessageWithDuration( this.showAlertifyMessageWithDuration(
`${defaultMessage} ${monitoringMessageForUser} Click on <b>Discovery</b> to go back.` ,4); `${message} Click on <b>Discovery</b> to go back.`, 4);
} }
}); });
...@@ -32,6 +32,9 @@ export default BaseModel.extend({ ...@@ -32,6 +32,9 @@ export default BaseModel.extend({
workingDirectory: attr("string"), workingDirectory: attr("string"),
stopped: attr("boolean"),
restart: attr("boolean"),
aopContent: attr("string"), aopContent: attr("string"),
kiekerConfigContent: attr("string"), kiekerConfigContent: attr("string"),
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<td>{{lastDiscoveryTimeAsDate}}</td> <td>{{lastDiscoveryTimeAsDate}}</td>
</tr> </tr>
<tr> <tr>
<td><b>Name</b>{{help-tooltip title="Name attribute has a higher priority than IP:Port in all views. This attribute will also be considered for monitoring. If it's not filled, a monitored node will be named after the IP:Port attribute."}}</td> <td><b>Name</b>{{help-tooltip title="Name attribute has a higher priority than IP:Port in all views. This attribute will also be considered for monitoring. If not filled, a monitored node will be named after the IP:Port attribute. While a procezz of this agent is monitored, changes to this attribute have no effect. Restart of process is necessary."}}</td>
<td> <td>
{{input class="form-control" value=agent.name}} {{input class="form-control" value=agent.name}}
</td> </td>
......
...@@ -4,10 +4,6 @@ ...@@ -4,10 +4,6 @@
</div> </div>
{{/if}} {{/if}}
<div class="text-center" style="margin-bottom: 5px;">
<button type="button" class="btn btn-success" {{action "saveAgent"}}>Save</button>
</div>
<div class="panel-group" id="accordion"> <div class="panel-group" id="accordion">
<!-- BEGIN collapse1 --> <!-- BEGIN collapse1 -->
...@@ -27,3 +23,7 @@ ...@@ -27,3 +23,7 @@
</div> </div>
</div> </div>
<div class="text-center" style="margin-bottom: 5px;">
<button type="button" class="btn btn-success" {{action "saveAgent"}}>Save</button>
</div>
\ No newline at end of file
...@@ -6,6 +6,14 @@ ...@@ -6,6 +6,14 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr>
<td><b>Is stopped?</b>{{help-tooltip title="Flag that indicates if the process is stopped."}}</td>
<td>
<div class="well well-sm container-word-wrap" style="margin-bottom: 0px;">
{{procezz.stopped}}
</div>
</td>
</tr>
<tr> <tr>
<td><b>Working Directory</b>{{help-tooltip title="Shows the file system directory of the process. Some processes don't contain the absolute path to their execution artifact. Therefore, this attribute might be a hint on how to start a process."}}</td> <td><b>Working Directory</b>{{help-tooltip title="Shows the file system directory of the process. Some processes don't contain the absolute path to their execution artifact. Therefore, this attribute might be a hint on how to start a process."}}</td>
<td> <td>
......
...@@ -4,11 +4,6 @@ ...@@ -4,11 +4,6 @@
</div> </div>
{{/if}} {{/if}}
<div style="margin-bottom: 5px;" class="button-box text-center">
<a class="btn btn-info" {{action "saveProcezz"}} role="button">Save</a>
<a class="btn btn-warning" {{action "restartProcezz"}} role="button">Restart</a>
</div>
<div class="panel-group" id="accordion"> <div class="panel-group" id="accordion">
<!-- BEGIN collapse1 --> <!-- BEGIN collapse1 -->
...@@ -59,3 +54,9 @@ ...@@ -59,3 +54,9 @@
</div> </div>
</div> </div>
</div> </div>
<div style="margin-bottom: 5px;" class="button-box text-center">
<a class="btn btn-info" {{action "saveProcezz"}} role="button">Save</a>
<a class="btn btn-warning" {{action "restartProcezz"}} role="button">Restart</a>
<a class="btn btn-primary" {{action "stopProcezz"}} role="button">Stop</a>
</div>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment