Skip to content

Commit

Permalink
Dataset distribution (#501)
Browse files Browse the repository at this point in the history
* feat: add datasets and distributions

* feat: review dataset and remove new array reference on a useSelector
  • Loading branch information
EmmanuelDemey authored Oct 24, 2023
1 parent 563badd commit c8ee252
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 45 deletions.
3 changes: 0 additions & 3 deletions app/src/js/applications/datasets/datasets/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ export function validate({ creator, contributor, disseminationStatus, labelLg1,
}


/**
* <li>{D.theme} : { dataset.theme} </li>
*/
export const DatasetEdit = (props) => {
const { id } = useParams();
const isEditing = !!id;
Expand Down
6 changes: 3 additions & 3 deletions app/src/js/applications/datasets/datasets/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import api from '../../../remote-api/datasets-api';
import { useQuery } from '@tanstack/react-query';
import { NewButton, PageTitle, VerticalMenu } from '@inseefr/wilco';
import D from '../../../i18n/build-dictionary';
import { Auth, SearchableList } from 'bauhaus-utilities';
import { Auth, SearchableList, Row } from 'bauhaus-utilities';
import React from 'react';

export const DatasetHome = () => {
Expand All @@ -13,7 +13,7 @@ export const DatasetHome = () => {

return (
<div className='container'>
<div className='row'>
<Row>
<VerticalMenu>
<Auth.AuthGuard roles={[Auth.ADMIN]}>
<NewButton
Expand All @@ -35,7 +35,7 @@ export const DatasetHome = () => {
itemFormatter={(_, dataset) => dataset.label}
/>
</div>
</div>
</Row>
</div>
)
}
9 changes: 5 additions & 4 deletions app/src/js/applications/datasets/datasets/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
CheckSecondLang, DateUtils, HTMLUtils,
PageTitleBlock,
Stores,
Row
} from 'bauhaus-utilities';
import React from 'react';
import { ActionToolbar, Button, DSURLToLabel, goBack, Loading, Note, ReturnButton } from '@inseefr/wilco';
Expand Down Expand Up @@ -68,7 +69,7 @@ export const DatasetView = (props) => {

<CheckSecondLang />

<div className="row">
<Row>
<Note
text={
<ul>
Expand All @@ -85,8 +86,8 @@ export const DatasetView = (props) => {
title={D1.globalInformationsTitle}
alone={true}
/>
</div>
<div className="row">
</Row>
<Row>
<Note
text={HTMLUtils.renderMarkdownElement(dataset.descriptionLg1)}
title={D1.descriptionTitle}
Expand All @@ -103,7 +104,7 @@ export const DatasetView = (props) => {
allowEmpty={true}
/>
)}
</div>
</Row>
</div>
);
}
1 change: 0 additions & 1 deletion app/src/js/applications/datasets/distributions/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ export const DistributionEdit = (props) => {

const onSubmit = () => {
const clientSideErrors = validate(editingDistribution);
console.log(clientSideErrors)
if(clientSideErrors.errorMessage?.length > 0){
setSubmitting(true);
setClientSideErrors(clientSideErrors);
Expand Down
6 changes: 3 additions & 3 deletions app/src/js/applications/datasets/distributions/home.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useQuery } from '@tanstack/react-query';
import api from '../../../remote-api/distributions-api';
import { NewButton, PageTitle, VerticalMenu } from '@inseefr/wilco';
import { Auth, SearchableList } from 'bauhaus-utilities';
import { Auth, SearchableList, Row } from 'bauhaus-utilities';
import D from '../../../i18n/build-dictionary';
import React from 'react';

Expand All @@ -13,7 +13,7 @@ export const DistributionHome = () => {

return (
<div className='container'>
<div className='row'>
<Row>
<VerticalMenu>
<Auth.AuthGuard roles={[Auth.ADMIN]}>
<NewButton
Expand All @@ -35,7 +35,7 @@ export const DistributionHome = () => {
itemFormatter={(_, dataset) => dataset.labelLg1}
/>
</div>
</div>
</Row>
</div>
)
}
10 changes: 5 additions & 5 deletions app/src/js/applications/datasets/distributions/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useQuery } from '@tanstack/react-query';
import api from '../../../remote-api/distributions-api';
import { useSelector } from 'react-redux';
import * as select from '../../../reducers';
import { Auth, CheckSecondLang, DateUtils, HTMLUtils, PageTitleBlock, Stores } from 'bauhaus-utilities';
import { Auth, CheckSecondLang, DateUtils, HTMLUtils, PageTitleBlock, Stores, Row } from 'bauhaus-utilities';
import { ActionToolbar, Button, goBack, Loading, Note, ReturnButton } from '@inseefr/wilco';
import D, { D1, D2 } from '../../../i18n/build-dictionary';
import React from 'react';
Expand Down Expand Up @@ -43,7 +43,7 @@ export const DistributionView = (props) => {

<CheckSecondLang />

<div className="row">
<Row>
<Note
text={
<ul>
Expand All @@ -57,8 +57,8 @@ export const DistributionView = (props) => {
title={D1.globalInformationsTitle}
alone={true}
/>
</div>
<div className="row">
</Row>
<Row>
<Note
text={HTMLUtils.renderMarkdownElement(distribution.descriptionLg1)}
title={D1.descriptionTitle}
Expand All @@ -75,7 +75,7 @@ export const DistributionView = (props) => {
allowEmpty={true}
/>
)}
</div>
</Row>
</div>
);

Expand Down
49 changes: 23 additions & 26 deletions app/src/js/applications/operations/routes/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import React, { Component } from 'react';
import React, { useEffect } from 'react';
import { Route } from 'react-router-dom';
import { connect } from 'react-redux';

import { loadSetup } from 'js/actions/operations/utils/setup';

import D from 'js/i18n';

import FamilyRoutes from 'js/applications/operations/routes/family';
import SeriesRoutes from 'js/applications/operations/routes/series';
import OperationsRoutes from 'js/applications/operations/routes/operation';
Expand All @@ -14,29 +11,29 @@ import IndicatorRoutes from 'js/applications/operations/routes/indicator';
import SimsRoutes from 'js/applications/operations/routes/sims';
import Menu from 'js/applications/operations/menu';
import OperationsTreeContainer from 'js/applications/operations/tree';
class RootComponent extends Component {
componentDidMount() {
this.props.loadSetup();

const RootComponent = ({ loadSetup }) => {
useEffect(() => {
loadSetup();
document.title = 'Bauhaus - ' + D.operationsTitle;
}
render() {
return (
<>
<Menu />
<FamilyRoutes />
<SeriesRoutes />
<OperationsRoutes />
<IndicatorRoutes />
<DocumentRoutes />
<SimsRoutes />
<Route
exact
path="/operations/tree"
component={OperationsTreeContainer}
/>
</>
);
}
}, [loadSetup]);

return (
<>
<Menu />
<FamilyRoutes />
<SeriesRoutes />
<OperationsRoutes />
<IndicatorRoutes />
<DocumentRoutes />
<SimsRoutes />
<Route
exact
path="/operations/tree"
component={OperationsTreeContainer}
/>
</>
);
}
const mapDispatchToProps = {
loadSetup,
Expand Down

0 comments on commit c8ee252

Please sign in to comment.