Skip to content

Commit

Permalink
feat: Refactor event attachments management (closes #398)
Browse files Browse the repository at this point in the history
wip: Upgrade to Quasar 2 / Vue 3 (#393)
  • Loading branch information
claustres committed Dec 1, 2022
1 parent 2279af2 commit b9d4b25
Show file tree
Hide file tree
Showing 15 changed files with 96 additions and 389 deletions.
178 changes: 0 additions & 178 deletions api/permissions.mjs

This file was deleted.

2 changes: 1 addition & 1 deletion api/src/app.hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default {
}, coreHooks.processObjectIDs),
coreHooks.authorise
],
find: [fuzzySearch({ fields: ['name'] }), coreHooks.marshallCollationQuery],
find: [fuzzySearch({ fields: ['name', 'profile.name', 'value'] }), coreHooks.marshallCollationQuery],
get: [],
create: [],
update: [coreHooks.preventUpdatePerspectives],
Expand Down
5 changes: 2 additions & 3 deletions api/src/services/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,11 @@ export async function checkInactiveOrganisations (app) {
const isInactive = await isOrganisationInactive(organisation, db, duration)
if (isInactive) {
// Find owner if any
const owners = await usersService.find({
const owners = await usersService.find({
query: {
'organisations._id': organisation._id,
'organisations.permissions': 'owner'
}
}
})
const owner = _.get(owners, 'data[0]')
// Remove inactive organisation anyway in case of orphan organisation
Expand Down Expand Up @@ -318,7 +318,6 @@ export default async function () {
service.name === 'groups' ||
service.name === 'members' ||
service.name === 'tags' ||
service.name === 'storage' ||
service.name === 'devices' ||
service.name === 'features' ||
service.name === 'alerts') {
Expand Down
39 changes: 0 additions & 39 deletions api/src/services/storage/storage.hooks.js

This file was deleted.

22 changes: 10 additions & 12 deletions config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -564,16 +564,6 @@ module.exports = {
editItemAction('EventCard.EDIT_ACTION', 'location'),
editItemAction('EventCard.EDIT_ACTION', 'participants'),
editItemAction('EventCard.EDIT_ACTION', 'coordinators'),
{
id: 'capture-photo', tooltip: 'EventCard.ADD_MEDIA_LABEL', icon: 'las la-camera',
visible: ['canCapturePhoto', { name: '$can', params: ['read', 'events', ':contextId', ':item'] }],
handler: 'capturePhoto', scope: 'footer'
},
{
id: 'add-media', tooltip: 'EventCard.ADD_MEDIA_LABEL', icon: 'las la-paperclip',
visible: { name: '$can', params: ['read', 'events', ':contextId', ':item'] },
handler: 'uploadMedia', scope: 'footer'
},
{
id: 'event-map', tooltip: 'EventCard.MAP_LABEL', icon: 'las la-map-marked-alt',
visible: ['hasAnyLocation', { name: '$can', params: ['read', 'events', ':contextId', ':item'] }],
Expand Down Expand Up @@ -1054,7 +1044,7 @@ module.exports = {
rightPane: {
content: {
'map': [
catalogTabbar(['user-layers', 'event-participants'], 'user-layers'),
catalogTabbar(['user-layers', 'user-views', 'catalog-layers', 'event-participants'], 'user-layers'),
{ id: 'user-layers', component: 'catalog/KUserLayersPanel', bind: '$data' },
{ component: 'QSpace' },
{ id: 'catalog-footer', component: 'frame/KPanel', content: [{
Expand All @@ -1065,8 +1055,16 @@ module.exports = {
}]
}
],
'user-views': [
catalogTabbar(['user-layers', 'user-views', 'catalog-layers', 'event-participants'], 'user-views'),
{ id: 'user-views', component: 'catalog/KViewsPanel' },
],
'catalog-layers': [
catalogTabbar(['user-layers', 'user-views', 'catalog-layers', 'event-participants'], 'catalog-layers'),
{ id: 'system-layers', component: 'catalog/KCatalogLayersPanel', bind: '$data', scope: 'user' }
],
'event-participants': [
catalogTabbar(['user-layers', 'event-participants'], 'event-participants'),
catalogTabbar(['user-layers', 'user-views', 'catalog-layers', 'event-participants'], 'event-participants'),
{ id: 'event-participants', component: 'EventActivityPanel', bind: '$data' }
]
}
Expand Down
3 changes: 1 addition & 2 deletions src/boot/kdk.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ export default async ({ app }) => {
app.component('KTextArea', await kdkCoreUtils.loadComponent('frame/KTextArea'))
app.component('KChipsPane', await kdkCoreUtils.loadComponent('frame/KChipsPane'))
app.component('KAvatar', await kdkCoreUtils.loadComponent('frame/KAvatar'))
app.component('KUploader', await kdkCoreUtils.loadComponent('input/KUploader'))
app.component('KModal', await kdkCoreUtils.loadComponent('frame/KModal'))
app.component('KForm', await kdkCoreUtils.loadComponent('form/KForm'))
app.component('KList', await kdkCoreUtils.loadComponent('collection/KList'))
Expand All @@ -78,7 +77,7 @@ export default async ({ app }) => {
app.component('KShape', await kdkCoreUtils.loadComponent('media/KShape'))
app.component('KStatisticsChart', await kdkCoreUtils.loadComponent('chart/KStatisticsChart'))
app.component('KLocationMap', await kdkCoreUtils.loadComponent('KLocationMap'))
app.component('KLayersPanel', await kdkCoreUtils.loadComponent('KLayersPanel'))
app.component('KLayersPanel', await kdkCoreUtils.loadComponent('catalog/KLayersPanel'))
app.component('KColorLegend', await kdkCoreUtils.loadComponent('KColorLegend'))
app.component('KPage', await kdkCoreUtils.loadComponent('layout/KPage'))

Expand Down
5 changes: 3 additions & 2 deletions src/components/ArchivedEventCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export default {
})
},
browseMedia () {
this.$refs.mediaBrowser.show(this.item.attachments)
this.$refs.mediaBrowser.show(this.attachments)
},
viewMap () {
this.$router.push({
Expand Down Expand Up @@ -247,9 +247,10 @@ export default {
}
}
},
created () {
async created () {
// Required alias for the event logs mixin
this.event = this.item
await this.loadAttachments()
// Set the required actor
if (this.$store.get('user')) this.refresh()
this.$events.on('user-changed', this.refresh)
Expand Down
21 changes: 1 addition & 20 deletions src/components/EventActivity.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,6 @@
<q-resize-observer @resize="onMapResized" />
</div>

<KModal ref="uploaderModal">
<KUploader ref="uploader"
:resource="objectId"
:base-query="uploaderQuery()"
:options="uploaderOptions()"
@uploader-ready="initializeMedias"
/>
</KModal>

<KMediaBrowser ref="mediaBrowser" :options="mediaBrowserOptions()" />

<router-view service="events"></router-view>
Expand All @@ -31,7 +22,7 @@ import { mixins as kCoreMixins, utils as kCoreUtils } from '@kalisio/kdk/core.cl
import { mixins as kMapMixins } from '@kalisio/kdk/map.client.map'
import mixins from '../mixins'
const activityMixin = kCoreMixins.baseActivity('event-activity')
const activityMixin = kCoreMixins.baseActivity('eventActivity')
export default {
provide () {
Expand Down Expand Up @@ -142,16 +133,6 @@ export default {
this.refreshCollection()
}
},
uploadMedia () {
this.$refs.uploaderModal.open()
// If the modal has already been created the uploader is ready otherwise wait for event
if (this.$refs.uploader) this.initializeMedias()
},
initializeMedias () {
this.$refs.uploader.initialize(this.event.attachments)
// Open file dialog the first time
if (!this.event.attachments || (this.event.attachments.length === 0)) this.$refs.uploader.openFileInput()
},
browseMedia () {
this.$refs.mediaBrowser.show(this.event.attachments)
},
Expand Down
Loading

0 comments on commit b9d4b25

Please sign in to comment.