Repository: qpid-dispatch Updated Branches: refs/heads/master aea968659 -> d49adbdb1
DISPATCH-201: Implemented DELETE. Removed jsonFormatter. Prevent occational error on loading ui-slider Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/d49adbdb Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/d49adbdb Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/d49adbdb Branch: refs/heads/master Commit: d49adbdb1b4e2e350e94ecb56b9b9b67257e466a Parents: aea9686 Author: Ernest Allen <eal...@redhat.com> Authored: Wed Mar 30 15:47:29 2016 -0400 Committer: Ernest Allen <eal...@redhat.com> Committed: Wed Mar 30 15:47:29 2016 -0400 ---------------------------------------------------------------------- .../src/main/webapp/plugin/css/plugin.css | 13 ++++++ .../src/main/webapp/plugin/html/qdrList.html | 9 +++- .../src/main/webapp/plugin/html/qdrSchema.html | 2 +- .../src/main/webapp/plugin/js/dispatchPlugin.js | 25 ++++------ .../hawtio/src/main/webapp/plugin/js/qdrList.js | 48 ++++++++++++++------ .../src/main/webapp/plugin/js/qdrSchema.js | 34 +++++++++++++- .../src/main/webapp/plugin/js/qdrService.js | 7 ++- 7 files changed, 104 insertions(+), 34 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/d49adbdb/console/hawtio/src/main/webapp/plugin/css/plugin.css ---------------------------------------------------------------------- diff --git a/console/hawtio/src/main/webapp/plugin/css/plugin.css b/console/hawtio/src/main/webapp/plugin/css/plugin.css index 889bf72..6ea72be 100644 --- a/console/hawtio/src/main/webapp/plugin/css/plugin.css +++ b/console/hawtio/src/main/webapp/plugin/css/plugin.css @@ -823,3 +823,16 @@ text.qpid-cpp.on-demand { font-size: 18px; font-weight: bold; } + +i.red { + color: red; +} + +.qdrListActions div.delete { + width: 20em; + margin: auto; + border: 1px solid #eaeaea; + height: 5em; + padding: 4em; + background-color: #fcfcfc; +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/d49adbdb/console/hawtio/src/main/webapp/plugin/html/qdrList.html ---------------------------------------------------------------------- diff --git a/console/hawtio/src/main/webapp/plugin/html/qdrList.html b/console/hawtio/src/main/webapp/plugin/html/qdrList.html index d07d3ca..41b2b0e 100644 --- a/console/hawtio/src/main/webapp/plugin/html/qdrList.html +++ b/console/hawtio/src/main/webapp/plugin/html/qdrList.html @@ -34,8 +34,15 @@ under the License. <div ng-show="selectedRecordName === selectedEntity" class="no-content">There are no {{selectedEntity}}s</div> <div ng-hide="selectedRecordName === selectedEntity" ng-grid="details"></div> </div> + <div ng-show="currentMode.id === 'delete'"> + <div class="delete" ng-show="selectedRecordName !== selectedEntity"> + <button class="btn btn-primary" ng-click="remove()">Delete</button> {{selectedRecordName}} + </div> + <div ng-hide="selectedRecordName !== selectedEntity"> + There are no {{selectedEntity}}s + </div> + </div> <div class="operations" ng-show="currentMode.id === 'operations'"> - <!-- <div ng-grid="detailsCREATE"></div> --> <fieldset ng-show="operation != ''"> <table> <tr> http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/d49adbdb/console/hawtio/src/main/webapp/plugin/html/qdrSchema.html ---------------------------------------------------------------------- diff --git a/console/hawtio/src/main/webapp/plugin/html/qdrSchema.html b/console/hawtio/src/main/webapp/plugin/html/qdrSchema.html index 15ebb46..6661baf 100644 --- a/console/hawtio/src/main/webapp/plugin/html/qdrSchema.html +++ b/console/hawtio/src/main/webapp/plugin/html/qdrSchema.html @@ -17,5 +17,5 @@ specific language governing permissions and limitations under the License. --> <div class="main-display row-fluid" ng-controller="QDR.SchemaController"> - <json-formatter json="schema" open="2"></json-formatter> + <div id="schema"></div> </div> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/d49adbdb/console/hawtio/src/main/webapp/plugin/js/dispatchPlugin.js ---------------------------------------------------------------------- diff --git a/console/hawtio/src/main/webapp/plugin/js/dispatchPlugin.js b/console/hawtio/src/main/webapp/plugin/js/dispatchPlugin.js index 5061317..ce52092 100644 --- a/console/hawtio/src/main/webapp/plugin/js/dispatchPlugin.js +++ b/console/hawtio/src/main/webapp/plugin/js/dispatchPlugin.js @@ -5,6 +5,9 @@ * The main entry point for the QDR module * */ +$.getScript('https://cdn.rawgit.com/angular-ui/ui-slider/master/src/slider.js', function() { + hawtioPluginLoader.addModule('ui.slider'); +}); var QDR = (function(QDR) { /** @@ -52,7 +55,7 @@ var QDR = (function(QDR) { * workspace, viewRegistry and layoutFull used by the * run function */ - QDR.module = angular.module('dispatch_plugin', ['bootstrap', 'jsonFormatter', 'hawtio-ui', 'hawtio-forms', 'ui.bootstrap.dialog', 'hawtioCore']) + QDR.module = angular.module('dispatch_plugin', ['bootstrap', 'hawtio-ui', 'hawtio-forms', 'ui.bootstrap.dialog', 'hawtioCore']) .config(function($routeProvider) { /** * Here we define the route for our plugin. One note is @@ -88,12 +91,9 @@ var QDR = (function(QDR) { $compileProvider.urlSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|blob):/); cur = $compileProvider.urlSanitizationWhitelist(); }) + .config(function( $controllerProvider, $provide, $compileProvider ) { - .config(function (JSONFormatterConfigProvider) { - // Enable the hover preview feature - JSONFormatterConfigProvider.hoverPreviewEnabled = true; }) - .filter('to_trusted', function($sce){ return function(text) { return $sce.trustAsHtml(text); @@ -141,7 +141,7 @@ var QDR = (function(QDR) { Core.addCSS(QDR.contextPath + "plugin/css/dispatch.css"); Core.addCSS(QDR.contextPath + "plugin/css/qdrTopology.css"); Core.addCSS(QDR.contextPath + "plugin/css/plugin.css"); - Core.addCSS("https://cdn.rawgit.com/mohsen1/json-formatter/master/dist/json-formatter.min.css"); + //Core.addCSS("https://cdn.rawgit.com/mohsen1/json-formatter/master/dist/json-formatter.min.css"); Core.addCSS("https://cdnjs.cloudflare.com/ajax/libs/jquery.tipsy/1.0.2/jquery.tipsy.css"); Core.addCSS("https://code.jquery.com/ui/1.8.24/themes/base/jquery-ui.css"); Core.addCSS("https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"); @@ -228,16 +228,6 @@ var QDR = (function(QDR) { })(QDR || {}); -$.getScript('https://cdn.rawgit.com/angular-ui/ui-slider/master/src/slider.js', function() { - hawtioPluginLoader.addModule('ui.slider'); -}); -$.getScript('https://cdn.rawgit.com/mohsen1/json-formatter/master/dist/json-formatter.min.js', function() { - hawtioPluginLoader.addModule('jsonFormatter'); - // tell the hawtio plugin loader about our plugin so it can be - // bootstrapped with the rest of angular - hawtioPluginLoader.addModule(QDR.pluginName); -}); - // force an more modern version of d3 to load $.getScript('https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.14/d3.min.js', function() {}); // tooltips on the list page @@ -245,6 +235,9 @@ $.getScript('https://cdn.rawgit.com/jaz303/tipsy/master/src/javascripts/jquery.t // tooltips on the topology page $.getScript('https://cdn.rawgit.com/briancray/tooltipsy/master/tooltipsy.min.js', function() {}); +// tell the hawtio plugin loader about our plugin so it can be +// bootstrapped with the rest of angular +hawtioPluginLoader.addModule(QDR.pluginName); http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/d49adbdb/console/hawtio/src/main/webapp/plugin/js/qdrList.js ---------------------------------------------------------------------- diff --git a/console/hawtio/src/main/webapp/plugin/js/qdrList.js b/console/hawtio/src/main/webapp/plugin/js/qdrList.js index d816521..2c69a1c 100644 --- a/console/hawtio/src/main/webapp/plugin/js/qdrList.js +++ b/console/hawtio/src/main/webapp/plugin/js/qdrList.js @@ -66,6 +66,13 @@ var QDR = (function(QDR) { isValid: function () { return $scope.operations.indexOf(this.op) > -1 } }, { + content: '<a><i class="icon-remove"></i> Delete</a>', + id: 'delete', + op: 'DELETE', + title: "Delete", + isValid: function () { return $scope.operations.indexOf(this.op) > -1 } + }, + { content: '<a><i class="icon-chart"></i> Chart</a>', id: 'charts', op: 'graph', @@ -90,6 +97,11 @@ var QDR = (function(QDR) { $scope.selectMode = function (mode) { $scope.currentMode = mode; if (mode.id === 'log') { + var ops = lookupOperations(); + if (ops.indexOf("LOG") == -1) { + $scope.currentMode = $scope.modes[0] + return; + } $scope.logResults = "getting recent log entries..."; QDRService.sendMethod($scope.currentNode.id, $scope.selectedEntity, {}, $scope.currentMode.op, function (nodeName, entity, response, context) { $scope.logResults = response.filter( function (entry) { @@ -184,6 +196,10 @@ var QDR = (function(QDR) { $scope.currentMode = $scope.modes[0]; else if ($scope.currentMode.id === 'log') $scope.selectMode($scope.currentMode) + else if ($scope.currentMode.id === 'delete') { + // clicked on a tree node while on the delete screen -> switch to attribute screen + $scope.currentMode = $scope.modes[0]; + } if (selectedNode.data.typeName === "entity") { $scope.selectedEntity = selectedNode.data.key; $scope.operations = lookupOperations() @@ -205,13 +221,17 @@ var QDR = (function(QDR) { var schemaEntity = QDRService.schema.entityTypes[entityName] for (attr in schemaEntity.attributes) { var entity = schemaEntity.attributes[attr] + var value = "" + if (angular.isDefined(entity['default'])) + value = entity['default'] row[attr] = { - value: "", + value: value, type: entity.type, graph: false, title: entity.description, aggregate: false, - aggregateTip: '' + aggregateTip: '', + 'default': entity['default'] } } return row; @@ -463,13 +483,6 @@ var QDR = (function(QDR) { $scope.tableRows = info.rows; updateEntityChildren(info.rows, info.expand); fixTooltips(); -/* - // must apply scope here to update the tableRows before selecting the row - $scope.$apply(); - if ($scope.gridDef.selectRow) - $scope.gridDef.selectRow(selectedRowIndex, true); - fixTooltips(); -*/ } var titleFromAlt = function (alt) { @@ -597,7 +610,7 @@ var QDR = (function(QDR) { QDR.log.info(note) Core.notification('success', note); $scope.selectMode($scope.modes[0]); - $scope.$apply(); + restartUpdate(); } } $scope.ok = function () { @@ -607,11 +620,15 @@ var QDR = (function(QDR) { if (field.input === 'input') { if (field.type === 'text' || field.type === 'disabled') value = field.attributeValue; - } - if (field.input === 'select') + } else if (field.input === 'select') { value = field.selected; + } else if (field.input === 'boolean') { + value = field.rawValue + } + if (value === "") + value = undefined; - if (value != field['default'] || field.required || (field.name === 'role')) { + if ((value && value != field['default']) || field.required || (field.name === 'role')) { if (field.name !== 'identity') attributes[field.name] = value } @@ -621,6 +638,10 @@ var QDR = (function(QDR) { }) QDRService.sendMethod($scope.currentNode.id, $scope.selectedEntity, attributes, $scope.currentMode.op, gotMethodResponse) } + $scope.remove = function () { + var attributes = {type: $scope.selectedEntity, name: $scope.selectedRecordName} + QDRService.sendMethod($scope.currentNode.id, $scope.selectedEntity, attributes, $scope.currentMode.op, gotMethodResponse) + } function doDialog(template, chart) { var d = $dialog.dialog({ @@ -731,3 +752,4 @@ var QDR = (function(QDR) { return QDR; } (QDR || {})); +// messaging-ci-01.mw.lab.eng.bos.redhat.com \ No newline at end of file http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/d49adbdb/console/hawtio/src/main/webapp/plugin/js/qdrSchema.js ---------------------------------------------------------------------- diff --git a/console/hawtio/src/main/webapp/plugin/js/qdrSchema.js b/console/hawtio/src/main/webapp/plugin/js/qdrSchema.js index dc39f9c..33a27f3 100644 --- a/console/hawtio/src/main/webapp/plugin/js/qdrSchema.js +++ b/console/hawtio/src/main/webapp/plugin/js/qdrSchema.js @@ -30,7 +30,39 @@ var QDR = (function (QDR) { return; } - $scope.schema = QDRService.schema; + var keys2kids = function (tree, obj) { + + if (obj === Object(obj)) { + tree.children = [] + for (var key in obj) { + var kid = {title: key} + if (obj[key] === Object(obj[key])) { + kid.isFolder = true + keys2kids(kid, obj[key]) + } else { + kid.title += (': ' + JSON.stringify(obj[key],null,2)) + } + tree.children.push(kid) + } + } + } + + var tree = [] + for (var key in QDRService.schema) { + var kid = {title: key} + var val = QDRService.schema[key] + if (val === Object(val)) + keys2kids(kid, val) + else + kid.title += (': ' + JSON.stringify(val,null,2)) + + tree.push(kid); + } + $('#schema').dynatree({ + minExpandLevel: 2, + children: tree + }) + }]); http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/d49adbdb/console/hawtio/src/main/webapp/plugin/js/qdrService.js ---------------------------------------------------------------------- diff --git a/console/hawtio/src/main/webapp/plugin/js/qdrService.js b/console/hawtio/src/main/webapp/plugin/js/qdrService.js index aebb71b..d944d92 100644 --- a/console/hawtio/src/main/webapp/plugin/js/qdrService.js +++ b/console/hawtio/src/main/webapp/plugin/js/qdrService.js @@ -626,7 +626,7 @@ The response looks like: application_properties.type = attrs.type; if (attrs.name) application_properties.name = attrs.name; - self.sender.send({ + var msg = { body: attrs, properties: { to: fullAddr, @@ -634,7 +634,10 @@ The response looks like: correlation_id: ret.id }, application_properties: application_properties - }) + } + self.sender.send( msg ); + console.dump("------- method called -------") + console.dump (msg) } catch (e) { error = "error sending: " + e; --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org