diff --git a/packages/piveau-hub-ui-modules/lib/data-provider-interface/DataProviderInterface.vue b/packages/piveau-hub-ui-modules/lib/data-provider-interface/DataProviderInterface.vue index 17fdb021bfe40ee8499d01701d6400bc70fe885c..0eee1b306041c6618b89749442e9ed575aafeec1 100644 --- a/packages/piveau-hub-ui-modules/lib/data-provider-interface/DataProviderInterface.vue +++ b/packages/piveau-hub-ui-modules/lib/data-provider-interface/DataProviderInterface.vue @@ -122,6 +122,7 @@ export default defineComponent({ edit: { enabled: route.query.edit === 'true', id: route.query.id as string || undefined, + catalog: route.query.catalog as string || undefined, fromDraft: route.query.fromDraft === 'true', }, ..._dpiContext diff --git a/packages/piveau-hub-ui-modules/lib/data-provider-interface/components/Navigation.vue b/packages/piveau-hub-ui-modules/lib/data-provider-interface/components/Navigation.vue index 0597db1eb728de427d75ae3a6a5a58466369ffe7..54a85b8936e1be69888b53d0a134f01abaf91309 100644 --- a/packages/piveau-hub-ui-modules/lib/data-provider-interface/components/Navigation.vue +++ b/packages/piveau-hub-ui-modules/lib/data-provider-interface/components/Navigation.vue @@ -62,6 +62,7 @@ import axios from 'axios'; import { ref, nextTick } from 'vue' import { getCurrentInstance } from "vue"; import { useI18n } from 'vue-i18n'; +import { useDpiContext } from '../composables/useDpiContext'; export default { name: 'Navigation', @@ -169,13 +170,17 @@ export default { const datasetId = this.getData(this.property)['datasetID']; const title = this.getData(this.property)['dct:title']; const description = this.getData(this.property)['dct:description']; - const catalogName = this.getData(this.property)['dcat:catalog'] ? this.getData(this.property)['dcat:catalog'] : ''; + const catalogId = + this.dpiContext.edit?.catalog + || this.getData(this.property)['catalog'] + || this.getData(this.property)['dcat:catalog'] + || this.getData(this.property)['dct:catalog'] let uploadUrl; let actionName; let actionParams = { id: datasetId, - catalog: catalogName, + catalog: catalogId, body: RDFdata, title, description, @@ -185,12 +190,12 @@ export default { // if no edit mode: just publish dataset regularly // if edit mode but no draft: publish/save dataset regularly if (!this.getIsEditMode || (this.getIsEditMode && !this.getIsDraft) || (this.getIsEditMode && this.getIsDraft && localStorage.getItem('dpi_duplicate'))) { - uploadUrl = `${this.$env.api.hubUrl}datasets?id=${datasetId}&catalogue=${catalogName}`; + uploadUrl = `${this.$env.api.hubUrl}datasets?id=${datasetId}&catalogue=${catalogId}`; actionParams = { data: RDFdata, token: rtpToken, url: uploadUrl }; actionName = 'auth/createDataset'; } else { // if edit mode and draft: publish user draft (remove from draft database and add to dataset database)-> publishUserDraftById - actionParams = { id: datasetId, catalog: catalogName }; + actionParams = { id: datasetId, catalog: catalogId }; actionName = 'auth/publishUserDraftById'; } @@ -198,11 +203,11 @@ export default { //if no edit mode: save draft regularly // if edit mode and draft: save draft regularly if (!this.getIsEditMode || (this.getIsEditMode && this.getIsDraft)) { - uploadUrl = `${this.$env.api.hubUrl}drafts/datasets/${datasetId}?catalogue=${catalogName}`; + uploadUrl = `${this.$env.api.hubUrl}drafts/datasets/${datasetId}?catalogue=${catalogId}`; actionName = 'auth/createUserDraft'; } else { // if edit mode and no draft: save dataset as draft (remove from dataset database and add to draft database)-> putDatasetToDraft - actionParams = { id: datasetId, catalog: catalogName, title, description }; + actionParams = { id: datasetId, catalog: catalogId, title, description }; actionName = 'auth/putDatasetToDraft'; } @@ -283,6 +288,10 @@ export default { return isUniqueID } }, + setup() { + const dpiContext = useDpiContext() + return { dpiContext } + } }; </script> diff --git a/packages/piveau-hub-ui-modules/lib/data-provider-interface/components/SimpleSelect.vue b/packages/piveau-hub-ui-modules/lib/data-provider-interface/components/SimpleSelect.vue index b0f349bcd695a1b432cf2cdb61435b7f87e7481e..b6e2f18b08a2af04a196b321942b621a82bb72da 100644 --- a/packages/piveau-hub-ui-modules/lib/data-provider-interface/components/SimpleSelect.vue +++ b/packages/piveau-hub-ui-modules/lib/data-provider-interface/components/SimpleSelect.vue @@ -138,8 +138,12 @@ onMounted(async () => { // So we need to wait until everything is fetched before proceeding further. await filterCatList() await nextTick() - // todo: can this be made more robust by using dpiContext.value.edit?.id? - const catalogIdToLoadForEdit = getNode?.('dcat:catalog')?.value || undefined + const catalogIdToLoadForEdit = + dpiContext.value.edit?.catalog + || getNode?.('catalog')?.value + || getNode?.('dcat:catalog')?.value + || getNode?.('dct:catalog')?.value + || undefined const maybeFoundCatalogFromQuery = authorizedCatalogs.value?.find(item => item.id === catalogIdToLoadForEdit) if (maybeFoundCatalogFromQuery) { setvalue({ id: maybeFoundCatalogFromQuery.id, name: maybeFoundCatalogFromQuery.name }) diff --git a/packages/piveau-hub-ui-modules/lib/data-provider-interface/composables/useDpiContext.ts b/packages/piveau-hub-ui-modules/lib/data-provider-interface/composables/useDpiContext.ts index 7af596bfe5f1fe2117b7097a31a6a13086c59781..9604df5fbea5878b81aec2491f1b92e2c7147fdd 100644 --- a/packages/piveau-hub-ui-modules/lib/data-provider-interface/composables/useDpiContext.ts +++ b/packages/piveau-hub-ui-modules/lib/data-provider-interface/composables/useDpiContext.ts @@ -14,6 +14,7 @@ export interface DpiContext { specificationName: string edit?: { enabled?: boolean + catalog?: string id?: string fromDraft?: boolean } diff --git a/packages/piveau-hub-ui-modules/lib/data-provider-interface/config/dcatapde/input-definition.ts b/packages/piveau-hub-ui-modules/lib/data-provider-interface/config/dcatapde/input-definition.ts index 81adb7fe35b93cc568fee1338829472599c8759c..21bcde4e4bb93cdd22a9babddea1930775e69c96 100644 --- a/packages/piveau-hub-ui-modules/lib/data-provider-interface/config/dcatapde/input-definition.ts +++ b/packages/piveau-hub-ui-modules/lib/data-provider-interface/config/dcatapde/input-definition.ts @@ -1344,8 +1344,9 @@ const dcatapProperties: InputDefinition = { catalog: { identifier: 'catalog', $formkit: 'simpleSelect', - name: 'dcat:catalog', - id: 'dcat:catalog', + // Intentionally not setting something like dcat:catalog here + // Because we don't neeed catalog to be part of the payload + name: 'catalog', class: 'property mandatory', options: {}, classes: { outer: 'formkitProperty formkitCmpWrap mx-0 my-3 p-3' } diff --git a/packages/piveau-hub-ui-modules/lib/data-provider-interface/utils/RDFconverter.js b/packages/piveau-hub-ui-modules/lib/data-provider-interface/utils/RDFconverter.js index 452a1ccb10efa63994102883d4f7bb036489c235..8315b505402f9fbd94c971421b36a81cc1511af5 100644 --- a/packages/piveau-hub-ui-modules/lib/data-provider-interface/utils/RDFconverter.js +++ b/packages/piveau-hub-ui-modules/lib/data-provider-interface/utils/RDFconverter.js @@ -383,15 +383,6 @@ function setAdditionalProperties(RDFdataset, data, mainURI, mainType, property, N3.DataFactory.namedNode(mainType) )) - // adding sample and catalog for datasets - if (property === 'datasets') { - RDFdataset.addQuad(N3.DataFactory.quad( - mainURI, - N3.DataFactory.namedNode(generalHelper.addNamespace('dcat:catalog', dpiConfig)), // no actual vocabulary - N3.DataFactory.literal(data['dcat:catalog']) // hould never be empty because of frontend checking - )) - } - // catalogues always have to contain the property dct:type with the value 'dcat-ap' if (property === 'catalogues') { RDFdataset.addQuad(N3.DataFactory.quad(