1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-02 09:51:09 +03:00

Added schedule.enabled support to job_template.schedules and projects.schedules.

This commit is contained in:
Chris Houseknecht 2014-03-25 10:53:23 -04:00
parent 54f3062445
commit 166cf61dc1
5 changed files with 58 additions and 14 deletions

View File

@ -11,19 +11,32 @@
'use strict'; 'use strict';
function ScheduleEdit($scope, $compile, $location, $routeParams, SchedulesList, GenerateList, Rest, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope, function ScheduleEdit($scope, $compile, $location, $routeParams, SchedulesList, GenerateList, Rest, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope,
GetBasePath, LookUpInit, Wait, SchedulerInit, Breadcrumbs, SearchInit, PaginateInit, PageRangeSetup, EditSchedule, AddSchedule, Find) { GetBasePath, LookUpInit, Wait, SchedulerInit, Breadcrumbs, SearchInit, PaginateInit, PageRangeSetup, EditSchedule, AddSchedule, Find, ToggleSchedule) {
ClearScope(); ClearScope();
var base, e, id, job_template, url; var base, e, id, parentObject, url;
base = $location.path().replace(/^\//, '').split('/')[0]; base = $location.path().replace(/^\//, '').split('/')[0];
$scope.$on('job_template_ready', function() { if ($scope.removePostRefresh) {
$scope.removePostRefresh();
}
$scope.removePostRefresh = $scope.$on('PostRefresh', function() {
var list = $scope.schedules;
list.forEach(function(element, idx) {
list[idx].play_tip = (element.enabled) ? 'Schedule is Active. Click to temporarily stop.' : 'Schedule is temporarily stopped. Click to activate.';
});
});
if ($scope.removeParentLoaded) {
$scope.removeParentLoaded();
}
$scope.removeScheduledLoaded = $scope.$on('ParentLoaded', function() {
// Add breadcrumbs // Add breadcrumbs
LoadBreadCrumbs({ LoadBreadCrumbs({
path: $location.path().replace(/\/schedules$/,''), path: $location.path().replace(/\/schedules$/,''),
title: job_template.name title: parentObject.name
}); });
e = angular.element(document.getElementById('breadcrumbs')); e = angular.element(document.getElementById('breadcrumbs'));
e.html(Breadcrumbs({ list: SchedulesList, mode: 'edit' })); e.html(Breadcrumbs({ list: SchedulesList, mode: 'edit' }));
@ -112,16 +125,28 @@ GetBasePath, LookUpInit, Wait, SchedulerInit, Breadcrumbs, SearchInit, PaginateI
AddSchedule({ scope: $scope, schedule: schedule, url: url }); AddSchedule({ scope: $scope, schedule: schedule, url: url });
}; };
if ($scope.removeScheduleToggled) {
$scope.removeScheduleToggled();
}
$scope.removeScheduleToggled = function() {
$scope.search(SchedulesList.iterator);
};
//scheduler = SchedulerInit({ scope: $scope }); $scope.toggleSchedule = function(id) {
//scheduler.inject('scheduler-target', true); ToggleSchedule({
scope: $scope,
id: id,
callback: 'ScheduleToggled'
});
};
// Load the parent object
id = $routeParams.id; id = $routeParams.id;
Rest.setUrl(GetBasePath(base) + id); Rest.setUrl(GetBasePath(base) + id);
Rest.get() Rest.get()
.success(function(data) { .success(function(data) {
job_template = data; parentObject = data;
$scope.$emit('job_template_ready'); $scope.$emit('ParentLoaded');
}) })
.error(function(status) { .error(function(status) {
ProcessErrors($scope, null, status, null, { hdr: 'Error!', ProcessErrors($scope, null, status, null, { hdr: 'Error!',
@ -131,5 +156,5 @@ GetBasePath, LookUpInit, Wait, SchedulerInit, Breadcrumbs, SearchInit, PaginateI
ScheduleEdit.$inject = ['$scope', '$compile', '$location', '$routeParams', 'SchedulesList', 'GenerateList', 'Rest', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', ScheduleEdit.$inject = ['$scope', '$compile', '$location', '$routeParams', 'SchedulesList', 'GenerateList', 'Rest', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller',
'ClearScope', 'GetBasePath', 'LookUpInit', 'Wait', 'SchedulerInit', 'Breadcrumbs', 'SearchInit', 'PaginateInit', 'PageRangeSetup', 'EditSchedule', 'AddSchedule', 'ClearScope', 'GetBasePath', 'LookUpInit', 'Wait', 'SchedulerInit', 'Breadcrumbs', 'SearchInit', 'PaginateInit', 'PageRangeSetup', 'EditSchedule', 'AddSchedule',
'Find' 'Find', 'ToggleSchedule'
]; ];

View File

@ -22,13 +22,16 @@ angular.module('SchedulesListDefinition', [])
fields: { fields: {
name: { name: {
key: true, key: true,
label: 'Name' label: 'Name',
ngClick: "editSchedule(schedule.id)"
}, },
dtstart: { dtstart: {
label: 'Start' label: 'Start',
searchable: false
}, },
dtend: { dtend: {
label: 'End' label: 'End',
searchable: false
} }
}, },
@ -46,6 +49,14 @@ angular.module('SchedulesListDefinition', [])
}, },
fieldActions: { fieldActions: {
"play": {
mode: "all",
ngClick: "toggleSchedule(schedule.id)",
awToolTip: "{{ schedule.play_tip }}",
dataTipWatch: "schedule.play_tip",
iconClass: "{{ 'fa icon-schedule-enabled-' + schedule.enabled }}",
dataPlacement: "top"
},
edit: { edit: {
label: 'Edit', label: 'Edit',
ngClick: "editSchedule(schedule.id)", ngClick: "editSchedule(schedule.id)",
@ -53,7 +64,6 @@ angular.module('SchedulesListDefinition', [])
awToolTip: 'Edit schedule', awToolTip: 'Edit schedule',
dataPlacement: 'top' dataPlacement: 'top'
}, },
"delete": { "delete": {
label: 'Delete', label: 'Delete',
ngClick: "deleteSchedule(schedule.id)", ngClick: "deleteSchedule(schedule.id)",

View File

@ -10,6 +10,7 @@
"project": null, "project": null,
"job_class": "ansible:playbook", "job_class": "ansible:playbook",
"name": "Hourly", "name": "Hourly",
"enabled": true,
"dtstart": "2014-03-10T17:00:00.000Z" , "dtstart": "2014-03-10T17:00:00.000Z" ,
"dtend": null, "dtend": null,
"rrule": "FREQ=HOURLY;DTSTART=20140310T170000Z;INTERVAL=1" "rrule": "FREQ=HOURLY;DTSTART=20140310T170000Z;INTERVAL=1"
@ -21,6 +22,7 @@
"project": null, "project": null,
"job_class": "ansible:playbook", "job_class": "ansible:playbook",
"name": "Weekly", "name": "Weekly",
"enabled": true,
"dtstart": "2014-03-17T13:00:00.000Z", "dtstart": "2014-03-17T13:00:00.000Z",
"dtend": null, "dtend": null,
"rrule": "FREQ=WEEKLY;DTSTART=20140317T130000Z;INTERVAL=1;COUNT=10;BYDAY=MO" "rrule": "FREQ=WEEKLY;DTSTART=20140317T130000Z;INTERVAL=1;COUNT=10;BYDAY=MO"
@ -32,6 +34,7 @@
"project": null, "project": null,
"job_class": "ansible:playbook", "job_class": "ansible:playbook",
"name": "Monthly", "name": "Monthly",
"enabled": false,
"dtstart": "2014-04-06T01:00:00.000Z", "dtstart": "2014-04-06T01:00:00.000Z",
"dtend": "2020-03-01T01:00:00.000Z", "dtend": "2020-03-01T01:00:00.000Z",
"rrule": "FREQ=MONTHLY;DTSTART=20140406T010000Z;INTERVAL=1;UNTIL=20200301T010000Z;BYMONTHDAY=1" "rrule": "FREQ=MONTHLY;DTSTART=20140406T010000Z;INTERVAL=1;UNTIL=20200301T010000Z;BYMONTHDAY=1"

View File

@ -11,6 +11,7 @@
"job_class": "inventory:sync", "job_class": "inventory:sync",
"job_type": "inventory_sync", "job_type": "inventory_sync",
"name": "Hourly", "name": "Hourly",
"enabled": true,
"dtstart": "2014-03-10T17:00:00.000Z" , "dtstart": "2014-03-10T17:00:00.000Z" ,
"dtend": null, "dtend": null,
"rrule": "FREQ=HOURLY;DTSTART=20140310T170000Z;INTERVAL=1" "rrule": "FREQ=HOURLY;DTSTART=20140310T170000Z;INTERVAL=1"
@ -23,6 +24,7 @@
"job_class": "inventory:sync", "job_class": "inventory:sync",
"job_type": "inventory_sync", "job_type": "inventory_sync",
"name": "Weekly", "name": "Weekly",
"enabled": true,
"dtstart": "2014-03-17T13:00:00.000Z", "dtstart": "2014-03-17T13:00:00.000Z",
"dtend": null, "dtend": null,
"rrule": "FREQ=WEEKLY;DTSTART=20140317T130000Z;INTERVAL=1;COUNT=10;BYDAY=MO" "rrule": "FREQ=WEEKLY;DTSTART=20140317T130000Z;INTERVAL=1;COUNT=10;BYDAY=MO"
@ -35,6 +37,7 @@
"job_class": "inventory:sync", "job_class": "inventory:sync",
"job_type": "inventory_sync", "job_type": "inventory_sync",
"name": "Monthly", "name": "Monthly",
"enabled": false,
"dtstart": "2014-04-06T01:00:00.000Z", "dtstart": "2014-04-06T01:00:00.000Z",
"dtend": "2020-03-01T01:00:00.000Z", "dtend": "2020-03-01T01:00:00.000Z",
"rrule": "FREQ=MONTHLY;DTSTART=20140406T010000Z;INTERVAL=1;UNTIL=20200301T010000Z;BYMONTHDAY=1" "rrule": "FREQ=MONTHLY;DTSTART=20140406T010000Z;INTERVAL=1;UNTIL=20200301T010000Z;BYMONTHDAY=1"

View File

@ -11,6 +11,7 @@
"job_class": "project:sync", "job_class": "project:sync",
"job_type": "project_sync", "job_type": "project_sync",
"name": "Hourly", "name": "Hourly",
"enabled": false,
"dtstart": "2014-03-10T17:00:00.000Z" , "dtstart": "2014-03-10T17:00:00.000Z" ,
"dtend": null, "dtend": null,
"rrule": "FREQ=HOURLY;DTSTART=20140310T170000Z;INTERVAL=1" "rrule": "FREQ=HOURLY;DTSTART=20140310T170000Z;INTERVAL=1"
@ -23,6 +24,7 @@
"job_class": "project:sync", "job_class": "project:sync",
"job_type": "project_sync", "job_type": "project_sync",
"name": "Weekly", "name": "Weekly",
"enabled": true,
"dtstart": "2014-03-17T13:00:00.000Z", "dtstart": "2014-03-17T13:00:00.000Z",
"dtend": null, "dtend": null,
"rrule": "FREQ=WEEKLY;DTSTART=20140317T130000Z;INTERVAL=1;COUNT=10;BYDAY=MO" "rrule": "FREQ=WEEKLY;DTSTART=20140317T130000Z;INTERVAL=1;COUNT=10;BYDAY=MO"
@ -35,6 +37,7 @@
"job_class": "project:sync", "job_class": "project:sync",
"job_type": "project_sync", "job_type": "project_sync",
"name": "Monthly", "name": "Monthly",
"enabled": true,
"dtstart": "2014-04-06T01:00:00.000Z", "dtstart": "2014-04-06T01:00:00.000Z",
"dtend": "2020-03-01T01:00:00.000Z", "dtend": "2020-03-01T01:00:00.000Z",
"rrule": "FREQ=MONTHLY;DTSTART=20140406T010000Z;INTERVAL=1;UNTIL=20200301T010000Z;BYMONTHDAY=1" "rrule": "FREQ=MONTHLY;DTSTART=20140406T010000Z;INTERVAL=1;UNTIL=20200301T010000Z;BYMONTHDAY=1"