Fixed text of empty state (#2295)

This commit is contained in:
Erik Jan de Wit 2022-04-05 17:02:27 +02:00 committed by GitHub
parent 97a5bca5b0
commit 4b150993a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 38 additions and 22 deletions

View file

@ -316,7 +316,7 @@ describe("Client Scopes test", () => {
});
describe("Scope test", () => {
const scopeTab = new RoleMappingTab();
const scopeTab = new RoleMappingTab("client-scope");
const scopeName = "address";
it("Assign role", () => {
const role = "admin";

View file

@ -637,7 +637,7 @@ describe("Clients test", () => {
});
describe("Service account tab test", () => {
const serviceAccountTab = new RoleMappingTab();
const serviceAccountTab = new RoleMappingTab("user");
const serviceAccountName = "service-account-client";
before(() => {

View file

@ -1,8 +1,10 @@
const expect = chai.expect;
export default class RoleMappingTab {
private type = "client";
private tab = "serviceAccountTab";
private scopeTab = "scopeTab";
private assignEmptyRoleBtn = "no-roles-for-this-client-empty-action";
private assignEmptyRoleBtn = (type: string) =>
`no-roles-for-this-${type}-empty-action`;
private assignRoleBtn = "assignRole";
private unAssignBtn = "unAssignRole";
private assignBtn = "assign";
@ -10,6 +12,10 @@ export default class RoleMappingTab {
private assignedRolesTable = "assigned-roles";
private namesColumn = 'td[data-label="Name"]:visible';
constructor(type: string) {
this.type = type;
}
goToServiceAccountTab() {
cy.findByTestId(this.tab).click();
return this;
@ -22,7 +28,7 @@ export default class RoleMappingTab {
assignRole(notEmpty = true) {
cy.findByTestId(
notEmpty ? this.assignEmptyRoleBtn : this.assignRoleBtn
notEmpty ? this.assignEmptyRoleBtn(this.type) : this.assignRoleBtn
).click();
return this;
}

View file

@ -58,4 +58,9 @@ export default {
"openid-connect": "openid-connect",
},
},
clientScopes: {
noRoles: "No roles for this client scope",
noRolesInstructions:
"You haven't created any roles for this client scope. Create a role to get started.",
},
};

View file

@ -99,8 +99,6 @@ export default {
password: "Password",
oneTimePassword: "One-Time Password",
kerberos: "Kerberos",
assignRole: "Assign role",
unAssignRole: "Unassign",
removeMappingTitle: "Remove mapping?",
removeMappingConfirm_one: "Are you sure you want to remove this mapping?",
removeMappingConfirm_other:
@ -265,8 +263,6 @@ export default {
policySaveError: "Could not update the policy due to {{error}}",
assignedClientScope: "Assigned client scope",
assignedType: "Assigned type",
hideInheritedRoles: "Hide inherited roles",
inherentFrom: "Inherited from",
emptyClientScopes: "This client doesn't have any added client scopes",
emptyClientScopesInstructions:
"There are currently no client scopes linked to this client. You can add existing client scopes to this client to share protocol mappers and roles.",
@ -355,7 +351,6 @@ export default {
oauthDeviceAuthorizationGrant: "OAuth 2.0 Device Authorization Grant",
oidcCibaGrant: "OIDC CIBA Grant",
enableServiceAccount: "Enable service account roles",
assignRolesTo: "Assign roles to {{client}} account",
searchByRoleName: "Search by role name",
filterByOrigin: "Filter by Origin",
realmRoles: "Realm roles",

View file

@ -115,6 +115,13 @@ export default {
Friday: "Friday",
Saturday: "Saturday",
assignRole: "Assign role",
assign: "Assign",
unAssignRole: "Unassign",
hideInheritedRoles: "Hide inherited roles",
assignRolesTo: "Assign roles to {{client}} account",
inherentFrom: "Inherited from",
unitLabel: "Select a time unit",
times: {
seconds: "Seconds",

View file

@ -55,7 +55,7 @@ export const AddRoleMappingModal = ({
onAssign,
onClose,
}: AddRoleMappingModalProps) => {
const { t } = useTranslation("clients");
const { t } = useTranslation("common");
const adminClient = useAdminClient();
const [clients, setClients] = useState<ClientRole[]>([]);
@ -228,7 +228,7 @@ export const AddRoleMappingModal = ({
hasInlineFilter
placeholderText={
<>
<FilterIcon /> {t("filterByOrigin")}
<FilterIcon /> {t("clients:filterByOrigin")}
</>
}
isGrouped

View file

@ -168,7 +168,7 @@ export const RoleMapping = ({
save,
onHideRolesToggle,
}: RoleMappingProps) => {
const { t } = useTranslation("clients");
const { t } = useTranslation(type);
const adminClient = useAdminClient();
const { addAlert, addError } = useAlerts();
@ -186,7 +186,7 @@ export const RoleMapping = ({
const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({
titleKey: "clients:removeMappingTitle",
messageKey: t("removeMappingConfirm", { count: selected.length }),
messageKey: t("clients:removeMappingConfirm", { count: selected.length }),
continueButtonLabel: "common:remove",
continueButtonVariant: ButtonVariant.danger,
onConfirm: async () => {
@ -243,7 +243,7 @@ export const RoleMapping = ({
<>
<ToolbarItem>
<Checkbox
label={t("hideInheritedRoles")}
label={t("common:hideInheritedRoles")}
id="hideInheritedRoles"
isChecked={hide}
onChange={(check) => {
@ -258,7 +258,7 @@ export const RoleMapping = ({
data-testid="assignRole"
onClick={() => setShowAssign(true)}
>
{t("assignRole")}
{t("common:assignRole")}
</Button>
</ToolbarItem>
<ToolbarItem>
@ -268,14 +268,14 @@ export const RoleMapping = ({
onClick={toggleDeleteDialog}
isDisabled={selected.length === 0}
>
{t("unAssignRole")}
{t("common:unAssignRole")}
</Button>
</ToolbarItem>
</>
}
actions={[
{
title: t("unAssignRole"),
title: t("common:unAssignRole"),
onRowClick: async (role) => {
setSelected([role]);
toggleDeleteDialog();
@ -286,17 +286,17 @@ export const RoleMapping = ({
columns={[
{
name: "role.name",
displayKey: t("name"),
displayKey: t("common:name"),
cellRenderer: ServiceRole,
},
{
name: "role.parent.name",
displayKey: t("inherentFrom"),
displayKey: t("common:inherentFrom"),
cellFormatters: [emptyFormatter()],
},
{
name: "role.description",
displayKey: t("description"),
displayKey: t("common:description"),
cellFormatters: [emptyFormatter()],
},
]}
@ -304,7 +304,7 @@ export const RoleMapping = ({
<ListEmptyState
message={t("noRoles")}
instructions={t("noRolesInstructions")}
primaryActionText={t("assignRole")}
primaryActionText={t("common:assignRole")}
onPrimaryAction={() => setShowAssign(true)}
/>
}

View file

@ -310,7 +310,7 @@ export const AssociatedRolesTab = ({
]}
emptyState={
<ListEmptyState
hasIcon={true}
hasIcon
message={t("noRolesAssociated")}
instructions={t("noRolesAssociatedInstructions")}
primaryActionText={t("addRole")}

View file

@ -113,6 +113,9 @@ export default {
deleteGrantsSuccess: "Grants successfully revoked.",
deleteGrantsError: "Error deleting grants.",
roleMapping: "Role mapping",
noRoles: "No roles for this user",
noRolesInstructions:
"You haven't assigned any roles to this user. Assign a role to get started.",
unlockAllUsers: "Unlock all users",
unlockUsersConfirm:
"All the users that are temporarily locked will be unlocked.",