From 40a3b005406754ac65342912474c5b242719e719 Mon Sep 17 00:00:00 2001 From: Nicolas Thouvenin Date: Fri, 5 Jul 2024 15:48:40 +0200 Subject: [PATCH 1/4] 14.0.57 --- Makefile | 4 ++-- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 1415f9813..d94deedc4 100644 --- a/Makefile +++ b/Makefile @@ -54,8 +54,8 @@ build: ## Deploy ================================================================= publish: build ## publish version to docker hub - docker build -t cnrsinist/lodex:14.0.56 --build-arg http_proxy --build-arg https_proxy . - docker push cnrsinist/lodex:14.0.56 + docker build -t cnrsinist/lodex:14.0.57 --build-arg http_proxy --build-arg https_proxy . + docker push cnrsinist/lodex:14.0.57 ## Development ================================================================= diff --git a/package-lock.json b/package-lock.json index 09539765d..d72f3cc24 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "lodex", - "version": "14.0.56", + "version": "14.0.57", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "lodex", - "version": "14.0.56", + "version": "14.0.57", "hasInstallScript": true, "license": "CECILL-2.1", "dependencies": { diff --git a/package.json b/package.json index 708ee2f6b..111fcb6b8 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "node": ">= 16" }, "name": "lodex", - "version": "14.0.56", + "version": "14.0.57", "description": "", "main": "src/api/index.js", "browser": { From d9664cdf763ccec670d330878f32cdceb5763bc5 Mon Sep 17 00:00:00 2001 From: Nicolas Thouvenin Date: Tue, 9 Jul 2024 13:45:08 +0200 Subject: [PATCH 2/4] more explicit errors from ws --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index d72f3cc24..a42764699 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,7 +28,7 @@ "@emotion/react": "11.7.1", "@emotion/styled": "11.6.0", "@ezs/analytics": "2.3.2", - "@ezs/basics": "2.7.0", + "@ezs/basics": "2.7.1", "@ezs/conditor": "2.12.1", "@ezs/core": "3.10.2", "@ezs/istex": "1.5.9", @@ -3128,9 +3128,9 @@ } }, "node_modules/@ezs/basics": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/@ezs/basics/-/basics-2.7.0.tgz", - "integrity": "sha512-7vfElBlONn22qvfr5kMwCTzDBXtBiXbgqKE/eV7W7nJfDtl3epR8nw8wMJQDBjVFixymKx6SZgmnBDD2/eYN3Q==", + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/@ezs/basics/-/basics-2.7.1.tgz", + "integrity": "sha512-t/IPlXOCHlWq5R9S2P6IfQTahbLJb7v4FwLQvt0QzjtTjMgcPENWTmZ+Ew7ml7pRcKIpCit3KkVzha1f65FpIg==", "dependencies": { "async-retry": "1.3.3", "better-https-proxy-agent": "1.0.9", diff --git a/package.json b/package.json index 111fcb6b8..32cc2581d 100644 --- a/package.json +++ b/package.json @@ -74,7 +74,7 @@ "@emotion/react": "11.7.1", "@emotion/styled": "11.6.0", "@ezs/analytics": "2.3.2", - "@ezs/basics": "2.7.0", + "@ezs/basics": "2.7.1", "@ezs/conditor": "2.12.1", "@ezs/core": "3.10.2", "@ezs/istex": "1.5.9", From 86cdcb10983048cb954b7d6ce61465d579c4a201 Mon Sep 17 00:00:00 2001 From: AlasDiablo <25723276+AlasDiablo@users.noreply.github.com> Date: Wed, 10 Jul 2024 09:04:09 +0200 Subject: [PATCH 3/4] feat(routine-builder): improve routine builder --- src/app/custom/translations.tsv | 3 + .../fields/sourceValue/SourceValueRoutine.js | 145 ++++++++++++++---- 2 files changed, 114 insertions(+), 34 deletions(-) diff --git a/src/app/custom/translations.tsv b/src/app/custom/translations.tsv index 4c8983141..807d7e648 100644 --- a/src/app/custom/translations.tsv +++ b/src/app/custom/translations.tsv @@ -1099,3 +1099,6 @@ "ejs_data" "Variable containing the routine data" "Variable contenant les données de la routine" "ejs_lodash" "Variable containing the Lodash function" "Variable contenant les fonctions de Lodash" "routine_args" "Routine fields" "Champs de la routine" +"routine_arg" "Field N°" "Champ N°" +"routine_arg_add" "Add a new field" "Ajouté un nouveau champ" +"routine_arg_delete" "Delete this field" "Supprimé ce champ" diff --git a/src/app/js/fields/sourceValue/SourceValueRoutine.js b/src/app/js/fields/sourceValue/SourceValueRoutine.js index cbb3f8fec..7a7965228 100644 --- a/src/app/js/fields/sourceValue/SourceValueRoutine.js +++ b/src/app/js/fields/sourceValue/SourceValueRoutine.js @@ -1,17 +1,19 @@ -import React from 'react'; +import React, { useEffect, useMemo, useState } from 'react'; import { compose } from 'recompose'; import ListAltIcon from '@mui/icons-material/ListAlt'; import PropTypes from 'prop-types'; import RoutineCatalog from '../wizard/RoutineCatalog'; import translate from 'redux-polyglot/translate'; import { polyglot as polyglotPropTypes } from '../../propTypes'; -import { Box, Button } from '@mui/material'; +import { Box, Button, IconButton, Tooltip, Typography } from '@mui/material'; import { fromFields } from '../../sharedSelectors'; import { loadField } from '../index'; import { connect } from 'react-redux'; import { getFieldForSpecificScope } from '../../../../common/scope'; import SearchAutocomplete from '../../admin/Search/SearchAutocomplete'; import RoutineCatalogAutocomplete from '../wizard/RoutineCatalogAutocomplete'; +import AddIcon from '@mui/icons-material/Add'; +import DeleteIcon from '@mui/icons-material/Delete'; const SourceValueRoutine = ({ fields, @@ -19,31 +21,38 @@ const SourceValueRoutine = ({ value, p: polyglot, }) => { - const [openRoutineCatalog, setOpenRoutineCatalog] = React.useState(false); - const [routine, setRoutine] = React.useState(''); - const [routineArgs, setRoutineArgs] = React.useState([]); - const [routineFields, setRoutineFields] = React.useState([]); - const [first, setFirst] = React.useState(true); + const [openRoutineCatalog, setOpenRoutineCatalog] = useState(false); + const [routine, setRoutine] = useState(''); + const [routineArgs, setRoutineArgs] = useState([]); + const [routineFields, setRoutineFields] = useState([null]); + const [first, setFirst] = useState(true); - const fieldsResource = React.useMemo( + const fieldsResource = useMemo( () => getFieldForSpecificScope(fields, 'collection'), [fields], ); - React.useEffect(() => { + useEffect(() => { if (typeof value === 'string') { setRoutine(value.split('/').slice(0, 4).join('/')); const args = value.split('/').slice(4); setRoutineArgs(args); - setRoutineFields( - fieldsResource.filter((field) => { - return args.includes(field.name); - }), - ); + const filteredRoutineFields = args + .map((arg) => { + return fieldsResource.find((field) => { + return field.name === arg; + }); + }) + .filter(Boolean); + if (filteredRoutineFields.length === 0) { + setRoutineFields([null]); + } else { + setRoutineFields(filteredRoutineFields); + } } }, [value]); - React.useEffect(() => { + useEffect(() => { if (!first) { const finalRoutine = [routine, ...routineArgs].join('/'); const transformers = [ @@ -66,13 +75,41 @@ const SourceValueRoutine = ({ const handleRoutineChange = (event) => { setRoutine(event.target.value); - setRoutineFields([]); + setRoutineFields([null]); setRoutineArgs([]); }; - const handleRoutineFieldsChange = (event, newValue) => { - setRoutineFields(newValue); - setRoutineArgs(newValue.map((field) => field.name)); + const handleRoutineFieldChange = (newIndex, newValue) => { + const newField = routineFields.map((field, index) => { + if (index === newIndex) { + return newValue; + } + return field; + }); + setRoutineFields(newField); + setRoutineArgs(newField.map((field) => field.name)); + }; + + const handleAddField = () => { + setRoutineFields([...routineFields, null]); + }; + + const handleDeleteField = (deleteIndex) => { + if (deleteIndex === 0 && routineFields.length === 1) { + setRoutineFields([null]); + setRoutineArgs([]); + return; + } + const newField = routineFields + .map((field, index) => { + if (index === deleteIndex) { + return undefined; + } + return field; + }) + .filter((field) => field !== undefined); + setRoutineFields(newField); + setRoutineArgs(newField.map((field) => field.name)); }; return ( @@ -108,21 +145,61 @@ const SourceValueRoutine = ({ /> - - + + + {polyglot.t('routine_args')} + + + {routineFields.map((field, index) => ( + + { + handleRoutineFieldChange(index, newValue); + }} + value={field} + clearText={polyglot.t('clear')} + /> + + handleDeleteField(index)} + > + + + + + ))} + + + + + + + + ); From ee4bc44f3f1487cdfaddeb57fcfc7f71bc372699 Mon Sep 17 00:00:00 2001 From: AlasDiablo <25723276+AlasDiablo@users.noreply.github.com> Date: Wed, 10 Jul 2024 09:38:04 +0200 Subject: [PATCH 4/4] typo: update translation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: François Parmentier --- src/app/custom/translations.tsv | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/custom/translations.tsv b/src/app/custom/translations.tsv index 807d7e648..84d63585c 100644 --- a/src/app/custom/translations.tsv +++ b/src/app/custom/translations.tsv @@ -1100,5 +1100,5 @@ "ejs_lodash" "Variable containing the Lodash function" "Variable contenant les fonctions de Lodash" "routine_args" "Routine fields" "Champs de la routine" "routine_arg" "Field N°" "Champ N°" -"routine_arg_add" "Add a new field" "Ajouté un nouveau champ" -"routine_arg_delete" "Delete this field" "Supprimé ce champ" +"routine_arg_add" "Add a new field" "Ajouter un nouveau champ" +"routine_arg_delete" "Delete this field" "Supprimer ce champ"