From ef4f22029b609b6c718a0149e64c4247169c2abc Mon Sep 17 00:00:00 2001 From: "makabe.t" Date: Tue, 7 Nov 2023 06:25:42 +0000 Subject: [PATCH] =?UTF-8?q?Merged=20PR=20551:=20=E7=94=BB=E9=9D=A2?= =?UTF-8?q?=E5=AE=9F=E8=A3=85=EF=BC=88=E4=BB=A3=E8=A1=8C=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E4=B8=AD=E3=81=AE=E3=83=98=E3=83=83=E3=83=80=E3=83=BC=E8=A1=A8?= =?UTF-8?q?=E7=A4=BA=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 概要 [Task2911: 画面実装(代行操作中のヘッダー表示)](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/2911) - 代行操作中に表示されるヘッダのタブを以下のタブのみに設定しました。 - User - Workflow - License ## レビューポイント - 代行操作タブ表示の判断材料としてヘッダコンポーネント内でselectorで代行操作の有無を判断してタブ表示用メソッドに渡していますが、データの取り扱いとして不自然なところはないでしょうか? ## UIの変更 - [Task2911](https://ndstokyo.sharepoint.com/:f:/r/sites/Piranha/Shared%20Documents/General/OMDS/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88/Task2911?csf=1&web=1&e=zFW1zj) ## 動作確認状況 - ローカルで確認 --- dictation_client/src/components/header/constants.ts | 9 +++++++++ dictation_client/src/components/header/loginedHeader.tsx | 6 +++++- dictation_client/src/components/header/utils.ts | 7 ++++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/dictation_client/src/components/header/constants.ts b/dictation_client/src/components/header/constants.ts index 79817eb..66a2665 100644 --- a/dictation_client/src/components/header/constants.ts +++ b/dictation_client/src/components/header/constants.ts @@ -70,3 +70,12 @@ export const TIER1_TO_TIER4_ONLY_TABS = [HEADER_MENUS_PARTNER]; * admin,standardでなく、第1~5階層でもないアカウントに表示する空のヘッダータブ */ export const INVALID_ACCOUNT_TABS = []; + +/** + * 代行操作中に表示するヘッダータブ + */ +export const DELEGATE_TABS = [ + HEADER_MENUS_LICENSE, + HEADER_MENUS_USER, + HEADER_MENUS_WORKFLOW, +]; diff --git a/dictation_client/src/components/header/loginedHeader.tsx b/dictation_client/src/components/header/loginedHeader.tsx index 8c75de2..9f16a9d 100644 --- a/dictation_client/src/components/header/loginedHeader.tsx +++ b/dictation_client/src/components/header/loginedHeader.tsx @@ -12,6 +12,7 @@ import { clearUserInfo, } from "features/login"; import { useNavigate } from "react-router-dom"; +import { selectDelegationAccessToken } from "features/auth/selectors"; import { getFilteredMenus } from "./utils"; import logo from "../../assets/images/OMS_logo_black.svg"; import ac from "../../assets/images/account_circle.svg"; @@ -27,12 +28,15 @@ interface HeaderProps { // ログイン後のヘッダー const LoginedHeader: React.FC = (props: HeaderProps) => { const { activePath } = props; - const filterMenus = getFilteredMenus(); const dispatch: AppDispatch = useDispatch(); const { instance } = useMsal(); const { t } = useTranslation(); const navigate = useNavigate(); + // メニューの代行操作表示制御 + const isDelegation = useSelector(selectDelegationAccessToken) !== null; + const filterMenus = getFilteredMenus(isDelegation); + // Headerのユーザー情報を取得する const isUserNameEmpty = useSelector(selectIsUserNameEmpty); const userName = useSelector(selectUserName); diff --git a/dictation_client/src/components/header/utils.ts b/dictation_client/src/components/header/utils.ts index 0ef137c..937786e 100644 --- a/dictation_client/src/components/header/utils.ts +++ b/dictation_client/src/components/header/utils.ts @@ -5,6 +5,7 @@ import { HEADER_MENUS, TIER1_TO_TIER4_ONLY_TABS, INVALID_ACCOUNT_TABS, + DELEGATE_TABS, } from "./constants"; import { TIERS } from "../auth/constants"; @@ -29,7 +30,7 @@ export const isLoginPaths = (d: string): d is LoginedPaths => { } }; // 権限、階層ごとに表示するヘッダーをわける -export const getFilteredMenus = () => { +export const getFilteredMenus = (isDelegation: boolean) => { const isAdmin = isAdminUser(); const isStandard = isStandardUser(); const isTier5 = isApproveTier([TIERS.TIER5]); @@ -40,6 +41,10 @@ export const getFilteredMenus = () => { TIERS.TIER4, ]); + if (isDelegation) { + return HEADER_MENUS.filter((item) => DELEGATE_TABS.includes(item.key)); + } + if (tier1ToTier4) { if (isAdmin) { return HEADER_MENUS;