mirror of
https://github.com/ansible/awx.git
synced 2026-01-17 04:31:21 -03:30
Adds approval toggles to wf and org notif lists
This commit is contained in:
parent
e2b8adcd09
commit
7eb7aad491
@ -35,6 +35,19 @@ export default ['i18n', 'templateUrl', function(i18n, templateUrl){
|
||||
excludeModal: true,
|
||||
columnClass: 'd-none d-sm-flex col-md-4 col-sm-3'
|
||||
},
|
||||
notification_templates_approvals: {
|
||||
label: i18n._('Approval'),
|
||||
columnClass: 'd-none d-md-flex justify-content-start col-md-1',
|
||||
flag: 'notification_templates_approvals',
|
||||
type: "toggle",
|
||||
ngClick: "toggleNotification($event, notification.id, 'notification_templates_approvals')",
|
||||
ngDisabled: "!sufficientRoleForNotifToggle",
|
||||
awToolTip: "{{ schedule.play_tip }}",
|
||||
dataTipWatch: "schedule.play_tip",
|
||||
dataPlacement: "right",
|
||||
nosort: true,
|
||||
ngIf: "showApprovalColumn"
|
||||
},
|
||||
notification_templates_started: {
|
||||
label: i18n._("Start"),
|
||||
flag: 'notification_templates_started',
|
||||
|
||||
@ -22,6 +22,10 @@ export default ['Wait', 'GetBasePath', 'ProcessErrors', 'Rest', 'GetChoices',
|
||||
url = params.url,
|
||||
id = params.id;
|
||||
|
||||
if ($state.includes('templates.editWorkflowJobTemplate') || $state.includes('organizations.edit')) {
|
||||
scope.showApprovalColumn = true;
|
||||
}
|
||||
|
||||
scope.addNotificationTemplate = function() {
|
||||
var org_id;
|
||||
if($stateParams.hasOwnProperty('project_id')){
|
||||
@ -51,6 +55,10 @@ export default ['Wait', 'GetBasePath', 'ProcessErrors', 'Rest', 'GetChoices',
|
||||
scope.relatednotificationsRemove = scope.$on('relatednotifications', function () {
|
||||
var columns = ['/notification_templates_started/', '/notification_templates_success/', '/notification_templates_error/'];
|
||||
|
||||
if ($state.includes('templates.editWorkflowJobTemplate') || $state.includes('organizations.edit')) {
|
||||
columns.push('/notification_templates_approvals');
|
||||
}
|
||||
|
||||
GetChoices({
|
||||
scope: scope,
|
||||
url: GetBasePath('notifications'),
|
||||
@ -64,9 +72,17 @@ export default ['Wait', 'GetBasePath', 'ProcessErrors', 'Rest', 'GetChoices',
|
||||
Rest.setUrl(notifier_url);
|
||||
Rest.get()
|
||||
.then(function(response) {
|
||||
let checkForSuccessOrError = response.config.url.indexOf('success') > 0 ? "notification_templates_success" : "notification_templates_error";
|
||||
let type;
|
||||
|
||||
let type = response.config.url.indexOf('started') > 0 ? "notification_templates_started" : checkForSuccessOrError;
|
||||
if (response.config.url.indexOf('started') > 0) {
|
||||
type = "notification_templates_started";
|
||||
} else if (response.config.url.indexOf('success') > 0) {
|
||||
type = "notification_templates_success";
|
||||
} else if (response.config.url.indexOf('error') > 0) {
|
||||
type = "notification_templates_error";
|
||||
} else if (response.config.url.indexOf('approvals') > 0) {
|
||||
type = "notification_templates_approvals";
|
||||
}
|
||||
|
||||
if (response.data.results) {
|
||||
_.forEach(response.data.results, function(result){
|
||||
|
||||
@ -527,8 +527,9 @@ angular.module('GeneratorHelpers', [systemStatus.name])
|
||||
} else if (field.type === 'template') {
|
||||
html = Template(field);
|
||||
} else if (field.type === 'toggle') {
|
||||
const ngIf = field.ngIf ? `ng-if="${field.ngIf}"` : '';
|
||||
html += `
|
||||
<div class="atSwitch-listTableCell ${field}-column ${field['class']} ${field.columnClass}">
|
||||
<div class="atSwitch-listTableCell ${field['class']} ${field.columnClass}" ${ngIf}>
|
||||
<at-switch on-toggle="${field.ngClick}" switch-on="${"flag" in field} ? ${list.iterator}.${field.flag} : ${list.iterator}.enabled" switch-disabled="${"ngDisabled" in field} ? ${field.ngDisabled} : false" tooltip-string="${field.awToolTip}" tooltip-placement="${field.dataPlacement ? field.dataPlacement : 'right'}" tooltip-watch="${field.dataTipWatch}"></at-switch>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@ -546,7 +546,9 @@ export default ['$compile', 'Attr', 'Icon',
|
||||
for (fld in list.fields) {
|
||||
if (options.mode !== 'lookup' || (options.mode === 'lookup' && (fld === 'name' || _.has(list.fields[fld], 'includeModal')))){
|
||||
let customClass = list.fields[fld].columnClass || '';
|
||||
const ngIf = list.fields[fld].ngIf ? `ng-if="${list.fields[fld].ngIf}"` : '';
|
||||
html += `<div
|
||||
${ngIf}
|
||||
base-path="${list.basePath || list.name}"
|
||||
collection="${list.name}"
|
||||
dataset="${list.iterator}_dataset"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user