From 3bd475f703a3da7e1bb8124af85a5187b598e7c0 Mon Sep 17 00:00:00 2001 From: Agnieszka Gancarczyk Date: Mon, 5 Jul 2021 16:58:19 +0100 Subject: [PATCH] sessions: added sessions type dropdown --- src/sessions/SessionSection.css | 3 ++ src/sessions/SessionsSection.tsx | 63 +++++++++++++++++++++++++++++++- 2 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 src/sessions/SessionSection.css diff --git a/src/sessions/SessionSection.css b/src/sessions/SessionSection.css new file mode 100644 index 0000000000..e0d670decb --- /dev/null +++ b/src/sessions/SessionSection.css @@ -0,0 +1,3 @@ +.filter-session-type-select { + margin-right: 10px; +} \ No newline at end of file diff --git a/src/sessions/SessionsSection.tsx b/src/sessions/SessionsSection.tsx index 35314ed209..42b8d272c0 100644 --- a/src/sessions/SessionsSection.tsx +++ b/src/sessions/SessionsSection.tsx @@ -1,12 +1,15 @@ -import React from "react"; +import React, { useState } from "react"; import { Link } from "react-router-dom"; -import { PageSection } from "@patternfly/react-core"; +import { useTranslation } from "react-i18next"; +import { PageSection, Select, SelectOption, SelectVariant } from "@patternfly/react-core"; import moment from "moment"; import type UserSessionRepresentation from "keycloak-admin/lib/defs/userSessionRepresentation"; import { ViewHeader } from "../components/view-header/ViewHeader"; import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable"; import { useAdminClient } from "../context/auth/AdminClient"; +import { FilterIcon } from "@patternfly/react-icons"; +import "./SessionSection.css"; const Clients = (row: UserSessionRepresentation) => { return ( @@ -21,7 +24,15 @@ const Clients = (row: UserSessionRepresentation) => { }; export const SessionsSection = () => { + const { t } = useTranslation("sessions"); const adminClient = useAdminClient(); + const [filterDropdownOpen, setFilterDropdownOpen] = useState(false); + const [filterType, setFilterType] = useState("All session types"); + const [key, setKey] = useState(0); + + const refresh = () => { + setKey(new Date().getTime()); + }; const loader = async () => { const activeClients = await adminClient.sessions.find(); @@ -44,6 +55,35 @@ export const SessionsSection = () => { return userSessions; }; + + const options = [ + , + , + , + , + , + ]; return ( <> @@ -53,6 +93,25 @@ export const SessionsSection = () => { loader={loader} ariaLabelKey="session:title" searchPlaceholderKey="sessions:searchForSession" + searchTypeComponent={ + + } columns={[ { name: "username",