-
Notifications
You must be signed in to change notification settings - Fork 593
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix pipeline details page breadcrumbs in admin perspective
- Loading branch information
1 parent
1e468ee
commit a941193
Showing
16 changed files
with
317 additions
and
34 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
frontend/packages/dev-console/src/components/cluster-tasks/ClusterTaskDetailsPage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import * as React from 'react'; | ||
import { DetailsPageProps, DetailsPage } from '@console/internal/components/factory'; | ||
import { navFactory, Kebab } from '@console/internal/components/utils'; | ||
import { DetailsForKind } from '@console/internal/components/default-resource'; | ||
import { useTasksBreadcrumbsFor } from '../pipelines/hooks'; | ||
|
||
const ClusterTaskDetailsPage: React.FC<DetailsPageProps> = (props) => { | ||
const { kindObj, match, kind } = props; | ||
const breadcrumbsFor = useTasksBreadcrumbsFor(kindObj, match); | ||
|
||
return ( | ||
<DetailsPage | ||
{...props} | ||
menuActions={Kebab.factory.common} | ||
breadcrumbsFor={() => breadcrumbsFor} | ||
pages={[navFactory.details(DetailsForKind(kind)), navFactory.editYaml()]} | ||
/> | ||
); | ||
}; | ||
|
||
export default ClusterTaskDetailsPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
frontend/packages/dev-console/src/components/pipelines/ClusterTriggerBindingPage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import * as React from 'react'; | ||
import { DetailsPageProps, DetailsPage } from '@console/internal/components/factory'; | ||
import { navFactory, Kebab } from '@console/internal/components/utils'; | ||
import { DetailsForKind } from '@console/internal/components/default-resource'; | ||
import { useTriggersBreadcrumbsFor } from './hooks'; | ||
|
||
const ClusterTriggerBindingPage: React.FC<DetailsPageProps> = (props) => { | ||
const { kindObj, match, kind } = props; | ||
const breadcrumbsFor = useTriggersBreadcrumbsFor(kindObj, match); | ||
|
||
return ( | ||
<DetailsPage | ||
{...props} | ||
menuActions={Kebab.factory.common} | ||
breadcrumbsFor={() => breadcrumbsFor} | ||
pages={[navFactory.details(DetailsForKind(kind)), navFactory.editYaml()]} | ||
/> | ||
); | ||
}; | ||
|
||
export default ClusterTriggerBindingPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...es/dev-console/src/components/pipelines/detail-page-tabs/PipelineConditionDetailsPage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import * as React from 'react'; | ||
import { DetailsPageProps, DetailsPage } from '@console/internal/components/factory'; | ||
import { navFactory, Kebab } from '@console/internal/components/utils'; | ||
import { DetailsForKind } from '@console/internal/components/default-resource'; | ||
import { usePipelinesBreadcrumbsFor } from '../hooks'; | ||
|
||
const PipelineConditionDetailsPage: React.FC<DetailsPageProps> = (props) => { | ||
const { kindObj, match, kind } = props; | ||
const breadcrumbsFor = usePipelinesBreadcrumbsFor(kindObj, match); | ||
|
||
return ( | ||
<DetailsPage | ||
{...props} | ||
menuActions={Kebab.factory.common} | ||
breadcrumbsFor={() => breadcrumbsFor} | ||
pages={[navFactory.details(DetailsForKind(kind)), navFactory.editYaml()]} | ||
/> | ||
); | ||
}; | ||
|
||
export default PipelineConditionDetailsPage; |
21 changes: 21 additions & 0 deletions
21
...ges/dev-console/src/components/pipelines/detail-page-tabs/PipelineResourceDetailsPage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import * as React from 'react'; | ||
import { DetailsPageProps, DetailsPage } from '@console/internal/components/factory'; | ||
import { navFactory, Kebab } from '@console/internal/components/utils'; | ||
import { DetailsForKind } from '@console/internal/components/default-resource'; | ||
import { usePipelinesBreadcrumbsFor } from '../hooks'; | ||
|
||
const PipelineResourceDetailsPage: React.FC<DetailsPageProps> = (props) => { | ||
const { kindObj, match, kind } = props; | ||
const breadcrumbsFor = usePipelinesBreadcrumbsFor(kindObj, match); | ||
|
||
return ( | ||
<DetailsPage | ||
{...props} | ||
menuActions={Kebab.factory.common} | ||
breadcrumbsFor={() => breadcrumbsFor} | ||
pages={[navFactory.details(DetailsForKind(kind)), navFactory.editYaml()]} | ||
/> | ||
); | ||
}; | ||
|
||
export default PipelineResourceDetailsPage; |
44 changes: 44 additions & 0 deletions
44
frontend/packages/dev-console/src/components/pipelines/hooks.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { match as RMatch } from 'react-router-dom'; | ||
// FIXME upgrading redux types is causing many errors at this time | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
import { useSelector } from 'react-redux'; | ||
import { getBreadcrumbPath } from '@console/internal/components/utils/breadcrumbs'; | ||
import { K8sKind } from '@console/internal/module/k8s'; | ||
import { RootState } from '@console/internal/redux'; | ||
import { getActivePerspective, getActiveNamespace } from '@console/internal/reducers/ui'; | ||
import { ALL_NAMESPACES_KEY } from '@console/shared'; | ||
import { pipelinesTab } from '../../utils/pipeline-utils'; | ||
|
||
type Match = RMatch<{ url: string }>; | ||
|
||
const useTabbedTableBreadcrumbsFor = (kindObj: K8sKind, match: Match, navOption: string) => { | ||
const currentNamespace = useSelector((state: RootState) => getActiveNamespace(state)); | ||
const isAdminPerspective = | ||
useSelector((state: RootState) => getActivePerspective(state)) === 'admin'; | ||
const namespace = ALL_NAMESPACES_KEY === currentNamespace ? 'all-namespaces' : currentNamespace; | ||
const subTab = pipelinesTab(kindObj); | ||
|
||
if (subTab == null) { | ||
return []; | ||
} | ||
|
||
return [ | ||
{ | ||
name: kindObj.labelPlural, | ||
path: isAdminPerspective | ||
? `/${navOption}/ns/${namespace}/${subTab}` | ||
: getBreadcrumbPath(match), | ||
}, | ||
{ name: `${kindObj.label} Details`, path: match.url }, | ||
]; | ||
}; | ||
|
||
export const usePipelinesBreadcrumbsFor = (kindObj: K8sKind, match: Match) => | ||
useTabbedTableBreadcrumbsFor(kindObj, match, 'pipelines'); | ||
|
||
export const useTasksBreadcrumbsFor = (kindObj: K8sKind, match: Match) => | ||
useTabbedTableBreadcrumbsFor(kindObj, match, 'tasks'); | ||
|
||
export const useTriggersBreadcrumbsFor = (kindObj: K8sKind, match: Match) => | ||
useTabbedTableBreadcrumbsFor(kindObj, match, 'triggers'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
frontend/packages/dev-console/src/components/tasks/TaskDetailsPage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import * as React from 'react'; | ||
import { DetailsPageProps, DetailsPage } from '@console/internal/components/factory'; | ||
import { navFactory, Kebab } from '@console/internal/components/utils'; | ||
import { DetailsForKind } from '@console/internal/components/default-resource'; | ||
import { useTasksBreadcrumbsFor } from '../pipelines/hooks'; | ||
|
||
const TaskDetailsPage: React.FC<DetailsPageProps> = (props) => { | ||
const { kindObj, match, kind } = props; | ||
const breadcrumbsFor = useTasksBreadcrumbsFor(kindObj, match); | ||
|
||
return ( | ||
<DetailsPage | ||
{...props} | ||
menuActions={Kebab.factory.common} | ||
breadcrumbsFor={() => breadcrumbsFor} | ||
pages={[navFactory.details(DetailsForKind(kind)), navFactory.editYaml()]} | ||
/> | ||
); | ||
}; | ||
|
||
export default TaskDetailsPage; |
8 changes: 4 additions & 4 deletions
8
...components/tasks-lists/TasksListsPage.tsx → ...onents/tasks/list-page/TasksListsPage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.