mirror of
https://github.com/ansible/awx.git
synced 2026-03-03 01:38:50 -03:30
Fix issue with schedulers
editing/adding schedules in the related accordians for Projects and Job Templates were not working, where the action buttons for schedules not even showing up in the Schedule accordian. I've updated hte form objects as well as the form-generator to accept the list of action buttons and their icons. Also fixed a related issue where the scheduler titles were not showing up on the scheduler dialog
This commit is contained in:
@@ -669,7 +669,6 @@ export function JobTemplatesEdit($filter, $scope, $rootScope, $compile, $locatio
|
|||||||
var defaultUrl = GetBasePath('job_templates'),
|
var defaultUrl = GetBasePath('job_templates'),
|
||||||
generator = GenerateForm,
|
generator = GenerateForm,
|
||||||
form = JobTemplateForm(),
|
form = JobTemplateForm(),
|
||||||
loadingFinishedCount = 0,
|
|
||||||
base = $location.path().replace(/^\//, '').split('/')[0],
|
base = $location.path().replace(/^\//, '').split('/')[0],
|
||||||
master = {},
|
master = {},
|
||||||
id = $routeParams.template_id,
|
id = $routeParams.template_id,
|
||||||
@@ -832,19 +831,15 @@ export function JobTemplatesEdit($filter, $scope, $rootScope, $compile, $locatio
|
|||||||
$scope.removeJobTemplateLoadFinished();
|
$scope.removeJobTemplateLoadFinished();
|
||||||
}
|
}
|
||||||
$scope.removeJobTemplateLoadFinished = $scope.$on('jobTemplateLoadFinished', function () {
|
$scope.removeJobTemplateLoadFinished = $scope.$on('jobTemplateLoadFinished', function () {
|
||||||
loadingFinishedCount++;
|
for (var set in relatedSets) {
|
||||||
if (loadingFinishedCount >= 2) {
|
$scope.search(relatedSets[set].iterator);
|
||||||
// The initial template load finished. Now load related jobs, which
|
|
||||||
// will turn off the 'working' spinner.
|
|
||||||
for (var set in relatedSets) {
|
|
||||||
$scope.search(relatedSets[set].iterator);
|
|
||||||
}
|
|
||||||
SchedulesControllerInit({
|
|
||||||
scope: $scope,
|
|
||||||
parent_scope: $scope,
|
|
||||||
iterator: 'schedule'
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
SchedulesControllerInit({
|
||||||
|
scope: $scope,
|
||||||
|
parent_scope: $scope,
|
||||||
|
iterator: 'schedule'
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set the status/badge for each related job
|
// Set the status/badge for each related job
|
||||||
|
|||||||
@@ -266,7 +266,6 @@ export default
|
|||||||
control: '<button type="button" class="btn btn-sm btn-primary" id="job_templates_create_survey_btn" ng-show="survey_enabled" ng-click="addSurvey()"><i class="fa fa-pencil"></i> Create Survey</button>'+
|
control: '<button type="button" class="btn btn-sm btn-primary" id="job_templates_create_survey_btn" ng-show="survey_enabled" ng-click="addSurvey()"><i class="fa fa-pencil"></i> Create Survey</button>'+
|
||||||
'<button style="display:none;" type="button" class="btn btn-sm btn-primary" id="job_templates_edit_survey_btn" ng-show="survey_enabled" ng-click="editSurvey()"><i class="fa fa-pencil"></i> Edit Survey</button>'+
|
'<button style="display:none;" type="button" class="btn btn-sm btn-primary" id="job_templates_edit_survey_btn" ng-show="survey_enabled" ng-click="editSurvey()"><i class="fa fa-pencil"></i> Edit Survey</button>'+
|
||||||
'<button style="display:none;margin-left:5px" type="button" class="btn btn-sm btn-primary" id="job_templates_delete_survey_btn" ng-show="survey_enabled" ng-click="deleteSurvey()"><i class="fa fa-trash-o"></i> Delete Survey</button>'+
|
'<button style="display:none;margin-left:5px" type="button" class="btn btn-sm btn-primary" id="job_templates_delete_survey_btn" ng-show="survey_enabled" ng-click="deleteSurvey()"><i class="fa fa-trash-o"></i> Delete Survey</button>'+
|
||||||
// '<div class="error ng-hide" id="job-template-survey-error" ng-show="survey_enabled === true && survey_exists!==true">A survey is enabled but it does not exist. Create a survey or disable the survey. </div>'
|
|
||||||
'<div class="error ng-hide" id="job-template-survey-error" ng-show="invalid_survey">A survey is enabled but it does not exist. Create a survey or uncheck the Enable Survey box to disable the survey. </div>'
|
'<div class="error ng-hide" id="job-template-survey-error" ng-show="invalid_survey">A survey is enabled but it does not exist. Create a survey or uncheck the Enable Survey box to disable the survey. </div>'
|
||||||
},
|
},
|
||||||
become_enabled: {
|
become_enabled: {
|
||||||
@@ -336,9 +335,81 @@ export default
|
|||||||
},
|
},
|
||||||
|
|
||||||
related: {
|
related: {
|
||||||
|
|
||||||
schedules: {
|
schedules: {
|
||||||
include: "SchedulesList"
|
type: 'collection',
|
||||||
|
title: 'Schedules',
|
||||||
|
iterator: 'schedule',
|
||||||
|
index: false,
|
||||||
|
open: false,
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
add: {
|
||||||
|
mode: 'all',
|
||||||
|
ngClick: 'addSchedule()',
|
||||||
|
awToolTip: 'Add a new schedule'
|
||||||
|
},
|
||||||
|
refresh: {
|
||||||
|
mode: 'all',
|
||||||
|
awToolTip: "Refresh the page",
|
||||||
|
ngClick: "refreshSchedules()"
|
||||||
|
},
|
||||||
|
stream: {
|
||||||
|
ngClick: "showActivity()",
|
||||||
|
awToolTip: "View Activity Stream",
|
||||||
|
mode: 'edit',
|
||||||
|
awFeature: 'activity_streams'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fields: {
|
||||||
|
name: {
|
||||||
|
key: true,
|
||||||
|
label: 'Name',
|
||||||
|
ngClick: "editSchedule(schedule.id)",
|
||||||
|
columnClass: "col-md-3 col-sm-3 col-xs-3"
|
||||||
|
},
|
||||||
|
dtstart: {
|
||||||
|
label: 'First Run',
|
||||||
|
filter: "longDate",
|
||||||
|
searchable: false,
|
||||||
|
columnClass: "col-md-2 col-sm-3 hidden-xs"
|
||||||
|
},
|
||||||
|
next_run: {
|
||||||
|
label: 'Next Run',
|
||||||
|
filter: "longDate",
|
||||||
|
searchable: false,
|
||||||
|
columnClass: "col-md-2 col-sm-3 col-xs-3"
|
||||||
|
},
|
||||||
|
dtend: {
|
||||||
|
label: 'Final Run',
|
||||||
|
filter: "longDate",
|
||||||
|
searchable: false,
|
||||||
|
columnClass: "col-md-2 col-sm-3 hidden-xs"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fieldActions: {
|
||||||
|
"play": {
|
||||||
|
mode: "all",
|
||||||
|
ngClick: "toggleSchedule($event, 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)",
|
||||||
|
icon: 'icon-edit',
|
||||||
|
awToolTip: 'Edit schedule',
|
||||||
|
dataPlacement: 'top'
|
||||||
|
},
|
||||||
|
"delete": {
|
||||||
|
label: 'Delete',
|
||||||
|
ngClick: "deleteSchedule(schedule.id)",
|
||||||
|
icon: 'icon-trash',
|
||||||
|
awToolTip: 'Delete schedule',
|
||||||
|
dataPlacement: 'top'
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"completed_jobs": {
|
"completed_jobs": {
|
||||||
include: "CompletedJobsList"
|
include: "CompletedJobsList"
|
||||||
|
|||||||
@@ -25,15 +25,6 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition'])
|
|||||||
collapseOpen: true,
|
collapseOpen: true,
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
// scm_update: {
|
|
||||||
// mode: 'edit',
|
|
||||||
// ngClick: 'SCMUpdate()',
|
|
||||||
// awToolTip: "{{ scm_update_tooltip }}",
|
|
||||||
// dataTipWatch: "scm_update_tooltip",
|
|
||||||
// ngClass: "scm_type_class",
|
|
||||||
// dataPlacement: 'top',
|
|
||||||
// ngDisabled: "scm_type.value === 'manual' "
|
|
||||||
// },
|
|
||||||
stream: {
|
stream: {
|
||||||
'class': "btn-primary btn-xs activity-btn",
|
'class': "btn-primary btn-xs activity-btn",
|
||||||
ngClick: "showActivity()",
|
ngClick: "showActivity()",
|
||||||
@@ -296,8 +287,80 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition'])
|
|||||||
},
|
},
|
||||||
|
|
||||||
schedules: {
|
schedules: {
|
||||||
include: "SchedulesList",
|
type: 'collection',
|
||||||
index: false
|
title: 'Schedules',
|
||||||
|
iterator: 'schedule',
|
||||||
|
index: false,
|
||||||
|
open: false,
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
add: {
|
||||||
|
mode: 'all',
|
||||||
|
ngClick: 'addSchedule()',
|
||||||
|
awToolTip: 'Add a new schedule'
|
||||||
|
},
|
||||||
|
refresh: {
|
||||||
|
mode: 'all',
|
||||||
|
awToolTip: "Refresh the page",
|
||||||
|
ngClick: "refreshSchedules()"
|
||||||
|
},
|
||||||
|
stream: {
|
||||||
|
ngClick: "showActivity()",
|
||||||
|
awToolTip: "View Activity Stream",
|
||||||
|
mode: 'edit',
|
||||||
|
awFeature: 'activity_streams'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fields: {
|
||||||
|
name: {
|
||||||
|
key: true,
|
||||||
|
label: 'Name',
|
||||||
|
ngClick: "editSchedule(schedule.id)",
|
||||||
|
columnClass: "col-md-3 col-sm-3 col-xs-3"
|
||||||
|
},
|
||||||
|
dtstart: {
|
||||||
|
label: 'First Run',
|
||||||
|
filter: "longDate",
|
||||||
|
searchable: false,
|
||||||
|
columnClass: "col-md-2 col-sm-3 hidden-xs"
|
||||||
|
},
|
||||||
|
next_run: {
|
||||||
|
label: 'Next Run',
|
||||||
|
filter: "longDate",
|
||||||
|
searchable: false,
|
||||||
|
columnClass: "col-md-2 col-sm-3 col-xs-3"
|
||||||
|
},
|
||||||
|
dtend: {
|
||||||
|
label: 'Final Run',
|
||||||
|
filter: "longDate",
|
||||||
|
searchable: false,
|
||||||
|
columnClass: "col-md-2 col-sm-3 hidden-xs"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fieldActions: {
|
||||||
|
"play": {
|
||||||
|
mode: "all",
|
||||||
|
ngClick: "toggleSchedule($event, 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)",
|
||||||
|
icon: 'icon-edit',
|
||||||
|
awToolTip: 'Edit schedule',
|
||||||
|
dataPlacement: 'top'
|
||||||
|
},
|
||||||
|
"delete": {
|
||||||
|
label: 'Delete',
|
||||||
|
ngClick: "deleteSchedule(schedule.id)",
|
||||||
|
icon: 'icon-trash',
|
||||||
|
awToolTip: 'Delete schedule',
|
||||||
|
dataPlacement: 'top'
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ export default
|
|||||||
|
|
||||||
var buttons,
|
var buttons,
|
||||||
scope = params.scope,
|
scope = params.scope,
|
||||||
callback = params.callback;
|
callback = params.callback,
|
||||||
|
title = params.title;
|
||||||
|
|
||||||
buttons = [{
|
buttons = [{
|
||||||
"label": "Cancel",
|
"label": "Cancel",
|
||||||
@@ -54,6 +55,7 @@ export default
|
|||||||
id: 'scheduler-modal-dialog',
|
id: 'scheduler-modal-dialog',
|
||||||
scope: scope,
|
scope: scope,
|
||||||
buttons: buttons,
|
buttons: buttons,
|
||||||
|
title: title,
|
||||||
width: 700,
|
width: 700,
|
||||||
height: 725,
|
height: 725,
|
||||||
minWidth: 400,
|
minWidth: 400,
|
||||||
@@ -111,7 +113,7 @@ export default
|
|||||||
schedule.rrule = schedule.rrule.replace(/ RRULE:/,';');
|
schedule.rrule = schedule.rrule.replace(/ RRULE:/,';');
|
||||||
schedule.rrule = schedule.rrule.replace(/DTSTART:/,'DTSTART=');
|
schedule.rrule = schedule.rrule.replace(/DTSTART:/,'DTSTART=');
|
||||||
|
|
||||||
ShowSchedulerModal({ scope: scope, callback: 'DialogReady' });
|
ShowSchedulerModal({ scope: scope, callback: 'DialogReady', title: 'Edit Schedule' });
|
||||||
scope.showRRuleDetail = false;
|
scope.showRRuleDetail = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -194,7 +196,7 @@ export default
|
|||||||
scheduler.inject('form-container', false);
|
scheduler.inject('form-container', false);
|
||||||
scheduler.injectDetail('occurrences', false);
|
scheduler.injectDetail('occurrences', false);
|
||||||
scheduler.clear();
|
scheduler.clear();
|
||||||
ShowSchedulerModal({ scope: scope, callback: 'DialogReady' });
|
ShowSchedulerModal({ scope: scope, callback: 'DialogReady', title: 'Add Schedule' });
|
||||||
scope.showRRuleDetail = false;
|
scope.showRRuleDetail = false;
|
||||||
|
|
||||||
if (scope.removeScheduleSaved) {
|
if (scope.removeScheduleSaved) {
|
||||||
|
|||||||
@@ -42,12 +42,6 @@ export default
|
|||||||
searchable: false,
|
searchable: false,
|
||||||
columnClass: "col-md-2 col-sm-3 hidden-xs"
|
columnClass: "col-md-2 col-sm-3 hidden-xs"
|
||||||
}
|
}
|
||||||
/*,
|
|
||||||
id: {
|
|
||||||
label: 'ID',
|
|
||||||
searchType: 'int',
|
|
||||||
searchOnly: true
|
|
||||||
}*/
|
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|||||||
@@ -1818,7 +1818,14 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
|||||||
html += (fAction.ngHref) ? this.attr(fAction, 'ngHref') : "";
|
html += (fAction.ngHref) ? this.attr(fAction, 'ngHref') : "";
|
||||||
html += (fAction.ngShow) ? this.attr(fAction, 'ngShow') : "";
|
html += (fAction.ngShow) ? this.attr(fAction, 'ngShow') : "";
|
||||||
html += ">";
|
html += ">";
|
||||||
html += SelectIcon({ action: act });
|
if (fAction.iconClass) {
|
||||||
|
html += "<i class=\"" + fAction.iconClass + "\"></i>";
|
||||||
|
} else {
|
||||||
|
html += SelectIcon({
|
||||||
|
action: act
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// html += SelectIcon({ action: act });
|
||||||
//html += (fAction.label) ? "<span class=\"list-action-label\"> " + fAction.label + "</span>": "";
|
//html += (fAction.label) ? "<span class=\"list-action-label\"> " + fAction.label + "</span>": "";
|
||||||
html += "</a>";
|
html += "</a>";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user