From d029bcfcacf984ba4c4fa6a788aaa57f7d7e9d9b Mon Sep 17 00:00:00 2001 From: Marek Libra Date: Mon, 23 Sep 2019 11:41:17 +0200 Subject: [PATCH 1/2] Dashboard is the default pod-detail tab --- frontend/public/components/pod.tsx | 5 +++-- frontend/public/components/utils/horizontal-nav.tsx | 6 +++--- frontend/public/components/utils/href.ts | 3 ++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/frontend/public/components/pod.tsx b/frontend/public/components/pod.tsx index 6c663c9099b..48a1ff431b0 100644 --- a/frontend/public/components/pod.tsx +++ b/frontend/public/components/pod.tsx @@ -39,6 +39,7 @@ import { formatDuration } from './utils/datetime'; import { CamelCaseWrap } from './utils/camel-case-wrap'; import { VolumesTable } from './volumes-table'; import { PodDashboard } from './pod-dashboard'; +import { POD_DETAIL_DASHBOARD_HREF, POD_DETAIL_OVERVIEW_HREF } from './utils/href'; export const menuActions = [...Kebab.factory.common]; const validReadinessStates = new Set(['ContainersNotReady', 'Ready', 'PodCompleted']); @@ -405,11 +406,11 @@ export const PodsDetailsPage: React.FC = (props) => ( menuActions={menuActions} pages={[ { - href: 'dashboard', // TODO: make it default once additional Cards are implemented + href: POD_DETAIL_DASHBOARD_HREF, name: 'Dashboard', component: PodDashboard, }, - navFactory.details(Details), + navFactory.details(Details, POD_DETAIL_OVERVIEW_HREF), navFactory.editYaml(), navFactory.envEditor(PodEnvironmentComponent), navFactory.logs(PodLogs), diff --git a/frontend/public/components/utils/horizontal-nav.tsx b/frontend/public/components/utils/horizontal-nav.tsx index 75a5a52db8d..50420228aed 100644 --- a/frontend/public/components/utils/horizontal-nav.tsx +++ b/frontend/public/components/utils/horizontal-nav.tsx @@ -46,10 +46,10 @@ export type Page = { component?: React.ComponentType; }; -type NavFactory = { [name: string]: (c?: React.ComponentType) => Page }; +type NavFactory = { [name: string]: (c?: React.ComponentType, href?: string) => Page }; export const navFactory: NavFactory = { - details: (component) => ({ - href: '', + details: (component, href = '') => ({ + href, name: 'Overview', component, }), diff --git a/frontend/public/components/utils/href.ts b/frontend/public/components/utils/href.ts index cab22b22d3e..a27c92cb4c9 100644 --- a/frontend/public/components/utils/href.ts +++ b/frontend/public/components/utils/href.ts @@ -1 +1,2 @@ -export const POD_DETAIL_OVERVIEW_HREF = ''; // TODO: see pod.tsx, will be changed once Pod Dashboard becomes the default tab +export const POD_DETAIL_DASHBOARD_HREF = ''; +export const POD_DETAIL_OVERVIEW_HREF = 'overview'; From 642d70a2c6a07b2520f052f7aa756c23170111e3 Mon Sep 17 00:00:00 2001 From: Marek Libra Date: Mon, 7 Oct 2019 15:29:58 +0200 Subject: [PATCH 2/2] Remove POD_DETAIL_DASHBOARD_HREF constant --- frontend/public/components/pod.tsx | 4 ++-- frontend/public/components/utils/href.ts | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/frontend/public/components/pod.tsx b/frontend/public/components/pod.tsx index 48a1ff431b0..40bb7aca788 100644 --- a/frontend/public/components/pod.tsx +++ b/frontend/public/components/pod.tsx @@ -39,7 +39,7 @@ import { formatDuration } from './utils/datetime'; import { CamelCaseWrap } from './utils/camel-case-wrap'; import { VolumesTable } from './volumes-table'; import { PodDashboard } from './pod-dashboard'; -import { POD_DETAIL_DASHBOARD_HREF, POD_DETAIL_OVERVIEW_HREF } from './utils/href'; +import { POD_DETAIL_OVERVIEW_HREF } from './utils/href'; export const menuActions = [...Kebab.factory.common]; const validReadinessStates = new Set(['ContainersNotReady', 'Ready', 'PodCompleted']); @@ -406,7 +406,7 @@ export const PodsDetailsPage: React.FC = (props) => ( menuActions={menuActions} pages={[ { - href: POD_DETAIL_DASHBOARD_HREF, + href: '', name: 'Dashboard', component: PodDashboard, }, diff --git a/frontend/public/components/utils/href.ts b/frontend/public/components/utils/href.ts index a27c92cb4c9..6b78b1df307 100644 --- a/frontend/public/components/utils/href.ts +++ b/frontend/public/components/utils/href.ts @@ -1,2 +1 @@ -export const POD_DETAIL_DASHBOARD_HREF = ''; export const POD_DETAIL_OVERVIEW_HREF = 'overview';