vault/ui/app/components/console/command-input.js
Matthew Irish f046445dac
UI - console refresh (#4679)
* add router service polyfill
* add refresh command
* move async code into ember-concurrency task and implement refresh that way
* use ember-concurrency derived state to show a loading spinner when the task is running
* scroll after appending to log too
2018-06-01 17:18:31 -05:00

34 lines
790 B
JavaScript

import Ember from 'ember';
import keys from 'vault/lib/keycodes';
export default Ember.Component.extend({
'data-test-component': 'console/command-input',
classNames: 'console-ui-input',
onExecuteCommand() {},
onFullscreen() {},
onValueUpdate() {},
onShiftCommand() {},
value: null,
isFullscreen: null,
actions: {
handleKeyUp(event) {
const keyCode = event.keyCode;
switch (keyCode) {
case keys.ENTER:
this.get('onExecuteCommand')(event.target.value);
break;
case keys.UP:
case keys.DOWN:
this.get('onShiftCommand')(keyCode);
break;
default:
this.get('onValueUpdate')(event.target.value);
}
},
fullscreen() {
this.get('onFullscreen')();
},
},
});