From f6adc876917660b5fcb44764a5de6589349a8f83 Mon Sep 17 00:00:00 2001 From: axolotle Date: Mon, 11 Mar 2024 14:47:36 +0100 Subject: [PATCH] migration: vue3 GLOBAL_DELETE INSTANCE_DELETE GLOBAL_SET INSTANCE_SET --- app/src/store/data.js | 24 +++++++++++------------- app/src/store/info.js | 7 +++---- app/src/views/app/AppInfo.vue | 4 +++- app/src/views/domain/DomainInfo.vue | 4 +++- app/src/views/group/GroupList.vue | 4 +--- app/src/views/tool/ToolFirewall.vue | 4 ++-- app/src/views/tool/ToolMigrations.vue | 2 +- app/src/views/tool/ToolSettings.vue | 4 +++- 8 files changed, 27 insertions(+), 26 deletions(-) diff --git a/app/src/store/data.js b/app/src/store/data.js index 9edbd216..c868490e 100644 --- a/app/src/store/data.js +++ b/app/src/store/data.js @@ -1,5 +1,3 @@ -import Vue from 'vue' - import api from '@/api' import { isEmptyValue } from '@/helpers/commons' import { stratify } from '@/helpers/data/tree' @@ -34,7 +32,7 @@ export default { }, SET_DOMAINS_DETAILS(state, [name, details]) { - Vue.set(state.domains_details, name, details) + state.domains_details[name] = details }, UPDATE_DOMAINS_DETAILS(state, payload) { @@ -43,9 +41,9 @@ export default { }, DEL_DOMAINS_DETAILS(state, [name]) { - Vue.delete(state.domains_details, name) + delete state.domains_details[name] if (state.domains) { - Vue.delete(state.domains, name) + delete state.domains[name] } }, @@ -72,16 +70,16 @@ export default { ADD_USERS(state, [user]) { if (!state.users) state.users = {} - Vue.set(state.users, user.username, user) + state.users[user.username] = user }, SET_USERS_DETAILS(state, [username, userData]) { - Vue.set(state.users_details, username, userData) + state.users_details[username] = userData if (!state.users) return const user = state.users[username] for (const key of ['fullname', 'mail']) { if (user[key] !== userData[key]) { - Vue.set(user, key, userData[key]) + user[key] = userData[key] } } }, @@ -92,9 +90,9 @@ export default { }, DEL_USERS_DETAILS(state, [username]) { - Vue.delete(state.users_details, username) + delete state.users_details[username] if (state.users) { - Vue.delete(state.users, username) + delete state.users[username] if (Object.keys(state.users).length === 0) { state.users = null } @@ -107,16 +105,16 @@ export default { ADD_GROUPS(state, [{ name }]) { if (state.groups !== undefined) { - Vue.set(state.groups, name, { members: [], permissions: [] }) + state.groups[name] = { members: [], permissions: [] } } }, UPDATE_GROUPS(state, [data, { groupName }]) { - Vue.set(state.groups, groupName, data) + state.groups[groupName] = data }, DEL_GROUPS(state, [groupname]) { - Vue.delete(state.groups, groupname) + delete state.groups[groupname] }, SET_PERMISSIONS(state, [permissions]) { diff --git a/app/src/store/info.js b/app/src/store/info.js index fc6698bc..1d92b539 100644 --- a/app/src/store/info.js +++ b/app/src/store/info.js @@ -1,4 +1,3 @@ -import Vue from 'vue' import router from '@/router' import i18n from '@/i18n' import api from '@/api' @@ -55,7 +54,7 @@ export default { UPDATE_REQUEST(state, { request, key, value }) { // This rely on data persistance and reactivity. - Vue.set(request, key, value) + request[key] = value }, REMOVE_REQUEST(state, request) { @@ -303,7 +302,7 @@ export default { // the ownership to stay generic. const request = error.request delete error.request - Vue.set(request, 'error', error) + request.error = error // Display the error in a modal on the current view. commit('SET_ERROR', request) } @@ -330,7 +329,7 @@ export default { DISMISS_WARNING({ commit, state }, request) { commit('SET_WAITING', false) - Vue.delete(request, 'showWarningMessage') + delete request.showWarningMessage }, UPDATE_ROUTER_KEY({ commit }, { to, from }) { diff --git a/app/src/views/app/AppInfo.vue b/app/src/views/app/AppInfo.vue index 2bf5e636..a2facae3 100644 --- a/app/src/views/app/AppInfo.vue +++ b/app/src/views/app/AppInfo.vue @@ -629,7 +629,9 @@ export default { Object.assign(this.externalResults, { forms: { [panel.id]: { [err.data.name]: [err.data.error] } }, }) - } else this.$set(panel, 'serverError', err.message) + } else { + panel.serverError = err.message + } }) }, diff --git a/app/src/views/domain/DomainInfo.vue b/app/src/views/domain/DomainInfo.vue index e37a75b6..630f9279 100644 --- a/app/src/views/domain/DomainInfo.vue +++ b/app/src/views/domain/DomainInfo.vue @@ -257,7 +257,9 @@ export default { Object.assign(this.externalResults, { forms: { [panel.id]: { [err.data.name]: [err.data.error] } }, }) - } else this.$set(panel, 'serverError', err.message) + } else { + panel.serverError = err.message + } }) }, diff --git a/app/src/views/group/GroupList.vue b/app/src/views/group/GroupList.vue index 92be1db0..3b2d9afb 100644 --- a/app/src/views/group/GroupList.vue +++ b/app/src/views/group/GroupList.vue @@ -133,8 +133,6 @@