From b4c926c1add589c0203acbade1a34f717f8c7d93 Mon Sep 17 00:00:00 2001 From: Camille Moussu Date: Thu, 23 May 2024 11:03:51 +0400 Subject: [PATCH] [#3]added breadcrumbs --- src/dashboards/AuthParams.tsx | 22 +++++++++++++++--- src/pages/Configuration.tsx | 42 ++++++++++++++++++++++++++++++++--- 2 files changed, 58 insertions(+), 6 deletions(-) diff --git a/src/dashboards/AuthParams.tsx b/src/dashboards/AuthParams.tsx index cae5997..8a606c4 100644 --- a/src/dashboards/AuthParams.tsx +++ b/src/dashboards/AuthParams.tsx @@ -1,15 +1,16 @@ import { FormControl, InputLabel, MenuItem, Select } from "@mui/material"; import { t } from "i18next"; -import attributes from "../static/attributes.json"; +import { useEffect, useState } from "react"; import { useAppDispatch, useAppSelector } from "../app/hooks"; -import "./AuthParams.css"; -import { useState } from "react"; import { OptionRenderer } from "../components/authParamOptions/OptionRenderer"; import { + getConfigAsync, removeError, setError, updateAuthParams, } from "../features/config/configSlice"; +import attributes from "../static/attributes.json"; +import "./AuthParams.css"; export function AuthParams() { const dispatch = useAppDispatch(); const authChoiceModules = useAppSelector( @@ -54,6 +55,21 @@ export function AuthParams() { return []; }), ]; + const configNum = useAppSelector((state) => + state.router.location?.hash.replace("#authParams/", "") + ); + useEffect(() => { + if ( + configNum !== "latest" && + Number(configNum) !== Number(config.data.metadata.cfgNum) + ) { + dispatch( + getConfigAsync(configNum === "latest" ? undefined : Number(configNum)) + ); + } else if (configNum === "latest" && config.data.metadata.next) { + dispatch(getConfigAsync()); + } + }, [dispatch, configNum, config.data.metadata]); const [optionSelected, setOptionSelected] = useState(authModule); try { diff --git a/src/pages/Configuration.tsx b/src/pages/Configuration.tsx index 174f6cc..ad2f62b 100644 --- a/src/pages/Configuration.tsx +++ b/src/pages/Configuration.tsx @@ -1,19 +1,39 @@ -import Manager from "./../dashboards/Manager"; +import { Breadcrumbs, Link } from "@mui/material"; +import { t } from "i18next"; +import { useAppSelector } from "../app/hooks"; import AddApp from "../components/managerComponents/AddApp"; -import SaveButton from "./../components/SaveButton"; import { ApplicationDashboard } from "../dashboards/ApplicationDashboard"; -import { HomePage } from "../dashboards/HomePage"; import { AuthParams } from "../dashboards/AuthParams"; +import { HomePage } from "../dashboards/HomePage"; +import { IssuerDashboard } from "../dashboards/IssuerDashboard"; +import SaveButton from "./../components/SaveButton"; +import Manager from "./../dashboards/Manager"; export function Configuration({ location, }: { location: { type: string; info: { name: string; type?: string } }; }) { + const metadata = useAppSelector((state) => state.config.data.metadata); + console.log(location); switch (location.type) { case "app": return (
+ + + {t("conf")} {metadata.cfgNum} + + + {location.type} + + + {location.info.type} + + + {location.info.name} + + + + + {location.info.name === "latest" + ? `${t(location.info.name)} ${t("conf")}` + : `${t("conf")} ${t(location.info.name)}`} + + + {t(location.type)} + +
); + case "issuer": + return ( +
+ +
+ ); default: return ; }