diff --git a/awx/ui/client/features/credentials/add-credentials.controller.js b/awx/ui/client/features/credentials/add-credentials.controller.js index ad1b9ae9d4..c9fd966f45 100644 --- a/awx/ui/client/features/credentials/add-credentials.controller.js +++ b/awx/ui/client/features/credentials/add-credentials.controller.js @@ -8,14 +8,17 @@ function AddCredentialsController (models) { omit: ['user', 'team', 'inputs'] }); - vm.form.credential_type.data = credentialType.categorizeByKind(); - vm.form.credential_type.placeholder = 'Select A Type'; + vm.form.credential_type._data = credentialType.getResults(); + vm.form.credential_type._placeholder = 'Select A Type'; + vm.form.credential_type._display = 'name'; + vm.form.credential_type._key = 'id'; + vm.form.credential_type._exp = 'type as type.name group by type.kind for type in state._data'; vm.form.inputs = { - get: credentialType.getTypeFromName, - source: vm.form.credential_type, - reference: 'vm.form.inputs', - key: 'inputs' + _get: credentialType.mergeInputProperties, + _source: vm.form.credential_type, + _reference: 'vm.form.inputs', + _key: 'inputs' }; vm.form.save = credential.post; diff --git a/awx/ui/client/features/credentials/add-credentials.view.html b/awx/ui/client/features/credentials/add-credentials.view.html index 10019be66a..8e0d0039ae 100644 --- a/awx/ui/client/features/credentials/add-credentials.view.html +++ b/awx/ui/client/features/credentials/add-credentials.view.html @@ -12,9 +12,9 @@ - + Type Details - + diff --git a/awx/ui/client/features/credentials/index.view.html b/awx/ui/client/features/credentials/index.view.html index c1fce0ad3e..31993f35b5 100644 --- a/awx/ui/client/features/credentials/index.view.html +++ b/awx/ui/client/features/credentials/index.view.html @@ -1,8 +1,6 @@
- - +
- - +
diff --git a/awx/ui/client/lib/components/_index.less b/awx/ui/client/lib/components/_index.less index 51040fdce4..d14b865d80 100644 --- a/awx/ui/client/lib/components/_index.less +++ b/awx/ui/client/lib/components/_index.less @@ -1,8 +1,4 @@ @import 'action/_index'; -@import 'badge/_index'; -@import 'dynamic/_index'; @import 'input/_index'; @import 'panel/_index'; @import 'popover/_index'; -@import 'toggle/_index'; - diff --git a/awx/ui/client/lib/components/action/action-group.partial.html b/awx/ui/client/lib/components/action/action-group.partial.html index 855f6ee179..e0df9581ac 100644 --- a/awx/ui/client/lib/components/action/action-group.partial.html +++ b/awx/ui/client/lib/components/action/action-group.partial.html @@ -1,5 +1,5 @@ -
-
+
+
diff --git a/awx/ui/client/lib/components/badge/_index.less b/awx/ui/client/lib/components/badge/_index.less deleted file mode 100644 index a3f3927a81..0000000000 --- a/awx/ui/client/lib/components/badge/_index.less +++ /dev/null @@ -1,8 +0,0 @@ -.at-Badge { - font-size: @at-font-size; - padding: 0 @at-space-2x; - margin: 0; - background-color: @at-gray; - color: @at-white; - border-radius: @at-border-radius; -} diff --git a/awx/ui/client/lib/components/badge/badge.directive.js b/awx/ui/client/lib/components/badge/badge.directive.js deleted file mode 100644 index e040dbbdb9..0000000000 --- a/awx/ui/client/lib/components/badge/badge.directive.js +++ /dev/null @@ -1,12 +0,0 @@ -function atBadge () { - return { - restrict: 'E', - transclude: true, - templateUrl: 'static/partials/components/badge/badge.partial.html', - scope: { - config: '=' - } - }; -} - -export default atBadge; diff --git a/awx/ui/client/lib/components/badge/badge.partial.html b/awx/ui/client/lib/components/badge/badge.partial.html deleted file mode 100644 index 3d5a0f0672..0000000000 --- a/awx/ui/client/lib/components/badge/badge.partial.html +++ /dev/null @@ -1,8 +0,0 @@ -
-
- {{ config.text }} -
- - -
- diff --git a/awx/ui/client/lib/components/dynamic/_index.less b/awx/ui/client/lib/components/dynamic/_index.less deleted file mode 100644 index 357d648081..0000000000 --- a/awx/ui/client/lib/components/dynamic/_index.less +++ /dev/null @@ -1,27 +0,0 @@ -.at-DynamicInputGroup { - padding: 0; - margin: 0; - margin: @at-space-6x 0 0 0; -} - -.at-DynamicInputGroup-border { - position: absolute; - width: @at-inset-width; - height: 100%; - background: @at-gray; - left: -@at-inset-width; -} - -.at-DynamicInputGroup-title { - .at-mixin-Heading(@at-font-size-2x); - margin-top: 0; - margin-left: @at-space-5x; - margin-bottom: @at-space-4x; -} - -.at-DynamicInputGroup-divider { - clear: both; - margin: 0; - padding: 0; - height: @at-space-6x; -} diff --git a/awx/ui/client/lib/components/dynamic/input-group.directive.js b/awx/ui/client/lib/components/dynamic/input-group.directive.js deleted file mode 100644 index b993aaa52a..0000000000 --- a/awx/ui/client/lib/components/dynamic/input-group.directive.js +++ /dev/null @@ -1,139 +0,0 @@ -function atDynamicInputGroupLink (scope, el, attrs, controllers) { - let dynamicController = controllers[0]; - let formController = controllers[1]; - let element = el[0].getElementsByClassName('at-DynamicInputGroup-container')[0]; - - dynamicController.init(scope, formController, element); -} - -function AtDynamicInputGroupController ($scope, $compile) { - let vm = this || {}; - - let form; - let scope; - let state; - let source; - let element; - - vm.init = (_scope_, _form_, _element_) => { - form = _form_; - scope = _scope_; - element = _element_; - state = scope.state || {}; - source = state.source; - - $scope.$watch('state.source.value', vm.update); - }; - - vm.isValidSource = () => { - if (!source.value || source.value === state.value) { - return false; - } - - return true; - }; - - vm.update = () => { - if (!vm.isValidSource()) { - return; - } - - if (state.components) { - vm.clear(); - } - - state.value = source.value; - - let inputs = state.get(source.value); - let components = vm.createComponentConfigs(inputs); - - vm.insert(components); - state.components = components; - vm.compile(components); - }; - - vm.createComponentConfigs = inputs => { - let components = []; - - inputs.forEach((input, i) => { - if (input.type === 'string') { - if (input.secret && input.multiline) { - input.component = 'at-input-textarea'; - } else if (input.secret) { - input.component = 'at-input-secret'; - } else if (input.multiline) { - input.component = 'at-input-textarea'; - } else { - input.component = 'at-input-text'; - } - } - - components.push(Object.assign({ - element: vm.createElement(input, i), - key: 'inputs', - dynamic: true - }, input)); - }); - - return components; - }; - - vm.createElement = (input, index) => { - let tabindex = Number(scope.tab) + index; - - let element = - `<${input.component} col="${scope.col}" tab="${tabindex}" - state="${state.reference}.components[${index}]"> - `; - - return angular.element(element); - }; - - vm.insert = components => { - let group = document.createElement('div'); - let divider = angular.element(`
`)[0]; - - for (let i = 0; i < components.length; i++) { - if (i !== 0 && (i % (12 / scope.col)) === 0) { - group.appendChild(divider); - } - - group.appendChild(components[i].element[0]); - } - - element.appendChild(group); - }; - - vm.compile = components => { - components.forEach(component => $compile(component.element[0])(scope.$parent)); - }; - - vm.clear = () => { - form.deregisterDynamicComponents(state.components); - element.innerHTML = ''; - }; -} - -AtDynamicInputGroupController.$inject = ['$scope', '$compile']; - -function atDynamicInputGroup (pathService) { - return { - restrict: 'E', - replace: true, - transclude: true, - require: ['atDynamicInputGroup', '^^atForm'], - templateUrl: pathService.getPartialPath('components/dynamic/input-group'), - controller: AtDynamicInputGroupController, - controllerAs: 'vm', - link: atDynamicInputGroupLink, - scope: { - state: '=', - col: '@', - tab: '@' - } - }; -} - -atDynamicInputGroup.$inject = ['PathService']; - -export default atDynamicInputGroup; diff --git a/awx/ui/client/lib/components/dynamic/input-group.partial.html b/awx/ui/client/lib/components/dynamic/input-group.partial.html deleted file mode 100644 index 288476baba..0000000000 --- a/awx/ui/client/lib/components/dynamic/input-group.partial.html +++ /dev/null @@ -1,11 +0,0 @@ -
-
-
-
-
-

-
-
-
-
-
diff --git a/awx/ui/client/lib/components/form/form.directive.js b/awx/ui/client/lib/components/form/form.directive.js index 5d71d3b817..d198febca9 100644 --- a/awx/ui/client/lib/components/form/form.directive.js +++ b/awx/ui/client/lib/components/form/form.directive.js @@ -59,17 +59,19 @@ function AtFormController (eventService) { let data = vm.components .filter(component => component.category === 'input') .reduce((values, component) => { - if (!component.state.value) { + if (!component.state._value) { return values; } - if (component.state.dynamic) { - values[component.state.key] = values[component.state.key] || []; - values[component.state.key].push({ - [component.state.id]: component.state.value + if (component.state._key && typeof component.state._value === 'object') { + values[component.state._id] = component.state._value[component.state._key]; + } else if (component.state._group) { + values[component.state._key] = values[component.state._key] || []; + values[component.state._key].push({ + [component.state._id]: component.state._value }); } else { - values[component.state.id] = component.state.value; + values[component.state._id] = component.state._value; } return values; @@ -87,25 +89,39 @@ function AtFormController (eventService) { }; vm.onSaveError = err => { + let handled; + if (err.status === 400) { - vm.setValidationErrors(err.data); + handled = vm.setValidationErrors(err.data); + } + + if (!handled) { + // TODO: launch modal for unexpected error type } }; vm.setValidationErrors = errors => { + let errorMessageSet = false; + for (let id in errors) { vm.components .filter(component => component.category === 'input') .forEach(component => { - if (component.state.id === id) { - component.state.rejected = true; - component.state.isValid = false; - component.state.message = errors[id].join(' '); + if (component.state._id === id) { + errorMessageSet = true; + + component.state._rejected = true; + component.state._isValid = false; + component.state._message = errors[id].join(' '); } }); } - vm.check(); + if (errorMessageSet) { + vm.check(); + } + + return errorMessageSet; }; vm.validate = () => { @@ -116,7 +132,7 @@ function AtFormController (eventService) { continue; } - if (!vm.components[i].state.isValid) { + if (!vm.components[i].state._isValid) { isValid = false; break; } @@ -133,7 +149,7 @@ function AtFormController (eventService) { } }; - vm.deregisterDynamicComponents = components => { + vm.deregisterInputGroup = components => { for (let i = 0; i < components.length; i++) { for (let j = 0; j < vm.components.length; j++) { if (components[i] === vm.components[j].state) { diff --git a/awx/ui/client/lib/components/index.js b/awx/ui/client/lib/components/index.js index 4838891576..b40db446ed 100644 --- a/awx/ui/client/lib/components/index.js +++ b/awx/ui/client/lib/components/index.js @@ -1,10 +1,10 @@ import actionGroup from './action/action-group.directive'; -import badge from './badge/badge.directive'; -import dynamicInputGroup from './dynamic/input-group.directive'; import form from './form/form.directive'; import formAction from './form/action.directive'; +import inputGroup from './input/group.directive'; import inputLabel from './input/label.directive'; -import inputSearch from './input/search.directive'; +import inputMessage from './input/message.directive'; +import inputNumber from './input/number.directive'; import inputSelect from './input/select.directive'; import inputSecret from './input/secret.directive'; import inputText from './input/text.directive'; @@ -13,20 +13,18 @@ import panel from './panel/panel.directive'; import panelHeading from './panel/heading.directive'; import panelBody from './panel/body.directive'; import popover from './popover/popover.directive'; -import toggleButton from './toggle/button.directive'; -import toggleContent from './toggle/content.directive'; import BaseInputController from './input/base.controller'; angular .module('at.lib.components', []) .directive('atActionGroup', actionGroup) - .directive('atBadge', badge) - .directive('atDynamicInputGroup', dynamicInputGroup) .directive('atForm', form) .directive('atFormAction', formAction) + .directive('atInputGroup', inputGroup) .directive('atInputLabel', inputLabel) - .directive('atInputSearch', inputSearch) + .directive('atInputMessage', inputMessage) + .directive('atInputNumber', inputNumber) .directive('atInputSecret', inputSecret) .directive('atInputSelect', inputSelect) .directive('atInputText', inputText) @@ -35,8 +33,6 @@ angular .directive('atPanelHeading', panelHeading) .directive('atPanelBody', panelBody) .directive('atPopover', popover) - .directive('atToggleButton', toggleButton) - .directive('atToggleContent', toggleContent) .service('BaseInputController', BaseInputController); diff --git a/awx/ui/client/lib/components/input/_index.less b/awx/ui/client/lib/components/input/_index.less index 468b2e929b..c227aa59fb 100644 --- a/awx/ui/client/lib/components/input/_index.less +++ b/awx/ui/client/lib/components/input/_index.less @@ -15,6 +15,14 @@ } } +.at-Input-button { + width: 72px; + + &, &:active, &:hover, &:focus { + background-color: @at-white; + } +} + .at-Input--focus { border-color: @at-blue; } @@ -25,6 +33,34 @@ } } +.at-InputGroup { + padding: 0; + margin: 0; + margin: @at-space-6x 0 0 0; +} + +.at-InputGroup-border { + position: absolute; + width: @at-inset-width; + height: 100%; + background: @at-gray; + left: -@at-inset-width; +} + +.at-InputGroup-title { + .at-mixin-Heading(@at-font-size-2x); + margin-top: 0; + margin-left: @at-space-5x; + margin-bottom: @at-space-4x; +} + +.at-InputGroup-divider { + clear: both; + margin: 0; + padding: 0; + height: @at-space-6x; +} + .at-InputLabel-name { color: @at-gray-dark-4x; font-size: @at-font-size-2x; @@ -32,6 +68,13 @@ text-transform: uppercase; } +.at-InputMessage--rejected { + font-size: @at-font-size; + color: @at-red; + margin: @at-space-3x 0 0 0; + padding: 0; +} + .at-InputLabel-required { color: @at-red; font-weight: @at-font-weight-2x; @@ -40,7 +83,7 @@ margin: @at-space-3x @at-space 0 0; } -.at-InputGroup { +.at-InputSelect { position: relative; width: 100%; @@ -55,10 +98,6 @@ } } -.at-InputSelect { - position: relative; -} - .at-InputSelect-input { position: relative; z-index: 2; @@ -71,19 +110,13 @@ position: absolute; z-index: 1; top: 0; -} -.at-Input-button { - width: 72px; + & > optgroup { + text-transform: uppercase; - &, &:active, &:hover, &:focus { - background-color: @at-white; + & > option { + text-transform: none; + } } } -.at-InputMessage--rejected { - font-size: @at-font-size; - color: @at-red; - margin: @at-space-3x 0 0 0; - padding: 0; -} diff --git a/awx/ui/client/lib/components/input/base.controller.js b/awx/ui/client/lib/components/input/base.controller.js index 814dfc54bf..f534a51e21 100644 --- a/awx/ui/client/lib/components/input/base.controller.js +++ b/awx/ui/client/lib/components/input/base.controller.js @@ -7,9 +7,9 @@ function BaseInputController () { scope.state = scope.state || {}; - scope.state.required = scope.state.required || false; - scope.state.isValid = scope.state.isValid || false; - scope.state.disabled = scope.state.disabled || false; + scope.state._required = scope.state.required || false; + scope.state._isValid = scope.state.isValid || false; + scope.state._disabled = scope.state.disabled || false; form.register(type, scope); @@ -17,13 +17,13 @@ function BaseInputController () { let isValid = true; let message = ''; - if (scope.state.required && !scope.state.value) { + if (scope.state._required && !scope.state._value) { isValid = false; message = REQUIRED_INPUT_MISSING_MESSAGE; } if (scope.state.validate) { - let result = scope.state.validate(scope.state.value); + let result = scope.state._validate(scope.state._value); if (!result.isValid) { isValid = false; @@ -40,10 +40,10 @@ function BaseInputController () { vm.check = () => { let result = vm.validate(); - if (result.isValid !== scope.state.isValid) { - scope.state.rejected = !result.isValid; - scope.state.isValid = result.isValid; - scope.state.message = result.message; + if (result.isValid !== scope.state._isValid) { + scope.state._rejected = !result.isValid; + scope.state._isValid = result.isValid; + scope.state._message = result.message; form.check(); } diff --git a/awx/ui/client/lib/components/input/group.directive.js b/awx/ui/client/lib/components/input/group.directive.js new file mode 100644 index 0000000000..58c985bdbd --- /dev/null +++ b/awx/ui/client/lib/components/input/group.directive.js @@ -0,0 +1,139 @@ +function atInputGroupLink (scope, el, attrs, controllers) { + let groupController = controllers[0]; + let formController = controllers[1]; + let element = el[0].getElementsByClassName('at-InputGroup-container')[0]; + + groupController.init(scope, formController, element); +} + +function AtInputGroupController ($scope, $compile) { + let vm = this || {}; + + let form; + let scope; + let state; + let source; + let element; + + vm.init = (_scope_, _form_, _element_) => { + form = _form_; + scope = _scope_; + element = _element_; + state = scope.state || {}; + source = state._source; + + $scope.$watch('state._source._value', vm.update); + }; + + vm.isValidSource = () => { + if (!source._value || source._value === state._value) { + return false; + } + + return true; + }; + + vm.update = () => { + if (!vm.isValidSource()) { + return; + } + + if (state._group) { + vm.clear(); + } + + state._value = source._value; + + let inputs = state._get(source._value); + let group = vm.createComponentConfigs(inputs); + + vm.insert(group); + state._group = group; + vm.compile(group); + }; + + vm.createComponentConfigs = inputs => { + let group = []; + + inputs.forEach((input, i) => { + if (input.type === 'string') { + if (input.secret && input.multiline) { + input._component = 'at-input-textarea'; + } else if (input.secret) { + input._component = 'at-input-secret'; + } else if (input.multiline) { + input._component = 'at-input-textarea'; + } else { + input._component = 'at-input-text'; + } + } + + group.push(Object.assign({ + _element: vm.createElement(input, i), + _key: 'inputs', + _group: true + }, input)); + }); + + return group; + }; + + vm.createElement = (input, index) => { + let tabindex = Number(scope.tab) + index; + + let element = + `<${input._component} col="${scope.col}" tab="${tabindex}" + state="${state._reference}._group[${index}]"> + `; + + return angular.element(element); + }; + + vm.insert = group => { + let container = document.createElement('div'); + let divider = angular.element(`
`)[0]; + + for (let i = 0; i < group.length; i++) { + if (i !== 0 && (i % (12 / scope.col)) === 0) { + container.appendChild(divider); + } + + container.appendChild(group[i]._element[0]); + } + + element.appendChild(container); + }; + + vm.compile = group => { + group.forEach(component => $compile(component._element[0])(scope.$parent)); + }; + + vm.clear = () => { + form.deregisterInputGroup(state._group); + element.innerHTML = ''; + }; +} + +AtInputGroupController.$inject = ['$scope', '$compile']; + +function atInputGroup (pathService) { + return { + restrict: 'E', + replace: true, + transclude: true, + require: ['atInputGroup', '^^atForm'], + templateUrl: pathService.getPartialPath('components/input/group'), + controller: AtInputGroupController, + controllerAs: 'vm', + link: atInputGroupLink, + scope: { + state: '=', + col: '@', + tab: '@' + } + }; +} + +atInputGroup.$inject = ['PathService']; + +export default atInputGroup; diff --git a/awx/ui/client/lib/components/input/group.partial.html b/awx/ui/client/lib/components/input/group.partial.html new file mode 100644 index 0000000000..6d20836d6a --- /dev/null +++ b/awx/ui/client/lib/components/input/group.partial.html @@ -0,0 +1,13 @@ +
+
+
+
+
+

+ +

+
+
+
+
+
diff --git a/awx/ui/client/lib/components/input/label.directive.js b/awx/ui/client/lib/components/input/label.directive.js index d583ea4990..4837c25c14 100644 --- a/awx/ui/client/lib/components/input/label.directive.js +++ b/awx/ui/client/lib/components/input/label.directive.js @@ -1,12 +1,8 @@ function atInputLabel (pathService) { return { restrict: 'E', - transclude: true, replace: true, - templateUrl: pathService.getPartialPath('components/input/label'), - scope: { - state: '=' - } + templateUrl: pathService.getPartialPath('components/input/label') }; } diff --git a/awx/ui/client/lib/components/input/message.directive.js b/awx/ui/client/lib/components/input/message.directive.js new file mode 100644 index 0000000000..d3c06fdd57 --- /dev/null +++ b/awx/ui/client/lib/components/input/message.directive.js @@ -0,0 +1,11 @@ +function atInputMessage (pathService) { + return { + restrict: 'E', + replace: true, + templateUrl: pathService.getPartialPath('components/input/message'), + }; +} + +atInputMessage.$inject = ['PathService']; + +export default atInputMessage; diff --git a/awx/ui/client/lib/components/input/message.partial.html b/awx/ui/client/lib/components/input/message.partial.html new file mode 100644 index 0000000000..00951434a6 --- /dev/null +++ b/awx/ui/client/lib/components/input/message.partial.html @@ -0,0 +1,4 @@ +

+ {{ state._message }} +

+ diff --git a/awx/ui/client/lib/components/input/number.directive.js b/awx/ui/client/lib/components/input/number.directive.js new file mode 100644 index 0000000000..be803212de --- /dev/null +++ b/awx/ui/client/lib/components/input/number.directive.js @@ -0,0 +1,54 @@ +const DEFAULT_STEP = '1'; +const DEFAULT_MIN = '0'; +const DEFAULT_MAX = '1000000000'; +const DEFAULT_PLACEHOLDER = ''; + +function atInputNumberLink (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 AtInputNumberController (baseInputController) { + let vm = this || {}; + + vm.init = (scope, element, form) => { + baseInputController.call(vm, 'input', scope, element, form); + + scope.state._step = scope.state._step || DEFAULT_STEP; + scope.state._min = scope.state._min || DEFAULT_MIN; + scope.state._max = scope.state._max || DEFAULT_MAX; + scope.state._placeholder = scope.state._placeholder || DEFAULT_PLACEHOLDER; + + vm.check(); + }; +} + +AtInputNumberController.$inject = ['BaseInputController']; + +function atInputNumber (pathService) { + return { + restrict: 'E', + transclude: true, + replace: true, + require: ['^^atForm', 'atInputNumber'], + templateUrl: pathService.getPartialPath('components/input/number'), + controller: AtInputNumberController, + controllerAs: 'vm', + link: atInputNumberLink, + scope: { + state: '=', + col: '@', + tab: '@' + } + }; +} + +atInputNumber.$inject = ['PathService']; + +export default atInputNumber; diff --git a/awx/ui/client/lib/components/input/number.partial.html b/awx/ui/client/lib/components/input/number.partial.html new file mode 100644 index 0000000000..90708edd38 --- /dev/null +++ b/awx/ui/client/lib/components/input/number.partial.html @@ -0,0 +1,19 @@ +
+
+ + + + + +
+
diff --git a/awx/ui/client/lib/components/input/search.directive.js b/awx/ui/client/lib/components/input/search.directive.js deleted file mode 100644 index 36995b6340..0000000000 --- a/awx/ui/client/lib/components/input/search.directive.js +++ /dev/null @@ -1,22 +0,0 @@ -// TODO: i18n - -function atInputSearch (pathService) { - function link (scope) { - scope.config = scope.config || {}; - scope.config.placeholder = scope.config.placeholder || 'SEARCH'; - } - - return { - restrict: 'E', - transclude: true, - templateUrl: pathService.getPartialPath('components/input/search'), - link, - scope: { - config: '=' - } - }; -} - -atInputSearch.$inject = ['PathService']; - -export default atInputSearch; diff --git a/awx/ui/client/lib/components/input/search.partial.html b/awx/ui/client/lib/components/input/search.partial.html deleted file mode 100644 index 4050a86524..0000000000 --- a/awx/ui/client/lib/components/input/search.partial.html +++ /dev/null @@ -1,10 +0,0 @@ -
- -
- -
-
diff --git a/awx/ui/client/lib/components/input/secret.partial.html b/awx/ui/client/lib/components/input/secret.partial.html index aef719c60f..1589d8ce41 100644 --- a/awx/ui/client/lib/components/input/secret.partial.html +++ b/awx/ui/client/lib/components/input/secret.partial.html @@ -1,23 +1,26 @@
- + +
- + ng-disabled="state._disabled || form.disabled" />
-

- {{ state.message }} -

+ +
diff --git a/awx/ui/client/lib/components/input/select.directive.js b/awx/ui/client/lib/components/input/select.directive.js index a2bc2fa558..9a1b004654 100644 --- a/awx/ui/client/lib/components/input/select.directive.js +++ b/awx/ui/client/lib/components/input/select.directive.js @@ -1,6 +1,7 @@ function atInputSelectLink (scope, element, attrs, controllers) { let formController = controllers[0]; let inputController = controllers[1]; + if (scope.tab === '1') { elements.select.focus(); } diff --git a/awx/ui/client/lib/components/input/select.partial.html b/awx/ui/client/lib/components/input/select.partial.html index dd7b5e2c13..5d2a6d9df8 100644 --- a/awx/ui/client/lib/components/input/select.partial.html +++ b/awx/ui/client/lib/components/input/select.partial.html @@ -1,28 +1,25 @@
- -
- + +
+ - + ng-disabled="state._disabled || form.disabled" + ng-options="{{ state._exp }}"> +
-

- {{ state.message }} -

+ +
diff --git a/awx/ui/client/lib/components/input/text.partial.html b/awx/ui/client/lib/components/input/text.partial.html index 7e1354d3a4..6b9dbe3aba 100644 --- a/awx/ui/client/lib/components/input/text.partial.html +++ b/awx/ui/client/lib/components/input/text.partial.html @@ -1,17 +1,17 @@
- - + -

- {{ state.message }} -

+ + +
diff --git a/awx/ui/client/lib/components/input/textarea.partial.html b/awx/ui/client/lib/components/input/textarea.partial.html index ff58753341..209becf4ac 100644 --- a/awx/ui/client/lib/components/input/textarea.partial.html +++ b/awx/ui/client/lib/components/input/textarea.partial.html @@ -1,16 +1,16 @@
- - -

- {{ state.message }} -

+ ng-disabled="state._disabled || form.disabled" /> + +
diff --git a/awx/ui/client/lib/components/panel/body.directive.js b/awx/ui/client/lib/components/panel/body.directive.js index 6011a81d92..da38d9ad76 100644 --- a/awx/ui/client/lib/components/panel/body.directive.js +++ b/awx/ui/client/lib/components/panel/body.directive.js @@ -3,10 +3,7 @@ function atPanelBody (pathService) { restrict: 'E', replace: true, transclude: true, - templateUrl: pathService.getPartialPath('components/panel/body'), - scope: { - state: '=' - } + templateUrl: pathService.getPartialPath('components/panel/body') }; } diff --git a/awx/ui/client/lib/components/panel/panel.directive.js b/awx/ui/client/lib/components/panel/panel.directive.js index db5212ce3c..7f3c0abfbf 100644 --- a/awx/ui/client/lib/components/panel/panel.directive.js +++ b/awx/ui/client/lib/components/panel/panel.directive.js @@ -1,27 +1,44 @@ +function atPanelLink (scope, el, attrs, controllers) { + let panelController = controllers[0]; + + panelController.init(scope, el); +} + function AtPanelController ($state) { let vm = this; + let scope; + let el; + + vm.init = (_scope_, _el_) => { + scope = _scope_; + el = _el_; + }; + vm.dismiss = () => { $state.go('^'); }; - vm.use = scope => { - scope.dismiss = this.dismiss; + vm.use = child => { + child.dismiss = vm.dismiss; }; } AtPanelController.$inject = ['$state']; -function atPanel (pathService) { +function atPanel (pathService, _$animate_) { return { restrict: 'E', replace: true, + require: ['atPanel'], transclude: true, templateUrl: pathService.getPartialPath('components/panel/panel'), controller: AtPanelController, controllerAs: 'vm', + link: atPanelLink, scope: { - state: '=' + state: '=', + animate: '@' } }; } diff --git a/awx/ui/client/lib/components/panel/panel.partial.html b/awx/ui/client/lib/components/panel/panel.partial.html index fdd858378f..476653e390 100644 --- a/awx/ui/client/lib/components/panel/panel.partial.html +++ b/awx/ui/client/lib/components/panel/panel.partial.html @@ -1,3 +1,3 @@
- +
diff --git a/awx/ui/client/lib/components/toggle/_index.less b/awx/ui/client/lib/components/toggle/_index.less deleted file mode 100644 index 0c3e0a824a..0000000000 --- a/awx/ui/client/lib/components/toggle/_index.less +++ /dev/null @@ -1,32 +0,0 @@ -.at-ToggleButton { - &, &:focus { - border-color: @at-gray-light; - background-color: @at-white; - } - - &:hover { - background-color: @at-gray-light-2x; - } - - & > span:hover { - border-color: @at-gray-light; - background-color: inherit; - } -} - -.at-ToggleButton--show { - &, &:hover, &:focus { - background-color: @at-blue; - border-color: @at-blue; - color: @at-white; - } -} - -.at-ToggleContent-well { - margin: @at-space-2x 0 0 0; - padding: @at-space-3x; - border-radius: @at-border-radius; - border: 1px solid transparent; - background-color: @at-gray-light-2x; - color: @at-gray-dark-2x; -} diff --git a/awx/ui/client/lib/components/toggle/button.directive.js b/awx/ui/client/lib/components/toggle/button.directive.js deleted file mode 100644 index b20ca29eee..0000000000 --- a/awx/ui/client/lib/components/toggle/button.directive.js +++ /dev/null @@ -1,12 +0,0 @@ -function atToggleButton () { - return { - restrict: 'E', - transclude: true, - templateUrl: 'static/partials/components/toggle/button.partial.html', - scope: { - config: '=' - } - }; -} - -export default atToggleButton; diff --git a/awx/ui/client/lib/components/toggle/button.partial.html b/awx/ui/client/lib/components/toggle/button.partial.html deleted file mode 100644 index e3f87eeb14..0000000000 --- a/awx/ui/client/lib/components/toggle/button.partial.html +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/awx/ui/client/lib/components/toggle/content.directive.js b/awx/ui/client/lib/components/toggle/content.directive.js deleted file mode 100644 index 3e54e07594..0000000000 --- a/awx/ui/client/lib/components/toggle/content.directive.js +++ /dev/null @@ -1,12 +0,0 @@ -function atToggleContent () { - return { - restrict: 'E', - transclude: true, - templateUrl: 'static/partials/component/toggle/content.partial.html', - scope: { - config: '=' - } - }; -} - -export default atToggleContent; diff --git a/awx/ui/client/lib/components/toggle/content.partial.html b/awx/ui/client/lib/components/toggle/content.partial.html deleted file mode 100644 index 941328a5a2..0000000000 --- a/awx/ui/client/lib/components/toggle/content.partial.html +++ /dev/null @@ -1,10 +0,0 @@ -
-
-
- {{ config.content.text }} -
-
- - -
- diff --git a/awx/ui/client/lib/models/CredentialType.js b/awx/ui/client/lib/models/CredentialType.js index eee40a5514..9ce565bf5e 100644 --- a/awx/ui/client/lib/models/CredentialType.js +++ b/awx/ui/client/lib/models/CredentialType.js @@ -15,16 +15,6 @@ function CredentialTypeModel (BaseModel) { })); }; - this.getTypeFromName = name => { - let type = this.model.get.data.results.filter(result => result.name === name); - - if (!type.length) { - return null; - } - - return this.mergeInputProperties(type[0]); - }; - this.mergeInputProperties = type => { return type.inputs.fields.map(field => { if (!type.inputs.required || type.inputs.required.indexOf(field.id) === -1) { diff --git a/awx/ui/client/src/app.js b/awx/ui/client/src/app.js index 06530ba096..60292c1520 100644 --- a/awx/ui/client/src/app.js +++ b/awx/ui/client/src/app.js @@ -72,6 +72,7 @@ import footer from './footer/main'; import scheduler from './scheduler/main'; import instanceGroups from './instance-groups/main'; +import 'angular-animate'; import '../lib/components'; import '../lib/models'; import '../lib/services'; @@ -136,6 +137,7 @@ var tower = angular.module('Tower', [ 'AWDirectives', 'features', + 'ngAnimate', 'at.lib.components', 'at.lib.models', 'at.lib.services',