Skip to content
Open
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ x/y/2018 ola-0.10.7
Bugs:
* Fix the build on Windows
* Entire codebase now passes codespell testing
* Fix the error dialog not displaying in the old web UI
*

Internal:
Expand Down
20 changes: 17 additions & 3 deletions javascript/ola/mobile/universe_tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ goog.require('goog.ui.Button');
goog.require('goog.ui.Container');

goog.require('ola.BaseFrame');
goog.require('ola.Dialog');
goog.require('ola.UniverseControl');
goog.require('ola.UniverseItem');
goog.require('ola.common.RdmSectionControl');
Expand Down Expand Up @@ -372,19 +373,19 @@ ola.mobile.UniverseTab.prototype.saveSection_ = function() {
var value = form.elements[id].value;
var int_val = parseInt(value);
if (isNaN(int_val)) {
this._showErrorDialog('Invalid Value',
this.showErrorDialog_('Invalid Value',
items[i]['description'] + ' must be an integer');
return;
}
var min = items[i]['min'];
if (min != undefined && int_val < min) {
this._showErrorDialog('Invalid Value',
this.showErrorDialog_('Invalid Value',
items[i]['description'] + ' must be > ' + (min - 1));
return;
}
var max = items[i]['max'];
if (max != undefined && int_val > max) {
this._showErrorDialog('Invalid Value',
this.showErrorDialog_('Invalid Value',
items[i]['description'] + ' must be < ' + (max + 1));
return;
}
Expand Down Expand Up @@ -428,3 +429,16 @@ ola.mobile.UniverseTab.prototype.saveSectionComplete_ = function(e) {
this.loadSection_();
}
};


/**
* Show the dialog with an error message
* @private
*/
ola.mobile.UniverseTab.prototype.showErrorDialog_ = function(title, error) {
var dialog = ola.Dialog.getInstance();
dialog.setTitle(title);
dialog.setContent(error);
dialog.setButtonSet(goog.ui.Dialog.ButtonSet.OK);
dialog.setVisible(true);
};