diff --git a/awx/ui/client/features/_index.less b/awx/ui/client/features/_index.less index d8685d6639..b7165c94c9 100644 --- a/awx/ui/client/features/_index.less +++ b/awx/ui/client/features/_index.less @@ -1,3 +1,16 @@ @import 'portalMode/_index'; @import 'output/_index'; -@import 'users/tokens/_index'; + +/** @define Popup Modal after create new token and applicaiton and save form */ +.PopupModal { + display: flex; +} + +.PopupModal-label { + font-weight: bold; + width: 130px; +} + +.PopupModal-value { + width: 70%; +} \ No newline at end of file diff --git a/awx/ui/client/features/applications/add-applications.controller.js b/awx/ui/client/features/applications/add-applications.controller.js index 4318d29c82..f490ddcc82 100644 --- a/awx/ui/client/features/applications/add-applications.controller.js +++ b/awx/ui/client/features/applications/add-applications.controller.js @@ -1,4 +1,4 @@ -function AddApplicationsController (models, $state, strings, $scope) { +function AddApplicationsController (models, $state, strings, $scope, Alert, $filter) { const vm = this || {}; const { application, me, organization } = models; @@ -60,6 +60,41 @@ function AddApplicationsController (models, $state, strings, $scope) { }; vm.form.onSaveSuccess = res => { + if (res.data && res.data.client_id) { + const name = res.data.name ? + `
+
+ ${strings.get('add.NAME_LABEL')} +
+
+ ${res.data.name} +
+
` : ''; + const clientId = res.data.client_id ? + `
+
+ ${strings.get('add.CLIENT_ID_LABEL')} +
+
+ ${res.data.client_id} +
+
` : ''; + const clientSecret = res.data.client_secret ? + `
+
+ ${strings.get('add.CLIENT_SECRECT_LABEL')} +
+
+ ${res.data.client_secret} +
+
` : ''; + + Alert(strings.get('add.MODAL_HEADER'), ` + ${$filter('sanitize')(name)} + ${clientId} + ${clientSecret} + `, null, null, null, null, null, true); + } $state.go('applications.edit', { application_id: res.data.id }, { reload: true }); }; @@ -74,7 +109,9 @@ AddApplicationsController.$inject = [ 'resolvedModels', '$state', 'ApplicationsStrings', - '$scope' + '$scope', + 'Alert', + '$filter', ]; export default AddApplicationsController; diff --git a/awx/ui/client/features/applications/applications.strings.js b/awx/ui/client/features/applications/applications.strings.js index ab4f8ea253..f6fb73f56a 100644 --- a/awx/ui/client/features/applications/applications.strings.js +++ b/awx/ui/client/features/applications/applications.strings.js @@ -21,7 +21,11 @@ function ApplicationsStrings (BaseString) { }; ns.add = { - PANEL_TITLE: t.s('NEW APPLICATION') + PANEL_TITLE: t.s('NEW APPLICATION'), + CLIENT_ID_LABEL: t.s('CLIENT ID'), + CLIENT_SECRECT_LABEL: t.s('CLIENT SECRET'), + MODAL_HEADER: t.s('APPLICATION INFORMATION'), + NAME_LABEL: t.s('NAME'), }; ns.list = { diff --git a/awx/ui/client/features/users/tokens/_index.less b/awx/ui/client/features/users/tokens/_index.less deleted file mode 100644 index f1052b5fa6..0000000000 --- a/awx/ui/client/features/users/tokens/_index.less +++ /dev/null @@ -1,9 +0,0 @@ -/** @define TokenModal */ -.TokenModal { - display: flex; -} - -.TokenModal-label { - font-weight: bold; - width: 130px; -} diff --git a/awx/ui/client/features/users/tokens/users-tokens-add.controller.js b/awx/ui/client/features/users/tokens/users-tokens-add.controller.js index 4ad1fa2d27..76236238bc 100644 --- a/awx/ui/client/features/users/tokens/users-tokens-add.controller.js +++ b/awx/ui/client/features/users/tokens/users-tokens-add.controller.js @@ -58,30 +58,30 @@ function AddTokensController ( return postToken .then(({ data }) => { const refreshHTML = data.refresh_token ? - `
-
+ `
+
${strings.get('add.REFRESH_TOKEN_LABEL')}
-
+
${data.refresh_token}
` : ''; Alert(strings.get('add.TOKEN_MODAL_HEADER'), ` -
-
+
+
${strings.get('add.TOKEN_LABEL')}
-
+
${data.token}
${refreshHTML} -
-
+
+
${strings.get('add.TOKEN_EXPIRES_LABEL')}
-
+
${$filter('longDate')(data.expires)}