cleanup orgs

This commit is contained in:
John Mitchell
2017-03-02 15:47:42 -05:00
parent 9bc217ec8d
commit b3e7102e02
15 changed files with 168 additions and 181 deletions

View File

@@ -16,7 +16,6 @@ import JobTemplates from "./forms/JobTemplates";
import JobVarsPrompt from "./forms/JobVarsPrompt"; import JobVarsPrompt from "./forms/JobVarsPrompt";
import LogViewerOptions from "./forms/LogViewerOptions"; import LogViewerOptions from "./forms/LogViewerOptions";
import LogViewerStatus from "./forms/LogViewerStatus"; import LogViewerStatus from "./forms/LogViewerStatus";
import Organizations from "./forms/Organizations";
export export
{ EventsViewer, { EventsViewer,
@@ -31,5 +30,4 @@ export
JobVarsPrompt, JobVarsPrompt,
LogViewerOptions, LogViewerOptions,
LogViewerStatus, LogViewerStatus,
Organizations,
}; };

View File

@@ -15,7 +15,6 @@ import InventorySources from "./lists/InventorySources";
import JobEvents from "./lists/JobEvents"; import JobEvents from "./lists/JobEvents";
import JobHosts from "./lists/JobHosts"; import JobHosts from "./lists/JobHosts";
import Jobs from "./lists/Jobs"; import Jobs from "./lists/Jobs";
import Organizations from "./lists/Organizations";
import PortalJobTemplates from "./lists/PortalJobTemplates"; import PortalJobTemplates from "./lists/PortalJobTemplates";
import PortalJobs from "./lists/PortalJobs"; import PortalJobs from "./lists/PortalJobs";
import ScheduledJobs from "./lists/ScheduledJobs"; import ScheduledJobs from "./lists/ScheduledJobs";
@@ -33,7 +32,6 @@ export
JobEvents, JobEvents,
JobHosts, JobHosts,
Jobs, Jobs,
Organizations,
PortalJobTemplates, PortalJobTemplates,
PortalJobs, PortalJobs,
ScheduledJobs, ScheduledJobs,

View File

@@ -1,65 +0,0 @@
/*************************************************
* Copyright (c) 2015 Ansible, Inc.
*
* All Rights Reserved
*************************************************/
export default
angular.module('OrganizationListDefinition', [])
.value('OrganizationList', {
name: 'organizations',
iterator: 'organization',
selectTitle: 'Add Organizations',
selectInstructions: '<p>Select existing organizations by clicking each organization or checking the related checkbox. When finished, ' +
'click the blue <em>Select</em> button, located bottom right.</p><p>Create a new organization by clicking the ' +
'<i class=\"fa fa-plus\"></i> button.</p>',
editTitle: 'ORGANIZATIONS',
hover: true,
index: false,
fields: {
name: {
key: true,
label: 'Name',
columnClass: 'col-lg-4 col-md-6 col-sm-8 col-xs-8'
},
description: {
label: 'Description',
columnClass: 'hidden-sm hidden-xs',
excludeModal: true
}
},
actions: {
add: {
mode: 'all', // One of: edit, select, all
ngClick: 'addOrganization()',
awToolTip: 'Create a new organization',
awFeature: 'multiple_organizations',
actionClass: 'btn List-buttonSubmit',
buttonContent: '&#43; ADD'
}
},
fieldActions: {
edit: {
label: 'Edit',
ngClick: "editOrganization(organization.id)",
icon: 'icon-edit',
"class": 'btn-xs btn-default',
awToolTip: 'Edit organization',
dataPlacement: 'top'
},
"delete": {
label: 'Delete',
ngClick: "deleteOrganization(organization.id, organization.name)",
icon: 'icon-trash',
"class": 'btn-xs btn-danger',
awToolTip: 'Delete organization',
dataPlacement: 'top'
}
}
});

View File

@@ -8,8 +8,8 @@ export default ['$scope', '$rootScope', '$location', '$stateParams',
'OrganizationForm', 'GenerateForm', 'Rest', 'Alert', 'OrganizationForm', 'GenerateForm', 'Rest', 'Alert',
'ProcessErrors', 'ClearScope', 'GetBasePath', 'Wait','$state', 'ProcessErrors', 'ClearScope', 'GetBasePath', 'Wait','$state',
function($scope, $rootScope, $location, $stateParams, OrganizationForm, function($scope, $rootScope, $location, $stateParams, OrganizationForm,
GenerateForm, Rest, Alert, ProcessErrors, GenerateForm, Rest, Alert, ProcessErrors, ClearScope, GetBasePath, Wait,
ClearScope, GetBasePath, Wait, $state) { $state) {
Rest.setUrl(GetBasePath('organizations')); Rest.setUrl(GetBasePath('organizations'));
Rest.options() Rest.options()

View File

@@ -4,12 +4,11 @@
* All Rights Reserved * All Rights Reserved
*************************************************/ *************************************************/
export default ['$scope', '$rootScope', '$location', '$log', '$stateParams', export default ['$scope', '$location', '$stateParams', 'OrganizationForm',
'OrganizationForm', 'Rest', 'Alert', 'ProcessErrors', 'Prompt', 'ClearScope', 'Rest', 'ProcessErrors', 'Prompt', 'ClearScope', 'GetBasePath', 'Wait',
'GetBasePath', 'Wait', '$state', 'ToggleNotification', '$state', 'ToggleNotification', function($scope, $location, $stateParams,
function($scope, $rootScope, $location, $log, $stateParams, OrganizationForm, Rest, ProcessErrors, Prompt, ClearScope, GetBasePath,
OrganizationForm, Rest, Alert, ProcessErrors, Prompt, ClearScope, Wait, $state, ToggleNotification) {
GetBasePath, Wait, $state, ToggleNotification) {
ClearScope(); ClearScope();

View File

@@ -11,11 +11,13 @@
* Controller for handling permissions adding * Controller for handling permissions adding
*/ */
export default ['$scope', '$rootScope', 'ProcessErrors', 'GetBasePath', 'generateList', export default ['$scope', '$rootScope', 'ProcessErrors', 'GetBasePath',
'templateUrl', '$state', 'Rest', '$q', 'Wait', '$window', 'QuerySet', 'UserList', 'generateList', '$state', 'Rest', '$q', 'Wait', '$window', 'QuerySet',
function($scope, $rootScope, ProcessErrors, GetBasePath, generateList, 'UserList',
templateUrl, $state, Rest, $q, Wait, $window, qs, UserList) { function($scope, $rootScope, ProcessErrors, GetBasePath, generateList,
$scope.$on("linkLists", function() { $state, Rest, $q, Wait, $window, qs, UserList) {
$scope.$on("linkLists", function() {
if ($state.current.name.split(".")[1] === "users") { if ($state.current.name.split(".")[1] === "users") {
$scope.addType = "Users"; $scope.addType = "Users";

View File

@@ -6,56 +6,56 @@
/* jshint unused: vars */ /* jshint unused: vars */
import addUsers from './addUsers.controller'; import addUsers from './addUsers.controller';
export default export default ['Wait', 'templateUrl', '$compile', function(Wait, templateUrl,
['Wait', 'templateUrl', '$state', '$view', '$compile', function(Wait, templateUrl, $state, $view, $compile) { $compile) {
return { return {
restrict: 'E', restrict: 'E',
scope: { scope: {
addUsersType: '@' addUsersType: '@'
}, },
controller: addUsers, controller: addUsers,
templateUrl: templateUrl('organizations/linkout/addUsers/addUsers'), templateUrl: templateUrl('organizations/linkout/addUsers/addUsers'),
link: function(scope, element, attrs, ctrl) { link: function(scope, element, attrs, ctrl) {
$("body").addClass("is-modalOpen"); $("body").addClass("is-modalOpen");
$("body").append(element); $("body").append(element);
Wait('start'); Wait('start');
scope.$broadcast("linkLists"); scope.$broadcast("linkLists");
setTimeout(function() { setTimeout(function() {
$('#add-users-modal').modal("show"); $('#add-users-modal').modal("show");
}, 200); }, 200);
$('.modal[aria-hidden=false]').each(function () { $('.modal[aria-hidden=false]').each(function () {
if ($(this).attr('id') !== 'add-users-modal') { if ($(this).attr('id') !== 'add-users-modal') {
$(this).modal('hide'); $(this).modal('hide');
} }
}); });
scope.closeModal = function() { scope.closeModal = function() {
$("body").removeClass("is-modalOpen"); $("body").removeClass("is-modalOpen");
$('#add-users-modal').on('hidden.bs.modal', $('#add-users-modal').on('hidden.bs.modal',
function () { function () {
$('.AddUsers').remove(); $('.AddUsers').remove();
}); });
$('#add-users-modal').modal('hide'); $('#add-users-modal').modal('hide');
}; };
scope.$on('closeUsersModal', function() { scope.$on('closeUsersModal', function() {
scope.closeModal(); scope.closeModal();
}); });
scope.compileList = function(html) { scope.compileList = function(html) {
$('#add-users-list').append($compile(html)(scope)); $('#add-users-list').append($compile(html)(scope));
}; };
Wait('stop'); Wait('stop');
window.scrollTo(0,0); window.scrollTo(0,0);
} }
}; };
} }
]; ];

View File

@@ -4,13 +4,11 @@
* All Rights Reserved * All Rights Reserved
*************************************************/ *************************************************/
export default ['$stateParams', '$scope', 'UserList', 'Rest', '$state', export default ['$stateParams', '$scope', 'Rest', '$state', '$compile', 'Wait',
'generateList', '$compile', 'Wait', 'OrgAdminList', 'OrgAdminList', 'OrgAdminsDataset', 'Prompt', 'ProcessErrors',
'OrgAdminsDataset', 'GetBasePath', '$filter',
'Prompt', 'ProcessErrors', 'GetBasePath', '$filter', function($stateParams, $scope, Rest, $state, $compile, Wait, OrgAdminList,
function($stateParams, $scope, UserList, Rest, $state, GenerateList, OrgAdminsDataset, Prompt, ProcessErrors, GetBasePath, $filter) {
$compile, Wait, OrgAdminList, OrgAdminsDataset, Prompt, ProcessErrors,
GetBasePath, $filter) {
var orgBase = GetBasePath('organizations'); var orgBase = GetBasePath('organizations');

View File

@@ -4,15 +4,12 @@
* All Rights Reserved * All Rights Reserved
*************************************************/ *************************************************/
export default ['$scope', '$rootScope', '$location', '$log', export default ['$scope', '$rootScope', '$stateParams', 'Rest', 'ProcessErrors',
'$stateParams', 'Rest', 'Alert', 'Prompt', 'ReturnToCaller', 'ClearScope', 'ProcessErrors', 'GetBasePath', 'InitiatePlaybookRun', 'Wait', 'TemplateCopyService',
'GetBasePath', 'JobTemplateForm', 'InitiatePlaybookRun', 'Wait', 'TemplateCopyService', '$state', 'OrgJobTemplateList', 'OrgJobTemplateDataset', 'QuerySet',
'$compile', '$state', 'OrgJobTemplateList', 'OrgJobTemplateDataset', 'QuerySet', function($scope, $rootScope, $stateParams, Rest, ProcessErrors, GetBasePath,
function($scope, $rootScope, $location, $log, InitiatePlaybookRun, Wait, TemplateCopyService, $state, OrgJobTemplateList,
$stateParams, Rest, Alert, Prompt, ReturnToCaller, ClearScope, ProcessErrors, Dataset, qs) {
GetBasePath, JobTemplateForm, InitiatePlaybookRun, Wait, TemplateCopyService,
$compile, $state, OrgJobTemplateList, Dataset, qs) {
var list = OrgJobTemplateList, var list = OrgJobTemplateList,
orgBase = GetBasePath('organizations'); orgBase = GetBasePath('organizations');

View File

@@ -4,15 +4,14 @@
* All Rights Reserved * All Rights Reserved
*************************************************/ *************************************************/
export default ['$scope', '$rootScope', '$location', '$log', export default ['$scope', '$rootScope', '$log', '$stateParams', 'Rest', 'Alert',
'$stateParams', 'Rest', 'Alert', 'Prompt', 'OrgProjectList', 'OrgProjectDataset', 'ProcessErrors', 'GetBasePath',
'ReturnToCaller', 'ClearScope', 'OrgProjectList', 'OrgProjectDataset', 'ProjectUpdate', 'Wait', 'GetChoices', 'Empty', 'Find', 'GetProjectIcon',
'ProcessErrors', 'GetBasePath', 'ProjectUpdate', 'GetProjectToolTip', '$filter', '$state',
'Wait', 'GetChoices', 'Empty', 'Find', 'GetProjectIcon', 'GetProjectToolTip', '$filter', '$state', function($scope, $rootScope, $log, $stateParams, Rest, Alert,
function($scope, $rootScope, $location, $log, $stateParams, Rest, Alert, Prompt, OrgProjectList, Dataset, ProcessErrors, GetBasePath, ProjectUpdate,
ReturnToCaller, ClearScope, OrgProjectList, Dataset, Wait, GetChoices, Empty, Find, GetProjectIcon, GetProjectToolTip, $filter,
ProcessErrors, GetBasePath, ProjectUpdate, $state) {
Wait, GetChoices, Empty, Find, GetProjectIcon, GetProjectToolTip, $filter, $state) {
var list = OrgProjectList, var list = OrgProjectList,
projUrl, projUrl,

View File

@@ -4,15 +4,10 @@
* All Rights Reserved * All Rights Reserved
*************************************************/ *************************************************/
export default ['$scope', '$rootScope', '$location', '$log', '$stateParams', 'OrgTeamList', export default ['$scope', '$stateParams', 'OrgTeamList', 'Rest',
'Rest', 'Alert', 'Prompt', 'OrgTeamsDataset', 'ReturnToCaller', 'ClearScope', 'OrgTeamsDataset', 'GetBasePath', 'Wait', '$state',
'ProcessErrors', 'GetBasePath', function($scope, $stateParams, OrgTeamList, Rest, Dataset, GetBasePath,
'Wait', '$state', Wait, $state) {
function($scope, $rootScope, $location, $log, $stateParams, OrgTeamList,
Rest, Alert, Prompt, Dataset, ReturnToCaller, ClearScope,
ProcessErrors, GetBasePath,
Wait, $state) {
var list = OrgTeamList, var list = OrgTeamList,
orgBase = GetBasePath('organizations'); orgBase = GetBasePath('organizations');

View File

@@ -5,11 +5,10 @@
*************************************************/ *************************************************/
export default ['$stateParams', '$scope', 'OrgUserList','Rest', '$state', export default ['$stateParams', '$scope', 'OrgUserList','Rest', '$state',
'generateList', '$compile', 'Wait', 'OrgUsersDataset', '$compile', 'Wait', 'OrgUsersDataset', 'Prompt', 'ProcessErrors',
'Prompt', 'ProcessErrors', 'GetBasePath', '$filter', 'GetBasePath', '$filter',
function($stateParams, $scope, OrgUserList, Rest, $state, GenerateList, function($stateParams, $scope, OrgUserList, Rest, $state, $compile, Wait,
$compile, Wait, OrgUsersDataset, Prompt, ProcessErrors, OrgUsersDataset, Prompt, ProcessErrors, GetBasePath, $filter) {
GetBasePath, $filter) {
var orgBase = GetBasePath('organizations'); var orgBase = GetBasePath('organizations');

View File

@@ -10,6 +10,8 @@ import OrganizationsAdd from './add/organizations-add.controller';
import OrganizationsEdit from './edit/organizations-edit.controller'; import OrganizationsEdit from './edit/organizations-edit.controller';
import organizationsLinkout from './linkout/main'; import organizationsLinkout from './linkout/main';
import OrganizationsLinkoutStates from './linkout/organizations-linkout.route'; import OrganizationsLinkoutStates from './linkout/organizations-linkout.route';
import OrganizationForm from './organizations.form';
import OrganizationList from './organizations.list';
import { N_ } from '../i18n'; import { N_ } from '../i18n';
@@ -20,6 +22,8 @@ angular.module('Organizations', [
.controller('OrganizationsList', OrganizationsList) .controller('OrganizationsList', OrganizationsList)
.controller('OrganizationsAdd', OrganizationsAdd) .controller('OrganizationsAdd', OrganizationsAdd)
.controller('OrganizationsEdit', OrganizationsEdit) .controller('OrganizationsEdit', OrganizationsEdit)
.factory('OrganizationForm', OrganizationForm)
.factory('OrganizationList', OrganizationList)
.config(['$stateProvider', 'stateDefinitionsProvider', '$stateExtenderProvider', .config(['$stateProvider', 'stateDefinitionsProvider', '$stateExtenderProvider',
function($stateProvider, stateDefinitionsProvider, $stateExtenderProvider) { function($stateProvider, stateDefinitionsProvider, $stateExtenderProvider) {
let stateExtender = $stateExtenderProvider.$get(), let stateExtender = $stateExtenderProvider.$get(),

View File

@@ -10,10 +10,10 @@
* @description This form is for adding/editing an organization * @description This form is for adding/editing an organization
*/ */
export default export default ['NotificationsList', 'i18n',
angular.module('OrganizationFormDefinition', []) function(NotificationsList, i18n) {
.factory('OrganizationFormObject', ['i18n', function(i18n) { return function() {
return { var OrganizationFormObject = {
addTitle: i18n._('NEW ORGANIZATION'), //Title in add mode addTitle: i18n._('NEW ORGANIZATION'), //Title in add mode
editTitle: '{{ name }}', //Title in edit mode editTitle: '{{ name }}', //Title in edit mode
@@ -98,18 +98,15 @@ export default
} }
} }
};}]) };
.factory('OrganizationForm', ['OrganizationFormObject', 'NotificationsList', var itm;
function(OrganizationFormObject, NotificationsList) { for (itm in OrganizationFormObject.related) {
return function() { if (OrganizationFormObject.related[itm].include === "NotificationsList") {
var itm; OrganizationFormObject.related[itm] = NotificationsList;
for (itm in OrganizationFormObject.related) { OrganizationFormObject.related[itm].generateList = true; // tell form generator to call list generator and inject a list
if (OrganizationFormObject.related[itm].include === "NotificationsList") { }
OrganizationFormObject.related[itm] = NotificationsList; }
OrganizationFormObject.related[itm].generateList = true; // tell form generator to call list generator and inject a list return OrganizationFormObject;
} };
} }];
return OrganizationFormObject;
};
}]);

View File

@@ -0,0 +1,66 @@
/*************************************************
* Copyright (c) 2015 Ansible, Inc.
*
* All Rights Reserved
*************************************************/
export default [function() {
return function() {
return {
name: 'organizations',
iterator: 'organization',
selectTitle: 'Add Organizations',
selectInstructions: '<p>Select existing organizations by clicking each organization or checking the related checkbox. When finished, ' +
'click the blue <em>Select</em> button, located bottom right.</p><p>Create a new organization by clicking the ' +
'<i class=\"fa fa-plus\"></i> button.</p>',
editTitle: 'Organizations',
hover: true,
index: false,
fields: {
name: {
key: true,
label: 'Name',
columnClass: 'col-lg-4 col-md-6 col-sm-8 col-xs-8'
},
description: {
label: 'Description',
columnClass: 'hidden-sm hidden-xs',
excludeModal: true
}
},
actions: {
add: {
mode: 'all', // One of: edit, select, all
ngClick: 'addOrganization()',
awToolTip: 'Create a new organization',
awFeature: 'multiple_organizations',
actionClass: 'btn List-buttonSubmit',
buttonContent: '&#43; ADD'
}
},
fieldActions: {
edit: {
label: 'Edit',
ngClick: "editOrganization(organization.id)",
icon: 'icon-edit',
"class": 'btn-xs btn-default',
awToolTip: 'Edit organization',
dataPlacement: 'top'
},
"delete": {
label: 'Delete',
ngClick: "deleteOrganization(organization.id, organization.name)",
icon: 'icon-trash',
"class": 'btn-xs btn-danger',
awToolTip: 'Delete organization',
dataPlacement: 'top'
}
}
};
}
}];