Skip to content

Commit b6c7174

Browse files
authored
Merge pull request #58 from Eclipse-Dominator/matching_timer_cancel
Matching timeout and cancel
2 parents 19b10a4 + ee770e5 commit b6c7174

30 files changed

+746
-4078
lines changed

.github/workflows/build_push_registry.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ jobs:
3030
question_service:
3131
- 'question_service/**'
3232
matching_service:
33-
- 'user_service/**'
34-
match_worker:
35-
- 'match_worker/**'
33+
- 'matching_service/**'
3634
collab_service:
3735
- 'collab_service/**'
3836
@@ -88,14 +86,7 @@ jobs:
8886
docker-compose push matching-service
8987
echo "::set-output name=build_status::true"
9088
91-
- name: 5. Build and Push match-worker
92-
if: steps.changes.outputs.match_worker == 'true'
93-
run: |
94-
docker-compose build match-worker
95-
docker-compose push match-worker
96-
echo "::set-output name=build_status::true"
97-
98-
- name: 6. Build and Push collab-service
89+
- name: 5. Build and Push collab-service
9990
if: steps.changes.outputs.collab_service == 'true'
10091
run: |
10192
docker-compose build collab-service

docker-compose.yml

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -28,62 +28,6 @@ services:
2828
volumes:
2929
- questions_test_cases:/app/question_test_cases
3030

31-
match-worker:
32-
container_name: match-worker_1
33-
image: asia-southeast1-docker.pkg.dev/cs3219-400714/peerprep/match-worker_1:latest
34-
environment:
35-
- CHANNEL_NAME=diff1
36-
build:
37-
context: ./match_worker
38-
dockerfile: Dockerfile.prod
39-
depends_on:
40-
rabbitmq:
41-
condition: service_healthy
42-
matching-service:
43-
condition: service_started
44-
45-
match-worker2:
46-
container_name: match-worker_2
47-
image: asia-southeast1-docker.pkg.dev/cs3219-400714/peerprep/match-worker_1:latest
48-
environment:
49-
- CHANNEL_NAME=diff2
50-
build:
51-
context: ./match_worker
52-
dockerfile: Dockerfile.prod
53-
depends_on:
54-
rabbitmq:
55-
condition: service_healthy
56-
matching-service:
57-
condition: service_started
58-
59-
match-worker3:
60-
container_name: match-worker_3
61-
image: asia-southeast1-docker.pkg.dev/cs3219-400714/peerprep/match-worker_1:latest
62-
environment:
63-
- CHANNEL_NAME=diff3
64-
build:
65-
context: ./match_worker
66-
dockerfile: Dockerfile.prod
67-
depends_on:
68-
rabbitmq:
69-
condition: service_healthy
70-
matching-service:
71-
condition: service_started
72-
73-
match-worker4:
74-
container_name: match-worker_4
75-
image: asia-southeast1-docker.pkg.dev/cs3219-400714/peerprep/match-worker_1:latest
76-
environment:
77-
- CHANNEL_NAME=diff4
78-
build:
79-
context: ./match_worker
80-
dockerfile: Dockerfile.prod
81-
depends_on:
82-
rabbitmq:
83-
condition: service_healthy
84-
matching-service:
85-
condition: service_started
86-
8731
collab-service:
8832
container_name: collab-service
8933
image: asia-southeast1-docker.pkg.dev/cs3219-400714/peerprep/collab-service:latest
@@ -121,9 +65,6 @@ services:
12165
- PORT=8082
12266
ports:
12367
- "8082:8082"
124-
depends_on:
125-
rabbitmq:
126-
condition: service_healthy
12768

12869
mongo:
12970
container_name: mongo

docker_compose_dev.yml

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -37,57 +37,6 @@ services:
3737
- PORT=8082
3838
ports:
3939
- "8082:8082"
40-
depends_on:
41-
rabbitmq:
42-
condition: service_healthy
43-
44-
match-worker:
45-
container_name: match-worker_1
46-
environment:
47-
- CHANNEL_NAME=diff1
48-
build:
49-
context: ./match_worker
50-
depends_on:
51-
rabbitmq:
52-
condition: service_healthy
53-
matching-service:
54-
condition: service_started
55-
56-
match-worker2:
57-
container_name: match-worker_2
58-
environment:
59-
- CHANNEL_NAME=diff2
60-
build:
61-
context: ./match_worker
62-
depends_on:
63-
rabbitmq:
64-
condition: service_healthy
65-
matching-service:
66-
condition: service_started
67-
68-
match-worker3:
69-
container_name: match-worker_3
70-
environment:
71-
- CHANNEL_NAME=diff3
72-
build:
73-
context: ./match_worker
74-
depends_on:
75-
rabbitmq:
76-
condition: service_healthy
77-
matching-service:
78-
condition: service_started
79-
80-
match-worker4:
81-
container_name: match-worker_4
82-
environment:
83-
- CHANNEL_NAME=diff4
84-
build:
85-
context: ./match_worker
86-
depends_on:
87-
rabbitmq:
88-
condition: service_healthy
89-
matching-service:
90-
condition: service_started
9140

9241
collab-service:
9342
container_name: collab-service

frontend/src/components/MatchMakeBtn/MatchMakeBtn.component.tsx

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import { ChevronDownIcon } from "@chakra-ui/icons";
1+
import { ChatIcon, ChevronDownIcon } from "@chakra-ui/icons";
22
import {
33
Button,
4+
ButtonGroup,
45
HStack,
6+
IconButton,
57
Menu,
68
MenuButton,
79
MenuItem,
@@ -15,30 +17,44 @@ const diffRange = [
1517
[3, 5.9],
1618
[6, 7.9],
1719
[8, 9.9],
20+
[0, 9.9],
1821
];
1922

2023
const CollaborateBtn = () => {
2124
return (
22-
<HStack>
23-
<Text>In Room</Text>
24-
</HStack>
25+
<ButtonGroup>
26+
<IconButton
27+
aria-label="open_chat"
28+
colorScheme="teal"
29+
variant="outline"
30+
icon={<ChatIcon />}
31+
/>
32+
</ButtonGroup>
2533
);
2634
};
2735

2836
const MatchMakeBtn = () => {
29-
const { findMatch, isMatching, matchedRoom } = useMatchmake();
37+
const { findMatch, isMatching, matchedRoom, timeLeft, cancelMatch } =
38+
useMatchmake();
3039

3140
return matchedRoom ? (
3241
<CollaborateBtn />
3342
) : (
3443
<Menu>
35-
<MenuButton
36-
as={Button}
37-
rightIcon={<ChevronDownIcon />}
38-
isLoading={isMatching}
39-
>
40-
Collaborate
41-
</MenuButton>
44+
{timeLeft ? (
45+
<Button onClick={cancelMatch} colorScheme="red">
46+
Cancel
47+
</Button>
48+
) : (
49+
<MenuButton
50+
as={Button}
51+
rightIcon={<ChevronDownIcon />}
52+
isLoading={isMatching}
53+
>
54+
Collaborate
55+
</MenuButton>
56+
)}
57+
4258
<MenuList>
4359
<MenuItem onClick={() => findMatch(diffRange[0][0], diffRange[0][1])}>
4460
Basic
@@ -52,6 +68,9 @@ const MatchMakeBtn = () => {
5268
<MenuItem onClick={() => findMatch(diffRange[3][0], diffRange[3][1])}>
5369
Hard
5470
</MenuItem>
71+
<MenuItem onClick={() => findMatch(diffRange[4][0], diffRange[4][1])}>
72+
All
73+
</MenuItem>
5574
</MenuList>
5675
</Menu>
5776
);

frontend/src/components/QnDrawer/QnDrawer.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export const QnDrawer = (prop: qnProp) => {
5252
</Tag>
5353
<Divider orientation="vertical" padding="2"></Divider>
5454
{question.topics.map((qnTag) => (
55-
<Tag>{qnTag}</Tag>
55+
<Tag key={qnTag}>{qnTag}</Tag>
5656
))}
5757
</HStack>
5858
</DrawerHeader>

frontend/src/components/QnSubmissionHistory/QnSubmissionHistory.component.tsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import {
33
Center,
44
HStack,
55
IconButton,
6+
Skeleton,
7+
SkeletonText,
8+
Stack,
69
Table,
710
TableContainer,
811
Tbody,
@@ -61,8 +64,22 @@ const SubmissionRow = ({ submission }: { submission: submissionRecord }) => {
6164
);
6265
};
6366

67+
const SubmissionRowSkeleton = () => {
68+
return (
69+
<Stack width="100%">
70+
<Skeleton height="20px" speed={0.9} />
71+
<Skeleton height="40px" speed={1} />
72+
<Skeleton height="40px" speed={1.1} />
73+
<Skeleton height="40px" speed={1.2} />
74+
</Stack>
75+
);
76+
};
77+
6478
const QnSubmissionHistory = () => {
65-
const { currSubmission, submissions } = useSharedEditor();
79+
const { currSubmission, submissions, submissionLoading } = useSharedEditor();
80+
if (submissionLoading) {
81+
return <SubmissionRowSkeleton />;
82+
}
6683

6784
if (submissions.length === 0 && !currSubmission) {
6885
return <Text>No Submissions found!</Text>;

0 commit comments

Comments
 (0)