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';
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();
var base, e, id, job_template, url;
var base, e, id, parentObject, url;
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
LoadBreadCrumbs({
path: $location.path().replace(/\/schedules$/,''),
title: job_template.name
title: parentObject.name
});
e = angular.element(document.getElementById('breadcrumbs'));
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 });
};
if ($scope.removeScheduleToggled) {
$scope.removeScheduleToggled();
}
$scope.removeScheduleToggled = function() {
$scope.search(SchedulesList.iterator);
};
//scheduler = SchedulerInit({ scope: $scope });
//scheduler.inject('scheduler-target', true);
$scope.toggleSchedule = function(id) {
ToggleSchedule({
scope: $scope,
id: id,
callback: 'ScheduleToggled'
});
};
// Load the parent object
id = $routeParams.id;
Rest.setUrl(GetBasePath(base) + id);
Rest.get()
.success(function(data) {
job_template = data;
$scope.$emit('job_template_ready');
parentObject = data;
$scope.$emit('ParentLoaded');
})
.error(function(status) {
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',
'ClearScope', 'GetBasePath', 'LookUpInit', 'Wait', 'SchedulerInit', 'Breadcrumbs', 'SearchInit', 'PaginateInit', 'PageRangeSetup', 'EditSchedule', 'AddSchedule',
'Find'
'Find', 'ToggleSchedule'
];

View File

@ -22,13 +22,16 @@ angular.module('SchedulesListDefinition', [])
fields: {
name: {
key: true,
label: 'Name'
label: 'Name',
ngClick: "editSchedule(schedule.id)"
},
dtstart: {
label: 'Start'
label: 'Start',
searchable: false
},
dtend: {
label: 'End'
label: 'End',
searchable: false
}
},
@ -46,6 +49,14 @@ angular.module('SchedulesListDefinition', [])
},
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: {
label: 'Edit',
ngClick: "editSchedule(schedule.id)",
@ -53,7 +64,6 @@ angular.module('SchedulesListDefinition', [])
awToolTip: 'Edit schedule',
dataPlacement: 'top'
},
"delete": {
label: 'Delete',
ngClick: "deleteSchedule(schedule.id)",

View File

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

View File

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

View File

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