From cea1f1bbe1565c85ad8edb6b350f1412316f06a7 Mon Sep 17 00:00:00 2001 From: gconsidine Date: Tue, 13 Jun 2017 11:59:14 -0400 Subject: [PATCH] Remove old credentials files from features dir * The non-refactored credentials code has been returned to its original location. Inventories and Jobs pull in Credentials based on its original location in the file structure. * Apply margin to individual inputs instead of panels to have consistent spacing at more narrow resolutions. * Add placeholder for a Lookup component which will be necessary to let users select an org for the credential. --- .../add-edit-credentials.view.html | 6 +- awx/ui/client/features/credentials/index.js | 6 +- awx/ui/client/lib/components/_index.less | 1 + awx/ui/client/lib/components/index.js | 4 + .../client/lib/components/input/_index.less | 17 +- .../components/input/checkbox.partial.html | 4 +- .../lib/components/input/group.directive.js | 33 +- .../lib/components/input/lookup.directive.js | 44 ++ .../lib/components/input/lookup.partial.html | 24 + .../lib/components/input/number.partial.html | 2 +- .../lib/components/input/secret.partial.html | 2 +- .../lib/components/input/select.partial.html | 2 +- .../lib/components/input/text.partial.html | 2 +- .../input/textarea-secret.partial.html | 4 +- .../components/input/textarea.partial.html | 4 +- .../components/list/list-item.directive.js | 0 .../lib/components/list/list.directive.js | 0 .../client/lib/components/panel/_index.less | 2 +- .../client/lib/components/utility/_index.less | 5 + .../components/utility/divider.directive.js | 12 + .../components/utility/divider.partial.html | 1 + awx/ui/client/src/app.js | 2 + .../src/credentials/credentials.form.js | 475 ++++++++++++++++++ .../credentials/credentials.list.js | 7 + .../factories/become-method-change.factory.js | 0 .../factories/credential-form-save.factory.js | 0 .../factories/kind-change.factory.js | 0 .../factories/owner-change.factory.js | 0 .../list/credentials-list.controller.js | 2 +- awx/ui/client/src/credentials/main.js | 25 + .../credentials/ownerList.block.less | 0 .../credentials/ownerList.directive.js | 0 .../credentials/ownerList.partial.html | 0 33 files changed, 644 insertions(+), 42 deletions(-) create mode 100644 awx/ui/client/lib/components/input/lookup.directive.js create mode 100644 awx/ui/client/lib/components/input/lookup.partial.html delete mode 100644 awx/ui/client/lib/components/list/list-item.directive.js delete mode 100644 awx/ui/client/lib/components/list/list.directive.js create mode 100644 awx/ui/client/lib/components/utility/_index.less create mode 100644 awx/ui/client/lib/components/utility/divider.directive.js create mode 100644 awx/ui/client/lib/components/utility/divider.partial.html create mode 100644 awx/ui/client/src/credentials/credentials.form.js rename awx/ui/client/{features => src}/credentials/credentials.list.js (92%) rename awx/ui/client/{features => src}/credentials/factories/become-method-change.factory.js (100%) rename awx/ui/client/{features => src}/credentials/factories/credential-form-save.factory.js (100%) rename awx/ui/client/{features => src}/credentials/factories/kind-change.factory.js (100%) rename awx/ui/client/{features => src}/credentials/factories/owner-change.factory.js (100%) rename awx/ui/client/{features => src}/credentials/list/credentials-list.controller.js (98%) create mode 100644 awx/ui/client/src/credentials/main.js rename awx/ui/client/{features => src}/credentials/ownerList.block.less (100%) rename awx/ui/client/{features => src}/credentials/ownerList.directive.js (100%) rename awx/ui/client/{features => src}/credentials/ownerList.partial.html (100%) diff --git a/awx/ui/client/features/credentials/add-edit-credentials.view.html b/awx/ui/client/features/credentials/add-edit-credentials.view.html index 44ca1d7025..9214adda59 100644 --- a/awx/ui/client/features/credentials/add-edit-credentials.view.html +++ b/awx/ui/client/features/credentials/add-edit-credentials.view.html @@ -10,7 +10,11 @@ - + + + + + Type Details diff --git a/awx/ui/client/features/credentials/index.js b/awx/ui/client/features/credentials/index.js index 1aa3e683c3..661d3deedc 100644 --- a/awx/ui/client/features/credentials/index.js +++ b/awx/ui/client/features/credentials/index.js @@ -1,5 +1,5 @@ -import CredentialList from './credentials.list.js'; -import ListController from './list/credentials-list.controller'; +import CredentialList from '../../src/credentials/credentials.list'; +import ListController from '../../src/credentials/list/credentials-list.controller'; import AddController from './add-credentials.controller.js'; import EditController from './edit-credentials.controller.js'; import { N_ } from '../../src/i18n'; @@ -111,7 +111,5 @@ config.$inject = [ angular .module('at.features.credentials', []) .config(config) - .factory('CredentialList', CredentialList) - .controller('ListController', ListController) .controller('AddController', AddController) .controller('EditController', EditController); diff --git a/awx/ui/client/lib/components/_index.less b/awx/ui/client/lib/components/_index.less index 4a313024b8..d26fbbc11d 100644 --- a/awx/ui/client/lib/components/_index.less +++ b/awx/ui/client/lib/components/_index.less @@ -4,3 +4,4 @@ @import 'modal/_index'; @import 'popover/_index'; @import 'tabs/_index'; +@import 'utility/_index'; diff --git a/awx/ui/client/lib/components/index.js b/awx/ui/client/lib/components/index.js index 602ffbdaf3..3f24c7376b 100644 --- a/awx/ui/client/lib/components/index.js +++ b/awx/ui/client/lib/components/index.js @@ -1,9 +1,11 @@ import actionGroup from './action/action-group.directive'; +import divider from './utility/divider.directive'; import form from './form/form.directive'; import formAction from './form/action.directive'; import inputCheckbox from './input/checkbox.directive'; import inputGroup from './input/group.directive'; import inputLabel from './input/label.directive'; +import inputLookup from './input/lookup.directive'; import inputMessage from './input/message.directive'; import inputNumber from './input/number.directive'; import inputSelect from './input/select.directive'; @@ -24,11 +26,13 @@ import BaseInputController from './input/base.controller'; angular .module('at.lib.components', []) .directive('atActionGroup', actionGroup) + .directive('atDivider', divider) .directive('atForm', form) .directive('atFormAction', formAction) .directive('atInputCheckbox', inputCheckbox) .directive('atInputGroup', inputGroup) .directive('atInputLabel', inputLabel) + .directive('atInputLookup', inputLookup) .directive('atInputMessage', inputMessage) .directive('atInputNumber', inputNumber) .directive('atInputSecret', inputSecret) diff --git a/awx/ui/client/lib/components/input/_index.less b/awx/ui/client/lib/components/input/_index.less index a396776a0d..7e6d191351 100644 --- a/awx/ui/client/lib/components/input/_index.less +++ b/awx/ui/client/lib/components/input/_index.less @@ -15,7 +15,7 @@ } } -.at-Checkbox { +.at-InputCheckbox { margin: 0; padding: 0; @@ -26,8 +26,8 @@ } } -.at-InputGroup-button { - height: 100%; +.at-InputContainer { + margin-top: @at-space-6x;; } .at-Input-button { @@ -69,7 +69,6 @@ .at-InputGroup { padding: 0; - margin: 0; margin: @at-space-6x 0 0 0; } @@ -81,11 +80,13 @@ left: -@at-inset-width; } +.at-InputGroup-button { + height: 100%; +} + .at-InputGroup-title { .at-mixin-Heading(@at-font-size-2x); - margin-top: 0; - margin-left: @at-space-5x; - margin-bottom: @at-space-4x; + margin: 0 0 0 @at-space-5x; } .at-InputGroup-divider { @@ -190,6 +191,6 @@ } } -.at-Textarea { +.at-InputTextarea { .at-mixin-FontFixedWidth(); } diff --git a/awx/ui/client/lib/components/input/checkbox.partial.html b/awx/ui/client/lib/components/input/checkbox.partial.html index 86b64994ac..60cc234efd 100644 --- a/awx/ui/client/lib/components/input/checkbox.partial.html +++ b/awx/ui/client/lib/components/input/checkbox.partial.html @@ -1,7 +1,7 @@ -
+
-
+
{ - let tabindex = Number(scope.tab) + index; - let col = input._expand ? 12 : scope.col; - - let element = - `<${input._component} col="${col}" tab="${tabindex}" - state="${state._reference}._group[${index}]"> - `; - - return angular.element(element); - }; - vm.insert = group => { let container = document.createElement('div'); let col = 1; @@ -128,13 +116,13 @@ function AtInputGroupController ($scope, $compile) { group.forEach((input, i) => { if (input._expand && !isDivided) { - container.appendChild(vm.createInputDivider()); + container.appendChild(vm.createDivider()[0]); } container.appendChild(input._element[0]); if ((input._expand || col % colPerRow === 0) && i !== group.length -1) { - container.appendChild(vm.createInputDivider()); + container.appendChild(vm.createDivider()[0]); isDivided = true; col = 0; } else { @@ -147,8 +135,19 @@ function AtInputGroupController ($scope, $compile) { element.appendChild(container); }; - vm.createInputDivider = () => { - return angular.element(`
`)[0]; + vm.createComponent = (input, index) => { + let tabindex = Number(scope.tab) + index; + let col = input._expand ? 12 : scope.col; + + return angular.element( + `<${input._component} col="${col}" tab="${tabindex}" + state="${state._reference}._group[${index}]"> + ` + ); + }; + + vm.createDivider = () => { + return angular.element(''); }; vm.compile = group => { diff --git a/awx/ui/client/lib/components/input/lookup.directive.js b/awx/ui/client/lib/components/input/lookup.directive.js new file mode 100644 index 0000000000..c8316ec8f3 --- /dev/null +++ b/awx/ui/client/lib/components/input/lookup.directive.js @@ -0,0 +1,44 @@ +function atInputLookupLink (scope, element, attrs, controllers) { + let formController = controllers[0]; + let inputController = controllers[1]; + + if (scope.tab === '1') { + element.find('input')[0].focus(); + } + + inputController.init(scope, element, formController); +} + +function AtInputLookupController (baseInputController) { + let vm = this || {}; + + vm.init = (scope, element, form) => { + baseInputController.call(vm, 'input', scope, element, form); + + vm.check(); + }; +} + +AtInputLookupController.$inject = ['BaseInputController']; + +function atInputLookup (pathService) { + return { + restrict: 'E', + transclude: true, + replace: true, + require: ['^^atForm', 'atInputLookup'], + templateUrl: pathService.getPartialPath('components/input/lookup'), + controller: AtInputLookupController, + controllerAs: 'vm', + link: atInputLookupLink, + scope: { + state: '=', + col: '@', + tab: '@' + } + }; +} + +atInputLookup.$inject = ['PathService']; + +export default atInputLookup; diff --git a/awx/ui/client/lib/components/input/lookup.partial.html b/awx/ui/client/lib/components/input/lookup.partial.html new file mode 100644 index 0000000000..a77505db33 --- /dev/null +++ b/awx/ui/client/lib/components/input/lookup.partial.html @@ -0,0 +1,24 @@ +
+
+ + +
+ + + + +
+ + +
+
diff --git a/awx/ui/client/lib/components/input/number.partial.html b/awx/ui/client/lib/components/input/number.partial.html index 90708edd38..57aa355bfa 100644 --- a/awx/ui/client/lib/components/input/number.partial.html +++ b/awx/ui/client/lib/components/input/number.partial.html @@ -1,4 +1,4 @@ -
+
diff --git a/awx/ui/client/lib/components/input/secret.partial.html b/awx/ui/client/lib/components/input/secret.partial.html index 2445338d88..b9979f5520 100644 --- a/awx/ui/client/lib/components/input/secret.partial.html +++ b/awx/ui/client/lib/components/input/secret.partial.html @@ -1,4 +1,4 @@ -
+
diff --git a/awx/ui/client/lib/components/input/select.partial.html b/awx/ui/client/lib/components/input/select.partial.html index d096c4baef..aaa31bebee 100644 --- a/awx/ui/client/lib/components/input/select.partial.html +++ b/awx/ui/client/lib/components/input/select.partial.html @@ -1,4 +1,4 @@ -
+
diff --git a/awx/ui/client/lib/components/input/text.partial.html b/awx/ui/client/lib/components/input/text.partial.html index 676f4f05d6..c5140df834 100644 --- a/awx/ui/client/lib/components/input/text.partial.html +++ b/awx/ui/client/lib/components/input/text.partial.html @@ -1,4 +1,4 @@ -
+
diff --git a/awx/ui/client/lib/components/input/textarea-secret.partial.html b/awx/ui/client/lib/components/input/textarea-secret.partial.html index 14c97eaf37..11d1f7a3df 100644 --- a/awx/ui/client/lib/components/input/textarea-secret.partial.html +++ b/awx/ui/client/lib/components/input/textarea-secret.partial.html @@ -1,4 +1,4 @@ -
+
@@ -15,7 +15,7 @@ ng-class="{'at-InputFile--drag': drag }" type="file" name="files" /> -