add help text to user token detail

This commit is contained in:
Keith J. Grant 2022-05-04 13:23:28 -07:00
parent 6a63af83c0
commit 3cedd0e0bd
3 changed files with 14 additions and 6 deletions

View File

@ -12,6 +12,7 @@ import { TokensAPI } from 'api';
import { formatDateString } from 'util/dates';
import useRequest, { useDismissableError } from 'hooks/useRequest';
import { toTitleCase } from 'util/strings';
import helptext from '../shared/User.helptext';
function UserTokenDetail({ token }) {
const { scope, description, created, modified, expires, summary_fields } =
@ -37,6 +38,7 @@ function UserTokenDetail({ token }) {
label={t`Application`}
value={summary_fields?.application?.name}
dataCy="application-token-detail-name"
helpText={helptext.application}
/>
<Detail
label={t`Description`}
@ -47,6 +49,7 @@ function UserTokenDetail({ token }) {
label={t`Scope`}
value={toTitleCase(scope)}
dataCy="application-token-detail-scope"
helpText={helptext.scope}
/>
<Detail
label={t`Expires`}

View File

@ -0,0 +1,8 @@
import { t } from '@lingui/macro';
const userHelpTextStrings = {
application: t`The application that this token belongs to, or leave this field empty to create a Personal Access Token.`,
scope: t`Scope for the token's access`,
};
export default userHelpTextStrings;

View File

@ -9,6 +9,7 @@ import ApplicationLookup from 'components/Lookup/ApplicationLookup';
import Popover from 'components/Popover';
import { required } from 'util/validators';
import { FormColumnLayout } from 'components/FormLayout';
import helptext from './User.helptext';
function UserTokenFormFields() {
const { setFieldValue, setFieldTouched } = useFormikContext();
@ -45,9 +46,7 @@ function UserTokenFormFields() {
label={
<span>
{t`Application`}
<Popover
content={t`Select the application that this token will belong to, or leave this field empty to create a Personal Access Token.`}
/>
<Popover content={helptext.application} />
</span>
}
touched={applicationMeta.touched}
@ -67,9 +66,7 @@ function UserTokenFormFields() {
isRequired
validated={!scopeMeta.touched || !scopeMeta.error ? 'default' : 'error'}
label={t`Scope`}
labelIcon={
<Popover content={t`Specify a scope for the token's access`} />
}
labelIcon={<Popover content={helptext.scope} />}
>
<AnsibleSelect
{...scopeField}