mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 18:40:01 -03:30
Merge pull request #1750 from jlmitch5/newTokensListRowItems
add new row items to user's token list
This commit is contained in:
commit
79ccabd0bd
@ -78,7 +78,7 @@ function ListApplicationsController (
|
||||
}
|
||||
|
||||
if (parseInt($state.params.application_id, 10) === app.id) {
|
||||
$state.go('^', reloadListStateParams, { reload: true });
|
||||
$state.go('applications', reloadListStateParams, { reload: true });
|
||||
} else {
|
||||
$state.go('.', reloadListStateParams, { reload: true });
|
||||
}
|
||||
|
||||
@ -34,7 +34,10 @@ function TokensStrings (BaseString) {
|
||||
ns.list = {
|
||||
ROW_ITEM_LABEL_DESCRIPTION: t.s('DESCRIPTION'),
|
||||
ROW_ITEM_LABEL_EXPIRED: t.s('EXPIRATION'),
|
||||
ROW_ITEM_LABEL_USED: t.s('LAST USED')
|
||||
ROW_ITEM_LABEL_USED: t.s('LAST USED'),
|
||||
ROW_ITEM_LABEL_SCOPE: t.s('SCOPE'),
|
||||
ROW_ITEM_LABEL_APPLICATION: t.s('APPLICATION'),
|
||||
HEADER: appName => t.s('{{ appName }} Token', { appName }),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -21,6 +21,11 @@ export default {
|
||||
name: 'users.edit.tokens.add',
|
||||
params: {
|
||||
},
|
||||
data: {
|
||||
activityStream: true,
|
||||
activityStreamTarget: 'o_auth2_access_token',
|
||||
noActivityStreamID: true
|
||||
},
|
||||
ncyBreadcrumb: {
|
||||
label: N_('CREATE TOKEN')
|
||||
},
|
||||
|
||||
@ -38,6 +38,16 @@ function ListTokensController (
|
||||
vm.tokensCount = dataset.count;
|
||||
});
|
||||
|
||||
vm.getScopeString = str => {
|
||||
if (str === 'Read') {
|
||||
return vm.strings.get('add.SCOPE_READ_LABEL');
|
||||
} else if (str === 'Write') {
|
||||
return vm.strings.get('add.SCOPE_WRITE_LABEL');
|
||||
}
|
||||
|
||||
return undefined;
|
||||
};
|
||||
|
||||
vm.getLastUsed = token => {
|
||||
const lastUsed = _.get(token, 'last_used');
|
||||
|
||||
@ -95,7 +105,7 @@ function ListTokensController (
|
||||
|
||||
Prompt({
|
||||
hdr: strings.get('deleteResource.HEADER'),
|
||||
resourceName: 'token',
|
||||
resourceName: strings.get('list.HEADER', tok.summary_fields.application.name),
|
||||
body: deleteModalBody,
|
||||
action,
|
||||
actionText: strings.get('add.DELETE_ACTION_LABEL')
|
||||
|
||||
@ -25,15 +25,24 @@
|
||||
<at-row ng-repeat="token in tokens">
|
||||
<div class="at-Row-items">
|
||||
<at-row-item
|
||||
header-value="{{ token.summary_fields.application.name }}">
|
||||
header-value="{{ vm.strings.get('list.HEADER', token.summary_fields.application.name) }}">
|
||||
</at-row-item>
|
||||
<at-row-item
|
||||
label-value="{{:: vm.strings.get('list.ROW_ITEM_LABEL_DESCRIPTION') }}"
|
||||
value="{{ token.description }}">
|
||||
</at-row-item>
|
||||
<at-row-item
|
||||
label-value="{{:: vm.strings.get('list.ROW_ITEM_LABEL_SCOPE') }}"
|
||||
value="{{ vm.getScopeString(token.scope) }}">
|
||||
</at-row-item>
|
||||
<at-row-item
|
||||
label-value="{{:: vm.strings.get('list.ROW_ITEM_LABEL_APPLICATION') }}"
|
||||
value="{{ token.summary_fields.application.name }}"
|
||||
value-link="/#/applications/{{ token.summary_fields.application.id }}">
|
||||
</at-row-item>
|
||||
<at-row-item
|
||||
label-value="{{:: vm.strings.get('list.ROW_ITEM_LABEL_EXPIRED') }}"
|
||||
value="{{ token.expriation | longDate }}">
|
||||
value="{{ token.expires | longDate }}">
|
||||
</at-row-item>
|
||||
<at-row-item
|
||||
label-value="{{:: vm.strings.get('list.ROW_ITEM_LABEL_USED') }}"
|
||||
|
||||
@ -17,6 +17,11 @@ export default {
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
},
|
||||
data: {
|
||||
activityStream: true,
|
||||
activityStreamTarget: 'o_auth2_access_token',
|
||||
noActivityStreamID: true
|
||||
},
|
||||
searchPrefix: 'token',
|
||||
params: {
|
||||
token_search: {
|
||||
|
||||
@ -46,6 +46,9 @@ export default function GetTargetTitle(i18n) {
|
||||
case 'o_auth2_application':
|
||||
rtnTitle = i18n._('APPLICATIONS');
|
||||
break;
|
||||
case 'o_auth2_access_token':
|
||||
rtnTitle = i18n._('TOKENS');
|
||||
break;
|
||||
}
|
||||
|
||||
return rtnTitle;
|
||||
|
||||
@ -22,6 +22,7 @@ export default ['templateUrl', 'i18n', function(templateUrl, i18n) {
|
||||
$scope.options = [
|
||||
{label: i18n._('All Activity'), value: 'dashboard'},
|
||||
{label: i18n._('Applications'), value: 'o_auth2_application'},
|
||||
{label: i18n._('Tokens'), value: 'o_auth2_access_token'},
|
||||
{label: i18n._('Credentials'), value: 'credential'},
|
||||
{label: i18n._('Hosts'), value: 'host'},
|
||||
{label: i18n._('Inventories'), value: 'inventory'},
|
||||
|
||||
@ -97,7 +97,7 @@ export default
|
||||
order_by: '-timestamp',
|
||||
page_size: '20',
|
||||
};
|
||||
if (streamConfig.activityStreamTarget && streamConfig.activityStreamId) {
|
||||
if (streamConfig.activityStreamTarget && streamConfig.activityStreamId && !streamConfig.noActivityStreamID) {
|
||||
stateGoParams.activity_search[streamConfig.activityStreamTarget] = $state.params[streamConfig.activityStreamId];
|
||||
}
|
||||
}
|
||||
@ -107,7 +107,7 @@ export default
|
||||
page_size: '20',
|
||||
};
|
||||
}
|
||||
if(streamConfig.activityStreamId) {
|
||||
if(streamConfig.activityStreamId && !streamConfig.noActivityStreamID) {
|
||||
stateGoParams.id = $state.params[streamConfig.activityStreamId];
|
||||
}
|
||||
if(stateGoParams.target === "custom_inventory_script"){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user