mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-12-16 18:37:25 +00:00
website: refactor send command for demo
This commit is contained in:
@@ -1,13 +1,15 @@
|
|||||||
Demo.DemoCrudController = Ember.ObjectController.extend({
|
Demo.DemoCrudController = Ember.ObjectController.extend({
|
||||||
needs: ['demo'],
|
needs: ['demo'],
|
||||||
|
isLoading: Ember.computed.alias('controllers.demo.isLoading'),
|
||||||
currentText: Ember.computed.alias('controllers.demo.currentText'),
|
currentText: Ember.computed.alias('controllers.demo.currentText'),
|
||||||
currentLog: Ember.computed.alias('controllers.demo.currentLog'),
|
currentLog: Ember.computed.alias('controllers.demo.currentLog'),
|
||||||
logPrefix: Ember.computed.alias('controllers.demo.logPrefix'),
|
logPrefix: Ember.computed.alias('controllers.demo.logPrefix'),
|
||||||
currentMarker: Ember.computed.alias('controllers.demo.currentMarker'),
|
currentMarker: Ember.computed.alias('controllers.demo.currentMarker'),
|
||||||
notCleared: Ember.computed.alias('controllers.demo.notCleared'),
|
notCleared: Ember.computed.alias('controllers.demo.notCleared'),
|
||||||
|
|
||||||
actions: {
|
sendCommand: function() {
|
||||||
submitText: function() {
|
// Request
|
||||||
|
Ember.run.later(this, function() {
|
||||||
var command = this.getWithDefault('currentText', '');
|
var command = this.getWithDefault('currentText', '');
|
||||||
var currentLogs = this.get('currentLog').toArray();
|
var currentLogs = this.get('currentLog').toArray();
|
||||||
|
|
||||||
@@ -28,6 +30,17 @@ Demo.DemoCrudController = Ember.ObjectController.extend({
|
|||||||
default:
|
default:
|
||||||
console.log("Submitting: ", command);
|
console.log("Submitting: ", command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.set('isLoading', false);
|
||||||
|
}, 1000);
|
||||||
|
},
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
submitText: function() {
|
||||||
|
this.set('isLoading', true);
|
||||||
|
|
||||||
|
// Send the actual request (fake for now)
|
||||||
|
this.sendCommand();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ Demo.DemoController = Ember.ObjectController.extend({
|
|||||||
logPrefix: "$ ",
|
logPrefix: "$ ",
|
||||||
cursor: 0,
|
cursor: 0,
|
||||||
notCleared: true,
|
notCleared: true,
|
||||||
|
isLoading: false,
|
||||||
|
|
||||||
setFromHistory: function() {
|
setFromHistory: function() {
|
||||||
var index = this.get('currentLog.length') + this.get('cursor');
|
var index = this.get('currentLog.length') + this.get('cursor');
|
||||||
@@ -14,6 +15,6 @@ Demo.DemoController = Ember.ObjectController.extend({
|
|||||||
actions: {
|
actions: {
|
||||||
close: function() {
|
close: function() {
|
||||||
this.transitionTo('index');
|
this.transitionTo('index');
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user