diff --git a/cypress/integration/clients_test.spec.ts b/cypress/integration/clients_test.spec.ts
index e6a355634b..2e3c5060ea 100644
--- a/cypress/integration/clients_test.spec.ts
+++ b/cypress/integration/clients_test.spec.ts
@@ -226,4 +226,36 @@ describe("Clients test", function () {
);
});
});
+
+ describe("Realm client", () => {
+ const clientName = "master-realm";
+
+ beforeEach(() => {
+ keycloakBefore();
+ loginPage.logIn();
+ sidebarPage.goToClients();
+ listingPage.searchItem(clientName).goToItemDetails(clientName);
+ });
+
+ it("displays the correct tabs", () => {
+ cy.findByTestId("client-tabs")
+ .find("#pf-tab-settings-settings")
+ .should("exist");
+
+ cy.findByTestId("client-tabs")
+ .find("#pf-tab-roles-roles")
+ .should("exist");
+
+ cy.findByTestId("client-tabs")
+ .find("#pf-tab-advanced-advanced")
+ .should("exist");
+
+ cy.findByTestId("client-tabs").find("li").should("have.length", 3);
+ });
+
+ it("hides the delete action", () => {
+ cy.findByTestId("action-dropdown").click();
+ cy.findByTestId("delete-client").should("not.exist");
+ });
+ });
});
diff --git a/src/clients/ClientDetails.tsx b/src/clients/ClientDetails.tsx
index abafb183e4..55cb7c085b 100644
--- a/src/clients/ClientDetails.tsx
+++ b/src/clients/ClientDetails.tsx
@@ -53,6 +53,8 @@ import { ClientScopes } from "./scopes/ClientScopes";
import { EvaluateScopes } from "./scopes/EvaluateScopes";
import { ServiceAccount } from "./service-account/ServiceAccount";
+const isRealmClient = (client: ClientRepresentation) => !client.protocol;
+
type ClientDetailHeaderProps = {
onChange: (value: boolean) => void;
value: boolean;
@@ -97,6 +99,27 @@ const ClientDetailHeader = ({
return [{ text }];
}, [client]);
+ const dropdownItems = [
+ toggleDownloadDialog()}>
+ {t("downloadAdapterConfig")}
+ ,
+ exportClient(client)}>
+ {t("common:export")}
+ ,
+ ...(!isRealmClient(client)
+ ? [
+ ,
+ toggleDeleteDialog()}
+ >
+ {t("common:delete")}
+ ,
+ ]
+ : []),
+ ];
+
return (
<>
@@ -106,18 +129,7 @@ const ClientDetailHeader = ({
badges={badges}
divider={false}
helpTextKey="clients-help:enableDisable"
- dropdownItems={[
- toggleDownloadDialog()}>
- {t("downloadAdapterConfig")}
- ,
- exportClient(client)}>
- {t("common:export")}
- ,
- ,
- toggleDeleteDialog()}>
- {t("common:delete")}
- ,
- ]}
+ dropdownItems={dropdownItems}
isEnabled={value}
onToggle={(value) => {
if (!value) {
@@ -262,6 +274,7 @@ export const ClientDetails = () => {
);
}
+
return (
<>
{
/>
-
+
{
reset={() => setupForm(client)}
/>
- {!client.publicClient && (
+ {!client.publicClient && !isRealmClient(client) && (
{
save()} />
)}
- {!client.publicClient && (
+ {!client.publicClient && !isRealmClient(client) && (
{
messageBundle="clients"
/>
- {t("clientScopes")}}
- >
- setActiveTab2(key as number)}
+ {!isRealmClient(client) && (
+ {t("clientScopes")}}
>
- {t("setup")}}
+ setActiveTab2(key as number)}
>
-
-
- {t("evaluate")}}
- >
-
-
-
-
+ {t("setup")}}
+ >
+
+
+ {t("evaluate")}}
+ >
+
+
+
+
+ )}
{client!.serviceAccountsEnabled && (