Skip to content

Commit

Permalink
Show PAT as part of bulk delete list
Browse files Browse the repository at this point in the history
* Show PAT as part of bulk delete list
* Update tooltip message in how to create a Personal Access Token

See: #8680
  • Loading branch information
nixocio committed Jul 30, 2021
1 parent d89719c commit e2f69a2
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 7 deletions.
1 change: 0 additions & 1 deletion awx/ui_next/src/components/DeleteButton/DeleteButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ function DeleteButton({
onConfirm,
modalTitle,
name,

variant,
children,
isDisabled,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function ApplicationFormFields({
label={t`Authorization grant type`}
labelIcon={
<Popover
content={t`The Grant type the user must use for acquire tokens for this application`}
content={t`The Grant type the user must use to acquire tokens for this application`}
/>
}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function UserTokenDetail({ token }) {
</DetailList>
<CardActionsRow>
<DeleteButton
name={summary_fields?.application?.name}
name={summary_fields?.application?.name || t`Personal Access Token`}
modalTitle={t`Delete User Token`}
onConfirm={deleteToken}
isDisabled={isLoading}
Expand Down
14 changes: 12 additions & 2 deletions awx/ui_next/src/screens/User/UserTokenList/UserTokenList.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@ function UserTokenList() {

const canAdd = true;

const modifiedSelected = selected.map((item) => {
if (item.application === null) {
return {
...item,
name: t`Personal Access Token`,
};
}
return item;
});

return (
<>
<PaginatedTable
Expand Down Expand Up @@ -162,15 +172,15 @@ function UserTokenList() {
<ToolbarDeleteButton
key="delete"
onDelete={handleDelete}
itemsToDelete={selected}
itemsToDelete={modifiedSelected}
pluralizedItemName={t`User tokens`}
/>,
]}
/>
)}
headerRow={
<HeaderRow qsConfig={QS_CONFIG}>
<HeaderCell sortKey="application__name">{t`Name`}</HeaderCell>
<HeaderCell sortKey="application__name">{t`Application Name`}</HeaderCell>
<HeaderCell sortKey="scope">{t`Scope`}</HeaderCell>
<HeaderCell sortKey="expires">{t`Expires`}</HeaderCell>
</HeaderRow>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function UserTokenListItem({ token, isSelected, onSelect, rowIndex }) {
<Link to={`/users/${id}/tokens/${token.id}/details`}>
{token.summary_fields?.application
? token.summary_fields.application.name
: `Personal access token`}
: t`Personal access token`}
</Link>
</Td>
<Td dataLabel={t`Scope`}>{toTitleCase(token.scope)}</Td>
Expand Down
2 changes: 1 addition & 1 deletion awx/ui_next/src/screens/User/shared/UserTokenForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function UserTokenFormFields() {
<span>
{t`Application`}
<Popover
content={t`Select the application that this token will belong to.`}
content={t`Select the application that this token will belong to, or leave this field empty to create a Personal Access Token.`}
/>
</span>
}
Expand Down

0 comments on commit e2f69a2

Please sign in to comment.