diff --git a/core/src/components/ConversationConstants.js b/core/src/components/ConversationConstants.js new file mode 100644 index 0000000000000..647b2454b0ea7 --- /dev/null +++ b/core/src/components/ConversationConstants.js @@ -0,0 +1,64 @@ +export const CONVERSATION = { + START_CALL: { + EVERYONE: 0, + USERS: 1, + MODERATORS: 2, + }, + + STATE: { + READ_WRITE: 0, + READ_ONLY: 1, + }, + + LISTABLE: { + NONE: 0, + USERS: 1, + ALL: 2, + }, + + TYPE: { + ONE_TO_ONE: 1, + GROUP: 2, + PUBLIC: 3, + CHANGELOG: 4, + ONE_TO_ONE_FORMER: 5, + NOTE_TO_SELF: 6, + }, + + BREAKOUT_ROOM_MODE: { + NOT_CONFIGURED: 0, + AUTOMATIC: 1, + MANUAL: 2, + FREE: 3, + }, + + BREAKOUT_ROOM_STATUS: { + // Main room + STOPPED: 0, + STARTED: 1, + // Breakout rooms + STATUS_ASSISTANCE_RESET: 0, + STATUS_ASSISTANCE_REQUESTED: 2, + }, + + OBJECT_TYPE: { + EMAIL: 'emails', + FILE: 'file', + PHONE: 'phone', + VIDEO_VERIFICATION: 'share:password', + BREAKOUT_ROOM: 'room', + DEFAULT: '', + }, +} + +export const AVATAR = { + SIZE: { + EXTRA_SMALL: 22, + SMALL: 32, + DEFAULT: 44, + MEDIUM: 64, + LARGE: 128, + EXTRA_LARGE: 180, + FULL: 512, + }, +} diff --git a/core/src/components/UnifiedSearch/ConversationIcon.vue b/core/src/components/UnifiedSearch/ConversationIcon.vue new file mode 100644 index 0000000000000..77e3877db4304 --- /dev/null +++ b/core/src/components/UnifiedSearch/ConversationIcon.vue @@ -0,0 +1,266 @@ + + + + + + + diff --git a/core/src/store/index.js b/core/src/store/index.js new file mode 100644 index 0000000000000..d263a5dc40740 --- /dev/null +++ b/core/src/store/index.js @@ -0,0 +1,11 @@ +import Vue from 'vue'; +import Vuex from 'vuex'; +import search from './unified-search-external-filters'; + +Vue.use(Vuex); + +export default new Vuex.Store({ + modules: { + search, + }, +}); diff --git a/core/src/store/unified-search-external-filters.js b/core/src/store/unified-search-external-filters.js new file mode 100644 index 0000000000000..b55335c4a0ae6 --- /dev/null +++ b/core/src/store/unified-search-external-filters.js @@ -0,0 +1,42 @@ +/* + * @copyright Copyright (c) 2021 Fon E. Noel NFEBE + * + * @author Fon E. Noel NFEBE + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ +const state = { + externalFilters: [], +} + +const mutations = { + registerExternalFilter(state, { id, label, callback, icon }) { + state.externalFilters.push({ id, name: label, callback, icon, isPluginFilter: true }) + }, +} + +const actions = { + registerExternalFilter({ commit }, { id, label, callback, icon }) { + commit('registerExternalFilter', { id, label, callback, icon }) + }, +} + +export default { + state, + mutations, + actions, +} diff --git a/core/src/unified-search.js b/core/src/unified-search.js index f9bddff4c6837..8650a2566d89a 100644 --- a/core/src/unified-search.js +++ b/core/src/unified-search.js @@ -26,6 +26,7 @@ import { translate as t, translatePlural as n } from '@nextcloud/l10n' import Vue from 'vue' import UnifiedSearch from './views/UnifiedSearch.vue' +import store from '../src/store/index.js' // eslint-disable-next-line camelcase __webpack_nonce__ = btoa(getRequestToken()) @@ -47,9 +48,24 @@ Vue.mixin({ }, }) +// Register the add/register filter action API globally +window.OCA.Core = window.OCA.Core || {} +window.OCA.Core.UnifiedSearch = { + registerFilterAction: ({ id, name, label, callback, icon }) => { + store.dispatch('registerExternalFilter', { + id, + name, + label, + icon, + callback, + }) + }, +} + export default new Vue({ el: '#unified-search', // eslint-disable-next-line vue/match-component-file-name name: 'UnifiedSearchRoot', + store, render: h => h(UnifiedSearch), }) diff --git a/core/src/views/UnifiedSearchModal.vue b/core/src/views/UnifiedSearchModal.vue index 9c719d2bcf6a3..28ca2cd588c05 100644 --- a/core/src/views/UnifiedSearchModal.vue +++ b/core/src/views/UnifiedSearchModal.vue @@ -1,29 +1,20 @@