Skip to content

Commit

Permalink
#786: Quartz plugin. Work in progress.
Browse files Browse the repository at this point in the history
  • Loading branch information
davsclaus committed Dec 30, 2013
1 parent 5de9884 commit 9dd1184
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 2 deletions.
12 changes: 12 additions & 0 deletions hawtio-web/src/main/webapp/app/quartz/html/jobs.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@
<div class="gridStyle" ng-grid="jobsGridOptions"></div>
</div>

<div modal="valueDetails.show" close="valueDetails.close()" options="valueDetails.options">
<form class="form-horizontal no-bottom-margin" ng-submit="valueDetails.close()">
<div class="modal-header"><h4>{{row.group}} {{row.name}}</h4></div>
<div class="modal-body">
<div ng-bind-html-unsafe="row.detailHtml"></div>
</div>
<div class="modal-footer">
<input class="btn" ng-click="valueDetails.close()" value="Close">
</div>
</form>
</div>

</div>

</div>
Expand Down
50 changes: 48 additions & 2 deletions hawtio-web/src/main/webapp/app/quartz/js/quartz.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ module Quartz {

var stateTemplate = '<div class="ngCellText pagination-centered" title="{{row.getProperty(col.field)}}"><i class="{{row.getProperty(col.field) | quartzIconClass}}"></i></div>';
var misfireTemplate = '<div class="ngCellText" title="{{row.getProperty(col.field)}}">{{row.getProperty(col.field) | quartzMisfire}}</div>';
var jobMapTemplate = '<div class="ngCellText" ng-click="openDetailView(row.entity)" ng-bind-html-unsafe="row.getProperty(col.field) | quartzJobDataClassText"></div>';

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

$scope.selectedSchedulerDetails = [];
$scope.selectedSchedulerIcon = null;
$scope.selectedScheduler = null;
$scope.selectedSchedulerMBean = $location.search()["nid"];
$scope.selectedSchedulerMBean = null;
$scope.triggers = [];
$scope.jobs = [];

Expand Down Expand Up @@ -96,11 +99,19 @@ module Quartz {
},
{
field: 'jobClass',
displayName: 'Job ClassName'
displayName: 'Job ClassName',
cellTemplate: jobMapTemplate
}
]
};

$scope.openDetailView = (entity) => {
$scope.row = entity;
if (entity.detailHtml) {
$scope.valueDetails.open();
}
};

$scope.renderQuartz = (response) => {
$scope.selectedSchedulerDetails = [];

Expand Down Expand Up @@ -164,6 +175,7 @@ module Quartz {
if (job) {
job = job[t.group];
if (job) {
generateSummaryAndDetail(job);
$scope.jobs.push(job);
}
}
Expand All @@ -174,6 +186,40 @@ module Quartz {
Core.$apply($scope);
}

function generateSummaryAndDetail(data) {
log.info("Generate summary for job " + data);
var value = data.jobDataMap;
if (!angular.isArray(value) && angular.isObject(value)) {
var detailHtml = "<table class='table table-striped'>";
var summary = "";
var object = value;
var keys = Object.keys(value).sort();
angular.forEach(keys, (key) => {
var value = object[key];
detailHtml += "<tr><td>"
+ humanizeValue(key) + "</td><td>" + value + "</td></tr>";
summary += "" + humanizeValue(key) + ": " + value + " "
});
detailHtml += "</table>";
data.summary = summary;
data.detailHtml = detailHtml;
} else {
// TODO can we format any nicer?
var text = value;
data.summary = "" + text + "";
data.detailHtml = "<pre>" + text + "</pre>";
if (angular.isArray(value)) {
var html = "<ul>";
angular.forEach(value, (item) => {
html += "<li>" + item + "</li>";
});
html += "</ul>";
data.detailHtml = html;
}

}
}

$scope.pause = () => {
if ($scope.gridOptions.selectedItems.length === 1) {
var groupName = $scope.gridOptions.selectedItems[0].group;
Expand Down
5 changes: 5 additions & 0 deletions hawtio-web/src/main/webapp/app/quartz/js/quartzHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ module Quartz {
return "unknown";
}

export function jobDataClassText(text) {
// add info sign icon to the text so the end user notice there is some more details, by clicking the cell.
return "<i class='icon-info-sign'> " + text + "</i>";
}

/**
* Returns true if the state of the item begins with the given state - or one of the given states
* @method
Expand Down
1 change: 1 addition & 0 deletions hawtio-web/src/main/webapp/app/quartz/js/quartzPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module Quartz {
}).
filter('quartzIconClass',() => iconClass).
filter('quartzMisfire',() => misfireText).
filter('quartzJobDataClassText',() => jobDataClassText).
run(($location:ng.ILocationService, workspace:Workspace, viewRegistry, layoutFull, helpRegistry) => {

viewRegistry['quartz'] = 'app/quartz/html/layoutQuartzTree.html';
Expand Down

0 comments on commit 9dd1184

Please sign in to comment.