open-vault/ui/app/controllers/application.js
madalynrose 2b41283a91
UI console (#4631)
* adding columnify and ember-cli-cjs-transform

* add yargs-parser

* remove vendored yargs-parser tokenizer and use cjs transform to import it from actual yargs-parser

* add clear command that clears the log, but maintains history

* make codemirror have no gutter and be auto-height when rendered in the console output log

* add fullscreen command and hook up fullscreen toggle button

* hook up copy button
2018-05-25 16:33:22 -04:00

42 lines
1.2 KiB
JavaScript

import Ember from 'ember';
import config from '../config/environment';
const { computed, inject } = Ember;
export default Ember.Controller.extend({
env: config.environment,
auth: inject.service(),
vaultVersion: inject.service('version'),
console: inject.service(),
consoleOpen: computed.alias('console.isOpen'),
activeCluster: computed('auth.activeCluster', function() {
return this.store.peekRecord('cluster', this.get('auth.activeCluster'));
}),
activeClusterName: computed('auth.activeCluster', function() {
const activeCluster = this.store.peekRecord('cluster', this.get('auth.activeCluster'));
return activeCluster ? activeCluster.get('name') : null;
}),
showNav: computed(
'activeClusterName',
'auth.currentToken',
'activeCluster.dr.isSecondary',
'activeCluster.{needsInit,sealed}',
function() {
if (
this.get('activeCluster.dr.isSecondary') ||
this.get('activeCluster.needsInit') ||
this.get('activeCluster.sealed')
) {
return false;
}
if (this.get('activeClusterName') && this.get('auth.currentToken')) {
return true;
}
}
),
actions: {
toggleConsole() {
this.toggleProperty('consoleOpen');
},
},
});