Skip to content

Commit 5d26f51

Browse files
Merge branch 'dev' into logs-URL-to-run-details
2 parents 942b034 + 943d84f commit 5d26f51

File tree

12 files changed

+228
-67
lines changed

12 files changed

+228
-67
lines changed

src/api/stacks/getMyStacksApi.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { httpMethods } from '../constants';
44
import { apiUrl } from '../apiUrl';
55

66
const getMyStacksApi = ({
7+
component_id,
78
workspace,
89
sort_by,
910
logical_operator,
@@ -12,6 +13,7 @@ const getMyStacksApi = ({
1213
filtersParam,
1314
authenticationToken,
1415
}: {
16+
component_id?: any;
1517
workspace: string;
1618
sort_by: string;
1719
logical_operator: string;
@@ -22,7 +24,14 @@ const getMyStacksApi = ({
2224
}): Promise<TStack> =>
2325
fetchApiWithAuthRequest({
2426
url: apiUrl(endpoints.Stacks.my(workspace)),
25-
params: { sort_by, logical_operator, page, size, ...filtersParam },
27+
params: {
28+
component_id,
29+
sort_by,
30+
logical_operator,
31+
page,
32+
size,
33+
...filtersParam,
34+
},
2635
method: httpMethods.get,
2736
authenticationToken,
2837
});

src/redux/actions/stacks/getMyStacksAction.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { stackActionTypes } from '../../actionTypes';
22
import getMyStacksApi from '../../../api/stacks/getMyStacksApi';
33

44
export const getMyStacksAction = ({
5+
component_id,
56
workspace,
67
sort_by,
78
logical_operator,
@@ -12,6 +13,7 @@ export const getMyStacksAction = ({
1213
onSuccess,
1314
onFailure,
1415
}: {
16+
component_id?: any;
1517
name?: string;
1618
workspace?: string;
1719
sort_by?: string;
@@ -29,6 +31,7 @@ export const getMyStacksAction = ({
2931
failureActionType: stackActionTypes.getMyStacks.failure,
3032
successActionType: stackActionTypes.getMyStacks.success,
3133
params: {
34+
component_id,
3235
workspace,
3336
name,
3437
sort_by,

src/routes/appRoutesConfig.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,14 @@ const routes = [
321321
},
322322
exact: true,
323323
},
324+
{
325+
path: routePaths.stackComponents.stacks(':type', ':id', ':string'),
326+
Component: stackComponentsDetail,
327+
visibility: {
328+
authentication: RouteVisibilityAuthentication.authenticatedOnly,
329+
},
330+
exact: true,
331+
},
324332

325333
{
326334
path: routePaths.settings.base,

src/routes/routePaths.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ export const routePaths = {
1111
dashboard: (workspace: string): string => `/workspaces/${workspace}`,
1212
pipelines: {
1313
base: `/pipelines`,
14-
list: (workspace: string): string => `/workspaces/${workspace}/pipelines/list`,
14+
list: (workspace: string): string =>
15+
`/workspaces/${workspace}/pipelines/list`,
1516
allRuns: (workspace: string): string => `/workspaces/${workspace}/all-runs`,
1617
},
1718
pipeline: {
@@ -96,6 +97,8 @@ export const routePaths = {
9697
`/workspaces/${workspace}/components/${type}/${id}/configuration`,
9798
runs: (type: string, id: TId, workspace: string): string =>
9899
`/workspaces/${workspace}/components/${type}/${id}/runs`,
100+
stacks: (type: string, id: TId, workspace: string): string =>
101+
`/workspaces/${workspace}/components/${type}/${id}/stacks`,
99102
},
100103

101104
settings: {

src/ui/layouts/common/Pagination/index.tsx

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ export const Pagination: React.FC<Props> = forwardRef((props, ref) => {
8484
} = callActionForStackComponentRunsForPagination();
8585
const locationPath = useLocation();
8686
const componentName = locationPath.pathname.split('/')[3];
87+
const CheckIfStackFormComponents =
88+
componentName === 'components' &&
89+
locationPath.pathname.split('/')[6] === 'stacks'
90+
? locationPath.pathname.split('/')[6]
91+
: locationPath.pathname.split('/')[5];
8792
const CheckIfRun =
8893
componentName === 'components'
8994
? locationPath.pathname.split('/')[6]
@@ -150,7 +155,16 @@ export const Pagination: React.FC<Props> = forwardRef((props, ref) => {
150155
break;
151156
}
152157
case 'components':
153-
if (CheckIfRun) {
158+
if (CheckIfRun && CheckIfStackFormComponents === 'stacks') {
159+
dispatchStackData(
160+
page,
161+
size,
162+
checkValidFilter.length ? (filters as any) : [],
163+
activeSorting,
164+
locationPath.pathname.split('/')[5],
165+
);
166+
break;
167+
} else if (CheckIfRun && CheckIfStackFormComponents === 'runs') {
154168
dispatchStackComponentRunsData(
155169
id,
156170
page,
@@ -168,6 +182,24 @@ export const Pagination: React.FC<Props> = forwardRef((props, ref) => {
168182
);
169183
break;
170184
}
185+
// dispatchStackComponentRunsData(
186+
// id,
187+
// page,
188+
// size,
189+
// checkValidFilter.length ? (filters as any) : [],
190+
// activeSorting,
191+
192+
// );
193+
// break;
194+
// } else {
195+
// dispatchStackComponentsData(
196+
// page,
197+
// size,
198+
// checkValidFilter.length ? (filters as any) : [],
199+
// activeSorting,
200+
// );
201+
// break;
202+
// }
171203
case 'pipelines':
172204
if (CheckIfRun) {
173205
dispatchPipelineRunsData(

src/ui/layouts/common/Table/index.tsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,12 @@ export const Table: React.FC<TableProps> = ({
190190
componentName === 'components'
191191
? locationPath.pathname.split('/')[6]
192192
: locationPath.pathname.split('/')[5];
193+
const CheckIfStackFormComponents =
194+
componentName === 'components' &&
195+
locationPath.pathname.split('/')[6] === 'stacks'
196+
? locationPath.pathname.split('/')[6]
197+
: locationPath.pathname.split('/')[5];
198+
193199
const id =
194200
componentName === 'components'
195201
? locationPath.pathname.split('/')[5]
@@ -201,6 +207,7 @@ export const Table: React.FC<TableProps> = ({
201207
if (filters) {
202208
setPageIndex(0);
203209
}
210+
204211
switch (componentName) {
205212
case 'stacks':
206213
if (CheckIfRun) {
@@ -218,11 +225,21 @@ export const Table: React.FC<TableProps> = ({
218225
itemPerPage,
219226
checkValidFilter.length ? (validFilters as any) : [],
220227
activeSorting,
228+
locationPath.pathname.split('/')[6],
221229
);
222230
break;
223231
}
224232
case 'components':
225-
if (CheckIfRun) {
233+
if (CheckIfRun && CheckIfStackFormComponents === 'stacks') {
234+
dispatchStackData(
235+
1,
236+
itemPerPage,
237+
checkValidFilter.length ? (validFilters as any) : [],
238+
activeSorting,
239+
locationPath.pathname.split('/')[5],
240+
);
241+
break;
242+
} else if (CheckIfRun && CheckIfStackFormComponents === 'runs') {
226243
dispatchStackComponentRunsData(
227244
id,
228245
1,

src/ui/layouts/pipelines/Pipelines/List/getHeaderCols.tsx

Lines changed: 41 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
Box,
77
FlexBox,
88
icons,
9-
LinkBox,
9+
// LinkBox,
1010
Paragraph,
1111
} from '../../../../components';
1212
import { HeaderCol } from '../../../common/Table';
@@ -47,40 +47,51 @@ export const GetHeaderCols = ({
4747
activeSortingDirection,
4848
filteredPipelines,
4949
});
50+
console.log('expendedRow', expendedRow);
5051
return [
5152
{
5253
width: '3%',
5354
renderRow: (pipeline: TPipeline) => (
54-
<LinkBox
55-
style={{ padding: 0 }}
56-
onClick={(e: Event) => {
57-
e.stopPropagation();
58-
if (openPipelineIds.indexOf(pipeline.id) === -1) {
59-
setOpenPipelineIds([...openPipelineIds, pipeline.id]);
60-
} else {
61-
setOpenPipelineIds(
62-
openPipelineIds.filter((id: TId) => id !== pipeline.id),
63-
);
64-
}
65-
}}
55+
<FlexBox
56+
justifyContent="center"
57+
style={{ paddingTop: '5px', paddingBottom: '5px' }}
6658
>
67-
<FlexBox
68-
justifyContent="center"
69-
style={{ paddingTop: '5px', paddingBottom: '5px' }}
70-
>
71-
{openPipelineIds.indexOf(pipeline.id) === -1 ? (
72-
<icons.chevronDownLight
73-
color={iconColors.grey}
74-
size={iconSizes.sm}
75-
/>
76-
) : (
77-
<icons.chevronUpLight
78-
color={iconColors.grey}
79-
size={iconSizes.sm}
80-
/>
81-
)}
82-
</FlexBox>
83-
</LinkBox>
59+
{expendedRow?.length === 1 ? (
60+
<icons.chevronDown color={iconColors.grey} size={iconSizes.sm} />
61+
) : (
62+
<icons.rightArrow color={iconColors.grey} size={iconSizes.sm} />
63+
)}
64+
</FlexBox>
65+
// <LinkBox
66+
// style={{ padding: 0 }}
67+
// onClick={(e: Event) => {
68+
// e.stopPropagation();
69+
// if (openPipelineIds.indexOf(pipeline.id) === -1) {
70+
// setOpenPipelineIds([...openPipelineIds, pipeline.id]);
71+
// } else {
72+
// setOpenPipelineIds(
73+
// openPipelineIds.filter((id: TId) => id !== pipeline.id),
74+
// );
75+
// }
76+
// }}
77+
// >
78+
// <FlexBox
79+
// justifyContent="center"
80+
// style={{ paddingTop: '5px', paddingBottom: '5px' }}
81+
// >
82+
// {openPipelineIds.indexOf(pipeline.id) === -1 ? (
83+
// <icons.chevronDownLight
84+
// color={iconColors.grey}
85+
// size={iconSizes.sm}
86+
// />
87+
// ) : (
88+
// <icons.chevronUpLight
89+
// color={iconColors.grey}
90+
// size={iconSizes.sm}
91+
// />
92+
// )}
93+
// </FlexBox>
94+
// </LinkBox>
8495
),
8596
},
8697
{

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

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ import { BasePage } from '../BasePage';
1313
import { useService } from './useService';
1414
import { useLocationPath, useSelector } from '../../../hooks';
1515
import FilterComponent, {
16+
getInitialFilterState,
1617
getInitialFilterStateForRuns,
1718
} from '../../../components/Filters';
1819
import { workspaceSelectors } from '../../../../redux/selectors';
19-
import { List } from '../Stacks/List';
20+
import { List as StackComponenList } from '../Stacks/List';
21+
import { List } from '../../stacks/Stacks/List';
2022

2123
const FilterWrapperForRun = () => {
2224
const locationPath = useLocationPath();
@@ -46,6 +48,35 @@ const FilterWrapperForRun = () => {
4648
</FilterComponent>
4749
);
4850
};
51+
52+
const FilterWrapperForStacks = () => {
53+
const locationPath = useLocationPath();
54+
55+
// TODO: Dev please note: getInitialFilterState is for stack inital filter value for any other component you need to modify it
56+
const [filters, setFilter] = useState([getInitialFilterState()]);
57+
function getFilter(values: any) {
58+
const filterValuesMap = values.map((v: any) => {
59+
return {
60+
column: v.column.selectedValue,
61+
type: v.contains.selectedValue,
62+
value: v.filterValue,
63+
};
64+
});
65+
return filterValuesMap;
66+
}
67+
return (
68+
<FilterComponent
69+
getInitials={getInitialFilterState}
70+
filters={filters}
71+
setFilter={setFilter}
72+
>
73+
<List
74+
stackComponentId={locationPath.split('/')[5]}
75+
filter={getFilter(filters)}
76+
/>
77+
</FilterComponent>
78+
);
79+
};
4980
const getTabPages = (
5081
stackId: TId,
5182
locationPath: any,
@@ -70,6 +101,15 @@ const getTabPages = (
70101
selectedWorkspace,
71102
),
72103
},
104+
{
105+
text: 'Stacks',
106+
Component: FilterWrapperForStacks,
107+
path: routePaths.stackComponents.stacks(
108+
locationPath.split('/')[4],
109+
stackId,
110+
selectedWorkspace,
111+
),
112+
},
73113
];
74114
};
75115

@@ -191,12 +231,12 @@ export const StackDetail: React.FC = () => {
191231
</Box>
192232
</Box> */}
193233
<Box paddingTop={'xl'}>
194-
<List
234+
<StackComponenList
195235
filter={[]}
196236
pagination={false}
197237
isExpended
198238
id={stackComponent.id}
199-
></List>
239+
></StackComponenList>
200240
{/* <>
201241
<table className={cn(styles.table)}>
202242
<tbody>

0 commit comments

Comments
 (0)