Skip to content

Commit

Permalink
WCMS-19787 added modified date information to /data page (#182)
Browse files Browse the repository at this point in the history
* WCMS-19787 added modified date information to /data page

* WCMS-19787 updated class attribute to className
added Modified Date info to DataSet component
updated DataSet data type

* WCMS-19787 removed accidentally added comma

* WCMS-19787 removed h1 bottom margin

* WCMS-19787 corrected typescript errors

* Remove extra margin

---------

Co-authored-by: Bethany Dunfield <[email protected]>
  • Loading branch information
averysmithproductions and brdunfield authored Apr 2, 2024
1 parent df4920e commit c5f4cc4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/services/useMetastoreDataset/useMetastoreDataset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const useMetastoreDataset = (datasetId : string, rootAPIUrl : string, additional
error: '',
description: '',
identifier: '',
modified: '',
} as DatasetType);
const [id, setId] = useState(datasetId)
const [rootUrl, setRootUrl] = useState(rootAPIUrl)
Expand All @@ -18,7 +19,7 @@ const useMetastoreDataset = (datasetId : string, rootAPIUrl : string, additional
async function fetchData() {
return axios.get(`${rootUrl}/metastore/schemas/dataset/items/${id}?show-reference-ids${additionalParamsString}`)
.then((res) => setDataset(res.data))
.catch((error) => setDataset({title: dataset.title, distribution: dataset.distribution, error: error, description: dataset.description, identifier: dataset.identifier}));
.catch((error) => setDataset({title: dataset.title, distribution: dataset.distribution, error: error, description: dataset.description, identifier: dataset.identifier, modified: dataset.modified}));
}
fetchData();
}, [id, rootUrl]);
Expand Down
10 changes: 8 additions & 2 deletions src/templates/Dataset/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import DatasetOverview from '../../components/DatasetOverviewTab';
import DatasetAPI from '../../components/DatasetAPITab';
import DataDictionary from '../../components/DatasetDataDictionaryTab';
import { DatasetDictionaryItemType, DatasetPageType, DatasetDictionaryType, DistributionType, ResourceType } from '../../types/dataset';
import TransformedDate from '../../components/TransformedDate';
import './dataset.scss';

const getSiteWideDataDictionary = (rootUrl : string, dataDictionaryUrl : string) => {
Expand Down Expand Up @@ -134,9 +135,14 @@ const Dataset = ({
<div className={'ds-l-container'}>
<div className={'ds-l-row'}>
<div className={'ds-l-md-col--9'}>
<h1 className={'ds-u-margin-bottom--4 ds-h1 title-underline'}>{title}</h1>
<h1 className={'ds-h1 title-underline'}>{title}</h1>
</div>
<div className={'ds-l-md-col--12 ds-u-color--gray ds-u-margin-y--1 ds-u-text-align--right'}>
<p className="ds-u-margin--0">Updated <TransformedDate date={dataset.modified} /></p>
</div>
<div className={'ds-l-md-col--9'}>
<div className={'ds-u-measure--wide ds-u-margin-bottom--7'}>
<p className="dc-c-metadata-description" dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(dataset.description) }}/>
<p className="dc-c-metadata-description ds-u-margin--0" dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(dataset.description) }}/>
</div>
</div>
</div>
Expand Down
4 changes: 4 additions & 0 deletions src/templates/FilteredResource/FilteredResourceBody.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import ResourcePreview from '../../components/ResourcePreview';
import ResourceFooter from '../../components/ResourceFooter';
import { buildCustomColHeaders } from './functions';
import QueryBuilder from './QueryBuilder';
import TransformedDate from '../../components/TransformedDate';
import 'swagger-ui-react/swagger-ui.css';

const FilteredResourceBody = ({
Expand Down Expand Up @@ -84,6 +85,9 @@ const FilteredResourceBody = ({
Back to {dataset.title}
</Link>
<h1 className="ds-title">{customTitle ? customTitle : pageTitle}</h1>
<div className="ds-l-row">
<span className="ds-l-col--12 ds-u-color--gray ds-u-margin-y--1 ds-u-text-align--right">Updated <TransformedDate date={dataset.modified} /></span>
</div>
<p
className="ds-u-margin-top--0 dc-c-metadata-description"
dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(distribution.data.description) }}
Expand Down
1 change: 1 addition & 0 deletions src/types/dataset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export type DatasetType = {
identifier: string,
describedBy?: any, // TODO
describedByType?: any, //TODO
modified: string,
}

export type ConditionType = {
Expand Down

0 comments on commit c5f4cc4

Please sign in to comment.