Skip to content

Commit f575e2e

Browse files
committed
Merge remote-tracking branch 'origin/dev' into main
2 parents 9ee818d + d33d2c8 commit f575e2e

File tree

80 files changed

+1073
-281
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+1073
-281
lines changed

global.d.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ interface TRequestActionPayload {
1616
failureActionType?: string;
1717
successActionType?: string;
1818
params?: Record<string, unknown>;
19-
onSuccess?: () => void;
19+
onSuccess?: (res: any) => void;
2020
onFailure?: (errorText: string) => void;
2121
}
2222

@@ -74,7 +74,13 @@ interface TWorkspace {
7474
name: string;
7575
createdAt: Date;
7676
}
77-
77+
interface Projects {
78+
id: TId;
79+
created: Date;
80+
updated: Date;
81+
name: string;
82+
description: string;
83+
}
7884
interface TPipeline {
7985
id: TId;
8086
name: string;
@@ -112,6 +118,13 @@ interface TStack {
112118
user?: any;
113119
isShared?: Boolean;
114120
}
121+
interface Roles {
122+
id: TId;
123+
created: Date;
124+
updated: Date;
125+
name: string;
126+
permissions: Array;
127+
}
115128
type TRunStatus =
116129
| 'finished'
117130
| 'In Progress'

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"i18next": "^19.6.3",
3838
"i18next-browser-languagedetector": "^5.0.0",
3939
"json2yaml": "^1.1.0",
40+
"jwt-decode": "^3.1.2",
4041
"node-sass": "^4.14.1",
4142
"query-string": "^6.13.1",
4243
"react": "^16.13.1",

src/App.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ import './App.css';
1111
import './ui/default.css';
1212

1313
const { store, persistor } = configureStore();
14+
if (
15+
process.env.REACT_APP_DEMO_SETUP === 'true' &&
16+
(process.env.REACT_APP_USERNAME === undefined ||
17+
process.env.REACT_APP_PASSWORD === undefined)
18+
) {
19+
console.warn(
20+
'You need to add process.env.REACT_APP_USERNAME and process.env.REACT_APP_PASSWORD in .env file.',
21+
);
22+
}
1423

1524
const App: React.FC = () => {
1625
return (

src/api/endpoints.ts

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,39 +19,42 @@ export const endpoints = {
1919
deleteInvite: (id: string): string => `/users/${id}`,
2020
},
2121

22+
projects: {
23+
my: '/projects',
24+
},
25+
2226
pipelines: {
23-
my: '/pipelines?hydrated=true',
24-
get: (pipelineId: TId): string =>
25-
`/pipelines/${pipelineId}?unlisted=false&hydrated=true`,
27+
my: (project: string): string => `/projects/${project}/pipelines`,
28+
get: (pipelineId: TId): string => `/pipelines/${pipelineId}`,
2629
},
2730
Stacks: {
28-
my: '/stacks?hydrated=true',
29-
get: (stackId: TId): string =>
30-
`/stacks/${stackId}?unlisted=false&hydrated=true`,
31+
my: (project: string): string => `/projects/${project}/stacks`,
32+
get: (stackId: TId): string => `/stacks/${stackId}`,
3133
},
3234
StackComponents: {
3335
types: '/component-types',
34-
my: (type: string): string => `/components?type=${type}&hydrated=true`,
35-
get: (stackComponentId: TId): string =>
36-
`/components/${stackComponentId}?hydrated=true`,
36+
my: (type: string, project: string): string =>
37+
`/projects/${project}/components?type=${type}`,
38+
get: (stackComponentId: TId): string => `/components/${stackComponentId}`,
3739
},
3840
runs: {
3941
pipeline: {
40-
get: (pipelineId: TId): string =>
41-
`/runs?pipeline_id=${pipelineId}&unlisted=false&hydrated=true`,
42+
get: (pipelineId: TId): string => `/runs?pipeline_id=${pipelineId}`,
4243
},
4344
stack: {
44-
get: (stackId: TId): string =>
45-
`/runs?stack_id=${stackId}&unlisted=false&hydrated=true`,
45+
get: (stackId: TId): string => `/runs?stack_id=${stackId}`,
4646
},
4747
stackComponent: {
4848
get: (stackComponentId: TId): string =>
49-
`/runs?component_id=${stackComponentId}&unlisted=false&hydrated=true`,
49+
`/runs?component_id=${stackComponentId}`,
5050
},
5151
graphById: {
5252
get: (runId: TId): string => `/runs/${runId}/graph`,
5353
},
54-
all: `/runs?unlisted=false&hydrated=true`,
55-
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}`,
56+
},
57+
roles: {
58+
all: `/roles`,
5659
},
5760
};

src/api/pipelines/getMyPipelinesApi.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ import { apiUrl } from '../apiUrl';
55

66
const getMyPipelinesApi = ({
77
authenticationToken,
8+
project,
89
}: {
910
authenticationToken: string;
11+
project: string;
1012
}): Promise<TPipeline> =>
1113
fetchApiWithAuthRequest({
12-
url: apiUrl(endpoints.pipelines.my),
14+
url: apiUrl(endpoints.pipelines.my(project)),
1315
method: httpMethods.get,
1416
authenticationToken,
1517
});
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { fetchApiWithAuthRequest } from '../fetchApi';
2+
import { endpoints } from '../endpoints';
3+
import { httpMethods } from '../constants';
4+
import { apiUrl } from '../apiUrl';
5+
6+
const getMyProjectApi = ({
7+
authenticationToken,
8+
}: {
9+
authenticationToken: string;
10+
}): Promise<TPipeline> =>
11+
fetchApiWithAuthRequest({
12+
url: apiUrl(endpoints.projects.my),
13+
method: httpMethods.get,
14+
authenticationToken,
15+
});
16+
17+
export default getMyProjectApi;

src/api/roles/getRolesApi.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { fetchApiWithAuthRequest } from '../fetchApi';
2+
import { endpoints } from '../endpoints';
3+
import { httpMethods } from '../constants';
4+
import { apiUrl } from '../apiUrl';
5+
6+
const getRolesApi = ({
7+
authenticationToken,
8+
}: {
9+
authenticationToken: string;
10+
}): Promise<Roles> =>
11+
fetchApiWithAuthRequest({
12+
url: apiUrl(endpoints.roles.all),
13+
method: httpMethods.get,
14+
authenticationToken,
15+
});
16+
17+
export default getRolesApi;

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/api/stackComponents/getStackComponentListApi.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ import { apiUrl } from '../apiUrl';
66
const getMyStackComponentsApi = ({
77
authenticationToken,
88
type,
9+
project,
910
}: {
11+
project: string;
1012
authenticationToken: string;
1113
type: string;
1214
}): Promise<TStack> =>
1315
fetchApiWithAuthRequest({
14-
url: apiUrl(endpoints.StackComponents.my(type)),
16+
url: apiUrl(endpoints.StackComponents.my(type, project)),
1517
method: httpMethods.get,
1618
authenticationToken,
1719
});

src/api/stacks/getMyStacksApi.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 getMyStacksApi = ({
7+
project,
78
authenticationToken,
89
}: {
10+
project: string;
911
authenticationToken: string;
1012
}): Promise<TStack> =>
1113
fetchApiWithAuthRequest({
12-
url: apiUrl(endpoints.Stacks.my),
14+
url: apiUrl(endpoints.Stacks.my(project)),
1315
method: httpMethods.get,
1416
authenticationToken,
1517
});

0 commit comments

Comments
 (0)