Unbreak and refactor error messages
Change-Id: I76b1c209390345961fe09f9ccd57749231893acf
This commit is contained in:
parent
9899c6e7bb
commit
bcd2ad2b3a
@ -51,7 +51,8 @@ define(['require'], function(require) {
|
|||||||
var dialogViews = require('views/dialogs'); // avoid circular dependencies
|
var dialogViews = require('views/dialogs'); // avoid circular dependencies
|
||||||
var dialog = new dialogViews.Dialog();
|
var dialog = new dialogViews.Dialog();
|
||||||
parentView.registerSubView(dialog);
|
parentView.registerSubView(dialog);
|
||||||
dialog.displayInfoMessage(_.extend({error: true, message: ''}, options));
|
dialog.render(_.extend({title: '', message: ''}, options));
|
||||||
|
dialog.displayErrorMessage(options);
|
||||||
},
|
},
|
||||||
showBandwidth: function(bandwidth) {
|
showBandwidth: function(bandwidth) {
|
||||||
bandwidth = parseInt(bandwidth, 10);
|
bandwidth = parseInt(bandwidth, 10);
|
||||||
|
@ -49,7 +49,7 @@ function(require, utils, models, simpleMessageTemplate, createClusterWizardTempl
|
|||||||
beforeTearDown: function() {
|
beforeTearDown: function() {
|
||||||
this.$el.modal('hide');
|
this.$el.modal('hide');
|
||||||
},
|
},
|
||||||
displayErrorMessage: function () {
|
displayError: function() {
|
||||||
var logsLink;
|
var logsLink;
|
||||||
try {
|
try {
|
||||||
if (app.page.model.constructor == models.Cluster) {
|
if (app.page.model.constructor == models.Cluster) {
|
||||||
@ -57,12 +57,13 @@ function(require, utils, models, simpleMessageTemplate, createClusterWizardTempl
|
|||||||
logsLink = '#cluster/' + app.page.model.id + '/logs/' + utils.serializeTabOptions(options);
|
logsLink = '#cluster/' + app.page.model.id + '/logs/' + utils.serializeTabOptions(options);
|
||||||
}
|
}
|
||||||
} catch(e) {}
|
} catch(e) {}
|
||||||
this.$('.modal-body').html(this.errorMessageTemplate({logsLink: logsLink}));
|
this.$('.modal-body').removeClass().addClass('modal-body');
|
||||||
|
this.$('.modal-body').html(views.Dialog.prototype.errorMessageTemplate({logsLink: logsLink}));
|
||||||
},
|
},
|
||||||
displayInfoMessage: function(options) {
|
displayErrorMessage: function(options) {
|
||||||
this.$el.html(views.Dialog.prototype.template(options));
|
this.displayError();
|
||||||
if (options.error) {
|
if (options.message) {
|
||||||
this.displayErrorMessage();
|
this.$('.text-error').text(options.message);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
initialize: function(options) {
|
initialize: function(options) {
|
||||||
@ -166,10 +167,7 @@ function(require, utils, models, simpleMessageTemplate, createClusterWizardTempl
|
|||||||
this.$el.modal('hide');
|
this.$el.modal('hide');
|
||||||
}, this))
|
}, this))
|
||||||
.fail(_.bind(function() {
|
.fail(_.bind(function() {
|
||||||
this.displayInfoMessage({
|
this.displayErrorMessage({message: 'Your OpenStack environment has been created, but configuration failed. You can configure it manually.'});
|
||||||
title: 'Environment Configuration Error',
|
|
||||||
message: 'Your OpenStack environment has been created, but confiugration failed. You can configure it manually.'
|
|
||||||
});
|
|
||||||
}, this));
|
}, this));
|
||||||
}, this))
|
}, this))
|
||||||
.fail(_.bind(function(response) {
|
.fail(_.bind(function(response) {
|
||||||
@ -178,9 +176,9 @@ function(require, utils, models, simpleMessageTemplate, createClusterWizardTempl
|
|||||||
this.goToPane(0);
|
this.goToPane(0);
|
||||||
cluster.trigger('invalid', cluster, {name: response.responseText});
|
cluster.trigger('invalid', cluster, {name: response.responseText});
|
||||||
} else if (response.status == 400) {
|
} else if (response.status == 400) {
|
||||||
this.displayInfoMessage({error: false, title: 'Create a new OpenStack environment error', message: response.responseText});
|
this.displayErrorMessage({message: response.responseText});
|
||||||
} else {
|
} else {
|
||||||
this.displayErrorMessage();
|
this.displayError();
|
||||||
}
|
}
|
||||||
}, this));
|
}, this));
|
||||||
}
|
}
|
||||||
@ -508,7 +506,7 @@ function(require, utils, models, simpleMessageTemplate, createClusterWizardTempl
|
|||||||
app.page.update();
|
app.page.update();
|
||||||
this.$el.modal('hide');
|
this.$el.modal('hide');
|
||||||
}, this))
|
}, this))
|
||||||
.fail(_.bind(this.displayErrorMessage, this));
|
.fail(_.bind(this.displayError, this));
|
||||||
} else {
|
} else {
|
||||||
this.$el.modal('hide');
|
this.$el.modal('hide');
|
||||||
}
|
}
|
||||||
@ -568,7 +566,7 @@ function(require, utils, models, simpleMessageTemplate, createClusterWizardTempl
|
|||||||
this.model.get('nodes').trigger('resize');
|
this.model.get('nodes').trigger('resize');
|
||||||
app.navbar.refresh();
|
app.navbar.refresh();
|
||||||
}, this))
|
}, this))
|
||||||
.fail(_.bind(this.displayErrorMessage, this));
|
.fail(_.bind(this.displayError, this));
|
||||||
},
|
},
|
||||||
render: function() {
|
render: function() {
|
||||||
this.constructor.__super__.render.call(this, {cluster: this.model});
|
this.constructor.__super__.render.call(this, {cluster: this.model});
|
||||||
@ -589,7 +587,7 @@ function(require, utils, models, simpleMessageTemplate, createClusterWizardTempl
|
|||||||
this.$el.modal('hide');
|
this.$el.modal('hide');
|
||||||
app.page.deploymentStarted();
|
app.page.deploymentStarted();
|
||||||
}, this))
|
}, this))
|
||||||
.fail(_.bind(this.displayErrorMessage, this));
|
.fail(_.bind(this.displayError, this));
|
||||||
},
|
},
|
||||||
render: function() {
|
render: function() {
|
||||||
this.constructor.__super__.render.call(this, {
|
this.constructor.__super__.render.call(this, {
|
||||||
@ -613,7 +611,7 @@ function(require, utils, models, simpleMessageTemplate, createClusterWizardTempl
|
|||||||
app.navbar.refresh();
|
app.navbar.refresh();
|
||||||
app.navigate('#clusters', {trigger: true});
|
app.navigate('#clusters', {trigger: true});
|
||||||
}, this))
|
}, this))
|
||||||
.fail(_.bind(this.displayErrorMessage, this));
|
.fail(_.bind(this.displayError, this));
|
||||||
},
|
},
|
||||||
render: function() {
|
render: function() {
|
||||||
this.constructor.__super__.render.call(this, {cluster: this.model});
|
this.constructor.__super__.render.call(this, {cluster: this.model});
|
||||||
@ -780,7 +778,7 @@ function(require, utils, models, simpleMessageTemplate, createClusterWizardTempl
|
|||||||
app.navbar.refresh();
|
app.navbar.refresh();
|
||||||
app.page.removeFinishedTasks();
|
app.page.removeFinishedTasks();
|
||||||
}, this))
|
}, this))
|
||||||
.fail(_.bind(this.displayErrorMessage, this));
|
.fail(_.bind(this.displayError, this));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
render: function() {
|
render: function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user