Merge "First commit for circuits app"
diff --git a/uiref/src/main/resources/app/view/uiRefTopov/uiRefTopov.css b/uiref/src/main/resources/app/view/uiRefTopov/uiRefTopov.css
index e794fc2..2c4e8a5 100644
--- a/uiref/src/main/resources/app/view/uiRefTopov/uiRefTopov.css
+++ b/uiref/src/main/resources/app/view/uiRefTopov/uiRefTopov.css
@@ -1 +1,7 @@
/* css for UI Reference App topology overlay */
+
+#topo-p-dialog .my-content-class div p {
+ color: #373;
+ font-size: 9pt;
+ padding-left: 12px;
+}
diff --git a/uiref/src/main/resources/app/view/uiRefTopov/uiRefTopovDemo.js b/uiref/src/main/resources/app/view/uiRefTopov/uiRefTopovDemo.js
index 338c1d5..650e942 100644
--- a/uiref/src/main/resources/app/view/uiRefTopov/uiRefTopovDemo.js
+++ b/uiref/src/main/resources/app/view/uiRefTopov/uiRefTopovDemo.js
@@ -7,7 +7,7 @@
'use strict';
// injected refs
- var $log, fs, flash, wss;
+ var $log, fs, flash, wss, tss, tds;
// constants
var displayStart = 'uiRefTopovDisplayStart',
@@ -37,6 +37,33 @@
wss.sendEvent(displayStop);
}
+ function createDialogContent(devs) {
+ 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) {
+ items.append('p').text(d);
+ });
+ return content;
+ }
+
+ function dCancel() {
+ $log.debug('Dialog CANCEL button pressed');
+ }
+
+ function dOk() {
+ $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
@@ -66,23 +93,56 @@
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('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
angular.module('ovUiRefTopov', [])
.factory('UiRefTopovDemoService',
['$log', 'FnService', 'FlashService', 'WebSocketService',
+ 'TopoSelectService', 'TopoDialogService',
- function (_$log_, _fs_, _flash_, _wss_) {
+ function (_$log_, _fs_, _flash_, _wss_, _tss_, _tds_) {
$log = _$log_;
fs = _fs_;
flash = _flash_;
wss = _wss_;
+ tss = _tss_;
+ tds = _tds_;
return {
startDisplay: startDisplay,
updateDisplay: updateDisplay,
- stopDisplay: stopDisplay
+ stopDisplay: stopDisplay,
+
+ deviceDialog: deviceDialog,
+ listDialog: listDialog
};
}]);
}());
diff --git a/uiref/src/main/resources/app/view/uiRefTopov/uiRefTopovOverlay.js b/uiref/src/main/resources/app/view/uiRefTopov/uiRefTopovOverlay.js
index 7d137a2..2295fa1 100644
--- a/uiref/src/main/resources/app/view/uiRefTopov/uiRefTopovOverlay.js
+++ b/uiref/src/main/resources/app/view/uiRefTopov/uiRefTopovOverlay.js
@@ -7,7 +7,7 @@
'use strict';
// injected refs
- var $log, tov, stds;
+ var $log, tov, demo;
// internal state should be kept in the service module (not here)
@@ -37,7 +37,7 @@
$log.debug("UI Ref topology overlay ACTIVATED");
},
deactivate: function () {
- stds.stopDisplay();
+ demo.stopDisplay();
$log.debug("UI Ref topology overlay DEACTIVATED");
},
@@ -46,8 +46,8 @@
foo: {
gid: 'chain',
tt: 'A FOO action',
- cb: function (data) {
- $log.debug('FOO action invoked with data:', data);
+ cb: function() {
+ demo.deviceDialog();
}
},
bar: {
@@ -63,22 +63,22 @@
// NOTE: fully qual. button ID is derived from overlay-id and key-name
keyBindings: {
0: {
- cb: function () { stds.stopDisplay(); },
+ cb: function () { demo.stopDisplay(); },
tt: 'Cancel Display Mode',
gid: 'xMark'
},
V: {
- cb: function () { stds.startDisplay('mouse'); },
+ cb: function () { demo.startDisplay('mouse'); },
tt: 'Start Mouse Mode',
gid: '*banner'
},
F: {
- cb: function () { stds.startDisplay('link'); },
+ cb: function () { demo.startDisplay('link'); },
tt: 'Start Link Mode',
gid: 'chain'
},
G: {
- cb: buttonCallback,
+ cb: function () { demo.listDialog(); },
tt: 'Uses the G key',
gid: 'crown'
},
@@ -93,7 +93,7 @@
// Must return true to consume ESC, false otherwise.
escape: function () {
// Must return true to consume ESC, false otherwise.
- return stds.stopDisplay();
+ return demo.stopDisplay();
},
// hooks for when the selection changes...
@@ -111,20 +111,15 @@
mouseover: function (m) {
// m has id, class, and type properties
$log.debug('mouseover:', m);
- stds.updateDisplay(m);
+ demo.updateDisplay(m);
},
mouseout: function () {
$log.debug('mouseout');
- stds.updateDisplay();
+ demo.updateDisplay();
}
}
};
-
- function buttonCallback(x) {
- $log.debug('Toolbar-button callback', x);
- }
-
function selectionCallback(x, d) {
$log.debug('Selection callback', x, d);
}
@@ -133,10 +128,10 @@
angular.module('ovUiRefTopov')
.run(['$log', 'TopoOverlayService', 'UiRefTopovDemoService',
- function (_$log_, _tov_, _stds_) {
+ function (_$log_, _tov_, _demo_) {
$log = _$log_;
tov = _tov_;
- stds = _stds_;
+ demo = _demo_;
tov.register(overlay);
}]);