uiref -- minor embellishment to topo dialog example.
Change-Id: Ie1e1811f691afc800a0d768cfbdacf85b6739371
diff --git a/uiref/src/main/resources/app/view/uiRefTopov/uiRefTopovDemo.js b/uiref/src/main/resources/app/view/uiRefTopov/uiRefTopovDemo.js
index eae2249..650e942 100644
--- a/uiref/src/main/resources/app/view/uiRefTopov/uiRefTopovDemo.js
+++ b/uiref/src/main/resources/app/view/uiRefTopov/uiRefTopovDemo.js
@@ -38,10 +38,12 @@
}
function createDialogContent(devs) {
- var content = tds.createDiv('my-content-class');
+ var content = tds.createDiv('my-content-class'),
+ items;
content.append('p').text('Do something to these devices?');
+ items = content.append('div');
devs.forEach(function (d) {
- content.append('p').text(d);
+ items.append('p').text(d);
});
return content;
}
@@ -54,6 +56,14 @@
$log.debug('Dialog OK button pressed');
}
+ function createListContent() {
+ var content = tds.createDiv('my-list-class'),
+ items;
+ // TODO: figure out best way to inject selectable list
+ content.append('p').text('(Selectable list to show here...)');
+ return content;
+ }
+
// === ---------------------------
// === Main API functions
@@ -83,20 +93,33 @@
return false;
}
+ // this example dialog invoked from the details panel, when one or more
+ // devices have been selected
function deviceDialog() {
var ctx = tss.selectionContext();
- $log.debug('dialog invoked with context:', ctx);
+ $log.debug('device dialog invoked with context:', ctx);
// only if at least one device was selected
if (ctx.devices.length) {
tds.openDialog()
+ .setTitle('Process Devices')
.addContent(createDialogContent(ctx.devices))
.addButton('Cancel', dCancel)
.addButton('OK', dOk);
}
}
+ // this example dialog invoked from the toolbar
+ function listDialog() {
+ $log.debug('list dialog invoked');
+
+ tds.openDialog()
+ .setTitle('A list of stuff')
+ .addContent(createListContent())
+ .addButton('Gotcha', dOk);
+ }
+
// === ---------------------------
// === Module Factory Definition
@@ -118,7 +141,8 @@
updateDisplay: updateDisplay,
stopDisplay: stopDisplay,
- deviceDialog: deviceDialog
+ deviceDialog: deviceDialog,
+ listDialog: listDialog
};
}]);
}());