Skip to content

Commit d56615f

Browse files
added components tab in stackDetails
1 parent 05ef2e8 commit d56615f

File tree

4 files changed

+89
-3
lines changed

4 files changed

+89
-3
lines changed

src/routes/appRoutesConfig.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,15 @@ const routes = [
157157
},
158158
exact: true,
159159
},
160+
{
161+
path: routePaths.stack.components(':id', ':string'),
162+
Component: StackDetail,
163+
visibility: {
164+
authentication: RouteVisibilityAuthentication.authenticatedOnly,
165+
},
166+
exact: true,
167+
},
168+
160169
{
161170
path: routePaths.stack.runs(':string', ':id'),
162171
Component: StackDetail,

src/routes/routePaths.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ export const routePaths = {
8383
`/workspaces/${workspace}/stacks/${id}/configuration`,
8484
runs: (workspace: string, id: TId): string =>
8585
`/workspaces/${workspace}/stacks/${id}/runs`,
86+
components: (id: TId, workspace: string): string =>
87+
`/workspaces/${workspace}/stacks/${id}/components`,
8688
},
8789
runs: {
8890
base: (id: TId): string => `/stacks/${id}`,
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
@import '../../../globalStyles';
2+
$nameColor: #22bbdd;
3+
4+
.tile {
5+
background: #f9f7ff;
6+
border-radius: 3px;
7+
padding: 5px 15px !important;
8+
margin-right: 10px !important;
9+
}
10+
11+
12+
13+
.tile,
14+
.name {
15+
color: $nameColor;
16+
}

src/ui/layouts/stacks/StackDetail/index.tsx

Lines changed: 62 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,18 @@ import React, { useState } from 'react';
66
import { routePaths } from '../../../../routes/routePaths';
77
import { translate } from './translate';
88
import { Configuration } from './Configuration';
9+
import styles from './NestedRow.module.scss';
910
import { Runs } from './Runs';
1011
import { BasePage } from '../BasePage';
1112
import { useService } from './useService';
12-
import { useLocationPath, useSelector } from '../../../hooks';
13+
import { useHistory, useLocationPath, useSelector } from '../../../hooks';
1314
import FilterComponent, {
1415
getInitialFilterStateForRuns,
1516
} from '../../../components/Filters';
1617
import { workspaceSelectors } from '../../../../redux/selectors';
1718
import { DEFAULT_WORKSPACE_NAME } from '../../../../constants';
1819
import { List } from '../Stacks/List';
20+
import { Box, FlexBox, Paragraph } from '../../../components';
1921

2022
const FilterWrapperForRun = () => {
2123
const locationPath = useLocationPath();
@@ -42,8 +44,51 @@ const FilterWrapperForRun = () => {
4244
</FilterComponent>
4345
);
4446
};
45-
const getTabPages = (stackId: TId, selectedWorkspace: string): TabPage[] => {
47+
48+
const getTabPages = (
49+
stackId: TId,
50+
selectedWorkspace: string,
51+
tiles?: any,
52+
history?: any,
53+
): TabPage[] => {
4654
return [
55+
{
56+
text: 'Components',
57+
Component: () => (
58+
<FlexBox.Row
59+
marginVertical="sm"
60+
marginHorizontal="md"
61+
className={styles.nestedrow}
62+
padding="md"
63+
alignItems="center"
64+
>
65+
{tiles &&
66+
tiles.map((tile: any, index: number) => (
67+
<Box key={index} className={styles.tile} color="black">
68+
<Paragraph
69+
size="small"
70+
style={{ cursor: 'pointer' }}
71+
onClick={() => {
72+
history.push(
73+
routePaths.stackComponents.configuration(
74+
tile.type,
75+
tile.id,
76+
selectedWorkspace,
77+
),
78+
);
79+
}}
80+
>
81+
<span>
82+
{tile.type} {'>'}{' '}
83+
</span>{' '}
84+
<span className={styles.name}>{tile.name}</span>
85+
</Paragraph>
86+
</Box>
87+
))}
88+
</FlexBox.Row>
89+
),
90+
path: routePaths.stack.components(stackId, selectedWorkspace),
91+
},
4792
{
4893
text: translate('tabs.configuration.text'),
4994
Component: () => <Configuration stackId={stackId} />,
@@ -87,9 +132,23 @@ export interface StackDetailRouteParams {
87132

88133
export const StackDetail: React.FC = () => {
89134
const { stack } = useService();
135+
const history = useHistory();
136+
const nestedRowtiles = [];
137+
for (const [key] of Object.entries(stack.components)) {
138+
nestedRowtiles.push({
139+
type: key,
140+
name: stack.components[key][0].name,
141+
id: stack.components[key][0].id,
142+
});
143+
}
90144
const selectedWorkspace = useSelector(workspaceSelectors.selectedWorkspace);
91145

92-
const tabPages = getTabPages(stack.id, selectedWorkspace);
146+
const tabPages = getTabPages(
147+
stack.id,
148+
selectedWorkspace,
149+
nestedRowtiles,
150+
history,
151+
);
93152
const breadcrumbs = getBreadcrumbs(stack.id, selectedWorkspace);
94153

95154
// const boxStyle = {

0 commit comments

Comments
 (0)