From d4068786fd7136cfe21c3ef3ad3040f57ed3385a Mon Sep 17 00:00:00 2001 From: Janicki Artur Date: Wed, 21 Nov 2018 12:52:12 +0100 Subject: [PATCH] refs #master Fix test and hide details panel from ssh-keys panel Arvados-DCO-1.1-Signed-off-by: Janicki Artur --- src/store/auth/auth-reducer.test.ts | 4 +++- .../main-content-bar/main-content-bar.tsx | 11 ++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/store/auth/auth-reducer.test.ts b/src/store/auth/auth-reducer.test.ts index 1202bacb..25ce2c11 100644 --- a/src/store/auth/auth-reducer.test.ts +++ b/src/store/auth/auth-reducer.test.ts @@ -44,7 +44,8 @@ describe('auth-reducer', () => { const state = reducer(initialState, authActions.SAVE_API_TOKEN("token")); expect(state).toEqual({ apiToken: "token", - user: undefined + user: undefined, + sshKeys: [] }); }); @@ -62,6 +63,7 @@ describe('auth-reducer', () => { const state = reducer(initialState, authActions.USER_DETAILS_SUCCESS(user)); expect(state).toEqual({ apiToken: undefined, + sshKeys: [], user: { email: "test@test.com", firstName: "John", diff --git a/src/views-components/main-content-bar/main-content-bar.tsx b/src/views-components/main-content-bar/main-content-bar.tsx index b0478377..16fa2a9c 100644 --- a/src/views-components/main-content-bar/main-content-bar.tsx +++ b/src/views-components/main-content-bar/main-content-bar.tsx @@ -6,10 +6,9 @@ import * as React from "react"; import { Toolbar, IconButton, Tooltip, Grid } from "@material-ui/core"; import { DetailsIcon } from "~/components/icon/icon"; import { Breadcrumbs } from "~/views-components/breadcrumbs/breadcrumbs"; -import { detailsPanelActions } from "~/store/details-panel/details-panel-action"; import { connect } from 'react-redux'; import { RootState } from '~/store/store'; -import { matchWorkflowRoute } from '~/routes/routes'; +import { matchWorkflowRoute, matchSshKeysRoute } from '~/routes/routes'; import { toggleDetailsPanel } from '~/store/details-panel/details-panel-action'; interface MainContentBarProps { @@ -23,8 +22,14 @@ const isWorkflowPath = ({ router }: RootState) => { return !!match; }; +const isSshKeysPath = ({ router }: RootState) => { + const pathname = router.location ? router.location.pathname : ''; + const match = matchSshKeysRoute(pathname); + return !!match; +}; + export const MainContentBar = connect((state: RootState) => ({ - buttonVisible: !isWorkflowPath(state) + buttonVisible: !isWorkflowPath(state) && !isSshKeysPath(state) }), { onDetailsPanelToggle: toggleDetailsPanel })((props: MainContentBarProps) => -- 2.30.2