Skip to content

Commit

Permalink
bring back check boxes to the camel browse UI but don't use them on t…
Browse files Browse the repository at this point in the history
…he trace UI; and share configuration between the browse and trace UIs
  • Loading branch information
jstrachan committed Apr 30, 2013
1 parent 4ae04e3 commit f3a5864
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 78 deletions.
26 changes: 1 addition & 25 deletions hawtio-web/src/main/webapp/app/camel/js/browse.ts
Expand Up @@ -6,31 +6,7 @@ module Camel {

$scope.messageDialog = new Core.Dialog();

$scope.gridOptions = {
selectedItems: $scope.selectedItems,
data: 'messages',
displayFooter: false,
showFilter: false,
showColumnMenu: true,
enableColumnResize: true,
enableColumnReordering: true,
filterOptions: {
filterText: ''
},
selectWithCheckboxOnly: true,
maintainColumnRatios: false,
columnDefs: [
{
field: 'id',
displayName: 'ID',
// for ng-grid
//width: '50%',
// for hawtio-datatable
// width: "22em",
cellTemplate: '<div class="ngCellText"><a ng-click="openMessageDialog(row)">{{row.entity.id}}</a></div>'
}
]
};
$scope.gridOptions = Camel.createBrowseGridOptions();

$scope.$watch('workspace.selection', function () {
if (workspace.moveIfViewInvalid()) return;
Expand Down
28 changes: 28 additions & 0 deletions hawtio-web/src/main/webapp/app/camel/js/helpers.ts
Expand Up @@ -694,4 +694,32 @@ module Camel {
}
return messageData;
}

export function createBrowseGridOptions() {
return {
data: 'messages',
displayFooter: false,
showFilter: false,
showColumnMenu: true,
enableColumnResize: true,
enableColumnReordering: true,
filterOptions: {
filterText: ''
},
selectWithCheckboxOnly: true,
showSelectionCheckbox: true,
maintainColumnRatios: false,
columnDefs: [
{
field: 'id',
displayName: 'ID',
// for ng-grid
//width: '50%',
// for hawtio-datatable
// width: "22em",
cellTemplate: '<div class="ngCellText"><a ng-click="openMessageDialog(row)">{{row.entity.id}}</a></div>'
}
]
};
}
}
82 changes: 29 additions & 53 deletions hawtio-web/src/main/webapp/app/camel/js/trace.ts
Expand Up @@ -7,37 +7,13 @@ module Camel {

$scope.messageDialog = new Core.Dialog();

// TODO should share from browse.ts
$scope.gridOptions = {
afterSelectionChange: onSelectionChanged,
selectedItems: [],
data: 'messages',
displayFooter: false,
showFilter: false,
showColumnMenu: true,
enableColumnResize: true,
enableColumnReordering: true,
filterOptions: {
filterText: ''
},
selectWithCheckboxOnly: true,
maintainColumnRatios: false,
columnDefs: [
{
field: 'id',
displayName: 'ID',
// for ng-grid
//width: '50%',
// for hawtio-datatable
// width: "22em",
cellTemplate: '<div class="ngCellText"><a ng-click="openMessageDialog(row)">{{row.entity.id}}</a></div>'
},
{
field: 'toNode',
displayName: 'To Node'
}
]
};
$scope.gridOptions = Camel.createBrowseGridOptions();
$scope.gridOptions.selectWithCheckboxOnly = false;
$scope.gridOptions.showSelectionCheckbox = false;
$scope.gridOptions.columnDefs.push({
field: 'toNode',
displayName: 'To Node'
});


$scope.startTracing = () => {
Expand Down Expand Up @@ -108,30 +84,30 @@ module Camel {
function onSelectionChanged() {
console.log("===== selection changed!!! and its now " + $scope.gridOptions.selectedItems.length);
angular.forEach($scope.gridOptions.selectedItems, (selected) => {
if (selected) {
var toNode = selected["toNode"];
if (toNode) {
// lets highlight the node in the diagram
var nodes = d3.select("svg").selectAll("g .node");

// lets clear the selected node first
nodes.attr("class", "node");

nodes.filter(function (item) {
if (item) {
var cid = item["cid"];
var rid = item["rid"];
if (cid) {
// we should match cid if defined
return toNode === cid;
} else {
return toNode === rid;
if (selected) {
var toNode = selected["toNode"];
if (toNode) {
// lets highlight the node in the diagram
var nodes = d3.select("svg").selectAll("g .node");

// lets clear the selected node first
nodes.attr("class", "node");

nodes.filter(function (item) {
if (item) {
var cid = item["cid"];
var rid = item["rid"];
if (cid) {
// we should match cid if defined
return toNode === cid;
} else {
return toNode === rid;
}
}
}
return null;
}).attr("class", "node selected");
return null;
}).attr("class", "node selected");
}
}
}
});
}

Expand Down

0 comments on commit f3a5864

Please sign in to comment.