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() { $scope.removeChoicesReady = $scope.$on('choicesReady', function() {
choicesCount++; choicesCount++;
if (choicesCount === 3) { if (choicesCount === 2) {
$scope.$emit('buildJobsList'); $scope.$emit('buildJobsList');
} }
}); });

View File

@@ -11,7 +11,7 @@
'use strict'; 'use strict';
function ScheduleEditController($scope, $compile, $location, $routeParams, SchedulesList, Rest, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope, 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(); 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'); Wait('start');
id = $routeParams.id;
url = GetBasePath(base) + id + '/'; GetChoices({
Rest.setUrl(url); scope: $scope,
Rest.get() url: GetBasePath('unified_jobs'), //'/static/sample/data/types/data.json'
.success(function(data) { field: 'type',
parentObject = data; variable: 'type_choices',
$scope.$emit('ParentLoaded'); callback: 'choicesReady'
}) });
.error(function(data, status) {
ProcessErrors($scope, data, status, null, { hdr: 'Error!',
msg: 'Call to ' + url + ' failed. GET returned: ' + status });
});
} }
ScheduleEditController.$inject = [ '$scope', '$compile', '$location', '$routeParams', 'SchedulesList', 'Rest', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', 'ClearScope', 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 }); DeleteJob({ scope: scope, id: id });
}; };
scope.relaunchJob = function(id) { scope.relaunchJob = function(event, id) {
var list, job, typeId; var list, job, typeId;
try {
$(event.target).tooltip('hide');
}
catch(e) {
//ignore
}
if (scope.completed_jobs) { if (scope.completed_jobs) {
list = 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'); parent_scope.$emit('listLoaded');
}); });
@@ -473,15 +474,4 @@ function(Find, Wait, Rest, InventoryUpdate, ProcessErrors, GetBasePath) {
id = params.id; id = params.id;
ProjectUpdate({ scope: scope, project_id: 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 = 'stopped';
itm.status_tip = 'Schedule is temporarily stopped. Click to activate.'; 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 // Copy summary_field values
for (field in list.fields) { for (field in list.fields) {
fld = list.fields[field]; fld = list.fields[field];

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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