Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/DIMOC-216/drag-and-drop #11

Merged
merged 6 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@
"[javascript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[css]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
}
89 changes: 49 additions & 40 deletions css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
/* Pages */

.pageHeader {
margin-block-start: var(--app-navigation-padding);
margin-inline-start: calc(var(--default-clickable-area) + var(--app-navigation-padding)* 2);
min-height: var(--default-clickable-area);
line-height: var(--default-clickable-area);
margin-block-start: var(--app-navigation-padding);
margin-inline-start: calc(
var(--default-clickable-area) + var(--app-navigation-padding) * 2
);
min-height: var(--default-clickable-area);
line-height: var(--default-clickable-area);
}

/* Lists */
Expand All @@ -30,7 +32,7 @@
margin-block-end: 11px !important;
}

.selectedZaakIcon>svg {
.selectedZaakIcon > svg {
fill: white;
}

Expand Down Expand Up @@ -88,22 +90,24 @@
overflow: auto;
}

.tabPanelFileUpload {
margin-block-end: 15px !important;
}

.detailGrid {
display: grid;
grid-template-columns: 1fr 1fr;
display: grid;
grid-template-columns: 1fr 1fr;
}

.publishedIcon>svg {
.publishedIcon > svg {
fill: var(--color-success);
}
.warningIcon>svg {
.warningIcon > svg {
fill: var(--color-warning);
}


/* Modals */
.form-group > * {
.form-group > * {
margin-block-end: 10px;
}

Expand All @@ -122,34 +126,39 @@
color: var(--color-error);
}

/* File drag and drop */

.filesListDragDropNotice {
width: 100%;
min-height: 113px;
margin: 0;
user-select: none;
color: var(--color-text-maxcontrast);
background-color: var(--color-main-background);
border-color: #000;
}

.filesListDragDropNoticeWrapper {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
height: fit-content;
max-height: 70%;
padding: 0 5vw;
border: 2px var(--color-border-dark) dashed;
border-radius: var(--border-radius-large);
}

.filesListDragDropNoticeWrapperIcon {
display: flex;
}

.filesListDragDropNoticeTitle {
margin: 12px 0;
}

/* File drag and drop */

.filesListDragDropNotice{
display: flex;
align-items: center;
justify-content: center;
width: 100%;
min-height: 113px;
margin: 0;
user-select: none;
color: var(--color-text-maxcontrast);
background-color: var(--color-main-background);
border-color: #000;
}

.filesListDragDropNoticeWrapper{
display: flex;
align-items: center;
justify-content: center;
height: 15vh;
max-height: 70%;
padding: 0 5vw;
border: 2px var(--color-border-dark) dashed;
border-radius: var(--border-radius-large);
}

.filesListDragDropNoticeTitle{
margin-left: 16px;
color: inherit;
.filesListDragDropNoticeTitle {
margin-left: 16px;
color: inherit;
}
2 changes: 1 addition & 1 deletion docker/init-ubuntu.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apt update;
apt install npm composer -y
apt install npm composer php-gd php-zip -y

cd /home/ubuntu/app
npm i
Expand Down
26 changes: 7 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 2 additions & 8 deletions src/composables/UseFileSelection.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,30 @@
allowMultiple,
allowedFileTypes,
onFileDrop,
onFileSelect,
} = options

// Data types computed ref
const dataTypes = computed(() => {
if (allowedFileTypes?.value) {
if (!Array.isArray(allowedFileTypes.value)) {
return [allowedFileTypes.value]

Check failure on line 29 in src/composables/UseFileSelection.js

View workflow job for this annotation

GitHub Actions / build

Multi-line function call not indented correctly; expected 8 spaces but found 12

Check failure on line 29 in src/composables/UseFileSelection.js

View workflow job for this annotation

GitHub Actions / build

Multi-line function call not indented correctly; expected 8 spaces but found 12
}
return allowedFileTypes.value
}
return null
})

Check failure on line 35 in src/composables/UseFileSelection.js

View workflow job for this annotation

GitHub Actions / build

Multi-line function call not indented correctly; expected 8 spaces but found 12

Check failure on line 35 in src/composables/UseFileSelection.js

View workflow job for this annotation

GitHub Actions / build

Multi-line function call not indented correctly; expected 8 spaces but found 12
// Accept string computed ref
const accept = computed(() => {
if (Array.isArray(dataTypes.value)) {
return dataTypes.value.join(',')
}
return '*'
})

Check failure on line 42 in src/composables/UseFileSelection.js

View workflow job for this annotation

GitHub Actions / build

Multi-line function call not indented correctly; expected 8 spaces but found 12

Check failure on line 42 in src/composables/UseFileSelection.js

View workflow job for this annotation

GitHub Actions / build

Multi-line function call not indented correctly; expected 8 spaces but found 12

// Handling of files drop
const onDrop = files => {

Check failure on line 45 in src/composables/UseFileSelection.js

View workflow job for this annotation

GitHub Actions / build

Multi-line function call not indented correctly; expected 8 spaces but found 12

Check failure on line 45 in src/composables/UseFileSelection.js

View workflow job for this annotation

GitHub Actions / build

Multi-line function call not indented correctly; expected 8 spaces but found 12
if (!files || files.length === 0) {
return
}
Expand All @@ -53,20 +54,13 @@
}
filesList.value = files
onFileDrop && onFileDrop()
onFileSelect && onFileSelect()
}

const reset = () => {
filesList.value = null
}

// const onLeave = () => {
// let timer
// document.addEventListener('mousemove', () => {
// clearTimeout(timer)
// timer = setTimeout(isOverDropZone.value = false, 300)
// })
// }

const setFiles = (files) => {
filesList.value = files
publicationStore.setAttachmentFile(null)
Expand Down
2 changes: 2 additions & 0 deletions src/dialogs/attachment/DeleteAttachmentDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ export default {
body: JSON.stringify({
...publicationStore.publicationItem,
attachments: [...this.filterdAttachments],
catalogi: publicationStore.publicationItem.catalogi.id,
metaData: publicationStore.publicationItem.metaData.id,
}),
},
)
Expand Down
23 changes: 11 additions & 12 deletions src/dialogs/attachment/DepublishAttachmentDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,23 +79,22 @@ export default {
},
body: JSON.stringify(publicationStore.attachmentItem),
},
)
.then((response) => {
this.loading = false
this.succes = true
).then(() => {
this.loading = false
this.succes = true

if (publicationStore.publicationItem) {
publicationStore.getPublicationAttachments(publicationStore.publicationItem?.id)
}

// Wait for the user to read the feedback then close the model
const self = this
setTimeout(function() {
self.succes = false
publicationStore.setAttachmentItem(false)
navigationStore.setDialog(false)
}, 2000)
})
// Wait for the user to read the feedback then close the model
const self = this
setTimeout(function() {
self.succes = false
publicationStore.setAttachmentItem(false)
navigationStore.setDialog(false)
}, 2000)
})
.catch((err) => {
this.error = err
this.loading = false
Expand Down
4 changes: 3 additions & 1 deletion src/dialogs/attachment/PublishAttachmentDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,17 @@ export default {
},
data() {
return {

loading: false,
succes: false,
error: false,
}
},
methods: {
PublishAttachment() {
const now = new Date().toISOString()
this.loading = true
publicationStore.attachmentItem.published = now

fetch(
`/index.php/apps/opencatalogi/api/attachments/${publicationStore.attachmentItem.id}`,
{
Expand Down
8 changes: 5 additions & 3 deletions src/dialogs/publication/ArchivePublicationDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ export default {
ArchivePublication() {
this.loading = true
publicationStore.publicationItem.status = 'archived'
publicationStore.publicationItem.catalogi = publicationStore.publicationItem?.catalogi?.id?.toString()
publicationStore.publicationItem.metaData = publicationStore.publicationItem?.metaData?.id?.toString()

fetch(
`/index.php/apps/opencatalogi/api/publications/${publicationStore.publicationItem.id}`,
Expand All @@ -78,7 +76,11 @@ export default {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(publicationStore.publicationItem),
body: JSON.stringify({
...publicationStore.publicationItem,
catalogi: publicationStore.publicationItem.catalogi.id,
metaData: publicationStore.publicationItem.metaData.id,
}),
},
)
.then((response) => {
Expand Down
8 changes: 5 additions & 3 deletions src/dialogs/publication/DepublishPublicationDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ export default {
this.loading = true
publicationStore.publicationItem.status = 'retracted'
publicationStore.publicationItem.published = ''
publicationStore.publicationItem.catalogi = publicationStore.publicationItem?.catalogi?.id?.toString()
publicationStore.publicationItem.metaData = publicationStore.publicationItem?.metaData?.id?.toString()

fetch(
`/index.php/apps/opencatalogi/api/publications/${publicationStore.publicationItem.id}`,
Expand All @@ -79,7 +77,11 @@ export default {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(publicationStore.publicationItem),
body: JSON.stringify({
...publicationStore.publicationItem,
catalogi: publicationStore.publicationItem.catalogi.id,
metaData: publicationStore.publicationItem.metaData.id,
}),
},
)
.then((response) => {
Expand Down
8 changes: 5 additions & 3 deletions src/dialogs/publication/PublishPublicationDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ export default {
PublishPublication() {
this.loading = true
publicationStore.publicationItem.status = 'published'
publicationStore.publicationItem.catalogi = publicationStore.publicationItem?.catalogi?.id?.toString()
publicationStore.publicationItem.metaData = publicationStore.publicationItem?.metaData?.id?.toString()

fetch(
`/index.php/apps/opencatalogi/api/publications/${publicationStore.publicationItem.id}`,
Expand All @@ -78,7 +76,11 @@ export default {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(publicationStore.publicationItem),
body: JSON.stringify({
...publicationStore.publicationItem,
catalogi: publicationStore.publicationItem.catalogi.id,
metaData: publicationStore.publicationItem.metaData.id,
}),
},
)
.then((response) => {
Expand Down
9 changes: 5 additions & 4 deletions src/dialogs/publicationData/DeletePublicationDataDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ export default {
methods: {
DeleteProperty() {
const publication = publicationStore.publicationItem
publication.catalogi = publication.catalogi?.id?.toString()
publication.metaData = publication.metaData?.id?.toString()

delete publication?.data[publicationStore.publicationDataKey]

this.loading = true
Expand All @@ -80,7 +77,11 @@ export default {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(publication),
body: JSON.stringify({
...publicationStore.publicationItem,
catalogi: publicationStore.publicationItem.catalogi.id,
metaData: publicationStore.publicationItem.metaData.id,
}),
},
)
.then((response) => {
Expand Down
2 changes: 1 addition & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ new Vue(
pinia,
render: h => h(App),
},
).$mount('#opencatalogi')
).$mount('#content')
Loading
Loading