Commit 68e3484c authored by Ioannis Tsafaras's avatar Ioannis Tsafaras
Browse files

Add loading message when deploying apps

parent 492df24d
......@@ -10,6 +10,7 @@ export default Ember.Controller.extend({
var _this = this;
Ember.run.later((function () {
_this.set("request", false);
_this.controllerFor('lambda-app').set('deployWait', true);
_this.transitionToRoute('lambda-app', application_id);
}), ENV.redirect_delay);
}
......
......@@ -10,6 +10,7 @@ export default Ember.Controller.extend({
var _this = this;
Ember.run.later((function () {
_this.set("request", false);
_this.controllerFor('lambda-instance').set('deployWait', true);
_this.transitionToRoute('lambda-instance', instance_id);
}), ENV.redirect_delay);
}
......
......@@ -10,6 +10,8 @@ export default Ember.Controller.extend({
success_delete: false,
delete_success_message: '',
delete_error_message: '',
deployWait: false,
numInstances: -1,
actions: {
withdraw: function(application_id, instance_id)
{
......
......@@ -9,6 +9,8 @@ export default Ember.Controller.extend({
success_delete: false,
delete_success_message: '',
delete_error_message: '',
deployWait: false,
numApps: -1,
actions: {
close_alert: function()
{
......
......@@ -8,6 +8,7 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
this._super(transition);
this.store.unloadAll('lambda-instance');
this.store.unloadAll('app-action');
this.controllerFor('lambda-app').set('numInstances', -1);
},
model: function (params) {
......@@ -23,6 +24,16 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
if (this.store.peekAll('app-action').get('length') === 0) {
hash.app = this.store.createRecord('app-action', {});
}
if (this.controllerFor('lambda-app').get('deployWait')) {
var numInstances = hash.instances.get('length');
var prevNumInstances = this.controllerFor('lambda-app').get('numInstances');
if ((prevNumInstances >= 0) && (prevNumInstances !== numInstances)) {
this.controllerFor('lambda-app').set('deployWait', false);
}
this.controllerFor('lambda-app').set('numInstances', numInstances);
}
return Ember.RSVP.hash(hash);
},
......@@ -35,6 +46,7 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
deactivate: function () {
Ember.run.cancel(this.poll);
this.controllerFor('lambda-app').set('deployWait', false);
},
actions: {
......
......@@ -9,6 +9,7 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
this.store.unloadAll('lambda-app');
this.store.unloadAll('app-action');
this.store.unloadAll('instance-action');
this.controllerFor('lambda-instance').set('numApps', -1);
},
model: function (params) {
......@@ -19,7 +20,7 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
var hash = {
instance: this.store.findRecord('lambda-instance', params.instance_uuid, { reload: true }),
apps: this.store.peekAll('lambda-app'),
apps: this.store.peekAll('lambda-app')
};
if (this.store.peekAll('app-action').get('length') === 0) {
hash.app = this.store.createRecord('app-action', {});
......@@ -27,6 +28,16 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
if (this.store.peekAll('instance-action').get('length') === 0) {
hash.instance_action = this.store.createRecord('instance-action', {});
}
if (this.controllerFor('lambda-instance').get('deployWait')) {
var numApps = hash.apps.get('length');
var prevNumApps = this.controllerFor('lambda-instance').get('numApps');
if ((prevNumApps >= 0) && (prevNumApps !== numApps)) {
this.controllerFor('lambda-instance').set('deployWait', false);
}
this.controllerFor('lambda-instance').set('numApps', numApps);
}
return Ember.RSVP.hash(hash);
},
......@@ -39,6 +50,7 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
deactivate: function () {
Ember.run.cancel(this.poll);
this.controllerFor('lambda-instance').set('deployWait', false);
},
actions: {
......
......@@ -143,7 +143,7 @@
</div>
<!--row-->
{{#if model.instances}}
{{#if (logical-op 'or' model.instances deployWait)}}
{{#if failure}}
{{#each model.app.errors as |error|}}
......@@ -181,14 +181,25 @@
<div class="col-ms-8 col-xs-8">
<table class="table table-bordered table-hover table-responsive">
<thead>
{{#if model.instances}}
<tr>
<th>Instance Name</th>
<th>Instance Status</th>
<th>App started</th>
<th>Actions</th>
</tr>
{{/if}}
{{#if deployWait}}
<tr>
<th><span style="font-size: .9em;" class="label bg-orange">
The application is currently being deployed on an instance
<i class="fa fa-spinner fa-spin"></i>
</span></th>
</tr>
{{/if}}
</thead>
<tbody>
{{#each sortedInstances as |li|}}
<tr>
<td>
......
......@@ -315,16 +315,17 @@
</div> <!-- box-primary -->
</div> <!--col -->
</div> <!--row-->
{{#if (compare model.apps.length "!==" 0)}}
{{#if app_failure}}
{{#each model.app.errors as |error|}}
<div class="alert alert-dismissable alert-danger" id="app_alert">
<button type="button" class="close" {{action "close_app_alert"}}>×</button>
{{error.message}}
</div>
{{/each}}
{{/if}}
{{#if (logical-op 'or' model.apps deployWait)}}
{{#if app_failure}}
{{#each model.app.errors as |error|}}
<div class="alert alert-dismissable alert-danger" id="app_alert">
<button type="button" class="close" {{action "close_app_alert"}}>×</button>
{{error.message}}
</div>
{{/each}}
{{/if}}
{{#if app_request}}
<div class="alert alert-dismissable alert-success" id="app_alert">
......@@ -349,12 +350,22 @@
<div class="col-ms-7 col-xs-7">
<table class="table table-bordered table-hover table-responsive">
<thead>
{{#if model.apps}}
<tr>
<th>Name</th>
<th>Type</th>
<th>Started</th>
<th>Actions</th>
</tr>
{{/if}}
{{#if deployWait}}
<tr>
<th><span style="font-size: .9em;" class="label bg-orange">
An application is currently being deployed on the instance
<i class="fa fa-spinner fa-spin"></i>
</span></th>
</tr>
{{/if}}
</thead>
<tbody>
{{#each sortedApps as |application|}}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment