Skip to content

Commit

Permalink
Add help text popovers to /#/applications details fields
Browse files Browse the repository at this point in the history
Add help text popovers to /#/applications details fields

See: #11873
  • Loading branch information
nixocio committed May 17, 2022
1 parent d55ed87 commit eef2c04
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ describe('<ApplicationAdd/>', () => {
<ApplicationAdd onSuccessfulAdd={onSuccessfulAdd} />
);
});

expect(wrapper.find('ApplicationAdd').length).toBe(1);
expect(wrapper.find('ApplicationForm').length).toBe(1);
expect(ApplicationsAPI.readOptions).toBeCalled();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { Detail, DetailList, UserDateDetail } from 'components/DetailList';
import { ApplicationsAPI } from 'api';
import DeleteButton from 'components/DeleteButton';
import ErrorDetail from 'components/ErrorDetail';
import applicationHelpTextStrings from '../shared/Application.helptext';

function ApplicationDetails({
application,
Expand Down Expand Up @@ -81,21 +82,24 @@ function ApplicationDetails({
application.authorization_grant_type
)}
dataCy="app-detail-authorization-grant-type"
helpText={applicationHelpTextStrings.authorizationGrantType}
/>
<Detail
label={t`Client ID`}
value={application.client_id}
dataCy="app-detail-client-id"
/>
<Detail
label={t`Redirect uris`}
label={t`Redirect URIs`}
value={application.redirect_uris}
dataCy="app-detail-redirect-uris"
helpText={applicationHelpTextStrings.redirectURIS}
/>
<Detail
label={t`Client type`}
value={getClientType(application.client_type)}
dataCy="app-detail-client-type"
helpText={applicationHelpTextStrings.clientType}
/>
<UserDateDetail label={t`Created`} date={application.created} />
<UserDateDetail label={t`Last Modified`} date={application.modified} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ describe('<ApplicationDetails/>', () => {
expect(
wrapper.find('Detail[label="Authorization grant type"]').prop('value')
).toBe('Authorization code');
expect(wrapper.find('Detail[label="Redirect uris"]').prop('value')).toBe(
expect(wrapper.find('Detail[label="Redirect URIs"]').prop('value')).toBe(
'http://www.google.com'
);
expect(wrapper.find('Detail[label="Client type"]').prop('value')).toBe(
Expand Down
9 changes: 9 additions & 0 deletions awx/ui/src/screens/Application/shared/Application.helptext.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { t } from '@lingui/macro';

const applicationHelpTextStrings = {
authorizationGrantType: t`The Grant type the user must use to acquire tokens for this application`,
clientType: t`Set to Public or Confidential depending on how secure the client device is.`,
redirectURIS: t`Allowed URIs list, space separated`,
};

export default applicationHelpTextStrings;
12 changes: 4 additions & 8 deletions awx/ui/src/screens/Application/shared/ApplicationForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import FormActionGroup from 'components/FormActionGroup/FormActionGroup';
import OrganizationLookup from 'components/Lookup/OrganizationLookup';
import AnsibleSelect from 'components/AnsibleSelect';
import Popover from 'components/Popover';
import applicationHelpTextStrings from './Application.helptext';

function ApplicationFormFields({
application,
Expand Down Expand Up @@ -83,7 +84,7 @@ function ApplicationFormFields({
label={t`Authorization grant type`}
labelIcon={
<Popover
content={t`The Grant type the user must use to acquire tokens for this application`}
content={applicationHelpTextStrings.authorizationGrantType}
/>
}
>
Expand Down Expand Up @@ -113,7 +114,7 @@ function ApplicationFormFields({
? required(null)
: null
}
tooltip={t`Allowed URIs list, space separated`}
tooltip={applicationHelpTextStrings.redirectURIS}
/>
<FormGroup
fieldId="clientType"
Expand All @@ -123,11 +124,7 @@ function ApplicationFormFields({
}
isRequired
label={t`Client type`}
labelIcon={
<Popover
content={t`Set to Public or Confidential depending on how secure the client device is.`}
/>
}
labelIcon={<Popover content={applicationHelpTextStrings.clientType} />}
>
<AnsibleSelect
{...clientTypeField}
Expand All @@ -145,7 +142,6 @@ function ApplicationFormFields({
function ApplicationForm({
onCancel,
onSubmit,

submitError,
application,
authorizationOptions,
Expand Down

0 comments on commit eef2c04

Please sign in to comment.