mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 16:51:11 +03:00
Merge pull request #4090 from mabashian/workflows-permissions-notifications
Notifications/Permissions with WFJT's
This commit is contained in:
commit
a1a581f961
@ -28,6 +28,7 @@ export default
|
||||
activeEditState: 'templates.editJobTemplate',
|
||||
// (optional) array of supporting templates to ng-include inside generated html
|
||||
include: ['/static/partials/survey-maker-modal.html'],
|
||||
detailsClick: "$state.go('templates.editJobTemplate')",
|
||||
|
||||
fields: {
|
||||
name: {
|
||||
@ -420,6 +421,7 @@ export default
|
||||
iterator: 'permission',
|
||||
index: false,
|
||||
open: false,
|
||||
ngClick: "$state.go('templates.editJobTemplate.permissions')",
|
||||
actions: {
|
||||
add: {
|
||||
ngClick: "$state.go('.add')",
|
||||
@ -482,11 +484,13 @@ export default
|
||||
|
||||
for (itm in JobTemplateFormObject.related) {
|
||||
if (JobTemplateFormObject.related[itm].include === "NotificationsList") {
|
||||
JobTemplateFormObject.related[itm] = NotificationsList;
|
||||
JobTemplateFormObject.related[itm] = _.clone(NotificationsList);
|
||||
JobTemplateFormObject.related[itm].ngClick = "$state.go('templates.editJobTemplate.notifications')";
|
||||
JobTemplateFormObject.related[itm].generateList = true; // tell form generator to call list generator and inject a list
|
||||
}
|
||||
if (JobTemplateFormObject.related[itm].include === "CompletedJobsList") {
|
||||
JobTemplateFormObject.related[itm] = CompletedJobsList;
|
||||
JobTemplateFormObject.related[itm].ngClick = "$state.go('templates.editJobTemplate.completed_jobs')";
|
||||
JobTemplateFormObject.related[itm].generateList = true;
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ export default
|
||||
stateTree: 'templates',
|
||||
activeEditState: 'templates.editWorkflowJobTemplate',
|
||||
tabs: true,
|
||||
detailsClick: "$state.go('templates.editWorkflowJobTemplate')",
|
||||
|
||||
fields: {
|
||||
name: {
|
||||
@ -114,6 +115,7 @@ export default
|
||||
iterator: 'permission',
|
||||
index: false,
|
||||
open: false,
|
||||
ngClick: "$state.go('templates.editWorkflowJobTemplate.permissions')",
|
||||
actions: {
|
||||
add: {
|
||||
ngClick: "$state.go('.add')",
|
||||
@ -198,7 +200,8 @@ export default
|
||||
|
||||
for (itm in WorkflowFormObject.related) {
|
||||
if (WorkflowFormObject.related[itm].include === "NotificationsList") {
|
||||
WorkflowFormObject.related[itm] = NotificationsList;
|
||||
WorkflowFormObject.related[itm] = _.clone(NotificationsList);
|
||||
WorkflowFormObject.related[itm].ngClick = "$state.go('templates.editWorkflowJobTemplate.notifications')";
|
||||
WorkflowFormObject.related[itm].generateList = true; // tell form generator to call list generator and inject a list
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ export default ['Wait', 'GetBasePath', 'ProcessErrors', 'Rest',
|
||||
notifier_id = params.notifier.id,
|
||||
callback = params.callback,
|
||||
column = params.column, // notification_template_success/notification_template__error
|
||||
url = params.url + "/"+ column + '/';
|
||||
url = params.url + "/" + column + '/';
|
||||
|
||||
if(!notifier[column]){
|
||||
params = {
|
||||
|
@ -1149,7 +1149,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
||||
|
||||
html += "<input ";
|
||||
html += (field.spinner) ? "" : "type=\"text\" ";
|
||||
html += "\" value=\"" + field['default'] + "\" ";
|
||||
html += " value=\"" + field['default'] + "\" ";
|
||||
html += "class=\"";
|
||||
if (!field.slider && !field.spinner) {
|
||||
html += "form-control";
|
||||
@ -1494,22 +1494,22 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
||||
html += "<div class=\"Form-tabHolder\">";
|
||||
|
||||
if(this.mode === "edit"){
|
||||
html += `<div id="${this.form.name}_tab" class="Form-tab" ` +
|
||||
`ng-click="$state.go('${this.form.stateTree}.edit')" ` +
|
||||
`ng-class="{'is-selected': $state.is('${this.form.activeEditState}') || $state.is('${this.form.stateTree}.edit') || $state.$current.data.formChildState }">` +
|
||||
html += `<div id="${this.form.name}_tab" class="Form-tab" `;
|
||||
html += this.form.detailsClick ? `ng-click="` + this.form.detailsClick + `" ` : `ng-click="$state.go('${this.form.stateTree}.edit')" `;
|
||||
html += `ng-class="{'is-selected': $state.is('${this.form.activeEditState}') || $state.is('${this.form.stateTree}.edit') || $state.$current.data.formChildState }">` +
|
||||
`${details}</div>`;
|
||||
|
||||
for (itm in this.form.related) {
|
||||
collection = this.form.related[itm];
|
||||
html += `<div id="${itm}_tab" `+
|
||||
`class="Form-tab" `+
|
||||
`ng-click="$state.go('${this.form.stateTree}.edit.${itm}')" `;
|
||||
`class="Form-tab" `;
|
||||
html += (this.form.related[itm].ngClick) ? `ng-click="` + this.form.related[itm].ngClick + `" ` : `ng-click="$state.go('${this.form.stateTree}.edit.${itm}')" `;
|
||||
if (collection.awToolTip){
|
||||
html += `aw-tool-tip="${collection.awToolTip}" ` +
|
||||
`aw-tip-placement="${collection.dataPlacement}" ` +
|
||||
`data-tip-watch="${collection.dataTipWatch}" `;
|
||||
}
|
||||
html += `ng-class="{'is-selected' : $state.is('${this.form.activeEditState}.${itm}') || $state.is('${this.form.stateTree}.edit.${itm}')}" ` ;
|
||||
html += `ng-class="{'is-selected' : $state.is('${this.form.activeEditState}.${itm}') || $state.is('${this.form.stateTree}.edit.${itm}') ` ;
|
||||
if(this.form.related[itm].disabled){
|
||||
html += `, 'Form-tab--disabled' : ${this.form.related[itm].disabled }`;
|
||||
}
|
||||
@ -1594,7 +1594,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
||||
html += "</div>";//tabHolder
|
||||
}
|
||||
|
||||
if(!_.isEmpty(this.form.related) && this.mode === "edit"){// TODO: either include $state.is('templates.editWorkflowJobTemplate') or figure out something else to do here
|
||||
if(!_.isEmpty(this.form.related) && this.mode === "edit"){
|
||||
html += `<div class="Form-tabSection" ng-class="{'is-selected' : $state.is('${this.form.activeEditState}') || $state.is('${this.form.stateTree}.edit') || $state.$current.data.formChildState }">`;
|
||||
}
|
||||
|
||||
@ -1648,7 +1648,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
||||
}
|
||||
else if (!field.subForm && currentSubForm !== undefined) {
|
||||
currentSubForm = undefined;
|
||||
html += '</div></div> ';
|
||||
html += '</div> ';
|
||||
}
|
||||
|
||||
html += this.buildField(fld, field, options, this.form);
|
||||
@ -1773,12 +1773,17 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(!_.isEmpty(this.form.related) && this.mode === "edit"){
|
||||
html += `</div>`;
|
||||
}
|
||||
|
||||
if (this.form.include){
|
||||
_.forEach(this.form.include, (template) =>{
|
||||
html += `<div ng-include="'${template}'"></div>`;
|
||||
});
|
||||
}
|
||||
// console.log(html)
|
||||
// console.log(html);
|
||||
return this.wrapPanel(html, options.noPanel);
|
||||
},
|
||||
|
||||
|
@ -166,8 +166,7 @@ export default
|
||||
}
|
||||
ToggleNotification({
|
||||
scope: $scope,
|
||||
url: defaultUrl,
|
||||
id: id,
|
||||
url: defaultUrl + id,
|
||||
notifier: notifier,
|
||||
column: column,
|
||||
callback: 'NotificationRefresh'
|
||||
|
@ -38,7 +38,7 @@ export default
|
||||
isDisabled: '=ngDisabled',
|
||||
preview: '='
|
||||
},
|
||||
templateUrl: templateUrl('job-templates/survey-maker/render/multiple-choice'),
|
||||
templateUrl: templateUrl('templates/survey-maker/render/multiple-choice'),
|
||||
link: _.partial(link, $timeout, CreateSelect2)
|
||||
};
|
||||
return directive;
|
||||
|
@ -119,7 +119,7 @@ export default
|
||||
isDisabled: '@ngDisabled',
|
||||
preview: '='
|
||||
},
|
||||
templateUrl: templateUrl('job-templates/survey-maker/render/survey-question'),
|
||||
templateUrl: templateUrl('templates/survey-maker/render/survey-question'),
|
||||
link: _.partial(link, $sce, $filter, Empty)
|
||||
};
|
||||
|
||||
|
@ -8,12 +8,12 @@
|
||||
[ '$scope', '$stateParams', 'WorkflowForm', 'GenerateForm', 'Alert', 'ProcessErrors',
|
||||
'ClearScope', 'GetBasePath', '$q', 'ParseTypeChange', 'Wait', 'Empty',
|
||||
'ToJSON', 'initSurvey', '$state', 'CreateSelect2', 'ParseVariableString',
|
||||
'TemplatesService', 'OrganizationList', 'Rest', 'WorkflowService',
|
||||
'TemplatesService', 'OrganizationList', 'Rest', 'WorkflowService', 'ToggleNotification',
|
||||
function(
|
||||
$scope, $stateParams, WorkflowForm, GenerateForm, Alert, ProcessErrors,
|
||||
ClearScope, GetBasePath, $q, ParseTypeChange, Wait, Empty,
|
||||
ToJSON, SurveyControllerInit, $state, CreateSelect2, ParseVariableString,
|
||||
TemplatesService, OrganizationList, Rest, WorkflowService
|
||||
TemplatesService, OrganizationList, Rest, WorkflowService, ToggleNotification
|
||||
) {
|
||||
|
||||
ClearScope();
|
||||
@ -616,6 +616,23 @@
|
||||
$state.transitionTo('templates');
|
||||
};
|
||||
|
||||
$scope.toggleNotification = function(event, notifier_id, column) {
|
||||
var notifier = this.notification;
|
||||
try {
|
||||
$(event.target).tooltip('hide');
|
||||
}
|
||||
catch(e) {
|
||||
// ignore
|
||||
}
|
||||
ToggleNotification({
|
||||
scope: $scope,
|
||||
url: GetBasePath('workflow_job_templates') + id,
|
||||
notifier: notifier,
|
||||
column: column,
|
||||
callback: 'NotificationRefresh'
|
||||
});
|
||||
};
|
||||
|
||||
init();
|
||||
}
|
||||
];
|
||||
|
Loading…
Reference in New Issue
Block a user