Latest job page and scheduling widget changes.

This commit is contained in:
Chris Houseknecht 2014-03-31 15:41:49 -04:00
parent 60b399409a
commit 2c8c1e660c
10 changed files with 90 additions and 60 deletions

View File

@ -71,7 +71,7 @@ function JobsListController ($scope, $compile, ClearScope, Breadcrumbs, LoadBrea
}
$scope.removeChoicesReady = $scope.$on('choicesReady', function() {
choicesCount++;
if (choicesCount === 3) {
if (choicesCount === 2) {
$scope.$emit('buildJobsList');
}
});

View File

@ -11,7 +11,7 @@
'use strict';
function ScheduleEditController($scope, $compile, $location, $routeParams, SchedulesList, Rest, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope,
GetBasePath, Wait, Breadcrumbs, Find, LoadDialogPartial, LoadSchedulesScope) {
GetBasePath, Wait, Breadcrumbs, Find, LoadDialogPartial, LoadSchedulesScope, GetChoices) {
ClearScope();
@ -54,21 +54,36 @@ GetBasePath, Wait, Breadcrumbs, Find, LoadDialogPartial, LoadSchedulesScope) {
});
});
// Load the parent object
if ($scope.removeChoicesReady) {
$scope.removeChocesReady();
}
$scope.removeChoicesReady = $scope.$on('choicesReady', function() {
// Load the parent object
id = $routeParams.id;
url = GetBasePath(base) + id + '/';
Rest.setUrl(url);
Rest.get()
.success(function(data) {
parentObject = data;
$scope.$emit('ParentLoaded');
})
.error(function(data, status) {
ProcessErrors($scope, data, status, null, { hdr: 'Error!',
msg: 'Call to ' + url + ' failed. GET returned: ' + status });
});
});
Wait('start');
id = $routeParams.id;
url = GetBasePath(base) + id + '/';
Rest.setUrl(url);
Rest.get()
.success(function(data) {
parentObject = data;
$scope.$emit('ParentLoaded');
})
.error(function(data, status) {
ProcessErrors($scope, data, status, null, { hdr: 'Error!',
msg: 'Call to ' + url + ' failed. GET returned: ' + status });
});
GetChoices({
scope: $scope,
url: GetBasePath('unified_jobs'), //'/static/sample/data/types/data.json'
field: 'type',
variable: 'type_choices',
callback: 'choicesReady'
});
}
ScheduleEditController.$inject = [ '$scope', '$compile', '$location', '$routeParams', 'SchedulesList', 'Rest', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', 'ClearScope',
'GetBasePath', 'Wait', 'Breadcrumbs', 'Find', 'LoadDialogPartial', 'LoadSchedulesScope' ];
'GetBasePath', 'Wait', 'Breadcrumbs', 'Find', 'LoadDialogPartial', 'LoadSchedulesScope', 'GetChoices' ];

View File

@ -28,8 +28,14 @@ angular.module('JobsHelper', ['Utilities', 'RestServices', 'FormGenerator', 'Job
DeleteJob({ scope: scope, id: id });
};
scope.relaunchJob = function(id) {
scope.relaunchJob = function(event, id) {
var list, job, typeId;
try {
$(event.target).tooltip('hide');
}
catch(e) {
//ignore
}
if (scope.completed_jobs) {
list = scope.completed_jobs;
}
@ -355,11 +361,6 @@ angular.module('JobsHelper', ['Utilities', 'RestServices', 'FormGenerator', 'Job
}
}
}
itm.status_popover_title = itm.status_label;
itm.status_popover = "<p>" + itm.job_explanation + "</p>\n" +
"<p><a href=\"/#/jobs/" + itm.id + "\">More...</a></p>\n" +
"<div class=\"popover-footer\"><span class=\"key\">esc</span> or click to close</div>\n";
});
parent_scope.$emit('listLoaded');
});
@ -473,15 +474,4 @@ function(Find, Wait, Rest, InventoryUpdate, ProcessErrors, GetBasePath) {
id = params.id;
ProjectUpdate({ scope: scope, project_id: id });
};
}])
.factory('ScheduledJobEdit', ['Find', 'EditSchedule', 'GetBasePath', function(Find, EditSchedule, GetBasePath) {
return function(params) {
var scope = params.scope,
id = params.id,
url = GetBasePath('schedules'),
schedule = Find({ list: scope.scheduled_jobs, key: 'id', val: id });
EditSchedule({ scope: scope, schedule: schedule, url: url });
};
}]);

View File

@ -521,6 +521,18 @@ angular.module('SchedulesHelper', ['Utilities', 'RestServices', 'SchedulesHelper
itm.status = 'stopped';
itm.status_tip = 'Schedule is temporarily stopped. Click to activate.';
}
// Set the item type label
if (list.fields.type) {
parent_scope.type_choices.every(function(choice) {
if (choice.value === item.type) {
itm.type_label = choice.label;
return false;
}
return true;
});
}
// Copy summary_field values
for (field in list.fields) {
fld = list.fields[field];

View File

@ -63,7 +63,8 @@ angular.module('CompletedJobsDefinition', [])
label: 'Type',
ngBind: 'completed_job.type_label',
link: false,
columnClass: "col-md-2 hidden-sm hidden-xs"
columnClass: "col-md-2 hidden-sm hidden-xs",
searchable: false
},
name: {
label: 'Name',
@ -93,7 +94,7 @@ angular.module('CompletedJobsDefinition', [])
submit: {
icon: 'icon-rocket',
mode: 'all',
ngClick: 'relaunchJob(completed_job.id)',
ngClick: 'relaunchJob($event, completed_job.id)',
awToolTip: 'Relaunch using the same parameters',
dataPlacement: 'top'
},

View File

@ -54,7 +54,8 @@ angular.module('QueuedJobsDefinition', [])
label: 'Type',
ngBind: 'queued_job.type_label',
link: false,
columnClass: "col-md-2 hidden-sm hidden-xs"
columnClass: "col-md-2 hidden-sm hidden-xs",
searchable: false
},
name: {
label: 'Name',
@ -76,7 +77,7 @@ angular.module('QueuedJobsDefinition', [])
submit: {
icon: 'icon-rocket',
mode: 'all',
ngClick: 'relaunchJob(queued_job.id)',
ngClick: 'relaunchJob($event, queued_job.id)',
awToolTip: 'Relaunch using the same parameters',
dataPlacement: 'top'
},

View File

@ -54,7 +54,8 @@ angular.module('RunningJobsDefinition', [])
label: 'Type',
ngBind: 'running_job.type_label',
link: false,
columnClass: "col-md-2 hidden-sm hidden-xs"
columnClass: "col-md-2 hidden-sm hidden-xs",
searchable: false
},
name: {
label: 'Name',
@ -76,7 +77,7 @@ angular.module('RunningJobsDefinition', [])
submit: {
icon: 'icon-rocket',
mode: 'all',
ngClick: 'relaunchJob(running_job.id)',
ngClick: 'relaunchJob($event, running_job.id)',
awToolTip: 'Relaunch using the same parameters',
dataPlacement: 'top'
},

View File

@ -23,11 +23,11 @@ angular.module('ScheduledJobsDefinition', [])
status: {
label: 'Status',
columnClass: 'col-md-2 col-sm-2 col-xs-2',
awToolTip: "{{ scheduled_job.status_tip }}",
awToolTip: "{{ schedule.status_tip }}",
awTipPlacement: "top",
icon: 'icon-job-{{ scheduled_job.status }}',
icon: 'icon-job-{{ schedule.status }}',
iconOnly: true,
ngClick: "toggleSchedule(scheduled_job.id)"
ngClick: "toggleSchedule($event, schedule.id)"
},
next_run: {
label: 'Next Run',
@ -41,9 +41,9 @@ angular.module('ScheduledJobsDefinition', [])
type: {
label: 'Type',
link: false,
sourceModel: '',
sourceField: '',
columnClass: "col-md-2 hidden-sm hidden-xs"
columnClass: "col-md-2 hidden-sm hidden-xs",
ngBind: 'schedule.type_label',
searchable: false
},
name: {
label: 'Name',
@ -64,20 +64,20 @@ angular.module('ScheduledJobsDefinition', [])
"play": {
mode: "all",
ngClick: "toggleSchedule($event, schedule.id)",
awToolTip: "{{ scheduled_job.play_tip }}",
dataTipWatch: "scheduled_job.play_tip",
iconClass: "{{ 'fa icon-schedule-enabled-' + scheduled_job.enabled }}",
awToolTip: "{{ schedule.play_tip }}",
dataTipWatch: "schedule.play_tip",
iconClass: "{{ 'fa icon-schedule-enabled-' + schedule.enabled }}",
dataPlacement: 'top'
},
"edit": {
mode: "all",
ngClick: "editSchedule(scheduled_job.id)",
ngClick: "editSchedule(schedule.id)",
awToolTip: "Edit the schedule",
dataPlacement: "top"
},
"delete": {
mode: 'all',
ngClick: 'deleteSchedule(scheduled_job.id)',
ngClick: 'deleteSchedule(schedule.id)',
awToolTip: 'Delete the schedule',
dataPlacement: 'top'
}

View File

@ -978,6 +978,7 @@ input[type="checkbox"].checkbox-no-label {
color: @green;
}
.icon-job-active:before,
.icon-job-running:before,
.icon-job-success:before,
.icon-job-successful:before,
@ -985,6 +986,7 @@ input[type="checkbox"].checkbox-no-label {
content: "\f111";
}
.icon-job-stopped:before,
.icon-job-error:before,
.icon-job-failed:before,
.icon-job-canceled:before {
@ -998,6 +1000,7 @@ input[type="checkbox"].checkbox-no-label {
content: "\f10c";
}
.icon-job-active,
.icon-job-running,
.icon-job-success,
.icon-job-successful {
@ -1013,6 +1016,7 @@ input[type="checkbox"].checkbox-no-label {
color: @warning;
}
.icon-job-stopped,
.icon-job-error,
.icon-job-failed,
.icon-job-canceled {
@ -1053,9 +1057,9 @@ input[type="checkbox"].checkbox-no-label {
.pagination li a {
font-size: 12px;
}
/*.list-table-container {
min-height: 338px;
}*/
i[class*="icon-job-"] {
font-size: 12.5px;
}
}
/* Inventory job status badge */

View File

@ -449,7 +449,7 @@ angular.module('GeneratorHelpers', [])
options = params.options,
base = params.base,
field = list.fields[fld],
html = '';
cap, html = '';
if (field.type !== undefined && field.type === 'DropDown') {
html = DropDown(params);
@ -496,15 +496,19 @@ angular.module('GeneratorHelpers', [])
// Start the Link
if ((field.key || field.link || field.linkTo || field.ngClick || field.ngHref || field.awToolTip || field.awPopOver) &&
options.mode !== 'lookup' && options.mode !== 'select' && !field.noLink && !field.ngBindHtml) {
html += "<a ";
cap = false;
if (field.linkTo) {
html += "href=\"" + field.linkTo + "\" ";
html += "<a href=\"" + field.linkTo + "\" ";
cap = true;
} else if (field.ngClick) {
html += "href=\"\"" + Attr(field, 'ngClick') + " ";
html += "<a href=\"\"" + Attr(field, 'ngClick') + " ";
cap = true;
} else if (field.ngHref) {
html += "ng-href=\"" + field.ngHref + "\" ";
html += "<a ng-href=\"" + field.ngHref + "\" ";
cap = true;
} else if (field.link || (field.key && (field.link === undefined || field.link))) {
html += "href=\"#/" + base + "/{{" + list.iterator + ".id }}\" ";
html += "<a href=\"#/" + base + "/{{" + list.iterator + ".id }}\" ";
cap = true;
}
if (field.awDroppable) {
html += Attr(field, 'awDroppable');
@ -528,7 +532,9 @@ angular.module('GeneratorHelpers', [])
html += "aw-pop-over=\"" + field.awPopOver + "\" ";
html += (field.dataPlacement) ? "data-placement=\"" + field.dataPlacement + "\" " : "";
}
html += ">";
if (cap) {
html += ">";
}
}
// Add icon: