From 6a55cfa4930e0edfa545784012a533faded3fb41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Farcy?= Date: Wed, 6 Dec 2023 14:16:19 +0100 Subject: [PATCH 1/4] Add layers names in List view & improve display --- public/locales/en/translation.json | 1 + public/locales/fr/translation.json | 1 + src/modules/RA/DataLayer/views/List.js | 3 ++- src/modules/RA/DataSource/views/List.js | 10 +++++++++- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json index 72e266ab..6c2a7e09 100644 --- a/public/locales/en/translation.json +++ b/public/locales/en/translation.json @@ -273,6 +273,7 @@ "label": "Label", "name": "Name", "fields": "Fields", + "layers": "associated layers", "file": { "related-files": "Linked files", "placeholder": "Drop here GeoJSON or zipped shapefile.", diff --git a/public/locales/fr/translation.json b/public/locales/fr/translation.json index 3e8b6567..a1ad8991 100644 --- a/public/locales/fr/translation.json +++ b/public/locales/fr/translation.json @@ -325,6 +325,7 @@ "label": "Libellé", "name": "Nom", "fields": "Champs", + "layers": "Couches associées", "file": { "related-files": "Fichiers associés", "placeholder": "Déposez ici le GeoJSON ou un zip des fichiers Shapefile", diff --git a/src/modules/RA/DataLayer/views/List.js b/src/modules/RA/DataLayer/views/List.js index b923b55a..89e576a5 100644 --- a/src/modules/RA/DataLayer/views/List.js +++ b/src/modules/RA/DataLayer/views/List.js @@ -3,6 +3,7 @@ import { AutocompleteInput, BooleanField, BooleanInput, + ChipField, Datagrid, Filter, List, @@ -65,7 +66,7 @@ export const DataLayerList = ({ viewList, ...props }) => ( - + diff --git a/src/modules/RA/DataSource/views/List.js b/src/modules/RA/DataSource/views/List.js index 1bc5cbae..af43e9b2 100644 --- a/src/modules/RA/DataSource/views/List.js +++ b/src/modules/RA/DataSource/views/List.js @@ -7,6 +7,9 @@ import { SelectInput, TextField, TextInput, + ReferenceArrayField, + SingleFieldList, + ChipField, } from 'react-admin'; import StatusChip from '../components/StatusChip'; @@ -21,7 +24,7 @@ import CommonBulkActionButtons from '../../../../components/react-admin/CommonBulkActionButtons'; import CustomCloneButton from '../../../../components/react-admin/CustomCloneButton'; -import { RES_DATASOURCE } from '../../ra-modules'; +import { RES_DATALAYER, RES_DATASOURCE } from '../../ra-modules'; const ListFilters = props => ( @@ -66,6 +69,11 @@ export const DataSourceList = props => ( label="datasource.form.geometry" render={({ geom_type: geomType }) => geomTypes[geomType] || ''} /> + + + + + Date: Mon, 11 Dec 2023 11:10:19 +0100 Subject: [PATCH 2/4] Add datasource form a read-only general information tab --- public/locales/en/translation.json | 11 ++++ public/locales/fr/translation.json | 11 ++++ .../components/DataSourceTabbedForm.js | 4 ++ .../DataSource/components/GeneralInfoTab.js | 65 +++++++++++++++++++ 4 files changed, 91 insertions(+) create mode 100644 src/modules/RA/DataSource/components/GeneralInfoTab.js diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json index 6c2a7e09..e3d2b1a2 100644 --- a/public/locales/en/translation.json +++ b/public/locales/en/translation.json @@ -351,6 +351,17 @@ "refresh": { "accepted": "Refresh accepted", "notAllowed": "Refresh not possible" + }, + "infos": { + "title": "General informations", + "created": "Created at", + "updated": "Updated at", + "description": "Description", + "no-description": "No description available", + "credit": "Credit", + "no-credit": "No credit available", + "author": "Author", + "no-author": "Unkown" } }, "edit": { diff --git a/public/locales/fr/translation.json b/public/locales/fr/translation.json index a1ad8991..c67c2608 100644 --- a/public/locales/fr/translation.json +++ b/public/locales/fr/translation.json @@ -403,6 +403,17 @@ "refresh": { "accepted": "Actualisation acceptée", "notAllowed": "Actualisation impossible" + }, + "infos": { + "title": "Informations Générales", + "created": "Créé le", + "updated": "Modifié le", + "description": "Description", + "no-description": "Aucune description disponible", + "credit": "Crédits", + "no-credit": "Aucun crédit disponible", + "author": "Auteur", + "no-author": "Inconnu" } }, "edit": { diff --git a/src/modules/RA/DataSource/components/DataSourceTabbedForm.js b/src/modules/RA/DataSource/components/DataSourceTabbedForm.js index 225ff4e3..2860aabd 100644 --- a/src/modules/RA/DataSource/components/DataSourceTabbedForm.js +++ b/src/modules/RA/DataSource/components/DataSourceTabbedForm.js @@ -17,6 +17,7 @@ import { fieldTypeChoices } from '..'; import MainTab from './MainTab'; import ReportTab from './ReportTab'; +import GeneralInfoTab from './GeneralInfoTab'; const DataSourceTabbedForm = ({ translate: t, ...props }) => { @@ -55,6 +56,9 @@ const DataSourceTabbedForm = ({ translate: t, ...props }) => { )} + + + ); }; diff --git a/src/modules/RA/DataSource/components/GeneralInfoTab.js b/src/modules/RA/DataSource/components/GeneralInfoTab.js new file mode 100644 index 00000000..6ecc68c3 --- /dev/null +++ b/src/modules/RA/DataSource/components/GeneralInfoTab.js @@ -0,0 +1,65 @@ +import React from 'react'; +import { List, ListItem, ListItemText } from '@material-ui/core'; +import { ReferenceField, FunctionField } from 'react-admin'; +import { RES_USER } from '../../ra-modules'; + + +const GeneralInfoTab = ({ + translate, + record: { + created_at: createdAt, + updated_at: updatedAt, + description, + credit, + author, + }, +}) => ( + + + + + + + + + + + + + + + {author + ? ( + + ( + + )} + /> + + ) : ( + + )} + + +); + +export default GeneralInfoTab; From 87942d3ccf2d53ad144104c61b5e25589456c23d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Farcy=60?= Date: Fri, 15 Dec 2023 10:23:19 +0100 Subject: [PATCH 3/4] Add layerlist to datasource general infos --- .../DataSource/components/GeneralInfoTab.js | 124 +++++++++++------- 1 file changed, 74 insertions(+), 50 deletions(-) diff --git a/src/modules/RA/DataSource/components/GeneralInfoTab.js b/src/modules/RA/DataSource/components/GeneralInfoTab.js index 6ecc68c3..093aaeef 100644 --- a/src/modules/RA/DataSource/components/GeneralInfoTab.js +++ b/src/modules/RA/DataSource/components/GeneralInfoTab.js @@ -1,8 +1,21 @@ import React from 'react'; -import { List, ListItem, ListItemText } from '@material-ui/core'; -import { ReferenceField, FunctionField } from 'react-admin'; -import { RES_USER } from '../../ra-modules'; +import { List, ListItem, ListItemText, makeStyles } from '@material-ui/core'; +import { + ReferenceField, + FunctionField, + ReferenceArrayField, + SingleFieldList, + ChipField, +} from 'react-admin'; +import { RES_USER, RES_DATALAYER } from '../../ra-modules'; +const useStyle = makeStyles({ + layers: { + display: 'flex', + flexDirection: 'column', + alignItems: 'flex-start', + }, +}); const GeneralInfoTab = ({ translate, @@ -13,53 +26,64 @@ const GeneralInfoTab = ({ credit, author, }, -}) => ( - - - - - - - - - - - - - - - {author - ? ( - - ( - - )} +}) => { + const classes = useStyle(); + return ( + + + + + + + + + + + + + + + {author + ? ( + + ( + + )} + /> + + ) : ( + - - ) : ( - - )} - - -); + )} + + + + + + + + + + + ); +}; export default GeneralInfoTab; From e2d55950939ecbdf10463bb10f247677d6c867d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Farcy=60?= Date: Fri, 15 Dec 2023 13:38:29 +0100 Subject: [PATCH 4/4] Datasource listview display associated layer count instead of names --- src/modules/RA/DataSource/views/List.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/modules/RA/DataSource/views/List.js b/src/modules/RA/DataSource/views/List.js index af43e9b2..b21426b4 100644 --- a/src/modules/RA/DataSource/views/List.js +++ b/src/modules/RA/DataSource/views/List.js @@ -7,9 +7,6 @@ import { SelectInput, TextField, TextInput, - ReferenceArrayField, - SingleFieldList, - ChipField, } from 'react-admin'; import StatusChip from '../components/StatusChip'; @@ -24,7 +21,7 @@ import CommonBulkActionButtons from '../../../../components/react-admin/CommonBulkActionButtons'; import CustomCloneButton from '../../../../components/react-admin/CustomCloneButton'; -import { RES_DATALAYER, RES_DATASOURCE } from '../../ra-modules'; +import { RES_DATASOURCE } from '../../ra-modules'; const ListFilters = props => ( @@ -69,11 +66,11 @@ export const DataSourceList = props => ( label="datasource.form.geometry" render={({ geom_type: geomType }) => geomTypes[geomType] || ''} /> - - - - - + layers.length} + />