diff --git a/ui/src/actions/holdingpen.ts b/ui/src/actions/holdingpen.ts index 7bbcfcd44..e990c6317 100644 --- a/ui/src/actions/holdingpen.ts +++ b/ui/src/actions/holdingpen.ts @@ -31,6 +31,7 @@ import { BACKOFFICE_SEARCH_API, HOLDINGPEN_NEW, HOLDINGPEN_LOGIN_NEW, + HOLDINGPEN_SEARCH_NEW, } from '../common/routes'; import { Credentials } from '../types'; import storage from '../common/storage'; @@ -302,16 +303,14 @@ export function resolveAction( return async (dispatch) => { dispatch(resolvingAction(action)); try { - await httpClient.post( + const response = await httpClient.post( `${BACKOFFICE_API}/authors/${id}/${action}/`, payload ); dispatch(resolveActionSuccess()); notifyActionSuccess(action); - setTimeout(() => { - window?.location?.reload(); - }, 3000); + dispatch(fetchAuthorSuccess(response.data)); } catch (err) { const { error } = httpErrorToActionPayload(err); notifyActionError( @@ -355,6 +354,7 @@ export function deleteWorkflow( dispatch(deleteWorkflowSuccess()); notifyDeleteSuccess(); + dispatch(push(HOLDINGPEN_SEARCH_NEW)); } catch (err) { const { error } = httpErrorToActionPayload(err); diff --git a/ui/src/holdingpen-new/components/SearchFilters.tsx b/ui/src/holdingpen-new/components/SearchFilters.tsx index 60ce7cdac..a703a0921 100644 --- a/ui/src/holdingpen-new/components/SearchFilters.tsx +++ b/ui/src/holdingpen-new/components/SearchFilters.tsx @@ -80,7 +80,7 @@ const SearchFilters: React.FC = ({ }; return ( - +

Results per page

diff --git a/ui/src/holdingpen-new/containers/DetailPageContainer/AuthorDetailPageContainer.tsx b/ui/src/holdingpen-new/containers/DetailPageContainer/AuthorDetailPageContainer.tsx index aead679c5..23f92a813 100644 --- a/ui/src/holdingpen-new/containers/DetailPageContainer/AuthorDetailPageContainer.tsx +++ b/ui/src/holdingpen-new/containers/DetailPageContainer/AuthorDetailPageContainer.tsx @@ -8,7 +8,7 @@ import { SyncOutlined, PlayCircleOutlined, } from '@ant-design/icons'; -import { Action, ActionCreator } from 'redux'; +import { ActionCreator, Action } from 'redux'; import { connect, RootStateOrAny } from 'react-redux'; import { Map } from 'immutable'; import { push } from 'connected-react-router'; @@ -30,7 +30,6 @@ import { getConfigFor } from '../../../common/config'; import { resolveDecision } from '../../utils/utils'; import DeleteWorkflow from '../../components/DeleteWorkflow/DeleteWorkflow'; import EmptyOrChildren from '../../../common/components/EmptyOrChildren'; -import GoBackLinkContainer from '../../../common/containers/GoBackLinkContainer'; import LinkLikeButton from '../../../common/components/LinkLikeButton/LinkLikeButton'; import { HOLDINGPEN_SEARCH_NEW } from '../../../common/routes'; @@ -53,9 +52,13 @@ const AuthorDetailPageContainer: React.FC = ({ dispatch(fetchAuthor(id)); }, []); - const data = author?.get('data') as Map; - const tickets = author?.get('tickets') as Map; - const decision = author?.get('decisions')?.first(); + const data = author?.get('data'); + const tickets = author?.get('tickets')?.size !== 0 && author?.get('tickets'); + const decision = author?.getIn(['decisions', 0]) as Map; + const status = author?.get('status'); + + const shouldDisplayDecisionsBox = + decision || status === 'approval' || (decision && status !== 'approval'); const ERRORS_URL = getConfigFor('INSPIRE_WORKFLOWS_DAGS_URL'); @@ -63,11 +66,17 @@ const AuthorDetailPageContainer: React.FC = ({ data?.get('positions') && 'institutions', data?.get('project_membership') && 'projects', (data?.get('urls') || data?.get('ids')) && 'links', - (data?.get('arxiv_categories') || data?.get('.advisors')) && 'other', - author?.get('status') === 'error' && 'errors', + (data?.get('arxiv_categories') || data?.get('advisors')) && 'other', + status === 'error' && 'errors', 'delete', ].filter(Boolean); + const handleResolveAction = (value: string, createTicket = false) => { + dispatch( + resolveAction(id, 'resolve', { value, create_ticket: createTicket }) + ); + }; + return (
= ({ @@ -95,17 +104,15 @@ const AuthorDetailPageContainer: React.FC = ({ > - {author?.get('status') && ( + {status && (
-

- {author?.get('status').toUpperCase()} -

+

{status?.toUpperCase()}

@@ -125,19 +132,21 @@ const AuthorDetailPageContainer: React.FC = ({ Status: {data?.get('status')}

)} - {(data?.get('ids') as any[])?.find( - (id: any) => id?.get('schema') === 'ORCID' - ) && ( -

- id?.get('schema') === 'ORCID' - ) as unknown as Map - } - noIcon - /> -

+ {data + ?.get('ids') + ?.find( + (id: { get: (arg0: string) => string }) => + id.get('schema') === 'ORCID' + ) && ( + string }) => + id?.get('schema') === 'ORCID' + )} + noIcon + /> )} @@ -206,7 +215,7 @@ const AuthorDetailPageContainer: React.FC = ({
- {author?.get('status') === 'error' && ( + {status === 'error' && (

See error details here:{' '} @@ -223,71 +232,48 @@ const AuthorDetailPageContainer: React.FC = ({ - {author?.get('status') && - author?.get('status') !== 'error' && - author?.get('status') !== 'running' && ( - - {author?.get('status') === 'approval' ? ( -

- - - -
- ) : ( -

- This workflow is{' '} - - {resolveDecision(decision?.get('action')) - ?.decision || 'completed'} - - . -

- )} - - )} + {shouldDisplayDecisionsBox && ( + + {!decision ? ( +
+ + + +
+ ) : ( +

+ This workflow is{' '} + + {resolveDecision(decision?.get('action')) + ?.decision || 'completed'} + + . +

+ )} +
+ )} = ({ {data?.getIn(['acquisition_source', 'email'])} on{' '} {new Date( - data?.getIn(['acquisition_source', 'datetime']) as Date - ).toLocaleDateString()} + data?.getIn(['acquisition_source', 'datetime']) + )?.toLocaleDateString()} . @@ -309,11 +295,20 @@ const AuthorDetailPageContainer: React.FC = ({ subTitle="Notes" > - {data?.get('_private_notes')?.map((note: any) => ( -

- "{note?.get('value')}" -

- ))} + {data + ?.get('_private_notes') + ?.map( + (note: { + get: (arg0: string) => {} | null | undefined; + }) => ( +

+ "{note?.get('value')}" +

+ ) + )}
)} @@ -375,7 +370,6 @@ const AuthorDetailPageContainer: React.FC = ({ Open in Editor - {/* TODO2: change to skip step once it's ready */}