Skip to content

Commit

Permalink
feat: Provide a message activity (close #152)
Browse files Browse the repository at this point in the history
  • Loading branch information
cnouguier committed Aug 26, 2024
1 parent c419df6 commit f716718
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 27 deletions.
3 changes: 1 addition & 2 deletions api/src/hooks.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Application hooks that run for every service
import fuzzySearch from 'feathers-mongodb-fuzzy-search'
import commonHooks from 'feathers-hooks-common'
import { permissions as corePermissions, hooks as coreHooks } from '@kalisio/kdk/core.api.js'
import * as permissions from '../../common/permissions.mjs'
Expand Down Expand Up @@ -29,7 +28,7 @@ export default {
}, authenticate('jwt')),
coreHooks.processObjectIDs,
coreHooks.authorise],
find: [fuzzySearch({ fields: ['name'] }), coreHooks.marshallCollationQuery],
find: [coreHooks.marshallCollationQuery],
get: [],
create: [],
// We only use pacth in editors to avoid dumping "hidden" (ie internal) properties
Expand Down
13 changes: 4 additions & 9 deletions api/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,7 @@
long-timeout "^0.1.1"
uuid "^9.0.0"

"@feathersjs/commons@^4.3.7":
version "4.5.15"
resolved "https://registry.yarnpkg.com/@feathersjs/commons/-/commons-4.5.15.tgz#2f9c2599fd93607206ee40ab0e5639b79c7781b8"
integrity sha512-eVEcLJL3GcPQBQcD77jI3fZ4MMx+iD02Px2Z1lDw+cn/iGCeQkWWAPQs4Tp+HGR1rTL5JO+unyhzN8V9X7OYmw==

"@feathersjs/commons@^4.5.11", "@feathersjs/commons@^4.5.16":
"@feathersjs/commons@^4.3.7", "@feathersjs/commons@^4.5.11", "@feathersjs/commons@^4.5.16":
version "4.5.16"
resolved "https://registry.yarnpkg.com/@feathersjs/commons/-/commons-4.5.16.tgz#878311fe316459642ba53399e0758efa021ed351"
integrity sha512-FXKAcGApcd9w3M42gjLi8+oaPijabS8qbD4ynQK3PM8J7BqpbSdCzURsI7EpReoQxFxdhrR4jix8cQIC/iAeuw==
Expand All @@ -112,9 +107,9 @@
integrity sha512-Xq8R6xD2rIWBCP32+VFX9caldveXqSNDLDNZS5OaKaqyYeIAeXtcjEz4no7jtuUqzxqFOTn/Ub2FqHhncI15Vg==

"@feathersjs/errors@^4.3.10":
version "4.5.15"
resolved "https://registry.yarnpkg.com/@feathersjs/errors/-/errors-4.5.15.tgz#ec371ca9905685e33f41e331975182f36241d1bd"
integrity sha512-EJAYWMsWZlUA/halbgZBc6eP2d3HPkHi5GzprYEK58GCh51KJ36VjX7VKVEnMjgBSED+PE00tpr3ZvUC4nUR+Q==
version "4.5.17"
resolved "https://registry.yarnpkg.com/@feathersjs/errors/-/errors-4.5.17.tgz#be22c87989da8df9e96d5d1c693d14b1e142f19e"
integrity sha512-HY1YJV/9d5wKd3RPNaWggOhAX4NmOulr5EvBMMm6jaMizJ7UMRUgZmqyRtuHL4h+u2LoLmWv9+wO3V+uCFoULg==
dependencies:
debug "^4.3.3"

Expand Down
2 changes: 1 addition & 1 deletion config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ module.exports = {
left: LeftPane,
top: {
content: [
{ id: 'layout', icon: 'las la-icons', label: 'Messages.LABEL', color: 'primary', disabled: true }
{ component: 'collection/KFilter', label: 'MessagesActivity.SEARCH', fields: ['body', 'author'], style: 'width: 50vw; min-width: 180px; max-width: 500px;' },
]
},
bottom: {
Expand Down
19 changes: 5 additions & 14 deletions src/components/messages/Composer.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="column">
<div class="row justify-between items-center no-wrap">
<div class="q-pl-sm">
<div :class="{ 'q-pa-xs': $q.screen.xs, 'q-pa-sm': $q.screen.gt.xs }">
<q-fab
:icon="getKindIcon(currentKind)"
:color="getKindColor(currentKind)"
Expand All @@ -22,20 +22,14 @@
</div>
<div class="row items-center justify-end">
<KAction
v-if="$q.screen.gt.xs"
id="add-file"
icon="las la-font"
tooltip="Composer.FORMAT_MESSAGE"
:toggle="{ color: 'primary', tooltip: 'Composer.CLOSE_EDITOR' }"
icon="las la-angle-up"
tooltip="Composer.OPEN_EDITOR"
:toggle="{ icon: 'las la-angle-down', color: 'primary', tooltip: 'Composer.CLOSE_EDITOR' }"
:handler="() => { editor = !editor }"
size="0.9rem"
/>
<KAction
id="add-file"
icon="las la-plus-circle"
tooltip="Composer.ATTACH_FILE"
:handler="attachFile"
size="0.9rem"
/>
</div>
</div>
<div class="row no-wrap">
Expand Down Expand Up @@ -110,9 +104,6 @@ function getKindColor (kind) {
function getKindLabel (kind) {
return i18n.t(MessageKinds[kind].label)
}
async function attachFile () {
$q.notify({ type: 'negative', message: 'Not implemented' })
}
async function sendMessage () {
if (_.isEmpty(body.value)) return
let tags = []
Expand Down
6 changes: 5 additions & 1 deletion src/components/messages/MessagesActivity.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<KActivity name="messages">
<KTimeLine
service="messages"
class="fit"
:base-query="baseQuery"
:filter-query="filter.query"
:processor="process"
:schema="schema"
/>
Expand All @@ -12,8 +13,11 @@
<script setup>
import _ from 'lodash'
import config from 'config'
import { Store } from '@kalisio/kdk/core.client'
// Data
const baseQuery = { $sort: { createdAt: -1 } }
const filter = Store.get('filter')
const MessageKinds = config.messagesActivity.messages
const schema = {
timestampField: 'createdAt',
Expand Down
1 change: 1 addition & 0 deletions src/i18n/app_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
},
"MessagesActivity": {
"LABEL": "Messages",
"SEARCH": "Search messages...",
"INFORMATION": "Information",
"WARNING": "Warning",
"ALERT": "Alert"
Expand Down
1 change: 1 addition & 0 deletions src/i18n/app_fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
},
"MessagesActivity": {
"LABEL": "Messages",
"SEARCH": "Rechercher des messages...",
"INFORMATION": "Information",
"WARNING": "Attention",
"ALERT": "Alerte"
Expand Down

0 comments on commit f716718

Please sign in to comment.