From 15ac6e1a17a1ed13bfc742908ca5755b36702dad Mon Sep 17 00:00:00 2001 From: Harris Tzovanakis Date: Tue, 26 Nov 2024 13:38:04 +0100 Subject: [PATCH] backoffice: add `PROCESSING` to the UI --- ui/src/backoffice/__tests__/index.test.tsx | 12 - .../components/ResultItem/ResultItem.tsx | 11 +- .../DashboardPageContainer.less | 6 + ...er.less => AuthorDetailPageContainer.less} | 5 + .../AuthorDetailPageContainer.tsx | 2 +- .../DetailPageContainer.tsx | 271 --- .../__tests__/DetailPageContainer.test.tsx | 34 - .../DetailPageContainer.test.tsx.snap | 1522 ----------------- .../SearchPageContainer.tsx | 4 +- ui/src/backoffice/utils/utils.tsx | 3 + 10 files changed, 25 insertions(+), 1845 deletions(-) rename ui/src/backoffice/containers/DetailPageContainer/{DetailPageContainer.less => AuthorDetailPageContainer.less} (88%) delete mode 100644 ui/src/backoffice/containers/DetailPageContainer/DetailPageContainer.tsx delete mode 100644 ui/src/backoffice/containers/DetailPageContainer/__tests__/DetailPageContainer.test.tsx delete mode 100644 ui/src/backoffice/containers/DetailPageContainer/__tests__/__snapshots__/DetailPageContainer.test.tsx.snap diff --git a/ui/src/backoffice/__tests__/index.test.tsx b/ui/src/backoffice/__tests__/index.test.tsx index d111b0374..6cab3908d 100644 --- a/ui/src/backoffice/__tests__/index.test.tsx +++ b/ui/src/backoffice/__tests__/index.test.tsx @@ -8,7 +8,6 @@ import { getStore, getStoreWithState } from '../../fixtures/store'; import Backoffice from '..'; import DashboardPageContainer from '../containers/DashboardPageContainer/DashboardPageContainer'; import SearchPageContainer from '../containers/SearchPageContainer/SearchPageContainer'; -import DetailPageContainer from '../containers/DetailPageContainer/DetailPageContainer'; import { BACKOFFICE_SEARCH, BACKOFFICE } from '../../common/routes'; describe('Backoffice', () => { @@ -68,17 +67,6 @@ describe('Backoffice', () => { expect(getByTestId('backoffice-dashboard-page')).toBeInTheDocument(); }); - it('navigates to DetailPageContainer when /backoffice/:id', () => { - const { getByTestId } = render( - - - - - - ); - - expect(getByTestId('backoffice-detail-page')).toBeInTheDocument(); - }); it('navigates to SearchPageContainer when /backoffice/search', () => { const { getByTestId } = render( diff --git a/ui/src/backoffice/components/ResultItem/ResultItem.tsx b/ui/src/backoffice/components/ResultItem/ResultItem.tsx index 1eeb74366..200345796 100644 --- a/ui/src/backoffice/components/ResultItem/ResultItem.tsx +++ b/ui/src/backoffice/components/ResultItem/ResultItem.tsx @@ -4,12 +4,12 @@ import { LoadingOutlined, StopOutlined, WarningOutlined, + FieldTimeOutlined, } from '@ant-design/icons'; import { Row, Col, Card } from 'antd'; import { Link } from 'react-router-dom'; import './ResultItem.less'; -import PublicationSelectContainer from '../../../authors/containers/PublicationSelectContainer'; import ResultItem from '../../../common/components/ResultItem'; import UnclickableTag from '../../../common/components/UnclickableTag'; import { BACKOFFICE } from '../../../common/routes'; @@ -41,6 +41,11 @@ const renderWorkflowStatus = (status: string) => { description: 'This workflow is currently running. Please wait for it to complete.', }, + processing: { + icon: , + text: 'Processing', + description: 'This workflow is currently processing.', + }, }; const statusInfo = statuses[status]; @@ -55,7 +60,7 @@ const renderWorkflowStatus = (status: string) => { ) : null; }; -const AuthorResultItem = ({ item }: { item: any }) => { +const WorkflowResultItem = ({ item }: { item: any }) => { const data = item?.get('data'); const decision = item?.get('decisions')?.first(); @@ -128,4 +133,4 @@ const AuthorResultItem = ({ item }: { item: any }) => { ); }; -export default AuthorResultItem; +export default WorkflowResultItem; diff --git a/ui/src/backoffice/containers/DashboardPageContainer/DashboardPageContainer.less b/ui/src/backoffice/containers/DashboardPageContainer/DashboardPageContainer.less index 2f97e460b..ce91bd91f 100644 --- a/ui/src/backoffice/containers/DashboardPageContainer/DashboardPageContainer.less +++ b/ui/src/backoffice/containers/DashboardPageContainer/DashboardPageContainer.less @@ -81,6 +81,9 @@ .blue { color: #2980b9; } +.processing { + color: #0050b3; +} .bg-error { background-color: #e74c3c; @@ -102,6 +105,9 @@ .bg-running { background-color: #c2c5c7; } +.bg-processing { + background-color: #b8b8b8; +} .font-white { color: white !important; diff --git a/ui/src/backoffice/containers/DetailPageContainer/DetailPageContainer.less b/ui/src/backoffice/containers/DetailPageContainer/AuthorDetailPageContainer.less similarity index 88% rename from ui/src/backoffice/containers/DetailPageContainer/DetailPageContainer.less rename to ui/src/backoffice/containers/DetailPageContainer/AuthorDetailPageContainer.less index 84d170d8f..bde9faa99 100644 --- a/ui/src/backoffice/containers/DetailPageContainer/DetailPageContainer.less +++ b/ui/src/backoffice/containers/DetailPageContainer/AuthorDetailPageContainer.less @@ -18,8 +18,13 @@ background-color: #f7b852; border: 1px solid #f7b852; } + &.bg-processing { + background-color: #0050b3; + border: 1px solid #0050b3; + } } + .ant-collapse-content-box { padding-bottom: 1rem; .error-code { diff --git a/ui/src/backoffice/containers/DetailPageContainer/AuthorDetailPageContainer.tsx b/ui/src/backoffice/containers/DetailPageContainer/AuthorDetailPageContainer.tsx index 4d440e0aa..b72360a2f 100644 --- a/ui/src/backoffice/containers/DetailPageContainer/AuthorDetailPageContainer.tsx +++ b/ui/src/backoffice/containers/DetailPageContainer/AuthorDetailPageContainer.tsx @@ -14,7 +14,7 @@ import { Map } from 'immutable'; import { push } from 'connected-react-router'; import classNames from 'classnames'; -import './DetailPageContainer.less'; +import './AuthorDetailPageContainer.less'; import Breadcrumbs from '../../components/Breadcrumbs/Breadcrumbs'; import ContentBox from '../../../common/components/ContentBox'; import CollapsableForm from '../../../submissions/common/components/CollapsableForm'; diff --git a/ui/src/backoffice/containers/DetailPageContainer/DetailPageContainer.tsx b/ui/src/backoffice/containers/DetailPageContainer/DetailPageContainer.tsx deleted file mode 100644 index 78914ae15..000000000 --- a/ui/src/backoffice/containers/DetailPageContainer/DetailPageContainer.tsx +++ /dev/null @@ -1,271 +0,0 @@ -import React from 'react'; -import Immutable, { List } from 'immutable'; -import { SyncOutlined, RedoOutlined, EditOutlined } from '@ant-design/icons'; -import { Row, Col, Button, Input, Space, Switch } from 'antd'; - -import './DetailPageContainer.less'; -import Breadcrumbs from '../../components/Breadcrumbs/Breadcrumbs'; -import item from '../../mocks/mockDetaiPageData'; -import references from '../../mocks/mockReferencesData'; -import ContentBox from '../../../common/components/ContentBox'; -import LiteratureTitle from '../../../common/components/LiteratureTitle'; -import PublicationInfoList from '../../../common/components/PublicationInfoList'; -import Abstract from '../../../literature/components/Abstract'; -import DOIList from '../../../literature/components/DOIList'; -import CollapsableForm from '../../../submissions/common/components/CollapsableForm'; -import AuthorList from '../../../common/components/AuthorList'; -import ReferenceList from '../../../literature/components/ReferenceList'; -import UnclickableTag from '../../../common/components/UnclickableTag/UnclickableTag'; - -interface DetailPageContainerProps { - item?: any; -} - -const OPEN_SECTIONS = ['references', 'errors', 'delete']; - -const DetailPageContainer: React.FC = () => { - const numberOfAuthors = (item.get('authors') as List)?.size || 0; - return ( -
- - - - - -
-

- ERROR on: Raise if a matching wf is not in completed state in - the Backoffice. View Stack Trace -

-
- -
- - - -

- -

-
- - ({numberOfAuthors} authors) -
-
- -
- -
- -
- - - -

- -

-
- - ({numberOfAuthors} authors) -
-
- -
- -
- -
-
- - -
- - - {}} - /> - - -
- {item.get('error')} -
-
- -
- - Term - - - Source - -
-
- Experiment-HEP - 12 -
- - - - -
- -
- - Name - -
- - Score - - - Accept - -
-
-
- HEP -
- 0.33 - - - - - -
-
-
- Physics -
- 0.33 - - - - - -
-
-
- Quantum physics -
- 0.33 - - - - - -
-
- - - - -
- - - - - - - - Automatic Decision:{' '} - Non-CORE 0.55 -
-
- References: 17/60 core, 52/60 matched -
-
- - 4 core keywords from fulltext. - -
-
- - 1 Filtered : - -
-
- neutrino, mass - 12 -
-
- - Harvested on{' '} - - {new Date('2024-05-20T15:30:20.467877').toLocaleDateString()} - {' '} - from APS using - hepcrawl. - - - No SNow tickets found. - - -
- - - -
-
- - - - -
- ); -}; - -export default DetailPageContainer; diff --git a/ui/src/backoffice/containers/DetailPageContainer/__tests__/DetailPageContainer.test.tsx b/ui/src/backoffice/containers/DetailPageContainer/__tests__/DetailPageContainer.test.tsx deleted file mode 100644 index e2fea010b..000000000 --- a/ui/src/backoffice/containers/DetailPageContainer/__tests__/DetailPageContainer.test.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import React from 'react'; -import { MemoryRouter } from 'react-router-dom'; -import { Provider } from 'react-redux'; -import { render } from '@testing-library/react'; - -import { getStore } from '../../../../fixtures/store'; - -import DetailPageContainer from '../DetailPageContainer'; -import { BACKOFFICE } from '../../../../common/routes'; - -describe('DetailPageContainer', () => { - it('renders without crashing', () => { - render( - - - - - - ); - }); - - it('renders the DetailPage component', () => { - const { getByTestId, asFragment } = render( - - - - - - ); - const detailPage = getByTestId('backoffice-detail-page'); - expect(detailPage).toBeInTheDocument(); - expect(asFragment()).toMatchSnapshot(); - }); -}); diff --git a/ui/src/backoffice/containers/DetailPageContainer/__tests__/__snapshots__/DetailPageContainer.test.tsx.snap b/ui/src/backoffice/containers/DetailPageContainer/__tests__/__snapshots__/DetailPageContainer.test.tsx.snap deleted file mode 100644 index 903ff17d2..000000000 --- a/ui/src/backoffice/containers/DetailPageContainer/__tests__/__snapshots__/DetailPageContainer.test.tsx.snap +++ /dev/null @@ -1,1522 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`DetailPageContainer renders the DetailPage component 1`] = ` - -
-
- - - - - - - - - -
-
-
-
-
-
-

- ERROR on: Raise if a matching wf is not in completed state in the Backoffice. - - View Stack Trace - -

-
-
-
-
-
-
-
-
-
-
-

- - - Introduction to Quantum Mechanics - - -

-
-
-
    -
  • -
    - - John Smith - -
    - , -
  • -
  • -
    - - Emily Johnson - -
    - , -
  • -
  • -
    - - Robert Brown - -
    - , -
  • -
  • -
    - - Sarah White - -
    -
  • -
-
- - (4 authors) - -
-
-
- - - Published in - - : - -
    -
  • - - - - Science Publishers Inc. - - - 4 - - - - , - - - 123-456 - - -
  • -
-
-
-
-
- Abstract: -
- - But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee - -
-
-
- - - DOI - - : - - -
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
- - - -
- -

- References -

-
-
-
-
-
-
-
-
-
-
-
-
-
    -
    -
  • -
    -
    -
    - - [1] - -
    -
    -
    -
    -
    -
    -
    -
      -
    • -
      - - N. P.Armitage - -
      - , -
    • -
    • -
      - - E. J.Mele - -
      - , -
    • -
    • -
      - - A.Vishwanath - -
      -
    • -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
  • -
    -
    -
  • -
    -
    -
    - - [2] - -
    -
    -
    -
    -
    -
    -
    -
      -
    • -
      - - Z.Fang - -
      -
    • -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
  • -
    -
    -
  • -
    -
    -
    - - [3] - -
    -
    -
    -
    -
    -
    -
    -
      -
    • -
      - - R.Shimano - -
      -
    • -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
  • -
    -
    -
  • -
    -
    -
    - - [4] - -
    -
    -
    -
    -
    -
    -
    - Nat. Commun. 7, 11788 -
    -
    -
      -
    • -
      - - S.Itoh - -
      -
    • -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
  • -
    -
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - - -
- -

- Errors -

-
-
-
-
-
- Traceback (most recent call last): - File "/usr/lib/python2.7/site-packages/workflow/engine.py", line 529, in _process - self.run_callbacks(callbacks, objects, obj) - File "/usr/lib/python2.7/site-packages/workflow/engine.py", line 465, in run_callbacks - indent + 1) - File "/usr/lib/python2.7/site-packages/workflow/engine.py", line 465, in run_callbacks - indent + 1) - File "/usr/lib/python2.7/site-packages/workflow/engine.py", line 481, in run_callbacks - self.execute_callback(callback_func, obj) - File "/usr/lib/python2.7/site-packages/workflow/engine.py", line 564, in execute_callback - callback(obj, self) - File "/code/inspirehep/modules/workflows/utils/__init__.py", line 155, in _decorator - res = func(*args, **kwargs) - File "/code/inspirehep/modules/workflows/tasks/arxiv.py", line 130, in arxiv_package_download - url=current_app.config['ARXIV_TARBALL_URL'].format(arxiv_id=arxiv_id), - File "/usr/lib/python2.7/site-packages/backoff/_sync.py", line 94, in retry - ret = target(*args, **kwargs) - File "/code/inspirehep/modules/workflows/utils/__init__.py", line 344, in download_file_to_workflow - workflow.files[name] = req.raw - File "/usr/lib/python2.7/site-packages/invenio_records_files/api.py", line 101, in wrapper - return method(self, *args, **kwargs) - File "/usr/lib/python2.7/site-packages/invenio_records_files/api.py", line 170, in __setitem__ - bucket=self.bucket, key=key, stream=stream - File "/usr/lib/python2.7/site-packages/invenio_files_rest/models.py", line 1169, in create - obj.set_contents(stream, **kwargs) - File "/usr/lib/python2.7/site-packages/invenio_files_rest/models.py", line 145, in inner - return f(self, *args, **kwargs) - File "/usr/lib/python2.7/site-packages/invenio_files_rest/models.py", line 131, in inner - res = f(self, *args, **kwargs) - File "/usr/lib/python2.7/site-packages/invenio_files_rest/models.py", line 1010, in set_contents - default_storage_class=self.bucket.default_storage_class, - File "/usr/lib/python2.7/site-packages/invenio_files_rest/models.py", line 145, in inner - return f(self, *args, **kwargs) - File "/usr/lib/python2.7/site-packages/invenio_files_rest/models.py", line 830, in set_contents - size_limit=size_limit, progress_callback=progress_callback)) - File "/usr/lib/python2.7/site-packages/invenio_xrootd/storage.py", line 111, in inner - res = f(self, *args, **kwargs) - File "/usr/lib/python2.7/site-packages/invenio_xrootd/storage.py", line 175, in save - return super(EOSFileStorage, self).save(*args, **kwargs) - File "/usr/lib/python2.7/site-packages/invenio_files_rest/storage/pyfs.py", line 99, in save - fp = self.open(mode='wb') - File "/usr/lib/python2.7/site-packages/invenio_files_rest/storage/pyfs.py", line 58, in open - return fs.open(path, mode=mode) - File "/usr/lib/python2.7/site-packages/xrootdpyfs/fs.py", line 197, in open - **kwargs - File "/usr/lib/python2.7/site-packages/xrootdpyfs/xrdfile.py", line 126, in __init__ - "instantiating file ({0})".format(path)) - File "/usr/lib/python2.7/site-packages/xrootdpyfs/xrdfile.py", line 140, in _raise_status - raise IOError(errstr) - IOError: XRootD error instantiating file (root://eospublic.cern.ch//eos/workspace/i/inspireqa/app/var/data/workflows/files/22/ac/73d1-b19d-4dcc-afa2-0edf97530a69/data?eos.bookingsize=104857600) file: [ERROR] Server responded with an error: [3021] Unable to get quota space - quota not defined or exhausted /eos/workspace/i/inspireqa/app/var/data/workflows/files/22/ac/73d1-b19d-4dcc-afa2-0edf97530a69/data; Disk quota exceeded - -
-
-
-
-
- -
-
- -
-
-
-
- - - -
- -

- Danger area -

-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-

- Decision -

-
- Automatic Decision: - - Non-CORE 0.55 - -
-
- References: - - 17/60 - - core, - - 52/60 - - matched -
-
- - - 4 - - core keywords from fulltext. - -
-
- - - 1 - - Filtered : - -
-
- neutrino, mass - - 12 - -
-
-
-
-
-
-
-
-
-
-
-
-
-
-

- Submission -

-
- Harvested on - - 5/20/2024 - - from - - APS - - using - - hepcrawl - - . -
-
-
-
-
-
-
-
-
-
-
-
-
-

- SNow information -

-
- No SNow tickets found. -
-
-
-
-
-
-
-
-
-
-
-
-
-

- Actions -

-
-
- - - -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -`; diff --git a/ui/src/backoffice/containers/SearchPageContainer/SearchPageContainer.tsx b/ui/src/backoffice/containers/SearchPageContainer/SearchPageContainer.tsx index 0610f1085..2be2a0a10 100644 --- a/ui/src/backoffice/containers/SearchPageContainer/SearchPageContainer.tsx +++ b/ui/src/backoffice/containers/SearchPageContainer/SearchPageContainer.tsx @@ -22,7 +22,7 @@ import WorkflowResultItem from '../../components/ResultItem/ResultItem'; const META_DESCRIPTION = 'Find workflows in backoffice'; const TITLE = 'Workflows Search'; -function renderAuthorItem(item: Map) { +function renderWorkflowItem(item: Map) { return ; } @@ -125,7 +125,7 @@ function BackofficeSearchPage({ loading, query, loadingAggregations, onSortByCha diff --git a/ui/src/backoffice/utils/utils.tsx b/ui/src/backoffice/utils/utils.tsx index fa6f662e7..8e5ec215f 100644 --- a/ui/src/backoffice/utils/utils.tsx +++ b/ui/src/backoffice/utils/utils.tsx @@ -4,6 +4,7 @@ import { CheckOutlined, HourglassOutlined, LoadingOutlined, + FieldTimeOutlined } from '@ant-design/icons'; import { push } from 'connected-react-router'; import { Action, ActionCreator } from 'redux'; @@ -45,6 +46,8 @@ export const getIcon = (status: string) => { return ; case 'running': return ; + case 'processing': + return ; default: return null; }