mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 19:10:07 -03:30
Autofill organization in a new notification template
Issue #2943 When navigating from an organization to a new notification template, the organization field should automatically populate the organization name.
This commit is contained in:
parent
987448c917
commit
a7dbb78c2e
@ -42,6 +42,23 @@ export default ['Rest', 'Wait', 'NotificationsFormObject',
|
||||
});
|
||||
}
|
||||
|
||||
if ($state.params.organization_id) {
|
||||
let id = $state.params.organization_id,
|
||||
url = GetBasePath('organizations') + id + '/';
|
||||
|
||||
Rest.setUrl(url);
|
||||
Rest.get()
|
||||
.success(function(data) {
|
||||
$scope.organization_name = data.name;
|
||||
})
|
||||
.error(function(data, status) {
|
||||
ProcessErrors($scope, data, status, form, {
|
||||
hdr: 'Error!',
|
||||
msg: `Failed to retrieve organization. GET status: ${status}`
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
if ($scope.removeChoicesReady) {
|
||||
$scope.removeChoicesReady();
|
||||
}
|
||||
|
||||
@ -52,6 +52,9 @@ angular.module('notifications', [
|
||||
add: 'notificationsAddController',
|
||||
edit: 'notificationsEditController'
|
||||
},
|
||||
urls: {
|
||||
add: '/add?organization_id'
|
||||
},
|
||||
resolve: {
|
||||
edit: {
|
||||
notification_template: ['$state', '$stateParams', '$q',
|
||||
|
||||
@ -30,8 +30,13 @@ export default ['Wait', 'GetBasePath', 'ProcessErrors', 'Rest', 'GetChoices',
|
||||
scope.current_user_admin_orgs = data.results.map(i => i.name);
|
||||
});
|
||||
|
||||
scope.addNotificationTemplate = function(){
|
||||
$state.go('notifications.add');
|
||||
scope.addNotificationTemplate = function() {
|
||||
if (id) {
|
||||
$state.go('notifications.add', {organization_id: id});
|
||||
}
|
||||
else {
|
||||
$state.go('notifications.add');
|
||||
}
|
||||
};
|
||||
|
||||
if (scope.relatednotificationsRemove) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user