Merge pull request #12178 from Tioborto/feat/add-token-description-column

feat: add token description column
This commit is contained in:
Kersom 2022-06-01 10:17:28 -04:00 committed by GitHub
commit 8c3e289170
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 7 deletions

View File

@ -7,6 +7,7 @@ import { parseQueryString, updateQueryString } from 'util/qs';
const Th = styled(PFTh)`
--pf-c-table--cell--Overflow: initial;
--pf-c-table--cell--MaxWidth: none;
`;
export default function HeaderRow({

View File

@ -9071,7 +9071,7 @@ msgstr "Utilisateur"
#: components/AppContainer/PageHeaderToolbar.js:165
msgid "User Details"
msgstr "Détails de l'erreur"
msgstr "Détails de l'utilisateur"
#: screens/Setting/SettingList.js:117
#: screens/Setting/Settings.js:114
@ -10164,4 +10164,4 @@ msgstr "{selectedItemsCount, plural, one {Click to run a health check on the sel
#: components/AppContainer/AppContainer.js:154
msgid "{sessionCountdown, plural, one {You will be logged out in # second due to inactivity} other {You will be logged out in # seconds due to inactivity}}"
msgstr "{sessionCountdown, plural, one {You will be logged out in # second due to inactivity} other {You will be logged out in # seconds due to inactivity}}"
msgstr "{sessionCountdown, plural, one {You will be logged out in # second due to inactivity} other {You will be logged out in # seconds due to inactivity}}"

View File

@ -134,6 +134,10 @@ function UserTokenList() {
name: t`Application name`,
key: 'application__name',
},
{
name: t`Description`,
key: 'description',
},
{
name: t`Scope`,
key: 'scope',
@ -181,6 +185,7 @@ function UserTokenList() {
headerRow={
<HeaderRow qsConfig={QS_CONFIG}>
<HeaderCell sortKey="application__name">{t`Application Name`}</HeaderCell>
<HeaderCell sortKey="description">{t`Description`}</HeaderCell>
<HeaderCell sortKey="scope">{t`Scope`}</HeaderCell>
<HeaderCell sortKey="expires">{t`Expires`}</HeaderCell>
</HeaderRow>

View File

@ -26,6 +26,9 @@ function UserTokenListItem({ token, isSelected, onSelect, rowIndex }) {
: t`Personal access token`}
</Link>
</Td>
<Td dataLabel={t`Description`} id={`token-description-${token.id}`}>
{toTitleCase(token.description)}
</Td>
<Td dataLabel={t`Scope`} id={`token-scope-${token.id}`}>
{toTitleCase(token.scope)}
</Td>

View File

@ -26,7 +26,7 @@ const token = {
},
created: '2020-06-23T15:06:43.188634Z',
modified: '2020-06-23T15:06:43.224151Z',
description: '',
description: 'foobar-token',
user: 1,
token: '************',
refresh_token: '************',
@ -62,8 +62,9 @@ describe('<UserTokenListItem />', () => {
});
expect(wrapper.find('Td').first().prop('select').isSelected).toBe(false);
expect(wrapper.find('Td').at(1).text()).toBe('Foobar app');
expect(wrapper.find('Td').at(2).text()).toContain('Read');
expect(wrapper.find('Td').at(3).text()).toContain('10/25/3019, 3:06:43 PM');
expect(wrapper.find('Td').at(2).text()).toBe('Foobar-token');
expect(wrapper.find('Td').at(3).text()).toContain('Read');
expect(wrapper.find('Td').at(4).text()).toContain('10/25/3019, 3:06:43 PM');
});
test('should render personal access token row properly', async () => {
@ -89,8 +90,9 @@ describe('<UserTokenListItem />', () => {
});
expect(wrapper.find('Td').first().prop('select').isSelected).toBe(false);
expect(wrapper.find('Td').at(1).text()).toEqual('Personal access token');
expect(wrapper.find('Td').at(2).text()).toEqual('Write');
expect(wrapper.find('Td').at(3).text()).toContain('10/25/3019, 3:06:43 PM');
expect(wrapper.find('Td').at(2).text()).toEqual('Foobar-token');
expect(wrapper.find('Td').at(3).text()).toEqual('Write');
expect(wrapper.find('Td').at(4).text()).toContain('10/25/3019, 3:06:43 PM');
});
test('should be checked', async () => {