11import React from 'react' ;
22
33import { routePaths } from '../../../../routes/routePaths' ;
4+ import { camelCaseToParagraph } from '../../../../utils' ;
5+ import { useLocationPath } from '../../../hooks' ;
46// import { translate } from './translate';
57import { BasePage } from '../BasePage' ;
68import { Configuration } from './Configuration' ;
@@ -17,19 +19,77 @@ import { useService } from './useService';
1719// import { formatMoney } from '../../../../utils/money';
1820// import { truncate } from '../../../../utils';
1921
20- const getTabPages = ( {
21- stackId,
22- runId,
23- } : {
22+ // const getTabPages = ({
23+ // stackId,
24+ // runId,
25+ // }: {
26+ // stackId: TId;
27+ // runId: TId;
28+ // }): TabPage[] => {
29+ // const locationPath = useLocationPath();
30+ // return [
31+ // {
32+ // text: 'DAG',
33+ // // <Statistics runId={runId} stackId={stackId} />
34+ // Component: () => <div>Coming soon</div>,
35+ // path: routePaths.run.component.statistics('alerter', runId, stackId),
36+ // },
37+ // {
38+ // text: 'Configuration',
39+ // // <Results runId={runId} stackId={stackId} />
40+ // Component: () => <Configuration runId={runId} />,
41+ // path: routePaths.run.component.results(runId, stackId),
42+ // },
43+ // ];
44+ // };
45+
46+ // const getBreadcrumbs = ({
47+ // stackId,
48+ // runId,
49+ // }: {
50+ // stackId: TId;
51+ // runId: TId;
52+ // }): TBreadcrumb[] => {
53+ // return [
54+ // {
55+ // name: 'Component',
56+ // clickable: true,
57+ // to: routePaths.stackComponents.base('alerter'),
58+ // },
59+ // {
60+ // name: 'alerteaaar',
61+ // clickable: true,
62+ // to: routePaths.stackComponents.base('alerter'),
63+ // },
64+ // {
65+ // name: `Run ${runId}`,
66+ // clickable: true,
67+ // to: routePaths.run.component.statistics('alerter', runId, stackId),
68+ // },
69+ // ];
70+ // };
71+
72+ export interface RunDetailRouteParams {
73+ id : TId ;
2474 stackId : TId ;
25- runId : TId ;
26- } ) : TabPage [ ] => {
27- return [
75+ }
76+
77+ export const RunDetail : React . FC = ( ) => {
78+ const locationPath = useLocationPath ( ) ;
79+ const { runId, stackId } = useService ( ) ;
80+
81+ // const { runId, stackId, run, billing } = useService();
82+ // debugger;
83+ const tabPages = [
2884 {
2985 text : 'DAG' ,
3086 // <Statistics runId={runId} stackId={stackId} />
3187 Component : ( ) => < div > Coming soon</ div > ,
32- path : routePaths . run . component . statistics ( 'alerter' , runId , stackId ) ,
88+ path : routePaths . run . component . statistics (
89+ locationPath . split ( '/' ) [ 2 ] ,
90+ runId ,
91+ stackId ,
92+ ) ,
3393 } ,
3494 {
3595 text : 'Configuration' ,
@@ -38,51 +98,27 @@ const getTabPages = ({
3898 path : routePaths . run . component . results ( runId , stackId ) ,
3999 } ,
40100 ] ;
41- } ;
42-
43- const getBreadcrumbs = ( {
44- stackId,
45- runId,
46- } : {
47- stackId : TId ;
48- runId : TId ;
49- } ) : TBreadcrumb [ ] => {
50- return [
101+ const breadcrumbs = [
51102 {
52103 name : 'Component' ,
53104 clickable : true ,
54- to : routePaths . stackComponents . base ( 'alerter' ) ,
105+ to : routePaths . stackComponents . base ( locationPath . split ( '/' ) [ 2 ] ) ,
55106 } ,
56107 {
57- name : 'alerter' ,
108+ name : camelCaseToParagraph ( locationPath . split ( '/' ) [ 2 ] ) ,
58109 clickable : true ,
59- to : routePaths . stackComponents . base ( 'alerter' ) ,
110+ to : routePaths . stackComponents . base ( locationPath . split ( '/' ) [ 2 ] ) ,
60111 } ,
61112 {
62113 name : `Run ${ runId } ` ,
63114 clickable : true ,
64- to : routePaths . run . component . statistics ( 'alerter' , runId , stackId ) ,
115+ to : routePaths . run . component . statistics (
116+ locationPath . split ( '/' ) [ 2 ] ,
117+ runId ,
118+ stackId ,
119+ ) ,
65120 } ,
66121 ] ;
67- } ;
68-
69- export interface RunDetailRouteParams {
70- id : TId ;
71- stackId : TId ;
72- }
73-
74- export const RunDetail : React . FC = ( ) => {
75- const { runId, stackId } = useService ( ) ;
76- // const { runId, stackId, run, billing } = useService();
77- // debugger;
78- const tabPages = getTabPages ( {
79- runId,
80- stackId,
81- } ) ;
82- const breadcrumbs = getBreadcrumbs ( {
83- runId,
84- stackId,
85- } ) ;
86122
87123 return (
88124 < BasePage
0 commit comments