mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 09:51:09 +03:00
Added support for schedule.enabled to Jobs page.
This commit is contained in:
parent
71904c3b5b
commit
f153105f79
@ -11,7 +11,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function JobsListController ($scope, $compile, ClearScope, Breadcrumbs, LoadBreadCrumbs, LoadScope, RunningJobsList, CompletedJobsList, QueuedJobsList,
|
function JobsListController ($scope, $compile, ClearScope, Breadcrumbs, LoadBreadCrumbs, LoadScope, RunningJobsList, CompletedJobsList, QueuedJobsList,
|
||||||
ScheduledJobsList, GetChoices, GetBasePath, Wait, DeleteJob) {
|
ScheduledJobsList, GetChoices, GetBasePath, Wait, DeleteJob, ToggleScheduleEnabled, Find) {
|
||||||
|
|
||||||
ClearScope();
|
ClearScope();
|
||||||
|
|
||||||
@ -75,6 +75,15 @@ function JobsListController ($scope, $compile, ClearScope, Breadcrumbs, LoadBrea
|
|||||||
url: GetBasePath('schedules')
|
url: GetBasePath('schedules')
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (scheduled_scope.removeScheduleToggled) {
|
||||||
|
scheduled_scope.removeScheduleToggled();
|
||||||
|
}
|
||||||
|
scheduled_scope.removeScheduleToggled = function(e, id) {
|
||||||
|
//scheduled_scope.search(ScheduledJobsList.iterator);
|
||||||
|
var schedule = Find({ list: scheduled_scope[ScheduledJobsList.name], key: 'id', val: id});
|
||||||
|
schedule.enabled = (schedule.enabled) ? false : true;
|
||||||
|
};
|
||||||
|
|
||||||
completed_scope.deleteJob = function(id) {
|
completed_scope.deleteJob = function(id) {
|
||||||
DeleteJob({ scope: completed_scope, id: id });
|
DeleteJob({ scope: completed_scope, id: id });
|
||||||
};
|
};
|
||||||
@ -87,6 +96,13 @@ function JobsListController ($scope, $compile, ClearScope, Breadcrumbs, LoadBrea
|
|||||||
DeleteJob({ scope: running_scope, id: id });
|
DeleteJob({ scope: running_scope, id: id });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
scheduled_scope.toggleSchedule = function(id) {
|
||||||
|
ToggleScheduleEnabled({
|
||||||
|
scope: scheduled_scope,
|
||||||
|
id: id
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if ($scope.removeChoicesReady) {
|
if ($scope.removeChoicesReady) {
|
||||||
@ -120,7 +136,7 @@ function JobsListController ($scope, $compile, ClearScope, Breadcrumbs, LoadBrea
|
|||||||
}
|
}
|
||||||
|
|
||||||
JobsListController.$inject = ['$scope', '$compile', 'ClearScope', 'Breadcrumbs', 'LoadBreadCrumbs', 'LoadScope', 'RunningJobsList', 'CompletedJobsList',
|
JobsListController.$inject = ['$scope', '$compile', 'ClearScope', 'Breadcrumbs', 'LoadBreadCrumbs', 'LoadScope', 'RunningJobsList', 'CompletedJobsList',
|
||||||
'QueuedJobsList', 'ScheduledJobsList', 'GetChoices', 'GetBasePath', 'Wait', 'DeleteJob'];
|
'QueuedJobsList', 'ScheduledJobsList', 'GetChoices', 'GetBasePath', 'Wait', 'DeleteJob', 'ToggleScheduleEnabled', 'Find'];
|
||||||
|
|
||||||
function JobsEdit($scope, $rootScope, $compile, $location, $log, $routeParams, JobForm, JobTemplateForm, GenerateForm, Rest,
|
function JobsEdit($scope, $rootScope, $compile, $location, $log, $routeParams, JobForm, JobTemplateForm, GenerateForm, Rest,
|
||||||
Alert, ProcessErrors, LoadBreadCrumbs, RelatedSearchInit, RelatedPaginateInit, ReturnToCaller, ClearScope, InventoryList,
|
Alert, ProcessErrors, LoadBreadCrumbs, RelatedSearchInit, RelatedPaginateInit, ReturnToCaller, ClearScope, InventoryList,
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('JobsHelper', ['Utilities', 'FormGenerator', 'JobSummaryDefinition', 'InventoryHelper', 'GeneratorHelpers'])
|
angular.module('JobsHelper', ['Utilities', 'FormGenerator', 'JobSummaryDefinition', 'InventoryHelper', 'GeneratorHelpers', 'SchedulesHelper'])
|
||||||
|
|
||||||
.factory('JobStatusToolTip', [
|
.factory('JobStatusToolTip', [
|
||||||
function () {
|
function () {
|
||||||
@ -326,5 +326,17 @@ function(Find, GetBasePath, Rest, Wait, ProcessErrors, Prompt){
|
|||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
}])
|
||||||
|
|
||||||
|
.factory('ToggleScheduleEnabled', ['ToggleSchedule', function(ToggleSchedule) {
|
||||||
|
return function(params) {
|
||||||
|
var scope = params.scope,
|
||||||
|
id = params.id;
|
||||||
|
ToggleSchedule({
|
||||||
|
scope: scope,
|
||||||
|
id: id,
|
||||||
|
callback: 'ScheduleToggled'
|
||||||
|
});
|
||||||
|
};
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
@ -107,38 +107,6 @@ angular.module('SchedulesHelper', ['Utilities', 'SchedulesHelper'])
|
|||||||
};
|
};
|
||||||
}])
|
}])
|
||||||
|
|
||||||
/*.factory('ShowDetails', [ function() {
|
|
||||||
return function(params) {
|
|
||||||
|
|
||||||
var scope = params.scope,
|
|
||||||
scheduler = params.scheduler,
|
|
||||||
e = params.e,
|
|
||||||
rrule;
|
|
||||||
|
|
||||||
if ($(e.target).text() === 'Details') {
|
|
||||||
if (scheduler.isValid()) {
|
|
||||||
scope.schedulerIsValid = true;
|
|
||||||
rrule = scheduler.getRRule();
|
|
||||||
scope.occurrence_list = [];
|
|
||||||
scope.dateChoice = 'utc';
|
|
||||||
rrule.all(function(date, i){
|
|
||||||
if (i < 10) {
|
|
||||||
scope.occurrence_list.push({ utc: date.toUTCString(), local: date.toString() });
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
scope.rrule_nlp_description = rrule.toText().replace(/^RRule error.*$/,'Natural language description not available');
|
|
||||||
scope.rrule = scheduler.getValue().rrule;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
scope.schedulerIsValid = false;
|
|
||||||
$('#scheduler-tabs a:first').tab('show');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}])*/
|
|
||||||
|
|
||||||
.factory('EditSchedule', ['SchedulerInit', 'ShowSchedulerModal', 'Wait', 'Rest',
|
.factory('EditSchedule', ['SchedulerInit', 'ShowSchedulerModal', 'Wait', 'Rest',
|
||||||
function(SchedulerInit, ShowSchedulerModal, Wait, Rest) {
|
function(SchedulerInit, ShowSchedulerModal, Wait, Rest) {
|
||||||
return function(params) {
|
return function(params) {
|
||||||
@ -246,4 +214,67 @@ angular.module('SchedulesHelper', ['Utilities', 'SchedulesHelper'])
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
}])
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flip a schedule's enable flag
|
||||||
|
*
|
||||||
|
* ToggleSchedule({
|
||||||
|
* scope: scope,
|
||||||
|
* id: schedule.id to update
|
||||||
|
* callback: scope.$emit label to call when update completes
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
.factory('ToggleSchedule', ['Wait', 'GetBasePath', 'ProcessErrors', 'Rest', function(Wait, GetBasePath, ProcessErrors, Rest) {
|
||||||
|
return function(params) {
|
||||||
|
var scope = params.scope,
|
||||||
|
id = params.id,
|
||||||
|
callback = params.callback,
|
||||||
|
url = GetBasePath('schedules') + id +'/';
|
||||||
|
|
||||||
|
// Perform the update
|
||||||
|
if (scope.removeScheduleFound) {
|
||||||
|
scope.removeScheduleFound();
|
||||||
|
}
|
||||||
|
scope.removeScheduleFound = scope.$on('removeScheduleFound', function(e, data) {
|
||||||
|
data.enabled = (data.enabled) ? false : true;
|
||||||
|
Rest.put(data)
|
||||||
|
.success( function() {
|
||||||
|
if (callback) {
|
||||||
|
scope.$emit(callback, id);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.error( function() {
|
||||||
|
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
||||||
|
msg: 'Failed to update schedule ' + id + ' PUT returned: ' + status });
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Get the existing record
|
||||||
|
Rest.setUrl(url);
|
||||||
|
Rest.get()
|
||||||
|
.success(function(){
|
||||||
|
|
||||||
|
})
|
||||||
|
.error(function(data,status){
|
||||||
|
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
||||||
|
msg: 'Failed to retrieve schedule ' + id + ' GET returned: ' + status });
|
||||||
|
});
|
||||||
|
};
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,13 +48,6 @@ angular.module('JobTemplatesListDefinition', [])
|
|||||||
},
|
},
|
||||||
|
|
||||||
fieldActions: {
|
fieldActions: {
|
||||||
edit: {
|
|
||||||
label: 'Edit',
|
|
||||||
ngClick: "editJobTemplate(job_template.id)",
|
|
||||||
awToolTip: 'Edit template',
|
|
||||||
"class": 'btn-default btn-xs',
|
|
||||||
dataPlacement: 'top'
|
|
||||||
},
|
|
||||||
submit: {
|
submit: {
|
||||||
label: 'Launch',
|
label: 'Launch',
|
||||||
mode: 'all',
|
mode: 'all',
|
||||||
@ -69,6 +62,13 @@ angular.module('JobTemplatesListDefinition', [])
|
|||||||
awToolTip: 'Schedule future job template runs',
|
awToolTip: 'Schedule future job template runs',
|
||||||
dataPlacement: 'top'
|
dataPlacement: 'top'
|
||||||
},
|
},
|
||||||
|
edit: {
|
||||||
|
label: 'Edit',
|
||||||
|
ngClick: "editJobTemplate(job_template.id)",
|
||||||
|
awToolTip: 'Edit template',
|
||||||
|
"class": 'btn-default btn-xs',
|
||||||
|
dataPlacement: 'top'
|
||||||
|
},
|
||||||
"delete": {
|
"delete": {
|
||||||
label: 'Delete',
|
label: 'Delete',
|
||||||
ngClick: "deleteJobTemplate(job_template.id, job_template.name)",
|
ngClick: "deleteJobTemplate(job_template.id, job_template.name)",
|
||||||
|
@ -92,11 +92,6 @@ angular.module('ProjectsListDefinition', [])
|
|||||||
},
|
},
|
||||||
|
|
||||||
fieldActions: {
|
fieldActions: {
|
||||||
edit: {
|
|
||||||
ngClick: "editProject(project.id)",
|
|
||||||
awToolTip: 'Edit the project',
|
|
||||||
dataPlacement: 'top'
|
|
||||||
},
|
|
||||||
scm_update: {
|
scm_update: {
|
||||||
ngClick: 'SCMUpdate(project.id)',
|
ngClick: 'SCMUpdate(project.id)',
|
||||||
awToolTip: "{{ project.scm_update_tooltip }}",
|
awToolTip: "{{ project.scm_update_tooltip }}",
|
||||||
@ -115,6 +110,11 @@ angular.module('ProjectsListDefinition', [])
|
|||||||
awToolTip: 'Schedule future SCM updates',
|
awToolTip: 'Schedule future SCM updates',
|
||||||
dataPlacement: 'top'
|
dataPlacement: 'top'
|
||||||
},
|
},
|
||||||
|
edit: {
|
||||||
|
ngClick: "editProject(project.id)",
|
||||||
|
awToolTip: 'Edit the project',
|
||||||
|
dataPlacement: 'top'
|
||||||
|
},
|
||||||
"delete": {
|
"delete": {
|
||||||
ngClick: "deleteProject(project.id, project.name)",
|
ngClick: "deleteProject(project.id, project.name)",
|
||||||
awToolTip: 'Delete the project',
|
awToolTip: 'Delete the project',
|
||||||
|
@ -60,7 +60,7 @@ angular.module('ScheduledJobsDefinition', [])
|
|||||||
awToolTip: "{{ scheduled_job.play_tip }}",
|
awToolTip: "{{ scheduled_job.play_tip }}",
|
||||||
dataTipWatch: "scheduled_job.play_tip",
|
dataTipWatch: "scheduled_job.play_tip",
|
||||||
iconClass: "{{ 'fa icon-schedule-enabled-' + scheduled_job.enabled }}",
|
iconClass: "{{ 'fa icon-schedule-enabled-' + scheduled_job.enabled }}",
|
||||||
dataPlacement: 'top',
|
dataPlacement: 'top'
|
||||||
},
|
},
|
||||||
"edit": {
|
"edit": {
|
||||||
mode: "all",
|
mode: "all",
|
||||||
|
@ -292,10 +292,21 @@ angular.module('AWDirectives', ['RestServices', 'Utilities', 'AuthService', 'Job
|
|||||||
content: attrs.awPopOver, trigger: trigger, html: true, container: container });
|
content: attrs.awPopOver, trigger: trigger, html: true, container: container });
|
||||||
$(element).click(function() {
|
$(element).click(function() {
|
||||||
var self = $(this);
|
var self = $(this);
|
||||||
|
try {
|
||||||
|
self.tooltip('hide');
|
||||||
|
}
|
||||||
|
catch(e) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
$('.help-link, .help-link-white').each( function() {
|
$('.help-link, .help-link-white').each( function() {
|
||||||
if (self.attr('id') !== $(this).attr('id')) {
|
if (self.attr('id') !== $(this).attr('id')) {
|
||||||
|
try {
|
||||||
$(this).popover('hide');
|
$(this).popover('hide');
|
||||||
}
|
}
|
||||||
|
catch(e) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
$('.popover').each(function() {
|
$('.popover').each(function() {
|
||||||
// remove lingering popover <div>. Seems to be a bug in TB3 RC1
|
// remove lingering popover <div>. Seems to be a bug in TB3 RC1
|
||||||
|
Loading…
Reference in New Issue
Block a user