mirror of
https://github.com/ansible/awx.git
synced 2026-03-23 20:05:03 -02:30
Merge pull request #6174 from jaredevantabor/source-notifications
Source notifications
This commit is contained in:
@@ -21,7 +21,7 @@ export default
|
|||||||
sourcesAdd.name,
|
sourcesAdd.name,
|
||||||
sourcesEdit.name
|
sourcesEdit.name
|
||||||
])
|
])
|
||||||
.value('SourcesFormDefinition', sourcesFormDefinition)
|
.factory('SourcesFormDefinition', sourcesFormDefinition)
|
||||||
.value('SourcesListDefinition', sourcesListDefinition)
|
.value('SourcesListDefinition', sourcesListDefinition)
|
||||||
.factory('GetSyncStatusMsg', GetSyncStatusMsg)
|
.factory('GetSyncStatusMsg', GetSyncStatusMsg)
|
||||||
.factory('ViewUpdateStatus', ViewUpdateStatus)
|
.factory('ViewUpdateStatus', ViewUpdateStatus)
|
||||||
|
|||||||
@@ -10,7 +10,25 @@
|
|||||||
* @description This form is for adding/editing a Group on the inventory page
|
* @description This form is for adding/editing a Group on the inventory page
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default {
|
export default ['NotificationsList', 'i18n', function(NotificationsList, i18n){
|
||||||
|
|
||||||
|
var notifications_object = {
|
||||||
|
name: 'notifications',
|
||||||
|
index: false,
|
||||||
|
basePath: "notifications",
|
||||||
|
include: "NotificationsList",
|
||||||
|
title: i18n._('Notifications'),
|
||||||
|
iterator: 'notification',
|
||||||
|
disabled: "source === undefined || source.value === ''",
|
||||||
|
generateList: true,
|
||||||
|
ngClick: "$state.go('inventories.edit.inventory_sources.edit.notifications')"
|
||||||
|
// search: {
|
||||||
|
// "or__job__inventory": ''
|
||||||
|
// }
|
||||||
|
};
|
||||||
|
let clone = _.clone(NotificationsList);
|
||||||
|
notifications_object = angular.extend(clone, notifications_object);
|
||||||
|
return {
|
||||||
addTitle: 'CREATE SOURCE',
|
addTitle: 'CREATE SOURCE',
|
||||||
editTitle: '{{ name }}',
|
editTitle: '{{ name }}',
|
||||||
showTitle: true,
|
showTitle: true,
|
||||||
@@ -19,9 +37,10 @@ export default {
|
|||||||
parent: 'inventories.edit.sources',
|
parent: 'inventories.edit.sources',
|
||||||
// the parent node this generated state definition tree expects to attach to
|
// the parent node this generated state definition tree expects to attach to
|
||||||
stateTree: 'inventories',
|
stateTree: 'inventories',
|
||||||
|
tabs: true,
|
||||||
// form generator inspects the current state name to determine whether or not to set an active (.is-selected) class on a form tab
|
// form generator inspects the current state name to determine whether or not to set an active (.is-selected) class on a form tab
|
||||||
// this setting is optional on most forms, except where the form's edit state name is not parentStateName.edit
|
// this setting is optional on most forms, except where the form's edit state name is not parentStateName.edit
|
||||||
activeEditState: 'inventories.edit.groups.editGroup',
|
activeEditState: 'inventories.edit.inventory_sources.edit',
|
||||||
detailsClick: "$state.go('inventories.edit.inventory_sources.edit')",
|
detailsClick: "$state.go('inventories.edit.inventory_sources.edit')",
|
||||||
well: false,
|
well: false,
|
||||||
fields: {
|
fields: {
|
||||||
@@ -333,5 +352,11 @@ export default {
|
|||||||
ngDisabled: true,
|
ngDisabled: true,
|
||||||
ngShow: '(group_obj.summary_fields.user_capabilities.edit || canAdd)'
|
ngShow: '(group_obj.summary_fields.user_capabilities.edit || canAdd)'
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
related: {
|
||||||
|
notifications: notifications_object
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}];
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export default {
|
|||||||
name: {
|
name: {
|
||||||
label: 'Sources',
|
label: 'Sources',
|
||||||
key: true,
|
key: true,
|
||||||
ngClick: "groupSelect(inventory_source.id)",
|
ngClick: "editSource(inventory_source.id)",
|
||||||
columnClass: 'col-lg-6 col-md-6 col-sm-6 col-xs-6',
|
columnClass: 'col-lg-6 col-md-6 col-sm-6 col-xs-6',
|
||||||
class: 'InventoryManage-breakWord',
|
class: 'InventoryManage-breakWord',
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,8 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export default ['Wait', 'GetBasePath', 'ProcessErrors', 'Rest', 'GetChoices',
|
export default ['Wait', 'GetBasePath', 'ProcessErrors', 'Rest', 'GetChoices',
|
||||||
'$state', '$rootScope',
|
'$state', '$rootScope', '$stateParams',
|
||||||
function(Wait, GetBasePath, ProcessErrors, Rest, GetChoices, $state, $rootScope) {
|
function(Wait, GetBasePath, ProcessErrors, Rest, GetChoices, $state, $rootScope, $stateParams) {
|
||||||
return function(params) {
|
return function(params) {
|
||||||
var scope = params.scope,
|
var scope = params.scope,
|
||||||
url = params.url,
|
url = params.url,
|
||||||
@@ -31,8 +31,22 @@ export default ['Wait', 'GetBasePath', 'ProcessErrors', 'Rest', 'GetChoices',
|
|||||||
});
|
});
|
||||||
|
|
||||||
scope.addNotificationTemplate = function() {
|
scope.addNotificationTemplate = function() {
|
||||||
if (id) {
|
var org_id;
|
||||||
$state.go('notifications.add', {organization_id: id});
|
if($stateParams.hasOwnProperty('project_id')){
|
||||||
|
org_id = scope.$parent.project_obj.organization;
|
||||||
|
}
|
||||||
|
else if($stateParams.hasOwnProperty('workflow_job_template_id')){
|
||||||
|
org_id = scope.$parent.workflow_job_template_obj.organization;
|
||||||
|
}
|
||||||
|
else if($stateParams.hasOwnProperty('inventory_source_id')){
|
||||||
|
org_id = scope.$parent.summary_fields.inventory.organization_id;
|
||||||
|
}
|
||||||
|
else if($stateParams.hasOwnProperty('organization_id')){
|
||||||
|
org_id = scope.$parent.organization_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (org_id) {
|
||||||
|
$state.go('notifications.add', {organization_id: org_id});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$state.go('notifications.add');
|
$state.go('notifications.add');
|
||||||
|
|||||||
@@ -407,17 +407,24 @@ function($injector, $stateExtender, $log, i18n) {
|
|||||||
},
|
},
|
||||||
views: {
|
views: {
|
||||||
'related': {
|
'related': {
|
||||||
templateProvider: function(FormDefinition, GenerateForm) {
|
templateProvider: function(FormDefinition, GenerateForm, $stateParams, SourcesFormDefinition) {
|
||||||
let html = GenerateForm.buildCollection({
|
var form, html;
|
||||||
|
if($stateParams && $stateParams.inventory_source_id){
|
||||||
|
form = SourcesFormDefinition;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
form = typeof(FormDefinition) === 'function' ?
|
||||||
|
FormDefinition() : FormDefinition;
|
||||||
|
}
|
||||||
|
html = GenerateForm.buildCollection({
|
||||||
mode: 'edit',
|
mode: 'edit',
|
||||||
related: `${list.iterator}s`,
|
related: `${list.iterator}s`,
|
||||||
form: typeof(FormDefinition) === 'function' ?
|
form: form
|
||||||
FormDefinition() : FormDefinition
|
|
||||||
});
|
});
|
||||||
return html;
|
return html;
|
||||||
},
|
},
|
||||||
controller: ['$scope', 'ListDefinition', 'Dataset', 'ToggleNotification', 'NotificationsListInit', 'GetBasePath', '$stateParams', 'inventorySourceData',
|
controller: ['$scope', 'ListDefinition', 'Dataset', 'ToggleNotification', 'NotificationsListInit', 'GetBasePath', '$stateParams',
|
||||||
function($scope, list, Dataset, ToggleNotification, NotificationsListInit, GetBasePath, $stateParams, inventorySourceData) {
|
function($scope, list, Dataset, ToggleNotification, NotificationsListInit, GetBasePath, $stateParams) {
|
||||||
var url , params = $stateParams, id;
|
var url , params = $stateParams, id;
|
||||||
if(params.hasOwnProperty('project_id')){
|
if(params.hasOwnProperty('project_id')){
|
||||||
id = params.project_id;
|
id = params.project_id;
|
||||||
@@ -431,8 +438,8 @@ function($injector, $stateExtender, $log, i18n) {
|
|||||||
id = params.workflow_job_template_id;
|
id = params.workflow_job_template_id;
|
||||||
url = GetBasePath('workflow_job_templates');
|
url = GetBasePath('workflow_job_templates');
|
||||||
}
|
}
|
||||||
if(params.hasOwnProperty('inventory_id')){
|
if(params.hasOwnProperty('inventory_source_id')){
|
||||||
id = inventorySourceData.id;
|
id = params.inventory_source_id;
|
||||||
url = GetBasePath('inventory_sources');
|
url = GetBasePath('inventory_sources');
|
||||||
}
|
}
|
||||||
if(params.hasOwnProperty('organization_id')){
|
if(params.hasOwnProperty('organization_id')){
|
||||||
@@ -484,15 +491,6 @@ function($injector, $stateExtender, $log, i18n) {
|
|||||||
ListDefinition: () => {
|
ListDefinition: () => {
|
||||||
return list;
|
return list;
|
||||||
},
|
},
|
||||||
inventorySourceData: ['$stateParams', //'GroupManageService',
|
|
||||||
function($stateParams){ //, GroupManageService) {
|
|
||||||
if($stateParams.hasOwnProperty('group_id')){
|
|
||||||
return; //GroupManageService.getInventorySource({ group: $stateParams.group_id }).then(res => res.data.results[0]);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}],
|
|
||||||
Dataset: ['ListDefinition', 'QuerySet', '$stateParams', 'GetBasePath', '$interpolate', '$rootScope',
|
Dataset: ['ListDefinition', 'QuerySet', '$stateParams', 'GetBasePath', '$interpolate', '$rootScope',
|
||||||
(list, qs, $stateParams, GetBasePath, $interpolate, $rootScope) => {
|
(list, qs, $stateParams, GetBasePath, $interpolate, $rootScope) => {
|
||||||
// allow related list definitions to use interpolated $rootScope / $stateParams in basePath field
|
// allow related list definitions to use interpolated $rootScope / $stateParams in basePath field
|
||||||
|
|||||||
Reference in New Issue
Block a user