Skip to content

Commit 55c5e40

Browse files
remove hydrated and added project scope for all runs
1 parent 7008d3c commit 55c5e40

File tree

14 files changed

+85
-72
lines changed

14 files changed

+85
-72
lines changed

src/api/endpoints.ts

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,42 +24,35 @@ export const endpoints = {
2424
},
2525

2626
pipelines: {
27-
my: (project: string): string =>
28-
`/projects/${project}/pipelines?hydrated=true`,
29-
get: (pipelineId: TId): string =>
30-
`/pipelines/${pipelineId}?unlisted=false&hydrated=true`,
27+
my: (project: string): string => `/projects/${project}/pipelines`,
28+
get: (pipelineId: TId): string => `/pipelines/${pipelineId}`,
3129
},
3230
Stacks: {
33-
my: (project: string): string =>
34-
`/projects/${project}/stacks?hydrated=true`,
35-
get: (stackId: TId): string =>
36-
`/stacks/${stackId}?unlisted=false&hydrated=true`,
31+
my: (project: string): string => `/projects/${project}/stacks`,
32+
get: (stackId: TId): string => `/stacks/${stackId}`,
3733
},
3834
StackComponents: {
3935
types: '/component-types',
4036
my: (type: string, project: string): string =>
41-
`/projects/${project}/components?type=${type}&hydrated=true`,
42-
get: (stackComponentId: TId): string =>
43-
`/components/${stackComponentId}?hydrated=true`,
37+
`/projects/${project}/components?type=${type}`,
38+
get: (stackComponentId: TId): string => `/components/${stackComponentId}`,
4439
},
4540
runs: {
4641
pipeline: {
47-
get: (pipelineId: TId): string =>
48-
`/runs?pipeline_id=${pipelineId}&unlisted=false&hydrated=true`,
42+
get: (pipelineId: TId): string => `/runs?pipeline_id=${pipelineId}`,
4943
},
5044
stack: {
51-
get: (stackId: TId): string =>
52-
`/runs?stack_id=${stackId}&unlisted=false&hydrated=true`,
45+
get: (stackId: TId): string => `/runs?stack_id=${stackId}`,
5346
},
5447
stackComponent: {
5548
get: (stackComponentId: TId): string =>
56-
`/runs?component_id=${stackComponentId}&unlisted=false&hydrated=true`,
49+
`/runs?component_id=${stackComponentId}`,
5750
},
5851
graphById: {
5952
get: (runId: TId): string => `/runs/${runId}/graph`,
6053
},
61-
all: `/runs?unlisted=false&hydrated=true`,
62-
get: (runId: TId): string => `/runs/${runId}?unlisted=false&hydrated=true`,
54+
all: (project: string): string => `/projects/${project}/runs`,
55+
get: (runId: TId): string => `/runs/${runId}`,
6356
},
6457
roles: {
6558
all: `/roles`,

src/api/runs/getAllRunsApi.ts

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

66
const getAllRunsApi = ({
7+
project,
78
authenticationToken,
89
}: {
10+
project: string;
911
authenticationToken: string;
1012
}): Promise<TOrganization> =>
1113
fetchApiWithAuthRequest({
12-
url: apiUrl(endpoints.runs.all),
14+
url: apiUrl(endpoints.runs.all(project)),
1315
method: httpMethods.get,
1416
authenticationToken,
1517
});

src/redux/actions/runs/getAllRunsAction.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ import { runActionTypes } from '../../actionTypes';
22
import getAllRunsApi from '../../../api/runs/getAllRunsApi';
33

44
export const getAllRunsAction = ({
5+
project,
56
onSuccess,
67
onFailure,
78
}: {
9+
project: string;
810
onSuccess?: () => void;
911
onFailure?: () => void;
1012
}): TRequestAction => ({
@@ -14,6 +16,7 @@ export const getAllRunsAction = ({
1416
isAuthenticated: true,
1517
failureActionType: runActionTypes.getAllRuns.failure,
1618
successActionType: runActionTypes.getAllRuns.success,
19+
params: { project },
1720
onSuccess,
1821
onFailure,
1922
},

src/routes/appRoutesConfig.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ const routes = [
117117
exact: true,
118118
},
119119
{
120-
path: routePaths.stacks.list,
120+
path: routePaths.stacks.list(':string'),
121121
Component: stacks,
122122
visibility: {
123123
authentication: RouteVisibilityAuthentication.authenticatedOnly,

src/routes/routePaths.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export const routePaths = {
5656
},
5757
stacks: {
5858
base: '/stacks',
59-
list: '/stacks/list',
59+
list: (project: string): string => `/projects/${project}/stacks/list`,
6060
allRuns: '/stacks/all-runs',
6161
},
6262
stack: {

src/ui/layouts/common/layouts/AuthenticatedLayout/AuthenticatedSidebar/Menu/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export const Menu: React.FC = () => {
7676
Icon={() => (
7777
<icons.stack color={iconColors.white} size={iconSizes.md} />
7878
)}
79-
to={routePaths.stacks.list}
79+
to={routePaths.stacks.list(selectedProject)}
8080
text={translate('menu.stacks.text')}
8181
/>
8282

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ export const GetHeaderCols = ({
6969
>
7070
<FlexBox justifyContent="center">
7171
{openPipelineIds.indexOf(pipeline.id) === -1 ? (
72-
<icons.rightArrow color={iconColors.grey} size={iconSizes.md} />
72+
<icons.rightArrow color={iconColors.grey} size={iconSizes.sm} />
7373
) : (
74-
<icons.chevronDown color={iconColors.grey} size={iconSizes.md} />
74+
<icons.chevronDown color={iconColors.grey} size={iconSizes.sm} />
7575
)}
7676
</FlexBox>
7777
</LinkBox>

src/ui/layouts/pipelines/Pipelines/useService.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export const useService = (): ServiceInterface => {
2525
setFetchingForAllRuns(true);
2626
dispatch(
2727
runsActions.allRuns({
28+
project: selectedProject,
2829
onSuccess: () => setFetchingForAllRuns(false),
2930
onFailure: () => setFetchingForAllRuns(false),
3031
}),

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import { Configuration } from './Configuration';
99
import { Runs } from './Runs';
1010
import { BasePage } from '../BasePage';
1111
import { useService } from './useService';
12+
import { useSelector } from '../../../hooks';
13+
import { projectSelectors } from '../../../../redux/selectors';
1214

1315
const getTabPages = (stackId: TId): TabPage[] => {
1416
return [
@@ -25,12 +27,15 @@ const getTabPages = (stackId: TId): TabPage[] => {
2527
];
2628
};
2729

28-
const getBreadcrumbs = (stackId: TId): TBreadcrumb[] => {
30+
const getBreadcrumbs = (
31+
stackId: TId,
32+
selectedProject: string,
33+
): TBreadcrumb[] => {
2934
return [
3035
{
3136
name: translate('header.breadcrumbs.stacks.text'),
3237
clickable: true,
33-
to: routePaths.stacks.list,
38+
to: routePaths.stacks.list(selectedProject),
3439
},
3540
{
3641
name: stackId,
@@ -46,9 +51,9 @@ export interface StackDetailRouteParams {
4651

4752
export const StackDetail: React.FC = () => {
4853
const { stack } = useService();
49-
54+
const selectedProject = useSelector(projectSelectors.selectedProject);
5055
const tabPages = getTabPages(stack.id);
51-
const breadcrumbs = getBreadcrumbs(stack.id);
56+
const breadcrumbs = getBreadcrumbs(stack.id, selectedProject);
5257

5358
const boxStyle = {
5459
backgroundColor: '#E9EAEC',

src/ui/layouts/runs/Stacks/index.tsx

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,30 @@ import { BasePage } from '../BasePage';
55
import { routePaths } from '../../../../routes/routePaths';
66

77
import { useService } from './useService';
8-
9-
const PAGES = [
10-
{
11-
text: translate('tabs.stacks.text'),
12-
Component: List,
13-
path: routePaths.stacks.list,
14-
},
15-
];
16-
17-
const BREADCRUMBS = [
18-
{
19-
name: translate('header.breadcrumbs.stacks.text'),
20-
clickable: true,
21-
to: routePaths.stacks.list,
22-
},
23-
];
8+
import { useSelector } from '../../../hooks';
9+
import { projectSelectors } from '../../../../redux/selectors';
2410

2511
export const Stacks: React.FC = () => {
2612
const { setFetching } = useService();
2713
console.log(setFetching);
28-
14+
const selectedProject = useSelector(projectSelectors.selectedProject);
2915
return (
3016
<BasePage
31-
tabPages={PAGES}
17+
tabPages={[
18+
{
19+
text: translate('tabs.stacks.text'),
20+
Component: List,
21+
path: routePaths.stacks.list(selectedProject),
22+
},
23+
]}
3224
tabBasePath={routePaths.stacks.base}
33-
breadcrumbs={BREADCRUMBS}
25+
breadcrumbs={[
26+
{
27+
name: translate('header.breadcrumbs.stacks.text'),
28+
clickable: true,
29+
to: routePaths.stacks.list(selectedProject),
30+
},
31+
]}
3432
headerWithButtons
3533
renderHeaderRight={() => <></>}
3634
/>

0 commit comments

Comments
 (0)