Skip to content

Commit

Permalink
CORE-4972: add not harvested view (#694)
Browse files Browse the repository at this point in the history
* CORE-4972: add not harvested view

* CORE-4972: remove roat gard
  • Loading branch information
ekachxaidze98 authored Sep 5, 2024
1 parent 1c85078 commit 54cab8a
Show file tree
Hide file tree
Showing 9 changed files with 177 additions and 51 deletions.
12 changes: 9 additions & 3 deletions components/application/activity-select/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const ActivitySelect = ({ children }) => (
const ActivitySelectOption = ({
children,
value,
disabled,
selected,
subMenu,
dataProviderId,
Expand All @@ -32,8 +33,10 @@ const ActivitySelectOption = ({
const router = useRouter()

const handleSubMenu = () => {
setShowSubMenu(!showSubMenu)
setSelectedSubMenu(null)
if (!disabled) {
setShowSubMenu(!showSubMenu)
setSelectedSubMenu(null)
}
}

const handleSubMenuClick = (item) => {
Expand All @@ -56,6 +59,7 @@ const ActivitySelectOption = ({
<div
className={classNames.use(styles.settingItemWrapper, {
[styles.settingItemWrapperBorder]: value === 'settings',
[styles.disabled]: disabled,
})}
>
{children || (
Expand Down Expand Up @@ -117,7 +121,9 @@ const ActivitySelectOption = ({
passHref
>
<Drawer.Item
className={styles[value]}
className={classNames.use(styles[value], {
[styles.disabled]: disabled,
})}
active={selected}
title={navigation.tooltips[value]}
>
Expand Down
7 changes: 7 additions & 0 deletions components/application/activity-select/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,10 @@
padding-top: 10px;
border-top: 1px solid var(--gray-300);
}

.disabled {
color: #616161;
pointer-events: none;
cursor: not-allowed;
opacity: 0.5;
}
20 changes: 19 additions & 1 deletion components/application/index.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useRef, useState, useEffect } from 'react'
import React, { useRef, useState, useEffect, useContext } from 'react'
import { observer } from 'mobx-react-lite'
import { DataProviderLogo } from '@oacore/design/lib/elements'
import { useRouter } from 'next/router'
Expand All @@ -19,6 +19,7 @@ import restart from '../upload/assets/restart.svg'
import notification from '../../templates/settings/assets/bell.svg'
import NotificationPopUp from '../../templates/settings/cards/notificationPopUp'
import { useNotification } from './useNotification'
import { GlobalContext } from '../../store'

const Application = observer(
({
Expand Down Expand Up @@ -113,6 +114,18 @@ const Application = observer(
return `${str.substring(0, maxLength)}...`
}

const { ...globalStore } = useContext(GlobalContext)

const disabledTabs = [
'indexing',
'deduplication',
'content',
'deposit-compliance',
'doi',
'rights-retention-strategy',
'settings',
]

return (
<>
<Head>
Expand Down Expand Up @@ -224,6 +237,11 @@ const Application = observer(
.map(({ path, test, children }) => (
<ActivitySelect.Option
key={path}
disabled={
!globalStore.dataProvider?.issues
?.harvestingStatus?.lastHarvestingDate &&
disabledTabs.includes(path)
}
value={path}
selected={test(pathname)}
dataProviderId={dataProvider.id}
Expand Down
10 changes: 10 additions & 0 deletions components/upload/assets/placeholderChart.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion store/issues.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Issues extends Store {
super(baseUrl, options)

this.issuesUrl = `${baseUrl}/issues`
this.getHarvestingStatus(true)
this.getHarvestingStatus()
this.getIssuesAggregation()
}

Expand All @@ -28,9 +28,11 @@ class Issues extends Store {

const { data } = await this.request(url, options)
this.harvestingStatus = data
return data
} catch (error) {
console.error('Error fetching harvesting status:', error)
this.harvestingStatus = null
throw error
}
}

Expand Down
2 changes: 1 addition & 1 deletion templates/harvesting/cards/harvesting-progress.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const HarvestingProgressCard = observer(
setLoading(true)
setModalOpen(false)
await sendHarvestingRequest(requestText)
await globalStore.dataProvider.retrieve()
await globalStore.dataProvider.issues.getHarvestingStatus(true)
setSuccess(true)
} catch (error) {
// eslint-disable-next-line no-console
Expand Down
2 changes: 1 addition & 1 deletion templates/harvesting/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { GlobalContext } from '../../store'
import info from '../../components/upload/assets/infoLight.svg'

import Title from 'components/title'
import { Card, Button } from 'design'
import { Button, Card } from 'design'
import texts from 'texts/issues'

const HarvestingPageTemplate = observer(
Expand Down
133 changes: 89 additions & 44 deletions templates/overview/index.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useRef, useState } from 'react'
import React, { useContext, useEffect, useRef, useState } from 'react'
import { classNames } from '@oacore/design/lib/utils'
import { observer } from 'mobx-react-lite'
import { useRouter } from 'next/router'
Expand All @@ -8,6 +8,11 @@ import { DataStatisticsCard, DoiCard, DepositingCard, IrusCard } from './cards'
import RioxxCard from './cards/rioxx-card'
import DashboardGuide from '../../components/dashboard-tutorial/dashboardGuide'
import NotificationGuide from '../settings/cards/notificationGuide'
import { GlobalContext } from '../../store'
import placeholder from '../../components/upload/assets/placeholderChart.svg'
import { Button } from '../../design'

import { Card } from 'design'

const OverviewTemplate = observer(
({
Expand Down Expand Up @@ -43,6 +48,7 @@ const OverviewTemplate = observer(
const [hasNotificationGuideBeenShown, setNotificationGuideShown] = useState(
localStorage.getItem('notificationGuideShown') === 'true'
)
const { ...globalStore } = useContext(GlobalContext)

const handleButtonClick = async () => {
setNotificationGuideShown(true)
Expand Down Expand Up @@ -100,50 +106,89 @@ const OverviewTemplate = observer(
className={classNames.use(styles.container).join(className)}
{...restProps}
>
<DataStatisticsCard
metadatadaHistory={metadatadaHistory}
metadataCount={metadataCount}
fullTextCount={fullTextCount}
harvestingDate={harvestingDate}
errorCount={errorCount}
warningCount={warningCount}
dataProviderId={dataProviderId}
viewStatistics={viewStatistics}
/>
{tutorial && tutorial.currentStep === 1 && (
<DashboardGuide
tutorial={tutorial}
dataProviderData={dataProviderData}
modal={modal}
/>
)}
{!hasNotificationGuideBeenShown && (
<NotificationGuide
dataProviderData={dataProviderData}
notificationGuide={notificationGuide}
handleButtonClick={handleButtonClick}
handleButtonClose={handleButtonClose}
/>
)}
<DepositingCard
chartData={timeLagData}
complianceLevel={complianceLevel}
dataProviderId={dataProviderId}
countryCode={countryCode}
/>
{globalStore.dataProvider?.issues?.harvestingStatus
?.lastHarvestingDate !== null ? (
<div>
<DataStatisticsCard
metadatadaHistory={metadatadaHistory}
metadataCount={metadataCount}
fullTextCount={fullTextCount}
harvestingDate={harvestingDate}
errorCount={errorCount}
warningCount={warningCount}
dataProviderId={dataProviderId}
viewStatistics={viewStatistics}
/>
{tutorial && tutorial.currentStep === 1 && (
<DashboardGuide
tutorial={tutorial}
dataProviderData={dataProviderData}
modal={modal}
/>
)}
{!hasNotificationGuideBeenShown && (
<NotificationGuide
dataProviderData={dataProviderData}
notificationGuide={notificationGuide}
handleButtonClick={handleButtonClick}
handleButtonClose={handleButtonClose}
/>
)}
<DepositingCard
chartData={timeLagData}
complianceLevel={complianceLevel}
dataProviderId={dataProviderId}
countryCode={countryCode}
/>

{rioxxCompliance != null && rioxxCompliance.totalCount > 0 && (
<RioxxCard compliance={rioxxCompliance} />
)}
{viewStatistics != null && <IrusCard statistics={viewStatistics} />}
{doiCount && (
<DoiCard
outputsCount={metadataCount}
doiCount={doiCount}
downloadUrl={doiDownloadUrl}
enrichmentSize={doiEnrichmentSize}
dataProviderId={dataProviderId}
/>
{rioxxCompliance != null && rioxxCompliance.totalCount > 0 && (
<RioxxCard compliance={rioxxCompliance} />
)}
{viewStatistics != null && <IrusCard statistics={viewStatistics} />}
{doiCount && (
<DoiCard
outputsCount={metadataCount}
doiCount={doiCount}
downloadUrl={doiDownloadUrl}
enrichmentSize={doiEnrichmentSize}
dataProviderId={dataProviderId}
/>
)}
</div>
) : (
<Card className={styles.placeholderCard}>
<Card.Title tag="h2">General information</Card.Title>
<div className={styles.innerContent}>
<img
src={placeholder}
alt="placeholder"
className={styles.logo}
/>
<h5 className={styles.placeholderTitle}>
You repository is still indexing.
</h5>
<p className={styles.placeholderDescription}>
This can take up to 3 weeks depending on the size of the data
provider and our workload. You will receive an email once this
has been done. In the meantime, find out more about how to
ensure your repository is indexed to maximum effect in the Data
Provider’s Guide.
</p>
<Button
className={styles.actionButton}
variant="contained"
tag="div"
onClick={() =>
window.open(
'https://core.ac.uk/documentation/membership-documentation',
'_blank'
)
}
>
Data Provider’s Guide
</Button>
</div>
</Card>
)}
</Tag>
)
Expand Down
38 changes: 38 additions & 0 deletions templates/overview/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -261,3 +261,41 @@
padding: 0.5rem 1rem;
background-color: var(--gray-100);
}

.inner-content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}

.placeholder-title {
margin: 40px 0;
font-size: 18px;
font-style: normal;
font-weight: 500;
line-height: 140%;
color: #212121;
text-align: center;
letter-spacing: 0.029px;
}

.placeholder-description {
max-width: 575px;
margin: 0 0 24px;
font-size: 16px;
font-style: normal;
font-weight: 400;
line-height: 140%;
color: #666;
text-align: center;
letter-spacing: 0.026px;
}

.placeholder-card {
margin-top: 16px;
}

.action-button {
margin-bottom: 64px;
}

0 comments on commit 54cab8a

Please sign in to comment.