mirror of https://github.com/rancher/ui.git
37 lines
749 B
JavaScript
37 lines
749 B
JavaScript
import { inject as service } from '@ember/service';
|
|
import Component from '@ember/component';
|
|
import C from 'ui/utils/constants';
|
|
import layout from './template';
|
|
|
|
const IN = 'in';
|
|
const OUT = 'out';
|
|
|
|
export default Component.extend({
|
|
layout,
|
|
settings: service(),
|
|
|
|
initialValue: null,
|
|
optIn: null,
|
|
|
|
actions: {
|
|
save: function(btnCb) {
|
|
this.get('settings').set(C.SETTING.TELEMETRY, (this.get('optIn') ? IN : OUT));
|
|
this.get('settings').one('settingsPromisesResolved', () => {
|
|
btnCb(true);
|
|
this.sendAction('saved');
|
|
});
|
|
},
|
|
},
|
|
|
|
init() {
|
|
this._super(...arguments);
|
|
|
|
let val = false;
|
|
if ( this.get('initialValue') === IN ) {
|
|
val = true;
|
|
}
|
|
|
|
this.set('optIn', val);
|
|
},
|
|
});
|