Skip to content

Commit

Permalink
fixed all bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Sudo-Thijn committed Oct 15, 2024
1 parent 0a74fda commit a4aa91a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 20 deletions.
6 changes: 3 additions & 3 deletions src/entities/attachment/attachment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class Attachment implements TAttachment {

public versionOf: string
public hash: string
public published: string | Date
public published: string | Date | null
public modified: string | Date
public license: string

Expand Down Expand Up @@ -63,7 +63,7 @@ export class Attachment implements TAttachment {

this.versionOf = data.versionOf || ''
this.hash = data.hash || ''
this.published = data.published || ''
this.published = data.published || null
this.modified = data.modified || ''
this.license = data.license || ''
}
Expand Down Expand Up @@ -95,7 +95,7 @@ export class Attachment implements TAttachment {
.or(z.literal('')),
}),
versionOf: z.string(),
published: z.string().datetime({ offset: true, message: 'is niet een geldige date-time' }).or(z.literal('')),
published: z.string().datetime({ offset: true, message: 'is niet een geldige date-time' }).or(z.null()),
license: z.string(),
})

Expand Down
5 changes: 2 additions & 3 deletions src/modals/attachment/EditAttachmentModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,9 @@ import { navigationStore, publicationStore } from '../../store/store.js'
:error="!!inputValidation.fieldErrors?.['downloadUrl']"
:helper-text="inputValidation.fieldErrors?.['downloadUrl']?.[0]" />
</div>
<NcButton
v-if="success === null"
<NcButton v-if="success === null"
v-tooltip="inputValidation.errorMessages?.[0]"
:disabled="true"
:disabled="!inputValidation.success"
type="primary"
@click="editAttachment()">
<template #icon>
Expand Down
2 changes: 1 addition & 1 deletion src/modals/catalog/AddCatalogModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export default {
methods: {
closeModal() {
navigationStore.setModal(false)
self.hasUpdated = false
this.hasUpdated = false
this.catalogi = {
title: '',
summary: '',
Expand Down
4 changes: 1 addition & 3 deletions src/store/modules/publication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,14 +324,12 @@ export const usePublicationStore = defineStore('publication', {
console.log('editAttachment', item)

const validateResult = item.validate()

console.log('validateResult', validateResult)
if (!validateResult.success) {
throw Error(validateResult.error.issues[0].message)
}

const response = await fetch(
`${apiEndpoint}/${item.id}`,
`/index.php/apps/opencatalogi/api/attachments/${item.id}`,
{
method: 'PUT',
headers: {
Expand Down
13 changes: 3 additions & 10 deletions src/views/publications/PublicationDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ import { ref } from 'vue'
:key="`${attachment}${i}`"
:name="attachment.name ?? attachment?.title"
:bold="false"
:active="publicationStore.attachmentItem.id === attachment.id"
:active="publicationStore.attachmentItem?.id === attachment.id"
:force-display-actions="true"
:details="(attachment?.published && attachment?.published <= getTime) ? 'Gepubliceerd' : 'Niet gepubliceerd'"
@click="setActiveAttachment(attachment)">
Expand All @@ -230,7 +230,6 @@ import { ref } from 'vue'
</template>
<template #actions>
<NcActionButton
:disabled="true"
@click="publicationStore.setAttachmentItem(attachment); navigationStore.setModal('EditAttachment')">
<template #icon>
<Pencil :size="20" />
Expand All @@ -244,34 +243,28 @@ import { ref } from 'vue'
</template>
Download
</NcActionButton>
<NcActionButton
v-if="!attachment?.published || attachment?.published > getTime"
:disabled="true"
<NcActionButton v-if="!attachment?.published || attachment?.published > getTime"
@click="publicationStore.setAttachmentItem(attachment); navigationStore.setDialog('publishAttachment')">
<template #icon>
<Publish :size="20" />
</template>
Publiceren
</NcActionButton>
<NcActionButton
v-if="attachment?.published && attachment?.published <= getTime"
:disabled="true"
<NcActionButton v-if="attachment?.published && attachment?.published <= getTime"
@click="publicationStore.setAttachmentItem(attachment); navigationStore.setDialog('depublishAttachment')">
<template #icon>
<PublishOff :size="20" />
</template>
Depubliceren
</NcActionButton>
<NcActionButton
:disabled="true"
@click="publicationStore.setAttachmentItem(attachment); navigationStore.setDialog('copyAttachment')">
<template #icon>
<ContentCopy :size="20" />
</template>
Kopiëren
</NcActionButton>
<NcActionButton
:disabled="true"
@click="publicationStore.setAttachmentItem(attachment); navigationStore.setDialog('deleteAttachment')">
<template #icon>
<Delete :size="20" />
Expand Down

0 comments on commit a4aa91a

Please sign in to comment.