Skip to content

Commit

Permalink
after deleting a queue/topic select the parent node
Browse files Browse the repository at this point in the history
  • Loading branch information
jstrachan committed Apr 26, 2013
1 parent 0e873b6 commit a3b00ee
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 9 deletions.
7 changes: 1 addition & 6 deletions hawtio-web/src/main/webapp/app/activemq/js/destination.ts
Expand Up @@ -16,12 +16,7 @@ module ActiveMQ {

function deleteSuccess() {
// lets set the selection to the parent
if (workspace.selection) {
var parent = workspace.selection.parent;
if (parent) {
$scope.workspace.updateSelectionNode(parent);
}
}
workspace.selectParentNode();
$scope.workspace.operationCounter += 1;
$scope.$apply();
notification("success", $scope.message);
Expand Down
6 changes: 5 additions & 1 deletion hawtio-web/src/main/webapp/app/camel/js/attributesToolBar.ts
Expand Up @@ -15,7 +15,11 @@ module Camel {
};

$scope.stop = () => {
$scope.invokeSelectedMBeans("stop()");
$scope.invokeSelectedMBeans("stop()", () => {
// lets navigate to the parent folder!
// as this will be going way
workspace.selectParentNode();
});
};

/**
Expand Down
12 changes: 10 additions & 2 deletions hawtio-web/src/main/webapp/app/camel/js/tree.ts
Expand Up @@ -12,11 +12,18 @@ module Camel {

function reloadFunction() {
var children = [];
var domainName = "org.apache.camel";

// lets pull out each context
var tree = workspace.tree;
if (tree) {
var domainName = "org.apache.camel";
var rootFolder = new Folder("Camel Contexts");
rootFolder.addClass = "org-apache-camel-contexts-folder";
rootFolder.children = children;
rootFolder.typeName = "contexts";
rootFolder.key = "camelContexts";
rootFolder.domain = domainName;

var folder = tree.get(domainName);
if (folder) {
angular.forEach(folder.children, (value, key) => {
Expand Down Expand Up @@ -74,6 +81,7 @@ module Camel {
jmxNode.sortChildren(false);
folder.children.push(jmxNode);
}
folder.parent = rootFolder;
children.push(folder);
}
}
Expand All @@ -82,7 +90,7 @@ module Camel {
}

var treeElement = $("#cameltree");
Jmx.enableTree($scope, $location, workspace, treeElement, children);
Jmx.enableTree($scope, $location, workspace, treeElement, [rootFolder]);
/*
// lets select the first node if we have no selection
Expand Down
14 changes: 14 additions & 0 deletions hawtio-web/src/main/webapp/app/core/js/workspace.ts
Expand Up @@ -420,6 +420,20 @@ class Workspace {
*/
}

/**
* In cases where we have just deleted something we typically want to change
* the selection to the parent node
*/
public selectParentNode() {
var selection = this.selection;
if (selection) {
var parent = selection.parent;
if (parent) {
this.updateSelectionNode(parent);
}
}
}

/**
* Returns the view configuration key for the kind of selection
* for example based on the domain and the node type
Expand Down

0 comments on commit a3b00ee

Please sign in to comment.