mirror of
https://github.com/ansible/awx.git
synced 2026-03-25 21:05:03 -02:30
Update User screens
* Add `modified` field to user endpoints. The API returns the last login date as the `modified` field to the users. * Add modified to user details. * Modify user form layout to be as per mockups. * Remove `last name` and `first name` from user row, since it is already on the column title. closes: https://github.com/ansible/awx/issues/5687 closes: https://github.com/ansible/awx/issues/9564
This commit is contained in:
@@ -948,7 +948,6 @@ class UserSerializer(BaseSerializer):
|
|||||||
'*',
|
'*',
|
||||||
'-name',
|
'-name',
|
||||||
'-description',
|
'-description',
|
||||||
'-modified',
|
|
||||||
'username',
|
'username',
|
||||||
'first_name',
|
'first_name',
|
||||||
'last_name',
|
'last_name',
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ function UserDetail({ user }) {
|
|||||||
last_name,
|
last_name,
|
||||||
last_login,
|
last_login,
|
||||||
created,
|
created,
|
||||||
|
modified,
|
||||||
is_superuser,
|
is_superuser,
|
||||||
is_system_auditor,
|
is_system_auditor,
|
||||||
summary_fields,
|
summary_fields,
|
||||||
@@ -56,14 +57,14 @@ function UserDetail({ user }) {
|
|||||||
return (
|
return (
|
||||||
<CardBody>
|
<CardBody>
|
||||||
<DetailList>
|
<DetailList>
|
||||||
|
<Detail label={t`First Name`} value={`${first_name}`} />
|
||||||
|
<Detail label={t`Last Name`} value={`${last_name}`} />
|
||||||
|
<Detail label={t`Email`} value={email} />
|
||||||
<Detail
|
<Detail
|
||||||
label={t`Username`}
|
label={t`Username`}
|
||||||
value={username}
|
value={username}
|
||||||
dataCy="user-detail-username"
|
dataCy="user-detail-username"
|
||||||
/>
|
/>
|
||||||
<Detail label={t`Email`} value={email} />
|
|
||||||
<Detail label={t`First Name`} value={`${first_name}`} />
|
|
||||||
<Detail label={t`Last Name`} value={`${last_name}`} />
|
|
||||||
<Detail label={t`User Type`} value={`${user_type}`} />
|
<Detail label={t`User Type`} value={`${user_type}`} />
|
||||||
{userAuthType && (
|
{userAuthType && (
|
||||||
<Detail
|
<Detail
|
||||||
@@ -75,6 +76,9 @@ function UserDetail({ user }) {
|
|||||||
<Detail label={t`Last Login`} value={formatDateString(last_login)} />
|
<Detail label={t`Last Login`} value={formatDateString(last_login)} />
|
||||||
)}
|
)}
|
||||||
<Detail label={t`Created`} value={formatDateString(created)} />
|
<Detail label={t`Created`} value={formatDateString(created)} />
|
||||||
|
{modified && (
|
||||||
|
<Detail label={t`Last Modified`} value={formatDateString(modified)} />
|
||||||
|
)}
|
||||||
</DetailList>
|
</DetailList>
|
||||||
<CardActionsRow>
|
<CardActionsRow>
|
||||||
{summary_fields.user_capabilities &&
|
{summary_fields.user_capabilities &&
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ describe('<UserDetail />', () => {
|
|||||||
assertDetail('User Type', 'System Administrator');
|
assertDetail('User Type', 'System Administrator');
|
||||||
assertDetail('Last Login', `11/4/2019, 11:12:36 PM`);
|
assertDetail('Last Login', `11/4/2019, 11:12:36 PM`);
|
||||||
assertDetail('Created', `10/28/2019, 3:01:07 PM`);
|
assertDetail('Created', `10/28/2019, 3:01:07 PM`);
|
||||||
|
assertDetail('Last Modified', `7/12/2021, 7:08:33 PM`);
|
||||||
assertDetail('Type', `SOCIAL`);
|
assertDetail('Type', `SOCIAL`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -51,20 +51,10 @@ function UserListItem({ user, isSelected, onSelect, detailUrl, rowIndex }) {
|
|||||||
)}
|
)}
|
||||||
</Td>
|
</Td>
|
||||||
<Td dataLabel={t`First Name`}>
|
<Td dataLabel={t`First Name`}>
|
||||||
{user.first_name && (
|
{user.first_name && <Fragment>{user.first_name}</Fragment>}
|
||||||
<Fragment>
|
|
||||||
<b css="margin-right: 24px">{t`First Name`}</b>
|
|
||||||
{user.first_name}
|
|
||||||
</Fragment>
|
|
||||||
)}
|
|
||||||
</Td>
|
</Td>
|
||||||
<Td dataLabel={t`Last Name`}>
|
<Td dataLabel={t`Last Name`}>
|
||||||
{user.last_name && (
|
{user.last_name && <Fragment>{user.last_name}</Fragment>}
|
||||||
<Fragment>
|
|
||||||
<b css="margin-right: 24px">{t`Last Name`}</b>
|
|
||||||
{user.last_name}
|
|
||||||
</Fragment>
|
|
||||||
)}
|
|
||||||
</Td>
|
</Td>
|
||||||
<Td dataLabel={t`Role`}>{user_type}</Td>
|
<Td dataLabel={t`Role`}>{user_type}</Td>
|
||||||
<ActionsTd dataLabel={t`Actions`}>
|
<ActionsTd dataLabel={t`Actions`}>
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"created": "2019-10-28T15:01:07.218634Z",
|
"created": "2019-10-28T15:01:07.218634Z",
|
||||||
|
"modified": "2021-07-12T19:08:33.947072Z",
|
||||||
"username": "admin",
|
"username": "admin",
|
||||||
"first_name": "Admin",
|
"first_name": "Admin",
|
||||||
"last_name": "User",
|
"last_name": "User",
|
||||||
|
|||||||
@@ -59,6 +59,19 @@ function UserFormFields({ user }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
<FormField
|
||||||
|
id="user-first-name"
|
||||||
|
label={t`First Name`}
|
||||||
|
name="first_name"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
<FormField
|
||||||
|
id="user-last-name"
|
||||||
|
label={t`Last Name`}
|
||||||
|
name="last_name"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
<FormField id="user-email" label={t`Email`} name="email" type="text" />
|
||||||
<FormField
|
<FormField
|
||||||
id="user-username"
|
id="user-username"
|
||||||
label={t`Username`}
|
label={t`Username`}
|
||||||
@@ -69,7 +82,6 @@ function UserFormFields({ user }) {
|
|||||||
}
|
}
|
||||||
isRequired={!ldapUser && !externalAccount}
|
isRequired={!ldapUser && !externalAccount}
|
||||||
/>
|
/>
|
||||||
<FormField id="user-email" label={t`Email`} name="email" type="text" />
|
|
||||||
{!ldapUser && !(socialAuthUser && externalAccount) && (
|
{!ldapUser && !(socialAuthUser && externalAccount) && (
|
||||||
<>
|
<>
|
||||||
<PasswordField
|
<PasswordField
|
||||||
@@ -96,30 +108,7 @@ function UserFormFields({ user }) {
|
|||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
<FormField
|
|
||||||
id="user-first-name"
|
|
||||||
label={t`First Name`}
|
|
||||||
name="first_name"
|
|
||||||
type="text"
|
|
||||||
/>
|
|
||||||
<FormField
|
|
||||||
id="user-last-name"
|
|
||||||
label={t`Last Name`}
|
|
||||||
name="last_name"
|
|
||||||
type="text"
|
|
||||||
/>
|
|
||||||
{!user.id && (
|
|
||||||
<OrganizationLookup
|
|
||||||
helperTextInvalid={organizationMeta.error}
|
|
||||||
isValid={!organizationMeta.touched || !organizationMeta.error}
|
|
||||||
onBlur={() => organizationHelpers.setTouched()}
|
|
||||||
onChange={handleOrganizationUpdate}
|
|
||||||
value={organizationField.value}
|
|
||||||
required
|
|
||||||
autoPopulate={!user?.id}
|
|
||||||
validate={required(t`Select a value for this field`)}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
{me.is_superuser && (
|
{me.is_superuser && (
|
||||||
<FormGroup
|
<FormGroup
|
||||||
fieldId="user-type"
|
fieldId="user-type"
|
||||||
@@ -138,6 +127,19 @@ function UserFormFields({ user }) {
|
|||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{!user.id && (
|
||||||
|
<OrganizationLookup
|
||||||
|
helperTextInvalid={organizationMeta.error}
|
||||||
|
isValid={!organizationMeta.touched || !organizationMeta.error}
|
||||||
|
onBlur={() => organizationHelpers.setTouched()}
|
||||||
|
onChange={handleOrganizationUpdate}
|
||||||
|
value={organizationField.value}
|
||||||
|
required
|
||||||
|
autoPopulate={!user?.id}
|
||||||
|
validate={required(t`Select a value for this field`)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user