Skip to content

Commit

Permalink
feat: début licence dans les métdonnées #286
Browse files Browse the repository at this point in the history
  • Loading branch information
ocruze committed Sep 18, 2024
1 parent bc501a9 commit c3aa4f9
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 8 deletions.
2 changes: 1 addition & 1 deletion assets/components/Input/AutocompleteSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { symToStr } from "tsafe/symToStr";
interface AutocompleteSelectProps<T> {
id?: string;
label: string;
hintText: string;
hintText?: string;
state?: "default" | "error" | "success";
stateRelatedMessage?: string;
defaultValue?: T[];
Expand Down
26 changes: 20 additions & 6 deletions assets/entrepot/pages/service/metadatas/Description.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import { XMLParser } from "fast-xml-parser";
import { FC, useEffect } from "react";
import { Controller, UseFormReturn } from "react-hook-form";

import { EndpointTypeEnum, ServiceFormValuesBaseType } from "../../../../@types/app";
import AutocompleteSelect from "../../../../components/Input/AutocompleteSelect";
import MarkdownEditor from "../../../../components/Input/MarkdownEditor";
import { getTranslation } from "../../../../i18n/i18n";
import { EndpointTypeEnum, ServiceFormValuesBaseType } from "../../../../@types/app";
import { getInspireKeywords, regex } from "../../../../utils";
import categories from "../../../../data/topic_categories.json";
import frequencyCodes from "../../../../data/maintenance_frequency.json";
import categories from "../../../../data/topic_categories.json";
import { useTranslation } from "../../../../i18n/i18n";
import { getInspireKeywords, regex } from "../../../../utils";

const keywords = getInspireKeywords();

Expand All @@ -35,8 +35,8 @@ type DescriptionProps = {
};

const Description: FC<DescriptionProps> = ({ visible, form, editMode }) => {
const { t: tCommon } = getTranslation("Common");
const { t } = getTranslation("MetadatasForm");
const { t: tCommon } = useTranslation("Common");
const { t } = useTranslation("MetadatasForm");

const {
register,
Expand Down Expand Up @@ -235,6 +235,20 @@ const Description: FC<DescriptionProps> = ({ visible, form, editMode }) => {
...register("organization_email"),
}}
/>

<h3>{t("metadata.description_form.public_access_limits_title")}</h3>
<AutocompleteSelect
label={t("metadata.description_form.access_and_use_conditions")}
options={[
"Aucune condition ne s'applique",
"Licence Ouverte / Open Licence version 2.0 https://www.etalab.gouv.fr/licence-ouverte-open-licence",
"Conditions inconnues",
]}
multiple={false}
freeSolo={true}
getOptionLabel={(option) => String(option)}
/>
<Input label={t("metadata.description_form.public_access_restrictions")} />
</div>
);
};
Expand Down
9 changes: 9 additions & 0 deletions assets/entrepot/pages/service/metadatas/metadatas-form-tr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ export const { i18n } = declareComponentKeys<
| "metadata.description_form.hint_organization"
| "metadata.description_form.organization_email"
| "metadata.description_form.hint_organization_email"
| "metadata.description_form.public_access_limits_title"
| "metadata.description_form.access_and_use_conditions"
| "metadata.description_form.public_access_restrictions"
| "attribution.title"
| "attribution.explain"
| "attribution_form.text"
Expand Down Expand Up @@ -94,6 +97,9 @@ export const MetadatasFormFrTranslations: Translations<"fr">["MetadatasForm"] =
"attribution_form.url": "URL de l’attribution (optionnel)",
"attribution_form.hint_url":
"Adresse de la page web vers laquelle doit pointer l’attribution. Il peut s'agir du site web de l’organisme producteur, d’une page de conditions d’utilisation des données ou de toute autre URL valide en lien avec les données représentées.",
"metadata.description_form.public_access_limits_title": "Limitations d'accès public",
"metadata.description_form.access_and_use_conditions": "Condition d'accès et d'utilisation",
"metadata.description_form.public_access_restrictions": "Restriction d'accès public",
"metadata.additionnal_infos_form.language": "Langue des métadonnées",
"metadata.additionnal_infos_form.hint_language": "La ou les langues utilisées pour décrire les métadonnées",
"metadata.additionnal_infos_form.charset": "Jeu de caractères de la ressource",
Expand Down Expand Up @@ -149,6 +155,9 @@ export const MetadatasFormEnTranslations: Translations<"en">["MetadatasForm"] =
"attribution_form.url": "Attribution URL",
"attribution_form.hint_url":
"Address of the web page to which the attribution should point. This may be the producing organization's website, a data use conditions page, or any other valid URL related to the data represented.",
"metadata.description_form.public_access_limits_title": undefined,
"metadata.description_form.access_and_use_conditions": undefined,
"metadata.description_form.public_access_restrictions": undefined,
"metadata.additionnal_infos_form.language": "Metadata language",
"metadata.additionnal_infos_form.hint_language": "The language(s) used to describe the metadata",
"metadata.additionnal_infos_form.charset": "Resource charset",
Expand Down
2 changes: 1 addition & 1 deletion assets/entrepot/pages/service/wfs/WfsServiceForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const WfsServiceForm: FC<WfsServiceFormProps> = ({ datastoreId, vectorDbId, offe
const { t: tCommon } = useTranslation("Common");

/* l'etape courante */
const [currentStep, setCurrentStep] = useState(STEPS.TABLES_INFOS);
const [currentStep, setCurrentStep] = useState(STEPS.METADATAS_DESCRIPTION); // TODO, A ENLEVER
const editMode = useMemo(() => !!offeringId, [offeringId]);

const queryClient = useQueryClient();
Expand Down

0 comments on commit c3aa4f9

Please sign in to comment.