Skip to content

Commit

Permalink
Do not show sign-out action for offline sessions
Browse files Browse the repository at this point in the history
Closes: keycloak#24763

Signed-off-by: Hynek Mlnarik <hmlnarik@redhat.com>
  • Loading branch information
hmlnarik committed Dec 13, 2023
1 parent 5f18d8b commit a680092
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions js/apps/admin-ui/src/sessions/SessionsTable.tsx
Expand Up @@ -9,8 +9,7 @@ import {
import { CubesIcon } from "@patternfly/react-icons";
import { ReactNode, useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { Link } from "react-router-dom";
import { useMatch, useNavigate } from "react-router-dom";
import { Link, useMatch, useNavigate } from "react-router-dom";

import { adminClient } from "../admin-client";
import { toClient } from "../clients/routes/Client";
Expand All @@ -30,6 +29,7 @@ import { toUser, UserRoute } from "../user/routes/User";
import { toUsers } from "../user/routes/Users";
import { isLightweightUser } from "../user/utils";
import useFormatDate from "../utils/useFormatDate";
import { IRowData } from "@patternfly/react-table";

export type ColumnName =
| "username"
Expand Down Expand Up @@ -179,12 +179,17 @@ export default function SessionsTable({
)
}
columns={columns}
actions={[
{
title: t("signOut"),
onRowClick: onClickSignOut,
} as Action<UserSessionRepresentation>,
]}
actionResolver={(rowData: IRowData) => {
if (rowData.data.type === "OFFLINE") {
return [];
}
return [
{
title: t("signOut"),
onRowClick: onClickSignOut,
} as Action<UserSessionRepresentation>,
];
}}
emptyState={
<ListEmptyState
hasIcon
Expand Down

0 comments on commit a680092

Please sign in to comment.