Skip to content

Commit 581790a

Browse files
authored
Mechanic ux (#281)
* E2E-UI * Mechanic UX fixes * Fix profile pages
1 parent 50402c6 commit 581790a

File tree

40 files changed

+1501
-368
lines changed

40 files changed

+1501
-368
lines changed

.github/workflows/pr-build.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ jobs:
2323
PLATFORMS: "linux/amd64,linux/arm64"
2424
permissions:
2525
pull-requests: write # Required to post comments
26+
contents: read
27+
checks: write
2628
steps:
2729
- name: Checkout code
2830
uses: actions/checkout@v4
@@ -177,6 +179,8 @@ jobs:
177179
runs-on: ubuntu-latest
178180
permissions:
179181
pull-requests: write
182+
contents: read
183+
checks: write
180184
steps:
181185
- name: Checkout code
182186
uses: actions/checkout@v4

deploy/docker/docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,9 @@ services:
155155
image: crapi/crapi-web:${VERSION:-latest}
156156
ports:
157157
- "${LISTEN_IP:-127.0.0.1}:8888:80"
158+
- "${LISTEN_IP:-127.0.0.1}:30080:80"
158159
- "${LISTEN_IP:-127.0.0.1}:8443:443"
160+
- "${LISTEN_IP:-127.0.0.1}:30443:443"
159161
environment:
160162
- COMMUNITY_SERVICE=crapi-community:${COMMUNITY_SERVER_PORT:-8087}
161163
- IDENTITY_SERVICE=crapi-identity:${IDENTITY_SERVER_PORT:-8080}

postman_collections/crAPI.postman_environment.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
"name": "Crapi",
44
"values": [{
55
"key": "url",
6-
"value": "http://127.0.0.1:8888",
6+
"value": "http://127.0.0.1:30080",
77
"enabled": true
88
},
99
{
1010
"key": "url_mail",
11-
"value": "http://127.0.0.1:8025",
11+
"value": "http://127.0.0.1:30080/mailhog",
1212
"enabled": true
1313
}
1414
],

services/identity/src/main/java/com/crapi/constant/UserMessage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public class UserMessage {
9191
public static final String CONVERT_VIDEO_INTERNAL_ERROR = "Error occured while executing.";
9292
public static final String CONVERT_VIDEO_CLOSE_TO_WIN_THE_GAME = "You are very close.";
9393
public static final String CONVERT_VIDEO_BASH_COMMAND_TRIGGERED =
94-
"Video conversion bash command triggered.";
94+
"Video conversion command executed.";
9595
public static final String SORRY_DIDNT_GET_PROFILE =
9696
"Sorry, Didn't get any profile video name for the user.";
9797
public static final String THIS_IS_ADMIN_FUNCTION =

services/identity/src/main/java/com/crapi/service/Impl/ProfileServiceImpl.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public CRAPIResponse deleteAdminProfileVideo(Long videoId, HttpServletRequest re
202202
@Transactional
203203
@Override
204204
public CRAPIResponse convertVideo(Long videoId, HttpServletRequest request) {
205-
BashCommand bashCommand = new BashCommand();
205+
BashCommand conversionShell = new BashCommand();
206206
ProfileVideo profileVideo;
207207
String host = request.getHeader(HttpHeaders.HOST);
208208
String xForwardedHost = request.getHeader("x-forwarded-host");
@@ -237,8 +237,11 @@ public CRAPIResponse convertVideo(Long videoId, HttpServletRequest request) {
237237
&& enable_shell_injection
238238
&& optionalProfileVideo.get().getConversion_params() != null) {
239239
profileVideo = optionalProfileVideo.get();
240-
return new CRAPIResponse(
241-
bashCommand.executeBashCommand(profileVideo.getConversion_params()), 200);
240+
String conversionCommand =
241+
String.format(
242+
"convertVideo -i %s %s",
243+
profileVideo.getVideo_name(), profileVideo.getConversion_params());
244+
return new CRAPIResponse(conversionShell.executeBashCommand(conversionCommand), 200);
242245
}
243246
return new CRAPIResponse(UserMessage.CONVERT_VIDEO_INTERNAL_ERROR, 500);
244247
}

services/mailhog/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#
22
# MailHog Dockerfile
33
#
4-
54
FROM golang:alpine AS builder
65

76
# Install MailHog:

services/web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "crapi-web",
33
"version": "0.1.0",
4-
"proxy": "http://localhost:8888",
4+
"proxy": "http://localhost:30080",
55
"private": true,
66
"dependencies": {
77
"@ant-design/cssinjs": "^1.21.1",
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import actionTypes from "../constants/actionTypes";
2+
3+
interface ActionPayload {
4+
accessToken: string;
5+
callback: (res: any, data?: any) => void;
6+
[key: string]: any;
7+
}
8+
9+
export const createCommentAction = ({
10+
accessToken,
11+
serviceId,
12+
comment,
13+
callback,
14+
...data
15+
}: ActionPayload) => {
16+
return {
17+
type: actionTypes.CREATE_SERVICE_COMMENT,
18+
payload: { accessToken, serviceId, comment, ...data, callback },
19+
};
20+
};
21+
22+
export const updateServiceRequestStatusAction = ({
23+
accessToken,
24+
serviceId,
25+
status,
26+
callback,
27+
...data
28+
}: ActionPayload) => {
29+
return {
30+
type: actionTypes.UPDATE_SERVICE_REQUEST_STATUS,
31+
payload: { accessToken, serviceId, status, ...data, callback },
32+
};
33+
};

services/web/src/actions/profileActions.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import actionTypes from "../constants/actionTypes";
1717

1818
interface ActionPayload {
1919
accessToken: string;
20-
callback: () => void;
20+
callback: (status: string, data: any) => void;
2121
[key: string]: any;
2222
}
2323

@@ -69,7 +69,7 @@ export const changeVideoNameAction = ({
6969
interface ConvertVideoPayload {
7070
accessToken: string;
7171
videoId: string;
72-
callback: () => void;
72+
callback: (res: string, data: any) => void;
7373
}
7474

7575
export const convertVideoAction = ({
@@ -86,3 +86,18 @@ export const convertVideoAction = ({
8686
},
8787
};
8888
};
89+
90+
export const getVideoAction = ({
91+
accessToken,
92+
videoId,
93+
callback,
94+
}: ActionPayload) => {
95+
return {
96+
type: actionTypes.GET_VIDEO,
97+
payload: {
98+
accessToken,
99+
videoId,
100+
callback,
101+
},
102+
};
103+
};

services/web/src/actions/userActions.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,18 @@ export const getMechanicServicesAction = ({
187187
};
188188
};
189189

190+
export const getMechanicServiceAction = ({
191+
accessToken,
192+
serviceId,
193+
callback,
194+
...data
195+
}: ActionPayload & AccessTokenPayload) => {
196+
return {
197+
type: actionTypes.GET_MECHANIC_SERVICE,
198+
payload: { accessToken, serviceId, callback, ...data },
199+
};
200+
};
201+
190202
export const getVehicleServicesAction = ({
191203
accessToken,
192204
VIN,

0 commit comments

Comments
 (0)