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", () => { describe("Scope test", () => {
const scopeTab = new RoleMappingTab(); const scopeTab = new RoleMappingTab("client-scope");
const scopeName = "address"; const scopeName = "address";
it("Assign role", () => { it("Assign role", () => {
const role = "admin"; const role = "admin";

View file

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

View file

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

View file

@ -58,4 +58,9 @@ export default {
"openid-connect": "openid-connect", "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", password: "Password",
oneTimePassword: "One-Time Password", oneTimePassword: "One-Time Password",
kerberos: "Kerberos", kerberos: "Kerberos",
assignRole: "Assign role",
unAssignRole: "Unassign",
removeMappingTitle: "Remove mapping?", removeMappingTitle: "Remove mapping?",
removeMappingConfirm_one: "Are you sure you want to remove this mapping?", removeMappingConfirm_one: "Are you sure you want to remove this mapping?",
removeMappingConfirm_other: removeMappingConfirm_other:
@ -265,8 +263,6 @@ export default {
policySaveError: "Could not update the policy due to {{error}}", policySaveError: "Could not update the policy due to {{error}}",
assignedClientScope: "Assigned client scope", assignedClientScope: "Assigned client scope",
assignedType: "Assigned type", assignedType: "Assigned type",
hideInheritedRoles: "Hide inherited roles",
inherentFrom: "Inherited from",
emptyClientScopes: "This client doesn't have any added client scopes", emptyClientScopes: "This client doesn't have any added client scopes",
emptyClientScopesInstructions: 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.", "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", oauthDeviceAuthorizationGrant: "OAuth 2.0 Device Authorization Grant",
oidcCibaGrant: "OIDC CIBA Grant", oidcCibaGrant: "OIDC CIBA Grant",
enableServiceAccount: "Enable service account roles", enableServiceAccount: "Enable service account roles",
assignRolesTo: "Assign roles to {{client}} account",
searchByRoleName: "Search by role name", searchByRoleName: "Search by role name",
filterByOrigin: "Filter by Origin", filterByOrigin: "Filter by Origin",
realmRoles: "Realm roles", realmRoles: "Realm roles",

View file

@ -115,6 +115,13 @@ export default {
Friday: "Friday", Friday: "Friday",
Saturday: "Saturday", 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", unitLabel: "Select a time unit",
times: { times: {
seconds: "Seconds", seconds: "Seconds",

View file

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

View file

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

View file

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

View file

@ -113,6 +113,9 @@ export default {
deleteGrantsSuccess: "Grants successfully revoked.", deleteGrantsSuccess: "Grants successfully revoked.",
deleteGrantsError: "Error deleting grants.", deleteGrantsError: "Error deleting grants.",
roleMapping: "Role mapping", 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", unlockAllUsers: "Unlock all users",
unlockUsersConfirm: unlockUsersConfirm:
"All the users that are temporarily locked will be unlocked.", "All the users that are temporarily locked will be unlocked.",