mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 10:00:01 -03:30
org update linkouts work
This commit is contained in:
parent
e237648f4c
commit
7b1008a08d
@ -166,6 +166,10 @@ table, tbody {
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.List-titleBadge--selected {
|
||||
background-color: @default-link;
|
||||
}
|
||||
|
||||
.List-titleText {
|
||||
color: @list-title-txt;
|
||||
font-size: 14px;
|
||||
|
||||
@ -312,31 +312,6 @@ var tower = angular.module('Tower', [
|
||||
templateUrl: urlPrefix + 'partials/projects.html',
|
||||
controller: OrganizationsAdd
|
||||
}).
|
||||
|
||||
state('organizationAdmins', {
|
||||
url: '/organizations/:organization_id/admins',
|
||||
templateUrl: urlPrefix + 'partials/organizations.html',
|
||||
controller: AdminsList
|
||||
}).
|
||||
|
||||
state('organizationUsers', {
|
||||
url:'/organizations/:organization_id/users',
|
||||
templateUrl: urlPrefix + 'partials/users.html',
|
||||
controller: UsersList
|
||||
}).
|
||||
|
||||
state('organizationUserAdd', {
|
||||
url: '/organizations/:organization_id/users/add',
|
||||
templateUrl: urlPrefix + 'partials/users.html',
|
||||
controller: UsersAdd
|
||||
}).
|
||||
|
||||
state('organizationUserEdit', {
|
||||
url: '/organizations/:organization_id/users/:user_id',
|
||||
templateUrl: urlPrefix + 'partials/users.html',
|
||||
controller: UsersEdit
|
||||
}).
|
||||
|
||||
state('teams', {
|
||||
url: '/teams',
|
||||
templateUrl: urlPrefix + 'partials/teams.html',
|
||||
|
||||
@ -46,100 +46,6 @@ export default
|
||||
},
|
||||
|
||||
related: {
|
||||
|
||||
users: {
|
||||
type: 'collection',
|
||||
title: 'Users',
|
||||
iterator: 'user',
|
||||
index: false,
|
||||
open: false,
|
||||
|
||||
actions: {
|
||||
add: {
|
||||
ngClick: "add('users')",
|
||||
label: 'Add',
|
||||
awToolTip: 'Add a new user',
|
||||
actionClass: 'btn List-buttonSubmit',
|
||||
buttonContent: '+ ADD'
|
||||
}
|
||||
},
|
||||
|
||||
fields: {
|
||||
username: {
|
||||
key: true,
|
||||
label: 'Username'
|
||||
},
|
||||
first_name: {
|
||||
label: 'First Name'
|
||||
},
|
||||
last_name: {
|
||||
label: 'Last Name'
|
||||
}
|
||||
},
|
||||
|
||||
fieldActions: {
|
||||
edit: {
|
||||
label: 'Edit',
|
||||
ngClick: "edit('users', user.id, user.username)",
|
||||
icon: 'icon-edit',
|
||||
'class': 'btn-default',
|
||||
awToolTip: 'Edit user'
|
||||
},
|
||||
"delete": {
|
||||
label: 'Delete',
|
||||
ngClick: "delete('users', user.id, user.username, 'user')",
|
||||
icon: 'icon-trash',
|
||||
"class": 'btn-danger',
|
||||
awToolTip: 'Remove user'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
admins: { // Assumes a plural name (e.g. things)
|
||||
type: 'collection',
|
||||
title: 'Administrators',
|
||||
iterator: 'admin', // Singular form of name (e.g. thing)
|
||||
index: false,
|
||||
open: false, // Open accordion on load?
|
||||
base: '/users',
|
||||
actions: { // Actions displayed top right of list
|
||||
add: {
|
||||
ngClick: "add('admins')",
|
||||
label: 'Add',
|
||||
awToolTip: 'Add new administrator',
|
||||
actionClass: 'btn List-buttonSubmit',
|
||||
buttonContent: '+ ADD'
|
||||
}
|
||||
},
|
||||
fields: {
|
||||
username: {
|
||||
key: true,
|
||||
label: 'Username'
|
||||
},
|
||||
first_name: {
|
||||
label: 'First Name'
|
||||
},
|
||||
last_name: {
|
||||
label: 'Last Name'
|
||||
}
|
||||
},
|
||||
fieldActions: { // Actions available on each row
|
||||
edit: {
|
||||
label: 'Edit',
|
||||
ngClick: "edit('users', admin.id, admin.username)",
|
||||
icon: 'icon-edit',
|
||||
awToolTip: 'Edit administrator',
|
||||
'class': 'btn-default'
|
||||
},
|
||||
"delete": {
|
||||
label: 'Delete',
|
||||
ngClick: "delete('admins', admin.id, admin.username, 'administrator')",
|
||||
icon: 'icon-trash',
|
||||
"class": 'btn-danger',
|
||||
awToolTip: 'Remove administrator'
|
||||
}
|
||||
}
|
||||
},
|
||||
permissions: {
|
||||
type: 'collection',
|
||||
title: 'Permissions',
|
||||
|
||||
@ -25,6 +25,8 @@ export default ['$scope', '$rootScope', '$compile', '$location',
|
||||
id = $stateParams.organization_id,
|
||||
relatedSets = {};
|
||||
|
||||
$scope.$parent.activeMode = 'edit';
|
||||
|
||||
$scope.$emit("HideOrgListHeader");
|
||||
|
||||
$scope.$emit("ReloadOrganzationCards", id);
|
||||
|
||||
8
awx/ui/client/src/organizations/linkout/main.js
Normal file
8
awx/ui/client/src/organizations/linkout/main.js
Normal file
@ -0,0 +1,8 @@
|
||||
import routes from './organizations-linkout.route';
|
||||
|
||||
export default angular.module('organizationsLinkout', [])
|
||||
.run(['$stateExtender', function($stateExtender) {
|
||||
routes.forEach(function(route) {
|
||||
$stateExtender.addState(route);
|
||||
});
|
||||
}]);
|
||||
@ -0,0 +1,81 @@
|
||||
export default ['$scope', '$stateParams', '$state', 'Rest', 'UserList', 'InventoryList', 'JobTemplateList', 'TeamList', 'ProjectList', 'generateList', 'SearchInit', 'PaginateInit', function($scope, $stateParams, $state, Rest, UserList, InventoryList, JobTemplateList, TeamList, ProjectList, GenerateList, SearchInit, PaginateInit) {
|
||||
|
||||
var getList = function(mode) {
|
||||
var list = {};
|
||||
if (mode === 'users') {
|
||||
list = _.cloneDeep(UserList);
|
||||
list.actions.add.buttonContent = '+ ADD user';
|
||||
} else if (mode === 'inventories') {
|
||||
list = _.cloneDeep(InventoryList);
|
||||
delete list.actions.add;
|
||||
} else if (mode === 'job_templates') {
|
||||
list = _.cloneDeep(JobTemplateList);
|
||||
delete list.actions.add;
|
||||
} else if (mode === 'teams') {
|
||||
list = _.cloneDeep(TeamList);
|
||||
delete list.actions.add;
|
||||
} else if (mode === 'projects') {
|
||||
list = _.cloneDeep(ProjectList);
|
||||
delete list.actions.add;
|
||||
} else if (mode === 'admins') {
|
||||
list = _.cloneDeep(UserList);
|
||||
list.actions.add.buttonContent = '+ ADD administrator';
|
||||
}
|
||||
return list;
|
||||
};
|
||||
|
||||
var getUrl = function(mode, data) {
|
||||
var url = "";
|
||||
if (mode === 'users') {
|
||||
url = data.related.users;
|
||||
} else if (mode === 'inventories') {
|
||||
url = data.related.inventories;
|
||||
} else if (mode === 'job_templates') {
|
||||
url = "/api/v1/job_templates/?project__organization=" + data.id;
|
||||
} else if (mode === 'teams') {
|
||||
url = data.related.teams;
|
||||
} else if (mode === 'projects') {
|
||||
url = data.related.projects;
|
||||
} else if (mode === 'admins') {
|
||||
url = data.related.admins;
|
||||
}
|
||||
return url;
|
||||
};
|
||||
|
||||
Rest.setUrl("/api/v1/organizations/" + $stateParams.organization_id);
|
||||
Rest.get()
|
||||
.success(function (data) {
|
||||
// include name of item in listTitle
|
||||
var mode = $state.current.name.split(".")[1],
|
||||
listTitle = data.name +
|
||||
"<div class='List-titleLockup'></div>" +
|
||||
mode.replace('_', ' '),
|
||||
list,
|
||||
url,
|
||||
generator = GenerateList;
|
||||
$scope.$parent.hideListHeader = true;
|
||||
$scope.$parent.activeCard = parseInt($stateParams.organization_id);
|
||||
$scope.$parent.activeMode = mode;
|
||||
|
||||
list = getList(mode);
|
||||
list.listTitle = listTitle;
|
||||
|
||||
url = getUrl(mode, data);
|
||||
|
||||
generator
|
||||
.inject(list, { mode: 'edit', scope: $scope });
|
||||
|
||||
SearchInit({
|
||||
scope: $scope,
|
||||
set: mode,
|
||||
list: list,
|
||||
url: url
|
||||
});
|
||||
PaginateInit({
|
||||
scope: $scope,
|
||||
list: list,
|
||||
url: url
|
||||
});
|
||||
$scope.search(list.iterator);
|
||||
});
|
||||
}];
|
||||
@ -0,0 +1,4 @@
|
||||
<div class="tab-pane" id="organizations">
|
||||
<div ui-view></div>
|
||||
<div ng-cloak id="htmlTemplate" class="Panel"></div>
|
||||
</div>
|
||||
@ -0,0 +1,143 @@
|
||||
/*************************************************
|
||||
* Copyright (c) 2016 Ansible, Inc.
|
||||
*
|
||||
* All Rights Reserved
|
||||
*************************************************/
|
||||
|
||||
import {templateUrl} from '../../shared/template-url/template-url.factory';
|
||||
import OrganizationsLinkout from './organizations-linkout.controller';
|
||||
|
||||
export default [
|
||||
{
|
||||
name: 'organizations.users',
|
||||
route: '/:organization_id/users',
|
||||
templateUrl: templateUrl('organizations/linkout/organizations-linkout'),
|
||||
controller: OrganizationsLinkout,
|
||||
data: {
|
||||
activityStream: true,
|
||||
activityStreamTarget: 'organization'
|
||||
},
|
||||
ncyBreadcrumb: {
|
||||
parent: function($scope) {
|
||||
$scope.$parent.$emit("ReloadOrgListView");
|
||||
return "setup";
|
||||
},
|
||||
label: "ORGANIZATIONS"
|
||||
},
|
||||
resolve: {
|
||||
features: ['FeaturesService', function(FeaturesService) {
|
||||
return FeaturesService.get();
|
||||
}]
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'organizations.teams',
|
||||
route: '/:organization_id/teams',
|
||||
templateUrl: templateUrl('organizations/linkout/organizations-linkout'),
|
||||
controller: OrganizationsLinkout,
|
||||
data: {
|
||||
activityStream: true,
|
||||
activityStreamTarget: 'organization'
|
||||
},
|
||||
ncyBreadcrumb: {
|
||||
parent: function($scope) {
|
||||
$scope.$parent.$emit("ReloadOrgListView");
|
||||
return "setup";
|
||||
},
|
||||
label: "ORGANIZATIONS"
|
||||
},
|
||||
resolve: {
|
||||
features: ['FeaturesService', function(FeaturesService) {
|
||||
return FeaturesService.get();
|
||||
}]
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'organizations.inventories',
|
||||
route: '/:organization_id/inventories',
|
||||
templateUrl: templateUrl('organizations/linkout/organizations-linkout'),
|
||||
controller: OrganizationsLinkout,
|
||||
data: {
|
||||
activityStream: true,
|
||||
activityStreamTarget: 'organization'
|
||||
},
|
||||
ncyBreadcrumb: {
|
||||
parent: function($scope) {
|
||||
$scope.$parent.$emit("ReloadOrgListView");
|
||||
return "setup";
|
||||
},
|
||||
label: "ORGANIZATIONS"
|
||||
},
|
||||
resolve: {
|
||||
features: ['FeaturesService', function(FeaturesService) {
|
||||
return FeaturesService.get();
|
||||
}]
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'organizations.projects',
|
||||
route: '/:organization_id/projects',
|
||||
templateUrl: templateUrl('organizations/linkout/organizations-linkout'),
|
||||
controller: OrganizationsLinkout,
|
||||
data: {
|
||||
activityStream: true,
|
||||
activityStreamTarget: 'organization'
|
||||
},
|
||||
ncyBreadcrumb: {
|
||||
parent: function($scope) {
|
||||
$scope.$parent.$emit("ReloadOrgListView");
|
||||
return "setup";
|
||||
},
|
||||
label: "ORGANIZATIONS"
|
||||
},
|
||||
resolve: {
|
||||
features: ['FeaturesService', function(FeaturesService) {
|
||||
return FeaturesService.get();
|
||||
}]
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'organizations.job_templates',
|
||||
route: '/:organization_id/job_templates',
|
||||
templateUrl: templateUrl('organizations/linkout/organizations-linkout'),
|
||||
controller: OrganizationsLinkout,
|
||||
data: {
|
||||
activityStream: true,
|
||||
activityStreamTarget: 'organization'
|
||||
},
|
||||
ncyBreadcrumb: {
|
||||
parent: function($scope) {
|
||||
$scope.$parent.$emit("ReloadOrgListView");
|
||||
return "setup";
|
||||
},
|
||||
label: "ORGANIZATIONS"
|
||||
},
|
||||
resolve: {
|
||||
features: ['FeaturesService', function(FeaturesService) {
|
||||
return FeaturesService.get();
|
||||
}]
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'organizations.admins',
|
||||
route: '/:organization_id/admins',
|
||||
templateUrl: templateUrl('organizations/linkout/organizations-linkout'),
|
||||
controller: OrganizationsLinkout,
|
||||
data: {
|
||||
activityStream: true,
|
||||
activityStreamTarget: 'organization'
|
||||
},
|
||||
ncyBreadcrumb: {
|
||||
parent: function($scope) {
|
||||
$scope.$parent.$emit("ReloadOrgListView");
|
||||
return "setup";
|
||||
},
|
||||
label: "ORGANIZATIONS"
|
||||
},
|
||||
resolve: {
|
||||
features: ['FeaturesService', function(FeaturesService) {
|
||||
return FeaturesService.get();
|
||||
}]
|
||||
}
|
||||
}
|
||||
];
|
||||
@ -48,7 +48,7 @@ export default ['$stateParams', '$scope', '$rootScope', '$location',
|
||||
|
||||
var parseCardData = function(cards) {
|
||||
return cards.map(function(card) {
|
||||
var val = {};
|
||||
var val = {}, url = '/#/organizations/' + card.id + '/';
|
||||
val.name = card.name;
|
||||
val.id = card.id;
|
||||
if (card.id + "" === cards.activeCard) {
|
||||
@ -57,34 +57,40 @@ export default ['$stateParams', '$scope', '$rootScope', '$location',
|
||||
val.description = card.description || undefined;
|
||||
val.links = [];
|
||||
val.links.push({
|
||||
href: card.related.users,
|
||||
href: url + 'users',
|
||||
name: "USERS",
|
||||
count: card.summary_fields.related_field_counts.users
|
||||
count: card.summary_fields.related_field_counts.users,
|
||||
activeMode: 'users'
|
||||
});
|
||||
val.links.push({
|
||||
href: card.related.teams,
|
||||
href: url + 'teams',
|
||||
name: "TEAMS",
|
||||
count: card.summary_fields.related_field_counts.teams
|
||||
count: card.summary_fields.related_field_counts.teams,
|
||||
activeMode: 'teams'
|
||||
});
|
||||
val.links.push({
|
||||
href: card.related.inventories,
|
||||
href: url + 'inventories',
|
||||
name: "INVENTORIES",
|
||||
count: card.summary_fields.related_field_counts.inventories
|
||||
count: card.summary_fields.related_field_counts.inventories,
|
||||
activeMode: 'inventories'
|
||||
});
|
||||
val.links.push({
|
||||
href: card.related.projects,
|
||||
href: url + 'projects',
|
||||
name: "PROJECTS",
|
||||
count: card.summary_fields.related_field_counts.projects
|
||||
count: card.summary_fields.related_field_counts.projects,
|
||||
activeMode: 'projects'
|
||||
});
|
||||
val.links.push({
|
||||
href: card.related.job_templates,
|
||||
href: url + 'job_templates',
|
||||
name: "JOB TEMPLATES",
|
||||
count: card.summary_fields.related_field_counts.job_templates
|
||||
count: card.summary_fields.related_field_counts.job_templates,
|
||||
activeMode: 'job_templates'
|
||||
});
|
||||
val.links.push({
|
||||
href: card.related.admins,
|
||||
href: url + 'admins',
|
||||
name: "ADMINS",
|
||||
count: card.summary_fields.related_field_counts.admins
|
||||
count: card.summary_fields.related_field_counts.admins,
|
||||
activeMode: 'admins'
|
||||
});
|
||||
return val;
|
||||
});
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
<div class="OrgCards-actionItems">
|
||||
<button class="OrgCards-actionItem
|
||||
List-actionButton"
|
||||
ng-class="{'List-editButton--selected': activeCard === card.id || card.isActiveCard }"
|
||||
ng-class="{'List-editButton--selected': (activeCard === card.id || card.isActiveCard) && activeMode === 'edit' }"
|
||||
ng-click="editOrganization(card.id)">
|
||||
<i class="OrgCards-actionItemIcon fa fa-pencil">
|
||||
</i>
|
||||
@ -46,7 +46,8 @@
|
||||
<div class="OrgCards-links">
|
||||
<div class="OrgCards-link" ng-repeat="link in card.links">
|
||||
<span class="badge List-titleBadge
|
||||
OrgCards-linkBadge">
|
||||
OrgCards-linkBadge"
|
||||
ng-class="{'List-titleBadge--selected': (activeCard === card.id || card.isActiveCard) && activeMode === link.activeMode }">
|
||||
{{ link.count }}
|
||||
</span>
|
||||
<a class="OrgCards-linkName"
|
||||
|
||||
@ -7,10 +7,12 @@
|
||||
import organizationsList from './list/main';
|
||||
import organizationsAdd from './add/main';
|
||||
import organizationsEdit from './edit/main';
|
||||
import organizationsLinkout from './linkout/main';
|
||||
|
||||
export default
|
||||
angular.module('organizations', [
|
||||
organizationsList.name,
|
||||
organizationsAdd.name,
|
||||
organizationsEdit.name,
|
||||
organizationsLinkout.name
|
||||
]);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user