c98130cc08
* ui: Add the most basic workspace root in /ui * We already have a LICENSE file in the repository root * Change directory path in build scripts ui-v2 -> ui * Make yarn install flags configurable from elsewhere * Minimal workspace root makefile * Call the new docker specific target * Update yarn in the docker build image * Reconfigure the netlify target and move to the higher makefile * Move ui-v2 -> ui/packages/consul-ui * Change repo root to refleect new folder structure * Temporarily don't hoist consul-api-double * Fixup CI configuration * Fixup lint errors * Fixup Netlify target
51 lines
1.5 KiB
JavaScript
51 lines
1.5 KiB
JavaScript
import Controller from '@ember/controller';
|
|
import { get, set } from '@ember/object';
|
|
import { inject as service } from '@ember/service';
|
|
|
|
export default Controller.extend({
|
|
repo: service('settings'),
|
|
dom: service('dom'),
|
|
timeout: service('timeout'),
|
|
confirming: false,
|
|
applyTransition: function() {
|
|
const tick = this.timeout.tick;
|
|
set(this, 'confirming', true);
|
|
tick().then(() => {
|
|
set(this, 'confirming', false);
|
|
});
|
|
},
|
|
actions: {
|
|
key: function(e) {
|
|
this.applyTransition();
|
|
switch (true) {
|
|
case e.keyCode === 13:
|
|
// disable ENTER
|
|
e.preventDefault();
|
|
}
|
|
},
|
|
change: function(e, value, item) {
|
|
const event = this.dom.normalizeEvent(e, value);
|
|
// TODO: Switch to using forms like the rest of the app
|
|
// setting utils/form/builder for things to be done before we
|
|
// can do that. For the moment just do things normally its a simple
|
|
// enough form at the moment
|
|
|
|
const target = event.target;
|
|
const blocking = get(this, 'item.client.blocking');
|
|
switch (target.name) {
|
|
case 'client[blocking]':
|
|
set(this, 'item.client.blocking', !blocking);
|
|
this.send('update', 'client', this.item.client);
|
|
break;
|
|
case 'urls[service]':
|
|
if (typeof get(this, 'item.urls') === 'undefined') {
|
|
set(this, 'item.urls', {});
|
|
}
|
|
set(this, 'item.urls.service', target.value);
|
|
this.send('update', 'urls', this.item.urls);
|
|
break;
|
|
}
|
|
},
|
|
},
|
|
});
|