mirror of
https://github.com/ZwareBear/awx.git
synced 2026-04-20 23:11:48 -05:00
Add UI/UX polish in prep for merge
* Bring UI/UX inline with recent changes * Use select components as a stopgap for credential_types and orgs * Add tabs to permissions view * Add Organization model
This commit is contained in:
@@ -128,10 +128,17 @@ function normalizePath (resource) {
|
||||
return `${version}${resource}/`;
|
||||
}
|
||||
|
||||
function getById (id) {
|
||||
let item = this.get('results').filter(result => result.id === id);
|
||||
|
||||
return item ? item[0] : undefined;
|
||||
}
|
||||
|
||||
function BaseModel (path) {
|
||||
this.model = {};
|
||||
this.get = get;
|
||||
this.normalizePath = normalizePath;
|
||||
this.getById = getById;
|
||||
this.request = request;
|
||||
this.http = {
|
||||
get: httpGet.bind(this),
|
||||
|
||||
@@ -26,18 +26,11 @@ function mergeInputProperties (type) {
|
||||
});
|
||||
}
|
||||
|
||||
function getById (id) {
|
||||
let type = this.get('results').filter(type => type.id === id);
|
||||
|
||||
return type ? type[0] : undefined;
|
||||
}
|
||||
|
||||
function CredentialTypeModel (method, id) {
|
||||
BaseModel.call(this, 'credential_types');
|
||||
|
||||
this.categorizeByKind = categorizeByKind.bind(this);
|
||||
this.mergeInputProperties = mergeInputProperties.bind(this);
|
||||
this.getById = getById.bind(this);
|
||||
|
||||
return this.request(method, id)
|
||||
.then(() => this);
|
||||
|
||||
18
awx/ui/client/lib/models/Organization.js
Normal file
18
awx/ui/client/lib/models/Organization.js
Normal file
@@ -0,0 +1,18 @@
|
||||
let BaseModel;
|
||||
|
||||
function OrganizationModel (method) {
|
||||
BaseModel.call(this, 'organizations');
|
||||
|
||||
return this.request(method)
|
||||
.then(() => this);
|
||||
}
|
||||
|
||||
function OrganizationModelLoader (_BaseModel_) {
|
||||
BaseModel = _BaseModel_;
|
||||
|
||||
return OrganizationModel;
|
||||
}
|
||||
|
||||
OrganizationModelLoader.$inject = ['BaseModel'];
|
||||
|
||||
export default OrganizationModelLoader;
|
||||
@@ -2,11 +2,13 @@ import Base from './Base';
|
||||
import Credential from './Credential';
|
||||
import CredentialType from './CredentialType';
|
||||
import Me from './Me';
|
||||
import Organization from './Organization';
|
||||
|
||||
angular
|
||||
.module('at.lib.models', [])
|
||||
.service('BaseModel', Base)
|
||||
.service('CredentialModel', Credential)
|
||||
.service('CredentialTypeModel', CredentialType)
|
||||
.service('MeModel', Me);
|
||||
.service('MeModel', Me)
|
||||
.service('OrganizationModel', Organization);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user