From 2c45e9a60a713fb81fc2ef15b9df4cdd99ce701d Mon Sep 17 00:00:00 2001 From: PRADO SEBASTIEN Date: Mon, 5 Feb 2024 10:52:16 +0100 Subject: [PATCH] fix(data): Cant import data with standard provenance if doesnt exist OpenSILEX/opensilex-dev!1169 --- .../components/data/form/DataImportForm.vue | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/opensilex-front/front/src/components/data/form/DataImportForm.vue b/opensilex-front/front/src/components/data/form/DataImportForm.vue index 638806606..3c691612e 100644 --- a/opensilex-front/front/src/components/data/form/DataImportForm.vue +++ b/opensilex-front/front/src/components/data/form/DataImportForm.vue @@ -194,8 +194,12 @@ export default class DataImportForm extends Vue { this.$opensilex.getService("opensilex.DataService") .searchProvenance("standard_provenance") .then((http: HttpResponse>>) => { + if(http.response.result[0] === undefined) { + this.standardProvURI = undefined; + } else { this.standardProvURI = http.response.result[0].uri; - }); + } + }); } getEmptyForm() { @@ -354,6 +358,15 @@ export default class DataImportForm extends Vue { } } }).catch((e) => { + if(this.standardProvURI === undefined) { + let message = + this.$t("DataImportForm.errorStandardProvenance") + + " : '" + + this.standardProvURI + + "' . " + + this.$t("DataImportForm.errorStandardProvenanceTwo") + this.$opensilex.showErrorToast(message); + } console.error(e); this.$opensilex.errorHandler(e); }); @@ -503,6 +516,8 @@ en: data-duplicated: Duplicated data data-not-imported: Data has not been imported. An error has occured during the importation process error: Erreur + errorStandardProvenance: The selected provenance is + errorStandardProvenanceTwo: To use the standard provenance, define it beforehand. message: Message reset-file: Reset file import-file : Import data CSV @@ -531,6 +546,8 @@ fr: data-duplicated: Données dupliquées data-not-imported: Données non importées. Une erreur s'est produite durant le processus d'importation error: Error + errorStandardProvenance: La provenance selectionnée est + errorStandardProvenanceTwo: Pour utiliser la provenance standard, définissez-la au préalable. message: Message reset-file: Reinitialiser fichier import-file : Importez des données