-
- {{ config.title.text }}
+
-
-
diff --git a/awx/ui/client/components/toggle/content.directive.js b/awx/ui/client/components/toggle/content.directive.js
index f8b3358201..3e54e07594 100644
--- a/awx/ui/client/components/toggle/content.directive.js
+++ b/awx/ui/client/components/toggle/content.directive.js
@@ -2,7 +2,7 @@ function atToggleContent () {
return {
restrict: 'E',
transclude: true,
- templateUrl: 'static/partials/components/toggle/content.partial.html',
+ templateUrl: 'static/partials/component/toggle/content.partial.html',
scope: {
config: '='
}
diff --git a/awx/ui/client/lib/credentials.factory.js b/awx/ui/client/lib/credentials.factory.js
deleted file mode 100644
index 4148d6ca1b..0000000000
--- a/awx/ui/client/lib/credentials.factory.js
+++ /dev/null
@@ -1,7 +0,0 @@
-function credentials($resource) {
-
-}
-
-credentials.$inject = ['$resource'];
-
-angular.module('at.lib');
diff --git a/awx/ui/client/models/Base.js b/awx/ui/client/models/Base.js
new file mode 100644
index 0000000000..62354abf22
--- /dev/null
+++ b/awx/ui/client/models/Base.js
@@ -0,0 +1,30 @@
+function get () {
+ return this.model.get().$promise
+ .then(response => {
+ this.response = response;
+ this.data = this.response.results;
+ });
+}
+
+function normalizePath (resource) {
+ let version = '/api/v2/';
+
+ return `${version}${resource}/`;
+}
+
+function Base ($resource) {
+ return (resource, params, actions) => {
+ let path = normalizePath(resource);
+
+ return {
+ data: null,
+ response: null,
+ model: $resource(path, params, actions),
+ get
+ };
+ };
+}
+
+Base.$inject = ['$resource'];
+
+export default Base;
diff --git a/awx/ui/client/models/Credential.js b/awx/ui/client/models/Credential.js
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/awx/ui/client/models/CredentialType.js b/awx/ui/client/models/CredentialType.js
new file mode 100644
index 0000000000..838924b2be
--- /dev/null
+++ b/awx/ui/client/models/CredentialType.js
@@ -0,0 +1,25 @@
+function categorizeByKind () {
+ let group = {};
+
+ this.data.forEach(result => {
+ group[result.kind] = group[result.kind] || [];
+ group[result.kind].push(result);
+ });
+
+ return Object.keys(group).map(category => ({
+ data: group[category],
+ category
+ }));
+}
+
+function CredentialType (Base) {
+ let base = Base('credential_types');
+
+ return Object.assign(base, {
+ categorizeByKind
+ });
+}
+
+CredentialType.$inject = ['Base'];
+
+export default CredentialType;
diff --git a/awx/ui/client/models/index.js b/awx/ui/client/models/index.js
new file mode 100644
index 0000000000..845b2bb628
--- /dev/null
+++ b/awx/ui/client/models/index.js
@@ -0,0 +1,15 @@
+import Base from './Base';
+import CredentialType from './CredentialType';
+
+function config ($resourceProvider) {
+ $resourceProvider.defaults.stripTrailingSlashes = false;
+}
+
+config.$inject = ['$resourceProvider'];
+
+angular
+ .module('at.models', [])
+ .config(config)
+ .factory('Base', Base)
+ .factory('CredentialType', CredentialType);
+
diff --git a/awx/ui/client/src/app.js b/awx/ui/client/src/app.js
index 46733e7d68..93bd8ac586 100644
--- a/awx/ui/client/src/app.js
+++ b/awx/ui/client/src/app.js
@@ -7,6 +7,7 @@
// Vendor dependencies
import 'jquery';
import 'angular';
+import 'angular-resource';
import 'angular-gettext';
import 'bootstrap';
import 'jquery-ui';
@@ -72,6 +73,7 @@ import scheduler from './scheduler/main';
import instanceGroups from './instance-groups/main';
import '../components';
+import '../models';
import './credentials';
var tower = angular.module('Tower', [
@@ -132,7 +134,10 @@ var tower = angular.module('Tower', [
'PromptDialog',
'AWDirectives',
'features',
- 'at.components',
+
+ 'ngResource',
+ 'at.component',
+ 'at.model',
'at.feature.credentials'
])
diff --git a/awx/ui/client/src/credentials/add-credentials.controller.js b/awx/ui/client/src/credentials/add-credentials.controller.js
new file mode 100644
index 0000000000..ea8fa34903
--- /dev/null
+++ b/awx/ui/client/src/credentials/add-credentials.controller.js
@@ -0,0 +1,26 @@
+function AddCredentialsController (credentialType) {
+ let vm = this || {};
+
+ vm.name = {
+ label: 'Name',
+ required: true
+ };
+
+ vm.description = {
+ label: 'Description'
+ };
+
+ vm.kind = {
+ label: 'Type',
+ required: true,
+ text: 'kind',
+ value: 'id',
+ data: credentialType.categorizeByKind()
+ };
+}
+
+AddCredentialsController.$inject = [
+ 'credentialType'
+];
+
+export default AddCredentialsController;
diff --git a/awx/ui/client/src/credentials/add-credentials.view.html b/awx/ui/client/src/credentials/add-credentials.view.html
new file mode 100644
index 0000000000..242052bf68
--- /dev/null
+++ b/awx/ui/client/src/credentials/add-credentials.view.html
@@ -0,0 +1,26 @@
+
+
+ Create Credentials
+
+
+
+
+ Details
+ Permissions
+
+
+
+
+
diff --git a/awx/ui/client/src/credentials/index.js b/awx/ui/client/src/credentials/index.js
index f17464eb86..ceb3e14619 100644
--- a/awx/ui/client/src/credentials/index.js
+++ b/awx/ui/client/src/credentials/index.js
@@ -1,8 +1,9 @@
import CredentialList from './credentials.list.js';
import ListController from './list/credentials-list.controller';
+import AddController from './add-credentials.controller.js';
import { N_ } from '../i18n';
-function routes ($stateExtenderProvider) {
+function config ($stateExtenderProvider) {
let stateExtender = $stateExtenderProvider.$get();
stateExtender.addState({
@@ -46,10 +47,15 @@ function routes ($stateExtenderProvider) {
},
views: {
'add@credentials': {
- templateProvider: function() {
- return '
test-add';
- }
+ templateUrl: '/static/views/credentials/add-credentials.view.html',
+ controller: AddController,
+ controllerAs: 'vm'
}
+ },
+ resolve: {
+ credentialType: ['CredentialType', CredentialType => {
+ return CredentialType.get().then(() => CredentialType);
+ }]
}
});
@@ -69,12 +75,13 @@ function routes ($stateExtenderProvider) {
});
}
-routes.$inject = [
+config.$inject = [
'$stateExtenderProvider'
];
angular
.module('at.feature.credentials', [])
- .config(routes)
+ .config(config)
.factory('CredentialList', CredentialList)
- .controller('ListController', ListController);
+ .controller('ListController', ListController)
+ .controller('AddController', AddController);
diff --git a/awx/ui/client/test/index.js b/awx/ui/client/test/index.js
index fc5eb8400d..f54a6bef6a 100644
--- a/awx/ui/client/test/index.js
+++ b/awx/ui/client/test/index.js
@@ -1,5 +1,5 @@
import 'angular';
import 'angular-mocks';
-import '../components/index.js';
-import './panel.spec.js';
+import '../components';
+import './panel.spec';
diff --git a/awx/ui/client/theme/_variables.less b/awx/ui/client/theme/_variables.less
index 27f49a3749..4e09ca6a45 100644
--- a/awx/ui/client/theme/_variables.less
+++ b/awx/ui/client/theme/_variables.less
@@ -1,23 +1,24 @@
@at-white: #ffffff;
-
@at-gray-lightest: #fafafa;
@at-gray-lighter: #f6f6f6;
@at-gray-light: #b7b7b7;
@at-gray: #848992;
@at-gray-dark: #707070;
-
-@at-link: #337AB7;
+@at-gray-darkest: #161b1f;
+@at-link: #337ab7;
@at-link-dark: #286090;
-
-@at-success: #5CB85C;
+@at-success: #5cb85c;
@at-success-dark: #449D44;
-
-@at-danger: #449D44;
+@at-danger: #d9534f;
@at-font-sm: 12px;
@at-font-md: 14px;
@at-font-lg: 16px;
+@at-font-weight-sm: 400;
+@at-font-weight-md: 700;
+@at-font-weight-lg: 900;
+
@at-padding-xxs: 5px;
@at-padding-xs: 6px;
@at-padding-sm: 10px;