From 094b696fdceda78b14465936947738bbaf4d3416 Mon Sep 17 00:00:00 2001 From: Ken Hoes Date: Wed, 11 May 2016 10:59:35 -0400 Subject: [PATCH 1/4] Credential UX audit cleanup --- awx/ui/client/legacy-styles/ansible-ui.less | 13 +++++++++++++ awx/ui/client/legacy-styles/forms.less | 5 +++++ awx/ui/client/src/app.js | 12 ++++++++---- awx/ui/client/src/controllers/Credentials.js | 19 ++++++++++--------- awx/ui/client/src/helpers/Credentials.js | 11 +++++++---- .../client/src/search/tagSearch.partial.html | 2 +- 6 files changed, 44 insertions(+), 18 deletions(-) diff --git a/awx/ui/client/legacy-styles/ansible-ui.less b/awx/ui/client/legacy-styles/ansible-ui.less index 6c06dbf4e2..9ac7f2d272 100644 --- a/awx/ui/client/legacy-styles/ansible-ui.less +++ b/awx/ui/client/legacy-styles/ansible-ui.less @@ -422,6 +422,19 @@ textarea.allowresize { max-width: 325px; background-color: @default-interface-txt; color: @default-bg; //white + + code { + color: #161b1f; + background-color: #e1e1e1; + line-height: 18px; + } + + a { + color: @default-warning; + &:hover { + color: @default-warning-hov; + } + } } .popover.right>.arrow:after { border-right-color: @default-interface-txt; diff --git a/awx/ui/client/legacy-styles/forms.less b/awx/ui/client/legacy-styles/forms.less index b753dd8ad1..0913f37354 100644 --- a/awx/ui/client/legacy-styles/forms.less +++ b/awx/ui/client/legacy-styles/forms.less @@ -200,6 +200,11 @@ .Form-textAreaLabel{ width:100%; + order: 1; +} + +.Form-formGroup.Form-textAreaLabel { + max-width: 100%; } .Form-textArea{ diff --git a/awx/ui/client/src/app.js b/awx/ui/client/src/app.js index 9a2e38ccfd..e03acc43b0 100644 --- a/awx/ui/client/src/app.js +++ b/awx/ui/client/src/app.js @@ -422,6 +422,10 @@ var tower = angular.module('Tower', [ controller: CredentialsEdit, data: { activityStreamId: 'credential_id' + }, + ncyBreadcrumb: { + parent: "credentials", + label: "EDIT CREDENTIAL" } }). @@ -742,12 +746,12 @@ var tower = angular.module('Tower', [ // remove any lingering intervals // except on jobDetails.* states var jobDetailStates = [ - 'jobDetail', - 'jobDetail.host-summary', + 'jobDetail', + 'jobDetail.host-summary', 'jobDetail.host-event.details', - 'jobDetail.host-event.json', + 'jobDetail.host-event.json', 'jobDetail.host-events', - 'jobDetail.host-event.stdout' + 'jobDetail.host-event.stdout' ]; if ($rootScope.jobDetailInterval && !_.includes(jobDetailStates, next.name) ) { window.clearInterval($rootScope.jobDetailInterval); diff --git a/awx/ui/client/src/controllers/Credentials.js b/awx/ui/client/src/controllers/Credentials.js index f7115aafb5..3db1512c06 100644 --- a/awx/ui/client/src/controllers/Credentials.js +++ b/awx/ui/client/src/controllers/Credentials.js @@ -15,7 +15,6 @@ export function CredentialsList($scope, $rootScope, $location, $log, $stateParams, Rest, Alert, CredentialList, GenerateList, Prompt, SearchInit, PaginateInit, ReturnToCaller, ClearScope, ProcessErrors, GetBasePath, SelectionInit, GetChoices, Wait, $state) { - ClearScope(); Wait('start'); @@ -33,7 +32,6 @@ export function CredentialsList($scope, $rootScope, $location, $log, $scope.credentialLoading = true; url = GetBasePath(base) + ( (base === 'users') ? $stateParams.user_id + '/credentials/' : $stateParams.team_id + '/credentials/' ); - if (mode === 'select') { SelectionInit({ scope: $scope, list: list, url: url, returnToCaller: 1 }); } @@ -119,13 +117,15 @@ export function CredentialsList($scope, $rootScope, $location, $log, actionText: 'DELETE' }); }; + + $scope.$emit('choicesReadyCredential'); } CredentialsList.$inject = ['$scope', '$rootScope', '$location', '$log', '$stateParams', 'Rest', 'Alert', 'CredentialList', 'generateList', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors', 'GetBasePath', 'SelectionInit', 'GetChoices', 'Wait', - '$state' + '$state', ]; @@ -317,13 +317,15 @@ CredentialsAdd.$inject = ['$scope', '$rootScope', '$compile', '$location', export function CredentialsEdit($scope, $rootScope, $compile, $location, $log, - $stateParams, CredentialForm, GenerateForm, Rest, Alert, ProcessErrors, + $stateParams, $timeout, CredentialForm, GenerateForm, Rest, Alert, ProcessErrors, RelatedSearchInit, RelatedPaginateInit, ReturnToCaller, ClearScope, Prompt, GetBasePath, GetChoices, KindChange, OrganizationList, LookUpInit, Empty, - OwnerChange, FormSave, Wait, $state, CreateSelect2) { + OwnerChange, FormSave, Wait, $state, CreateSelect2, Authorization) { + if (!$rootScope.current_user) { + Authorization.restoreUserInfo(); + } ClearScope(); - var defaultUrl = GetBasePath('credentials'), generator = GenerateForm, form = CredentialForm, @@ -331,7 +333,6 @@ export function CredentialsEdit($scope, $rootScope, $compile, $location, $log, master = {}, id = $stateParams.credential_id, relatedSets = {}; - generator.inject(form, { mode: 'edit', related: true, scope: $scope }); generator.reset(); $scope.id = id; @@ -668,9 +669,9 @@ export function CredentialsEdit($scope, $rootScope, $compile, $location, $log, } CredentialsEdit.$inject = ['$scope', '$rootScope', '$compile', '$location', - '$log', '$stateParams', 'CredentialForm', 'GenerateForm', 'Rest', 'Alert', + '$log', '$stateParams', '$timeout', 'CredentialForm', 'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'RelatedSearchInit', 'RelatedPaginateInit', 'ReturnToCaller', 'ClearScope', 'Prompt', 'GetBasePath', 'GetChoices', 'KindChange', 'OrganizationList', 'LookUpInit', 'Empty', 'OwnerChange', - 'FormSave', 'Wait', '$state', 'CreateSelect2' + 'FormSave', 'Wait', '$state', 'CreateSelect2', 'Authorization' ]; diff --git a/awx/ui/client/src/helpers/Credentials.js b/awx/ui/client/src/helpers/Credentials.js index b5e3fbd3d1..6e79c01cc5 100644 --- a/awx/ui/client/src/helpers/Credentials.js +++ b/awx/ui/client/src/helpers/Credentials.js @@ -39,7 +39,7 @@ angular.module('CredentialsHelper', ['Utilities']) scope.project_required = false; scope.subscription_required = false; scope.key_description = "Paste the contents of the SSH private key file.
esc or click to close
"; - scope.key_hint= "drag and drop an SSH private key file on the field below"; + scope.key_hint= "paste or drag and drop an SSH private key file on the field below"; scope.host_required = false; scope.password_required = false; scope.hostLabel = ''; @@ -65,7 +65,7 @@ angular.module('CredentialsHelper', ['Utilities']) scope.domain_required = false; scope.subscription_required = false; scope.key_description = "Paste the contents of the SSH private key file."; - scope.key_hint= "drag and drop an SSH private key file on the field below"; + scope.key_hint= "paste or drag and drop an SSH private key file on the field below"; scope.host_required = false; scope.password_required = false; scope.hostLabel = ''; @@ -222,8 +222,8 @@ angular.module('CredentialsHelper', ['Utilities']) } ]) -.factory('FormSave', ['$rootScope', 'Refresh', '$location', 'Alert', 'Rest', 'ProcessErrors', 'Empty', 'GetBasePath', 'CredentialForm', 'ReturnToCaller', 'Wait', - function ($rootScope, Refresh, $location, Alert, Rest, ProcessErrors, Empty, GetBasePath, CredentialForm, ReturnToCaller, Wait) { +.factory('FormSave', ['$rootScope', 'Refresh', '$location', 'Alert', 'Rest', 'ProcessErrors', 'Empty', 'GetBasePath', 'CredentialForm', 'ReturnToCaller', 'Wait', '$state', + function ($rootScope, Refresh, $location, Alert, Rest, ProcessErrors, Empty, GetBasePath, CredentialForm, ReturnToCaller, Wait, $state) { return function (params) { var scope = params.scope, mode = params.mode, @@ -293,6 +293,8 @@ angular.module('CredentialsHelper', ['Utilities']) else { ReturnToCaller(1); } + $state.go('credentials.edit', {credential_id: data.id}, {reload: true}); + }) .error(function (data, status) { Wait('stop'); @@ -314,6 +316,7 @@ angular.module('CredentialsHelper', ['Utilities']) else { ReturnToCaller(1); } + }) .error(function (data, status) { Wait('stop'); diff --git a/awx/ui/client/src/search/tagSearch.partial.html b/awx/ui/client/src/search/tagSearch.partial.html index 18a8d85d53..16138d3109 100644 --- a/awx/ui/client/src/search/tagSearch.partial.html +++ b/awx/ui/client/src/search/tagSearch.partial.html @@ -1,5 +1,5 @@
-
+
Date: Wed, 11 May 2016 14:25:34 -0400 Subject: [PATCH 2/4] Added copy in for host tool tips --- awx/ui/client/src/helpers/Credentials.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/awx/ui/client/src/helpers/Credentials.js b/awx/ui/client/src/helpers/Credentials.js index 6e79c01cc5..2abb06e4eb 100644 --- a/awx/ui/client/src/helpers/Credentials.js +++ b/awx/ui/client/src/helpers/Credentials.js @@ -75,7 +75,6 @@ angular.module('CredentialsHelper', ['Utilities']) scope.passwordLabel = 'Password (API Key)'; scope.projectPopOver = "

The project value

"; scope.hostPopOver = "

The host value

"; - if (!Empty(scope.kind)) { // Apply kind specific settings switch (scope.kind.value) { @@ -131,6 +130,7 @@ angular.module('CredentialsHelper', ['Utilities']) scope.password_required = true; scope.hostLabel = "vCenter Host"; scope.passwordLabel = 'Password'; + scope.hostPopOver = "Enter the hostname or IP address which corresponds to your VMware vCenter."; break; case 'openstack': scope.hostLabel = "Host (Authentication URL)"; @@ -152,6 +152,8 @@ angular.module('CredentialsHelper', ['Utilities']) scope.passwordLabel = 'Password'; scope.host_required = true; scope.hostLabel = "Satellite 6 Host"; + scope.hostPopOver = "Enter the hostname or IP address name which
" + + "corresponds to your Red Hat Satellite 6 server."; break; case 'cloudforms': scope.username_required = true; @@ -159,6 +161,8 @@ angular.module('CredentialsHelper', ['Utilities']) scope.passwordLabel = 'Password'; scope.host_required = true; scope.hostLabel = "CloudForms Host"; + scope.hostPopOver = "Enter the hostname or IP address for the virtual
" + + " machine which is hosting the CloudForm appliance."; break; case 'net': scope.username_required = true; @@ -294,7 +298,7 @@ angular.module('CredentialsHelper', ['Utilities']) ReturnToCaller(1); } $state.go('credentials.edit', {credential_id: data.id}, {reload: true}); - + }) .error(function (data, status) { Wait('stop'); From 86b7d08b58a292fc5d89d5711c99240140b536fc Mon Sep 17 00:00:00 2001 From: Ken Hoes Date: Thu, 12 May 2016 10:04:09 -0400 Subject: [PATCH 3/4] PR feedback fixes --- awx/ui/client/legacy-styles/ansible-ui.less | 4 ++-- awx/ui/client/src/controllers/Credentials.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/awx/ui/client/legacy-styles/ansible-ui.less b/awx/ui/client/legacy-styles/ansible-ui.less index 9ac7f2d272..7cdb4f7da5 100644 --- a/awx/ui/client/legacy-styles/ansible-ui.less +++ b/awx/ui/client/legacy-styles/ansible-ui.less @@ -424,8 +424,8 @@ textarea.allowresize { color: @default-bg; //white code { - color: #161b1f; - background-color: #e1e1e1; + color: @default-data-txt; + background-color: @default-white-button-bord; line-height: 18px; } diff --git a/awx/ui/client/src/controllers/Credentials.js b/awx/ui/client/src/controllers/Credentials.js index 3db1512c06..db1b3a3527 100644 --- a/awx/ui/client/src/controllers/Credentials.js +++ b/awx/ui/client/src/controllers/Credentials.js @@ -317,7 +317,7 @@ CredentialsAdd.$inject = ['$scope', '$rootScope', '$compile', '$location', export function CredentialsEdit($scope, $rootScope, $compile, $location, $log, - $stateParams, $timeout, CredentialForm, GenerateForm, Rest, Alert, ProcessErrors, + $stateParams, CredentialForm, GenerateForm, Rest, Alert, ProcessErrors, RelatedSearchInit, RelatedPaginateInit, ReturnToCaller, ClearScope, Prompt, GetBasePath, GetChoices, KindChange, OrganizationList, LookUpInit, Empty, OwnerChange, FormSave, Wait, $state, CreateSelect2, Authorization) { @@ -669,7 +669,7 @@ export function CredentialsEdit($scope, $rootScope, $compile, $location, $log, } CredentialsEdit.$inject = ['$scope', '$rootScope', '$compile', '$location', - '$log', '$stateParams', '$timeout', 'CredentialForm', 'GenerateForm', 'Rest', 'Alert', + '$log', '$stateParams', 'CredentialForm', 'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'RelatedSearchInit', 'RelatedPaginateInit', 'ReturnToCaller', 'ClearScope', 'Prompt', 'GetBasePath', 'GetChoices', 'KindChange', 'OrganizationList', 'LookUpInit', 'Empty', 'OwnerChange', From 7361b8cef32cb100859d9f7edc76f3dd62ea1b24 Mon Sep 17 00:00:00 2001 From: Ken Hoes Date: Mon, 16 May 2016 09:44:11 -0400 Subject: [PATCH 4/4] Fixed unrelated jshint errors --- awx/ui/client/src/inventory-scripts/add/add.controller.js | 2 +- .../client/src/job-detail/host-event/host-event.controller.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/awx/ui/client/src/inventory-scripts/add/add.controller.js b/awx/ui/client/src/inventory-scripts/add/add.controller.js index 66c54d49df..e005515215 100644 --- a/awx/ui/client/src/inventory-scripts/add/add.controller.js +++ b/awx/ui/client/src/inventory-scripts/add/add.controller.js @@ -48,7 +48,7 @@ export default organization: scope.organization, script: scope.script }) - .success(function (data) { + .success(function () { $state.go('inventoryScripts', {}, {reload: true}); Wait('stop'); }) diff --git a/awx/ui/client/src/job-detail/host-event/host-event.controller.js b/awx/ui/client/src/job-detail/host-event/host-event.controller.js index 8b97a11765..280c7256a6 100644 --- a/awx/ui/client/src/job-detail/host-event/host-event.controller.js +++ b/awx/ui/client/src/job-detail/host-event/host-event.controller.js @@ -17,10 +17,10 @@ if (typeof value === 'object'){return false;} else {return true;} }; - + //var CodeMirror; var codeMirror = function(el, json){ var container = $(el)[0]; - var editor = CodeMirror.fromTextArea(container, { + var editor = codeMirror.fromTextArea(container, { lineNumbers: true, mode: {name: "javascript", json: true} });