-
Notifications
You must be signed in to change notification settings - Fork 13
Topcoder Admin App - Misc Update 0601 #1093
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import { FC, useMemo } from 'react' | ||
import { format } from 'date-fns' | ||
|
||
import { CheckIcon, XIcon } from '@heroicons/react/solid' | ||
import { CheckIcon } from '@heroicons/react/solid' | ||
import { useWindowSize, WindowSize } from '~/libs/shared' | ||
import { | ||
Button, | ||
|
@@ -27,7 +27,6 @@ export interface ReviewerListProps { | |
approvingReviewerId: number | ||
onPageChange: (page: number) => void | ||
onApproveApplication: (reviewer: Reviewer) => void | ||
onUnapproveApplication: (reviewer: Reviewer) => void | ||
onToggleSort: (sort: Sort) => void | ||
} | ||
|
||
|
@@ -36,22 +35,15 @@ const ApproveButton: FC<{ | |
openReviews: number | ||
approvingReviewerId: number | ||
onApproveApplication: ReviewerListProps['onApproveApplication'] | ||
onUnapproveApplication: ReviewerListProps['onUnapproveApplication'] | ||
}> = props => { | ||
const handleApprove = useEventCallback((): void => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
props.onApproveApplication(props.reviewer) | ||
}) | ||
|
||
const handleRemove = useEventCallback((): void => { | ||
props.onUnapproveApplication(props.reviewer) | ||
}) | ||
|
||
const isApproving = props.approvingReviewerId === props.reviewer.userId | ||
const isOtherApproving = props.approvingReviewerId > 0 | ||
const hideApproveButton | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
= props.openReviews < 1 || props.reviewer.applicationStatus !== 'Pending' | ||
const showRemoveButton | ||
= props.reviewer.applicationStatus === 'Approved' | ||
|
||
return ( | ||
<> | ||
|
@@ -61,19 +53,7 @@ const ApproveButton: FC<{ | |
className={styles.approvingLoadingSpinner} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
/> | ||
) : ( | ||
hideApproveButton ? ( | ||
showRemoveButton && ( | ||
<Button | ||
primary | ||
variant='danger' | ||
onClick={handleRemove} | ||
> | ||
<XIcon className='icon icon-fill' /> | ||
{' '} | ||
Remove Reviewer | ||
</Button> | ||
) | ||
) : ( | ||
!hideApproveButton && ( | ||
<Button | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
primary | ||
onClick={handleApprove} | ||
|
@@ -125,15 +105,13 @@ const Actions: FC<{ | |
openReviews: number | ||
approvingReviewerId: number | ||
onApproveApplication: ReviewerListProps['onApproveApplication'] | ||
onUnapproveApplication: ReviewerListProps['onUnapproveApplication'] | ||
}> = props => ( | ||
<div className={styles.rowActions}> | ||
<ApproveButton | ||
reviewer={props.reviewer} | ||
openReviews={props.openReviews} | ||
approvingReviewerId={props.approvingReviewerId} | ||
onApproveApplication={props.onApproveApplication} | ||
onUnapproveApplication={props.onUnapproveApplication} | ||
/> | ||
</div> | ||
) | ||
|
@@ -202,7 +180,6 @@ const ReviewerList: FC<ReviewerListProps> = props => { | |
openReviews={props.openReviews} | ||
approvingReviewerId={props.approvingReviewerId} | ||
onApproveApplication={props.onApproveApplication} | ||
onUnapproveApplication={props.onUnapproveApplication} | ||
/> | ||
), | ||
type: 'action', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,11 @@ | |
* Model for table roles filter | ||
*/ | ||
export type TableRolesFilter = { | ||
id: string | ||
id?: string | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
roleName: string | ||
createdAtString: string | ||
modifiedAtString: string | ||
createdByHandle: string | ||
modifiedByHandle: string | ||
createdAtString?: string | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
modifiedAtString?: string | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
createdByHandle?: string | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
modifiedByHandle?: string | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,7 +134,7 @@ export function isValidNumber(value: number | undefined): boolean { | |
/** | ||
* validation schema for form new billing account | ||
*/ | ||
export const formEditBillingAccountSchema: Yup.ObjectSchema<FormEditBillingAccount> | ||
export const formAddBillingAccountSchema: Yup.ObjectSchema<FormEditBillingAccount> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The variable name |
||
= Yup.object({ | ||
budgetAmount: Yup.number() | ||
.transform(value => (Number.isNaN(value) ? undefined : value)) | ||
|
@@ -183,6 +183,59 @@ export const formEditBillingAccountSchema: Yup.ObjectSchema<FormEditBillingAccou | |
.min(1, 'Subscription number must be greater than or equal 1.'), | ||
}) | ||
|
||
/** | ||
* validation schema for form new billing account | ||
*/ | ||
export const formEditBillingAccountSchema: Yup.ObjectSchema<FormEditBillingAccount> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The variable |
||
= Yup.object({ | ||
budgetAmount: Yup.number() | ||
.transform(value => (Number.isNaN(value) ? undefined : value)) | ||
.optional() | ||
.typeError('Invalid number.') | ||
.min(1, 'Budget amount must be greater than or equal 1.'), | ||
client: Yup.object() | ||
.shape({ | ||
id: Yup.number() | ||
.typeError('Invalid number.') | ||
.required('Id is required.'), | ||
name: Yup.string() | ||
.required('Name is required.'), | ||
}) | ||
.default(undefined) | ||
.required('Client is required.'), | ||
companyId: Yup.number() | ||
.typeError('Invalid number.') | ||
.required('Customer number is required.') | ||
.min(1, 'Customer number must be greater than or equal 1.'), | ||
description: Yup.string() | ||
.trim() | ||
.required('Description is required.'), | ||
endDate: Yup.date() | ||
.required('End date is required.'), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding a |
||
name: Yup.string() | ||
.trim() | ||
.required('Name is required.'), | ||
paymentTerms: Yup.number() | ||
.transform(value => (Number.isNaN(value) ? undefined : value)) | ||
.optional() | ||
.typeError('Invalid number.') | ||
.min(1, 'Payment terms must be greater than or equal 1.'), | ||
poNumber: Yup.string() | ||
.trim() | ||
.required('PO Number is required.'), | ||
salesTax: Yup.number() | ||
.required('Sales tax is required.'), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
startDate: Yup.date() | ||
.required('Start date is required.'), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding a |
||
status: Yup.string() | ||
.required('Status is required.'), | ||
subscriptionNumber: Yup.number() | ||
.transform(value => (Number.isNaN(value) ? undefined : value)) | ||
.optional() | ||
.typeError('Invalid number.') | ||
.min(1, 'Subscription number must be greater than or equal 1.'), | ||
}) | ||
|
||
/** | ||
* validation schema for form new billing account | ||
*/ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
gap: 30px; | ||
margin-left: auto; | ||
margin-top: 16px; | ||
flex-wrap: wrap; | ||
} | ||
|
||
.loadingSpinnerContainer { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ import { | |
useRef, | ||
useState, | ||
} from 'react' | ||
import { NavigateFunction, useNavigate, useParams } from 'react-router-dom' | ||
import { useParams } from 'react-router-dom' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
import { sortBy } from 'lodash' | ||
|
||
import { XIcon } from '@heroicons/react/solid' | ||
|
@@ -63,7 +63,6 @@ export const ManageReviewerPage: FC = () => { | |
challengeId: string | ||
}>() | ||
const [challengeUuid, setChallengeUuid] = useState('') | ||
const navigate: NavigateFunction = useNavigate() | ||
const [filterCriteria, setFilterCriteria]: [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
ReviewFilterCriteria, | ||
Dispatch<SetStateAction<ReviewFilterCriteria>> | ||
|
@@ -137,12 +136,6 @@ export const ManageReviewerPage: FC = () => { | |
}) | ||
}) | ||
|
||
const unapprove = useEventCallback((): void => { | ||
if (challengeUuid) { | ||
navigate(`${rootRoute}/challenge-management/${challengeUuid}/manage-user`) | ||
} | ||
}) | ||
|
||
// Init | ||
useEffect(() => { | ||
search() | ||
|
@@ -204,6 +197,14 @@ export const ManageReviewerPage: FC = () => { | |
<PageHeader> | ||
<h2>{`${pageTitle} ${challengeId}`}</h2> | ||
<div className={styles.headerActions}> | ||
<LinkButton | ||
primary | ||
onClick={handleRejectPendingConfirmDialog} | ||
size='lg' | ||
to={`${rootRoute}/challenge-management/${challengeUuid}/manage-user`} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
> | ||
User Management | ||
</LinkButton> | ||
<Button | ||
primary | ||
variant='danger' | ||
|
@@ -232,7 +233,6 @@ export const ManageReviewerPage: FC = () => { | |
reviewers={reviewers} | ||
openReviews={openReviews} | ||
onApproveApplication={approve} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
onUnapproveApplication={unapprove} | ||
approvingReviewerId={userId} | ||
paging={{ | ||
page: filterCriteria.page, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
XIcon
import has been removed. Ensure that this icon is not used elsewhere in the component. If it is needed, it should be re-imported.