Skip to content

Commit

Permalink
Merge pull request #111 from ConductionNL/feature/DIMOC-214/directory…
Browse files Browse the repository at this point in the history
…-modal-fix

changed directory property for url
  • Loading branch information
RalkeyOfficial authored Aug 7, 2024
2 parents aa981c7 + 9f9afd3 commit 9a97261
Show file tree
Hide file tree
Showing 23 changed files with 313 additions and 289 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/CI-workflows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ jobs:
run: phpcbf .
continue-on-error: ${{ github.ref != 'refs/heads/main' }}

- name: Commit code formatting changes
if: success() && github.ref != 'refs/heads/main'
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git add src
git diff --cached --quiet || (git commit -m "Update src from PHP Codesniffer" && git pull origin $(git rev-parse --abbrev-ref HEAD) --rebase --autostash && git push)
#- name: Commit code formatting changes
# if: success() && github.ref != 'refs/heads/main'
# run: |
# git config user.name "GitHub Actions"
# git config user.email "[email protected]"
# git add src
# git diff --cached --quiet || (git commit -m "Update src from PHP Codesniffer" && git pull origin $(git rev-parse --abbrev-ref HEAD) --rebase --autostash && git push)

- name: Run phpcs
run: phpcs -q --report=checkstyle src | cs2pr
Expand Down
10 changes: 10 additions & 0 deletions docs/beheerders/directory.md
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
# Directory

De directory vormt het overzicht van alle andere (externe) catalogi die bij jouw installatie bekend zijn. Een Catalogus die bij jouw installatie bekend is noemen een listing (als in is gelist op jouw directory).

## Opzetten federatief netwerk

Directories worden tussen installaties onderling uitgewisseld en geupdate. Je hoeft dus nooit handmatig catalogi van andere toe te voegen aan jouw catalogus.

## Listing

Bij een listing kan je de volgende zaken aanpassen.
12 changes: 0 additions & 12 deletions lib/Controller/PublicationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,6 @@

class PublicationsController extends Controller
{
const TEST_ARRAY = [
"354980e5-c967-4ba5-989b-65c2b0cd2ff4" => [
"id" => "354980e5-c967-4ba5-989b-65c2b0cd2ff4",
"name" => "Input voor OpenCatalogi",
"summary" => "Dit is een selectie van high-value datasets in DCAT-AP 2.0 standaard x"
],
"2ab0011e-9b4c-4c50-a50d-a16fc0be0178" => [
"id" => "2ab0011e-9b4c-4c50-a50d-a16fc0be0178",
"title" => "Publication two",
"description" => "summary for two"
]
];

public function __construct
(
Expand Down
6 changes: 3 additions & 3 deletions src/modals/Modals.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<EditMetaDataPropertyModal />
<AddCatalogModal />
<EditCatalogModal />
<AddListingModal />
<AddDirectoryModal />
<EditListingModal />
<AddPublicationDataModal />
<EditPublicationDataModal />
Expand All @@ -37,7 +37,7 @@ import EditMetaDataPropertyModal from './metaData/EditMetaDataPropertyModal.vue'
import AddCatalogModal from './catalog/AddCatalogModal.vue'
import EditCatalogModal from './catalog/EditCatalogModal.vue'
import AddListingModal from './directory/AddListingModal.vue'
import AddDirectoryModal from './directory/AddDirectoryModal.vue'
import EditListingModal from './directory/EditListingModal.vue'
import AddOrganisationModal from './organisation/AddOrganisationModal.vue'
import EditOrganisatioModal from './organisation/EditOrganisationModal.vue'
Expand All @@ -59,7 +59,7 @@ export default {
EditMetaDataPropertyModal,
AddCatalogModal,
EditCatalogModal,
AddListingModal,
AddDirectoryModal,
EditListingModal,
AddPublicationDataModal,
EditPublicationDataModal,
Expand Down
6 changes: 3 additions & 3 deletions src/modals/catalog/AddCatalogModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import { catalogiStore, navigationStore } from '../../store/store.js'
@click="addCatalog">
<template #icon>
<NcLoadingIcon v-if="loading" :size="20" />
<ContentSaveOutline v-if="!loading" :size="20" />
<Plus v-if="!loading" :size="20" />
</template>
Toevoegen
</NcButton>
Expand All @@ -51,7 +51,7 @@ import { catalogiStore, navigationStore } from '../../store/store.js'

<script>
import { NcButton, NcModal, NcTextField, NcLoadingIcon, NcNoteCard } from '@nextcloud/vue'
import ContentSaveOutline from 'vue-material-design-icons/ContentSaveOutline.vue'
import Plus from 'vue-material-design-icons/Plus.vue'
export default {
name: 'AddCatalogModal',
Expand All @@ -62,7 +62,7 @@ export default {
NcLoadingIcon,
NcNoteCard,
// Icons
ContentSaveOutline,
Plus,
},
data() {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import { navigationStore, directoryStore } from '../../store/store.js'

<template>
<NcModal
v-if="navigationStore.modal === 'addListing'"
v-if="navigationStore.modal === 'addDirectory'"
ref="modalRef"
label-id="addListingModal"
@close="navigationStore.setModal(false)">
<div class="modal__content">
<h2>Directory toevoegen</h2>
Je directory bevat alle bij jouw installatie bekende catalogi. Om nieuwe catalogi te ontdekken heb je de directory van een andere (externe) installatie nodig. Nadat deze is opgegeven zullen de twee installaties een federatief netwerk vormen en catalogi blijven uitwisselen.
<div v-if="success !== null || error">
<NcNoteCard v-if="success" type="success">
<p>Listing succesvol toegevoegd</p>
Expand All @@ -25,52 +26,62 @@ import { navigationStore, directoryStore } from '../../store/store.js'
<NcNoteCard v-if="validateUrlError" type="error">
<p>Er is geen valide URL ingevoerd.</p>
</NcNoteCard>
<NcTextField v-model="directory.url" label="Url" @input="validateUrl" />
<NcTextField v-model="directory.directory" label="Url" @input="validateUrl" />
</div>
<NcButton
v-if="success === null"
:disabled="!isUrlValid || loading || !directory.url"
:disabled="!isUrlValid || loading || !directory.directory"
type="primary"
@click="addDirectory">
<template #icon>
<NcLoadingIcon v-if="loading" :size="20" />
<ContentSaveOutline v-if="!loading" :size="20" />
<Plus v-if="!loading" :size="20" />
</template>
Submit
Toevoegen
</NcButton>
<NcButton @click="openLink('https://conduction.gitbook.io/opencatalogi-nextcloud/beheerders/directory', '_blank')">
<template #icon>
<HelpCircleOutline :size="20" />
</template>
Meer informatie over de directory
</NcButton>
</div>
</NcModal>
</template>

<script>
import { NcButton, NcModal, NcTextField, NcLoadingIcon, NcNoteCard } from '@nextcloud/vue'
import ContentSaveOutline from 'vue-material-design-icons/ContentSaveOutline.vue'
import Plus from 'vue-material-design-icons/Plus.vue'
import HelpCircleOutline from 'vue-material-design-icons/HelpCircleOutline.vue'
export default {
name: 'AddListingModal',
name: 'AddDirectoryModal',
components: {
NcModal,
NcTextField,
NcButton,
NcLoadingIcon,
NcNoteCard,
ContentSaveOutline,
// Icons
Plus,
HelpCircleOutline,
},
data() {
return {
directory: {
url: '',
directory: '',
},
loading: false,
success: null,
error: false,
validateUrlError: null,
urlPattern: /^(https?:\/\/)?(([a-z\d]([a-z\d-]*[a-z\d])*)\.)+[a-z]{2,}$/i,
// eslint-disable-next-line no-useless-escape
urlPattern: /^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$/,
}
},
computed: {
isUrlValid() {
return this.urlPattern.test(this.directory.url)
return this.urlPattern.test(this.directory.directory)
},
},
methods: {
Expand All @@ -82,16 +93,7 @@ export default {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
title: this.title,
summary: this.summary,
description: this.description,
search: this.search,
metadata: this.metadata,
status: this.status,
lastSync: this.lastSync,
default: this.defaultValue,
}),
body: JSON.stringify(this.directory),
})
.then((response) => {
this.loading = false
Expand All @@ -105,6 +107,10 @@ export default {
this.success = null
this.closeModal()
}, 2500)
this.directory = {
directory: '',
}
})
.catch((err) => {
this.error = err
Expand All @@ -115,13 +121,16 @@ export default {
navigationStore.setModal(false)
},
validateUrl(event) {
this.directory.url = event.target.value
this.directory.directory = event.target.value
if (!this.isUrlValid) {
this.validateUrlError = 'Er is geen valide URL ingevoerd.'
} else {
this.validateUrlError = null
}
},
openLink(url, type = '') {
window.open(url, type)
},
},
}
</script>
Expand Down
6 changes: 3 additions & 3 deletions src/modals/metaData/AddMetaDataModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { navigationStore, metadataStore } from '../../store/store.js'
@click="addMetaData">
<template #icon>
<NcLoadingIcon v-if="loading" :size="20" />
<ContentSaveOutline v-if="!loading" :size="20" />
<Plus v-if="!loading" :size="20" />
</template>
Toevoegen
</NcButton>
Expand All @@ -41,7 +41,7 @@ import { navigationStore, metadataStore } from '../../store/store.js'

<script>
import { NcButton, NcModal, NcTextField, NcTextArea, NcLoadingIcon, NcNoteCard } from '@nextcloud/vue'
import ContentSaveOutline from 'vue-material-design-icons/ContentSaveOutline.vue'
import Plus from 'vue-material-design-icons/Plus.vue'
export default {
name: 'AddMetaDataModal',
Expand All @@ -53,7 +53,7 @@ export default {
NcLoadingIcon,
NcNoteCard,
// Icons
ContentSaveOutline,
Plus,
},
data() {
return {
Expand Down
8 changes: 4 additions & 4 deletions src/modals/organisation/AddOrganisationModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ import { navigationStore, organisationStore } from '../../store/store.js'
@click="addOrganisation()">
<template #icon>
<NcLoadingIcon v-if="loading" :size="20" />
<ContentSaveOutline v-if="!loading" :size="20" />
<Plus v-if="!loading" :size="20" />
</template>
Opslaan
Toevoegen
</NcButton>
</div>
</NcModal>
Expand All @@ -76,7 +76,7 @@ import {
NcTextArea,
NcTextField,
} from '@nextcloud/vue'
import ContentSaveOutline from 'vue-material-design-icons/ContentSaveOutline.vue'
import Plus from 'vue-material-design-icons/Plus.vue'
export default {
name: 'AddOrganisationModal',
Expand All @@ -88,7 +88,7 @@ export default {
NcLoadingIcon,
NcNoteCard,
// Icons
ContentSaveOutline,
Plus,
},
data() {
return {
Expand Down
8 changes: 4 additions & 4 deletions src/modals/publication/AddPublicationModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ import { navigationStore, publicationStore } from '../../store/store.js'
@click="addPublication()">
<template #icon>
<NcLoadingIcon v-if="loading" :size="20" />
<ContentSaveOutline v-if="!loading" :size="20" />
<Plus v-if="!loading" :size="20" />
</template>
Opslaan
Toevoegen
</NcButton>
</div>
</NcModal>
Expand All @@ -109,7 +109,7 @@ import {
NcNoteCard,
NcDateTimePicker,
} from '@nextcloud/vue'
import ContentSaveOutline from 'vue-material-design-icons/ContentSaveOutline.vue'
import Plus from 'vue-material-design-icons/Plus.vue'
export default {
name: 'AddPublicationModal',
Expand All @@ -124,7 +124,7 @@ export default {
NcNoteCard,
NcDateTimePicker,
// Icons
ContentSaveOutline,
Plus,
},
data() {
return {
Expand Down
8 changes: 4 additions & 4 deletions src/modals/theme/AddThemeModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ import { navigationStore, themeStore } from '../../store/store.js'
@click="addTheme()">
<template #icon>
<NcLoadingIcon v-if="loading" :size="20" />
<ContentSaveOutline v-if="!loading" :size="20" />
<Plus v-if="!loading" :size="20" />
</template>
Opslaan
Toevoegen
</NcButton>
</div>
</NcModal>
Expand All @@ -60,7 +60,7 @@ import {
NcTextArea,
NcTextField,
} from '@nextcloud/vue'
import ContentSaveOutline from 'vue-material-design-icons/ContentSaveOutline.vue'
import Plus from 'vue-material-design-icons/Plus.vue'
export default {
name: 'AddThemeModal',
Expand All @@ -72,7 +72,7 @@ export default {
NcLoadingIcon,
NcNoteCard,
// Icons
ContentSaveOutline,
Plus,
},
data() {
return {
Expand Down
Loading

0 comments on commit 9a97261

Please sign in to comment.