Skip to content

Commit d33d2c8

Browse files
authored
Merge pull request #66 from zenml-io/improve/QOL
Improve/qol
2 parents 44716fd + ec2019d commit d33d2c8

File tree

79 files changed

+989
-264
lines changed

Some content is hidden

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

79 files changed

+989
-264
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/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
});

src/redux/actionTypes/constants.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,21 @@ const pipelineActionTypes = {
2828
PIPELINES_GET_PIPELINE_FOR_ID: 'PIPELINES_GET_PIPELINE_FOR_ID',
2929
RUNS_GET_PIPELINE_FOR_ID: 'RUNS_GET_PIPELINE_FOR_ID',
3030
};
31+
32+
const projectActionTypes = {
33+
PROJECTS_GET_MY_PROJECTS: 'PROJECTS_GET_MY_PROJECTS',
34+
SELECT_PROJECT_FROM_MY_PROJECTS: 'SELECT_PROJECT_FROM_MY_PROJECTS',
35+
};
3136
const stackActionTypes = {
3237
STACKS_GET_MY_STACKS: 'STACKS_GET_MY_STACKS',
3338
STACKS_GET_STACK_FOR_ID: 'STACKS_GET_STACK_FOR_ID',
3439
RUNS_GET_STACK_FOR_ID: 'RUNS_GET_STACK_FOR_ID',
3540
};
3641

42+
const rolesActionTypes = {
43+
ROLES_GET_ALL_ROLES: 'ROLES_GET_ALL_ROLES',
44+
};
45+
3746
const stackComponentActionTypes = {
3847
STACKCOMPONENTS_GET_STACKCOMPONENTS_TYPE:
3948
'STACKCOMPONENTS_GET_STACKCOMPONENTS_TYPE',
@@ -75,12 +84,12 @@ export const actionTypes = {
7584
...sessionActionTypes,
7685
...userActionTypes,
7786
...organizationActionTypes,
78-
87+
...projectActionTypes,
7988
...pipelineActionTypes,
8089
...stackActionTypes,
8190
...runActionTypes,
8291
...runPagesActionTypes,
83-
92+
...rolesActionTypes,
8493
...pipelinePagesActionTypes,
8594
...stackPagesActionTypes,
8695
...stackComponentPagesActionTypes,

0 commit comments

Comments
 (0)