mirror of
https://github.com/ansible/awx.git
synced 2026-02-22 13:36:02 -03:30
update users token crud list to utilize string file
This commit is contained in:
@@ -15,11 +15,21 @@ function TokensStrings (BaseString) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
ns.add = {
|
ns.add = {
|
||||||
PANEL_TITLE: t.s('CREATE TOKEN')
|
PANEL_TITLE: t.s('CREATE TOKEN'),
|
||||||
|
APP_PLACEHOLDER: t.s('SELECT AN APPLICATION'),
|
||||||
|
SCOPE_HELP_TEXT: t.s('Specify a scope for the token\'s access'),
|
||||||
|
TOKEN_MODAL_HEADER: t.s('TOKEN INFORMATION'),
|
||||||
|
TOKEN_LABEL: t.s('TOKEN'),
|
||||||
|
REFRESH_TOKEN_LABEL: t.s('REFRESH TOKEN'),
|
||||||
|
TOKEN_EXPIRES_LABEL: t.s('EXPIRES'),
|
||||||
|
ERROR_HEADER: t.s('COULD NOT CREATE TOKEN'),
|
||||||
|
ERROR_BODY_LABEL: t.s('Returned status:'),
|
||||||
|
LAST_USED_LABEL: t.s('by'),
|
||||||
|
DELETE_ACTION_LABEL: t.s('DELETE')
|
||||||
};
|
};
|
||||||
|
|
||||||
ns.list = {
|
ns.list = {
|
||||||
ROW_ITEM_LABEL_EXPIRED: t.s('DESCRIPTION'),
|
ROW_ITEM_LABEL_DESCRIPTION: t.s('DESCRIPTION'),
|
||||||
ROW_ITEM_LABEL_EXPIRED: t.s('EXPIRATION'),
|
ROW_ITEM_LABEL_EXPIRED: t.s('EXPIRATION'),
|
||||||
ROW_ITEM_LABEL_USED: t.s('LAST USED')
|
ROW_ITEM_LABEL_USED: t.s('LAST USED')
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -22,14 +22,14 @@ function AddTokensController (models, $state, strings, Rest, Alert, Wait, GetBas
|
|||||||
vm.form.application._resource = 'application';
|
vm.form.application._resource = 'application';
|
||||||
vm.form.application._route = 'users.edit.tokens.add.application';
|
vm.form.application._route = 'users.edit.tokens.add.application';
|
||||||
vm.form.application._model = application;
|
vm.form.application._model = application;
|
||||||
vm.form.application._placeholder = strings.get('SELECT AN APPLICATION');
|
vm.form.application._placeholder = strings.get('add.APP_PLACEHOLDER');
|
||||||
vm.form.application.required = true;
|
vm.form.application.required = true;
|
||||||
|
|
||||||
vm.form.description.required = false;
|
vm.form.description.required = false;
|
||||||
|
|
||||||
vm.form.scope = {
|
vm.form.scope = {
|
||||||
choices: ['', 'read', 'write'],
|
choices: ['', 'read', 'write'],
|
||||||
help_text: 'Specify a scope for the token\'s access',
|
help_text: strings.get('add.SCOPE_HELP_TEXT'),
|
||||||
id: 'scope',
|
id: 'scope',
|
||||||
label: 'Scope',
|
label: 'Scope',
|
||||||
required: true,
|
required: true,
|
||||||
@@ -43,10 +43,10 @@ function AddTokensController (models, $state, strings, Rest, Alert, Wait, GetBas
|
|||||||
Rest.setUrl(GetBasePath('users') + $state.params.user_id + '/authorized_tokens');
|
Rest.setUrl(GetBasePath('users') + $state.params.user_id + '/authorized_tokens');
|
||||||
return Rest.post(data)
|
return Rest.post(data)
|
||||||
.then(({data}) => {
|
.then(({data}) => {
|
||||||
Alert('TOKEN INFORMATION', `
|
Alert(strings.get('add.TOKEN_MODAL_HEADER'), `
|
||||||
<div class="TokenModal">
|
<div class="TokenModal">
|
||||||
<div class="TokenModal-label">
|
<div class="TokenModal-label">
|
||||||
TOKEN
|
${strings.get('add.TOKEN_LABEL')}
|
||||||
</div>
|
</div>
|
||||||
<div class="TokenModal-value">
|
<div class="TokenModal-value">
|
||||||
${data.token}
|
${data.token}
|
||||||
@@ -54,7 +54,7 @@ function AddTokensController (models, $state, strings, Rest, Alert, Wait, GetBas
|
|||||||
</div>
|
</div>
|
||||||
<div class="TokenModal">
|
<div class="TokenModal">
|
||||||
<div class="TokenModal-label">
|
<div class="TokenModal-label">
|
||||||
REFRESH TOKEN
|
${strings.get('add.REFRESH_TOKEN_LABEL')}
|
||||||
</div>
|
</div>
|
||||||
<div class="TokenModal-value">
|
<div class="TokenModal-value">
|
||||||
${data.refresh_token}
|
${data.refresh_token}
|
||||||
@@ -62,7 +62,7 @@ function AddTokensController (models, $state, strings, Rest, Alert, Wait, GetBas
|
|||||||
</div>
|
</div>
|
||||||
<div class="TokenModal">
|
<div class="TokenModal">
|
||||||
<div class="TokenModal-label">
|
<div class="TokenModal-label">
|
||||||
EXPIRES
|
${strings.get('add.TOKEN_EXPIRES_LABEL')}
|
||||||
</div>
|
</div>
|
||||||
<div class="TokenModal-value">
|
<div class="TokenModal-value">
|
||||||
${$filter('longDate')(data.expires)}
|
${$filter('longDate')(data.expires)}
|
||||||
@@ -73,8 +73,8 @@ function AddTokensController (models, $state, strings, Rest, Alert, Wait, GetBas
|
|||||||
})
|
})
|
||||||
.catch(({data, status}) => {
|
.catch(({data, status}) => {
|
||||||
ProcessErrors($scope, data, status, null, {
|
ProcessErrors($scope, data, status, null, {
|
||||||
hdr: 'COULD NOT CREATE TOKEN',
|
hdr: strings.get('add.ERROR_HEADER'),
|
||||||
msg: `Returned status: ${status}`
|
msg: `${strings.get('add.ERROR_BODY_LABEL')} ${status}`
|
||||||
});
|
});
|
||||||
Wait('stop');
|
Wait('stop');
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export default {
|
|||||||
params: {
|
params: {
|
||||||
},
|
},
|
||||||
ncyBreadcrumb: {
|
ncyBreadcrumb: {
|
||||||
label: N_("ADD TOKEN")
|
label: N_("CREATE TOKEN")
|
||||||
},
|
},
|
||||||
views: {
|
views: {
|
||||||
'preFormView@users.edit': {
|
'preFormView@users.edit': {
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ function ListTokensController (
|
|||||||
const { username, id } = _.get(user, 'summary_fields.last_used', {});
|
const { username, id } = _.get(user, 'summary_fields.last_used', {});
|
||||||
|
|
||||||
if (username && id) {
|
if (username && id) {
|
||||||
html += ` by <a href="/#/users/${id}">${$filter('sanitize')(username)}</a>`;
|
html += ` ${strings.get('add.LAST_USED_LABEL')} <a href="/#/users/${id}">${$filter('sanitize')(username)}</a>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return html;
|
return html;
|
||||||
@@ -98,7 +98,7 @@ function ListTokensController (
|
|||||||
resourceName: 'token',
|
resourceName: 'token',
|
||||||
body: deleteModalBody,
|
body: deleteModalBody,
|
||||||
action,
|
action,
|
||||||
actionText: 'DELETE'
|
actionText: strings.get('add.DELETE_ACTION_LABEL')
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user