Skip to content

Commit 9204d86

Browse files
committed
Merge branch 'feat/system-admin' into diazz-admin-f2f-30376988
2 parents 07ac31d + b261088 commit 9204d86

34 files changed

+1351
-19
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
"tc-auth-lib": "topcoder-platform/tc-auth-lib#1.0.27",
104104
"typescript": "^4.8.4",
105105
"universal-navigation": "https://github.com/topcoder-platform/universal-navigation#9fc50d938be7182",
106-
"uuid": "^9.0.0",
106+
"uuid": "^11.1.0",
107107
"yup": "^1.6.1"
108108
},
109109
"devDependencies": {

src/apps/admin/src/admin-app.routes.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ const ManageResourcePage: LazyLoadedComponent = lazyLoad(
3333
() => import('./challenge-management/ManageResourcePage'),
3434
'ManageResourcePage',
3535
)
36+
const ManageSubmissionPage: LazyLoadedComponent = lazyLoad(
37+
() => import('./challenge-management/ManageSubmissionPage'),
38+
'ManageSubmissionPage',
39+
)
3640
const AddResourcePage: LazyLoadedComponent = lazyLoad(
3741
() => import('./challenge-management/AddResourcePage'),
3842
'AddResourcePage',
@@ -145,6 +149,11 @@ export const adminRoutes: ReadonlyArray<PlatformRoute> = [
145149
id: 'add-resource',
146150
route: ':challengeId/manage-resource/add',
147151
},
152+
{
153+
element: <ManageSubmissionPage />,
154+
id: 'manage-resource',
155+
route: ':challengeId/manage-submission',
156+
},
148157
],
149158
element: <ChallengeManagement />,
150159
id: manageChallengeRouteId,
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.container {
2+
display: flex;
3+
flex-direction: column;
4+
}
5+
6+
.blockTableContainer {
7+
position: relative;
8+
}
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/**
2+
* Manage Submission Page.
3+
*/
4+
import { FC } from 'react'
5+
import { useParams } from 'react-router-dom'
6+
import classNames from 'classnames'
7+
8+
import { LinkButton } from '~/libs/ui'
9+
10+
import {
11+
useManageBusEvent,
12+
useManageBusEventProps,
13+
useManageChallengeSubmissions,
14+
useManageChallengeSubmissionsProps,
15+
} from '../../lib/hooks'
16+
import {
17+
ActionLoading,
18+
PageWrapper,
19+
SubmissionTable,
20+
TableLoading,
21+
TableNoRecord,
22+
} from '../../lib'
23+
24+
import styles from './ManageSubmissionPage.module.scss'
25+
26+
interface Props {
27+
className?: string
28+
}
29+
30+
export const ManageSubmissionPage: FC<Props> = (props: Props) => {
31+
const { challengeId = '' }: { challengeId?: string } = useParams<{
32+
challengeId: string
33+
}>()
34+
const { isRunningTest, isRunningTestBool, doPostBusEvent }: useManageBusEventProps
35+
= useManageBusEvent()
36+
37+
const {
38+
isLoading,
39+
submissions,
40+
isRemovingSubmission,
41+
isRemovingSubmissionBool,
42+
isRemovingReviewSummations,
43+
isRemovingReviewSummationsBool,
44+
doRemoveSubmission,
45+
doRemoveReviewSummations,
46+
showSubmissionHistory,
47+
setShowSubmissionHistory,
48+
}: useManageChallengeSubmissionsProps
49+
= useManageChallengeSubmissions(challengeId)
50+
51+
return (
52+
<PageWrapper
53+
pageTitle='Submission Management'
54+
className={classNames(styles.container, props.className)}
55+
headerActions={(
56+
<LinkButton primary light to='./../..' size='lg'>
57+
Back
58+
</LinkButton>
59+
)}
60+
>
61+
{isLoading ? (
62+
<TableLoading />
63+
) : (
64+
<>
65+
{submissions.length === 0 ? (
66+
<TableNoRecord />
67+
) : (
68+
<div className={styles.blockTableContainer}>
69+
<SubmissionTable
70+
data={submissions}
71+
isRemovingSubmission={isRemovingSubmission}
72+
doRemoveSubmission={doRemoveSubmission}
73+
isRemovingReviewSummations={
74+
isRemovingReviewSummations
75+
}
76+
doRemoveReviewSummations={
77+
doRemoveReviewSummations
78+
}
79+
isRunningTest={isRunningTest}
80+
doPostBusEvent={doPostBusEvent}
81+
showSubmissionHistory={showSubmissionHistory}
82+
setShowSubmissionHistory={setShowSubmissionHistory}
83+
/>
84+
85+
{(isRemovingSubmissionBool
86+
|| isRunningTestBool
87+
|| isRemovingReviewSummationsBool) && (
88+
<ActionLoading />
89+
)}
90+
</div>
91+
)}
92+
</>
93+
)}
94+
</PageWrapper>
95+
)
96+
}
97+
98+
export default ManageSubmissionPage
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as ManageSubmissionPage } from './ManageSubmissionPage'
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* App config for bus event
3+
*/
4+
import { v4 as uuidv4 } from 'uuid'
5+
6+
import { RequestBusAPI } from '../lib/models'
7+
8+
/**
9+
* Create data for bus event
10+
* @param submissionId submission id
11+
* @param testType test type
12+
* @returns data for bus event
13+
*/
14+
export const CREATE_BUS_EVENT_DATA_SUBMISSION_MARATHON_MATCH = (
15+
submissionId: string,
16+
testType: string,
17+
): RequestBusAPI => ({
18+
'mime-type': 'application/json',
19+
originator: 'MMFinalScoreProcessor',
20+
payload: {
21+
id: uuidv4(),
22+
resource: 'score',
23+
submissionId,
24+
testType,
25+
},
26+
timestamp: new Date()
27+
.toISOString(),
28+
topic: 'submission.notification.score',
29+
})

src/apps/admin/src/lib/components/ChallengeList/ChallengeList.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
import { useEventCallback } from '../../hooks'
2222
import { Challenge, ChallengeFilterCriteria, ChallengeType } from '../../models'
2323
import { Paging } from '../../models/challenge-management/Pagination'
24+
import { checkIsMM } from '../../utils'
2425

2526
import { MobileListView } from './MobileListView'
2627
import styles from './ChallengeList.module.scss'
@@ -134,6 +135,7 @@ const Actions: FC<{
134135
challenge: Challenge
135136
currentFilters: ChallengeFilterCriteria
136137
}> = props => {
138+
const isMM = useMemo(() => checkIsMM(props.challenge), [props.challenge])
137139
const [openDropdown, setOpenDropdown] = useState(false)
138140
const navigate = useNavigate()
139141
const goToManageUser = useEventCallback(() => {
@@ -208,6 +210,16 @@ const Actions: FC<{
208210
>
209211
Resources
210212
</li>
213+
{isMM && (
214+
<li
215+
onClick={function onClick() {
216+
navigate(`${props.challenge.id}/manage-submission`)
217+
setOpenDropdown(false)
218+
}}
219+
>
220+
Submissions
221+
</li>
222+
)}
211223
</ul>
212224
</DropdownMenu>
213225

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
@import '@libs/ui/styles/includes';
2+
3+
.container {
4+
display: flex;
5+
flex-direction: column;
6+
padding-bottom: $sp-8;
7+
8+
@include ltelg {
9+
padding-bottom: $sp-4;
10+
}
11+
}
12+
13+
.rowActions {
14+
display: flex;
15+
align-items: center;
16+
}
17+
18+
.desktopTable {
19+
td {
20+
vertical-align: middle;
21+
}
22+
}

0 commit comments

Comments
 (0)