website: refactor send command for demo
This commit is contained in:
parent
518b31a6f6
commit
2568be1efa
|
@ -1,13 +1,15 @@
|
|||
Demo.DemoCrudController = Ember.ObjectController.extend({
|
||||
needs: ['demo'],
|
||||
isLoading: Ember.computed.alias('controllers.demo.isLoading'),
|
||||
currentText: Ember.computed.alias('controllers.demo.currentText'),
|
||||
currentLog: Ember.computed.alias('controllers.demo.currentLog'),
|
||||
logPrefix: Ember.computed.alias('controllers.demo.logPrefix'),
|
||||
currentMarker: Ember.computed.alias('controllers.demo.currentMarker'),
|
||||
notCleared: Ember.computed.alias('controllers.demo.notCleared'),
|
||||
|
||||
actions: {
|
||||
submitText: function() {
|
||||
sendCommand: function() {
|
||||
// Request
|
||||
Ember.run.later(this, function() {
|
||||
var command = this.getWithDefault('currentText', '');
|
||||
var currentLogs = this.get('currentLog').toArray();
|
||||
|
||||
|
@ -28,6 +30,17 @@ Demo.DemoCrudController = Ember.ObjectController.extend({
|
|||
default:
|
||||
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: "$ ",
|
||||
cursor: 0,
|
||||
notCleared: true,
|
||||
isLoading: false,
|
||||
|
||||
setFromHistory: function() {
|
||||
var index = this.get('currentLog.length') + this.get('cursor');
|
||||
|
@ -14,6 +15,6 @@ Demo.DemoController = Ember.ObjectController.extend({
|
|||
actions: {
|
||||
close: function() {
|
||||
this.transitionTo('index');
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue