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

added: expert button in configuration dialog

parent 374ee8a4
No related branches found
No related tags found
No related merge requests found
import Component from '@ember/component';
import layout from '../templates/components/discovery-settings';
import { inject as service } from "@ember/service";
import { alias } from '@ember/object/computed';
export default Component.extend({
layout,
configuration: service("configuration"),
toggleState: alias('configuration.discoverySettings.expertMode'),
actions: {
saveSettings() {
// TODO https://github.com/funkensturm/ember-local-storage
}
}
});
......@@ -2,16 +2,22 @@ import Router from "explorviz-frontend/router";
export function initialize(appInstance) {
const service = appInstance.lookup("service:page-setup");
const pageSetupService = appInstance.lookup("service:page-setup");
if(service){
service.get("navbarRoutes").push("discovery");
if(pageSetupService){
pageSetupService.get("navbarRoutes").push("discovery");
}
Router.map(function() {
this.route("discovery");
});
const configurationService = appInstance.lookup('service:configuration');
if(configurationService){
configurationService.get('pluginSettings').addObject('discovery-settings');
configurationService.set('discoverySettings', {expertMode: false});
}
appInstance.lookup("service:agent-reload");
}
......
......@@ -12,16 +12,27 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, {
actions: {
// @Override BaseRoute
resetRoute() {
this.controller.set('procezzForDetailView', null);
this.controller.set('agentForDetailView', null);
this.cleanupController();
}
},
// stop first, there might be an old service instance running
this.get("agentReload").stopUpdate();
this.get("agentReload").startUpdate();
// @Override Ember-Hook
resetController(controller, isExiting, transition) {
if (isExiting && transition.targetName !== 'error') {
this.cleanupController();
}
},
cleanupController() {
this.controller.set('procezzForDetailView', null);
this.controller.set('agentForDetailView', null);
// stop first, there might be an old service instance running
this.get("agentReload").stopUpdate();
this.get("agentReload").startUpdate();
},
setupProcessView: on('activate', function(){
this.controllerFor('discovery').setup();
})
......
<div class="container-fluid">
<table class="table table-striped">
<thead>
<tr>
<th class="col-xs-4">Setting</th>
<th class="col-xs-8">Value</th>
</tr>
</thead>
<tbody>
<tr>
<td><b>Expert Mode</b></td>
<td>
<div style="position:absolute;">
{{x-toggle value=toggleState onToggle=(action (mut toggleState))}}
</div>
</td>
</tr>
</tbody>
</table>
<button type="button" class="btn btn-success" {{action "saveSettings"}}>Save</button>
</div>
\ No newline at end of file
export { default } from 'explorviz-frontend-extension-discovery/components/discovery-settings';
\ No newline at end of file
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
moduleForComponent('discovery-settings', 'Integration | Component | discovery settings', {
integration: true
});
test('it renders', function(assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.on('myAction', function(val) { ... });
this.render(hbs`{{discovery-settings}}`);
assert.equal(this.$().text().trim(), '');
// Template block usage:
this.render(hbs`
{{#discovery-settings}}
template block text
{{/discovery-settings}}
`);
assert.equal(this.$().text().trim(), 'template block text');
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment