diff --git a/package-lock.json b/package-lock.json index 40ba0c1cb..32fcf804a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,6 +24,7 @@ "leaflet": "^1.9.4", "lodash": "^4.17.21", "moment": "^2.30.1", + "pinia": "^2.2.4", "velocity-animate": "^1.5.2", "vue": "^2.7.16", "vue-apexcharts": "^1.6.2", @@ -34,8 +35,7 @@ "vue-router": "^3.6.5", "vue2-leaflet": "^2.7.1", "vuedraggable": "^2.24.3", - "vuejs-logger": "1.5.5", - "vuex": "^3.6.2" + "vuejs-logger": "1.5.5" }, "devDependencies": { "@types/leaflet": "^1.9.12", @@ -3700,6 +3700,12 @@ "he": "^1.2.0" } }, + "node_modules/@vue/devtools-api": { + "version": "6.6.4", + "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.6.4.tgz", + "integrity": "sha512-sGhTPMuXqZ1rVOk32RylztWkfXTRhuS7vgAKv0zjqk8gbsHkJ7xfFf+jbySxt7tWObEJwyKaHMikV/WGDiQm8g==", + "license": "MIT" + }, "node_modules/@vue/eslint-config-prettier": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/@vue/eslint-config-prettier/-/eslint-config-prettier-9.0.0.tgz", @@ -15668,6 +15674,58 @@ "node": ">=0.10.0" } }, + "node_modules/pinia": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/pinia/-/pinia-2.2.4.tgz", + "integrity": "sha512-K7ZhpMY9iJ9ShTC0cR2+PnxdQRuwVIsXDO/WIEV/RnMC/vmSoKDTKW/exNQYPI+4ij10UjXqdNiEHwn47McANQ==", + "license": "MIT", + "dependencies": { + "@vue/devtools-api": "^6.6.3", + "vue-demi": "^0.14.10" + }, + "funding": { + "url": "https://github.com/sponsors/posva" + }, + "peerDependencies": { + "@vue/composition-api": "^1.4.0", + "typescript": ">=4.4.4", + "vue": "^2.6.14 || ^3.3.0" + }, + "peerDependenciesMeta": { + "@vue/composition-api": { + "optional": true + }, + "typescript": { + "optional": true + } + } + }, + "node_modules/pinia/node_modules/vue-demi": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.10.tgz", + "integrity": "sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==", + "hasInstallScript": true, + "license": "MIT", + "bin": { + "vue-demi-fix": "bin/vue-demi-fix.js", + "vue-demi-switch": "bin/vue-demi-switch.js" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + }, + "peerDependencies": { + "@vue/composition-api": "^1.0.0-rc.1", + "vue": "^3.0.0-0 || ^2.6.0" + }, + "peerDependenciesMeta": { + "@vue/composition-api": { + "optional": true + } + } + }, "node_modules/pino": { "version": "6.14.0", "resolved": "https://registry.npmjs.org/pino/-/pino-6.14.0.tgz", @@ -18542,7 +18600,7 @@ "version": "5.4.5", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", - "dev": true, + "devOptional": true, "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", @@ -19218,15 +19276,6 @@ "deprecated": "Vue 2 has reached EOL and is no longer actively maintained. See https://v2.vuejs.org/eol/ for more details.", "license": "MIT" }, - "node_modules/vuex": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/vuex/-/vuex-3.6.2.tgz", - "integrity": "sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw==", - "license": "MIT", - "peerDependencies": { - "vue": "^2.0.0" - } - }, "node_modules/watchpack": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.2.tgz", diff --git a/package.json b/package.json index 124c2b782..d76d380a0 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "leaflet": "^1.9.4", "lodash": "^4.17.21", "moment": "^2.30.1", + "pinia": "^2.2.4", "velocity-animate": "^1.5.2", "vue": "^2.7.16", "vue-apexcharts": "^1.6.2", @@ -41,8 +42,7 @@ "vue-router": "^3.6.5", "vue2-leaflet": "^2.7.1", "vuedraggable": "^2.24.3", - "vuejs-logger": "1.5.5", - "vuex": "^3.6.2" + "vuejs-logger": "1.5.5" }, "engines": { "node": ">= 20.0.0", diff --git a/src/components/ApiAction.vue b/src/components/ApiAction.vue index e308ce9fe..024e11570 100644 --- a/src/components/ApiAction.vue +++ b/src/components/ApiAction.vue @@ -73,9 +73,10 @@ diff --git a/src/components/Data/Documents/Page.vue b/src/components/Data/Documents/Page.vue index 589f31700..91d420f39 100644 --- a/src/components/Data/Documents/Page.vue +++ b/src/components/Data/Documents/Page.vue @@ -239,7 +239,7 @@ import get from 'lodash/get'; import isUndefined from 'lodash/isUndefined'; import mapValues from 'lodash/mapValues'; import pickBy from 'lodash/pickBy'; -import { mapGetters } from 'vuex'; +import { mapState } from 'pinia'; import DeleteCollectionModal from '../Collections/DeleteCollectionModal.vue'; import CollectionDropdownAction from '../Collections/DropdownAction.vue'; @@ -254,7 +254,7 @@ import { saveSettingsForCollection, } from '@/services/localSettings'; import { extractAttributesFromMapping } from '@/services/mappingHelpers'; -import { KIndexGettersTypes, StoreNamespaceTypes } from '@/store'; +import { useAuthStore, useKuzzleStore, useStorageIndexStore } from '@/stores'; import { truncateName } from '@/utils'; import Filters from '@/components/Common/Filters/Filters.vue'; @@ -290,6 +290,11 @@ export default { indexName: String, collectionName: String, }, + setup() { + return { + storageIndexStore: useStorageIndexStore(), + }; + }, data() { return { searchQuery: null, @@ -329,8 +334,8 @@ export default { }; }, computed: { - ...mapGetters('kuzzle', ['wrapper', '$kuzzle']), - ...mapGetters('auth', [ + ...mapState(useKuzzleStore, ['wrapper', '$kuzzle']), + ...mapState(useAuthStore, [ 'canSearchDocument', 'canCreateDocument', 'canDeleteDocument', @@ -403,15 +408,11 @@ export default { })); }, index() { - return this.$store.getters[ - `${StoreNamespaceTypes.INDEX}/${KIndexGettersTypes.GET_ONE_INDEX}` - ](this.indexName); + return this.storageIndexStore.getOneIndex(this.indexName); }, collection() { return this.index - ? this.$store.getters[ - `${StoreNamespaceTypes.INDEX}/${KIndexGettersTypes.GET_ONE_COLLECTION}` - ](this.index, this.collectionName) + ? this.storageIndexStore.getOneCollection(this.index, this.collectionName) : null; }, collectionMapping() { diff --git a/src/components/Data/Documents/RealtimeOnlyEmptyState.vue b/src/components/Data/Documents/RealtimeOnlyEmptyState.vue index 3399bf640..064c624a7 100644 --- a/src/components/Data/Documents/RealtimeOnlyEmptyState.vue +++ b/src/components/Data/Documents/RealtimeOnlyEmptyState.vue @@ -29,7 +29,9 @@ diff --git a/src/components/Data/Documents/Update.vue b/src/components/Data/Documents/Update.vue index 2b9a27296..fc55ae3c5 100644 --- a/src/components/Data/Documents/Update.vue +++ b/src/components/Data/Documents/Update.vue @@ -35,9 +35,9 @@ diff --git a/src/components/ResetPassword.vue b/src/components/ResetPassword.vue index d6d11b364..e15671ba6 100644 --- a/src/components/ResetPassword.vue +++ b/src/components/ResetPassword.vue @@ -30,7 +30,7 @@ diff --git a/src/components/Security/Profiles/Create.vue b/src/components/Security/Profiles/Create.vue index bf2f88875..302c7e93c 100644 --- a/src/components/Security/Profiles/Create.vue +++ b/src/components/Security/Profiles/Create.vue @@ -7,10 +7,11 @@