ONOS-4619: Web UI -- Support for chained dialog operations.
Also added bool() helper method to JsonUtils and RequestHandler.
Change-Id: Ie3a9db983f0936b1ad48488ce19d1cdc2e20c16a
(cherry picked from commit 9bf9356)
diff --git a/web/gui/src/main/webapp/app/fw/layer/dialog.js b/web/gui/src/main/webapp/app/fw/layer/dialog.js
index 5585029..70f1082 100644
--- a/web/gui/src/main/webapp/app/fw/layer/dialog.js
+++ b/web/gui/src/main/webapp/app/fw/layer/dialog.js
@@ -96,14 +96,16 @@
};
}
- function makeButton(callback, text, keyName) {
+ function makeButton(callback, text, keyName, chained) {
var cb = fs.isF(callback),
key = fs.isS(keyName);
function invoke() {
cb && cb();
- clearBindings();
- panel.hide();
+ if (!chained) {
+ clearBindings();
+ panel.hide();
+ }
}
if (key) {
@@ -129,15 +131,23 @@
return dApi;
}
- function addButton(cb, text, key) {
+ function addButton(cb, text, key, chained) {
if (pApi) {
- pApi.appendFooter(makeButton(cb, text, key));
+ pApi.appendFooter(makeButton(cb, text, key, chained));
}
return dApi;
}
+ function _addOk(cb, text, chained) {
+ return addButton(cb, text || 'OK', 'enter', chained);
+ }
+
function addOk(cb, text) {
- return addButton(cb, text || 'OK', 'enter');
+ return _addOk(cb, text, false);
+ }
+
+ function addOkChained(cb, text) {
+ return _addOk(cb, text, true);
}
function addCancel(cb, text) {
@@ -164,6 +174,7 @@
addContent: addContent,
addButton: addButton,
addOk: addOk,
+ addOkChained: addOkChained,
addCancel: addCancel,
bindKeys: function () {
ks.dialogKeys(keyBindings);