Skip to content

Commit

Permalink
Merge pull request #49216 from nextcloud/backport/49209/stable30
Browse files Browse the repository at this point in the history
[stable30] fix(app-store): Add back legacy store API used for update and removal
  • Loading branch information
susnux authored Dec 6, 2024
2 parents eda37c0 + c007d67 commit e517e7d
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 27 deletions.
9 changes: 8 additions & 1 deletion apps/settings/src/components/AppList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,12 @@

<script>
import { subscribe, unsubscribe } from '@nextcloud/event-bus'
import AppItem from './AppList/AppItem.vue'
import pLimit from 'p-limit'
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import AppItem from './AppList/AppItem.vue'
import AppManagement from '../mixins/AppManagement'
import { useAppApiStore } from '../store/app-api-store'
import { useAppsStore } from '../store/apps-store'

export default {
name: 'AppList',
Expand All @@ -152,6 +154,8 @@ export default {
NcButton,
},

mixins: [AppManagement],

props: {
category: {
type: String,
Expand All @@ -161,8 +165,11 @@ export default {

setup() {
const appApiStore = useAppApiStore()
const store = useAppsStore()

return {
appApiStore,
store,
}
},

Expand Down
17 changes: 10 additions & 7 deletions apps/settings/src/main-apps-users-management.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,34 @@
*/

import Vue from 'vue'
import VTooltip from 'v-tooltip'
import Vuex from 'vuex'
import VTooltipPlugin from 'v-tooltip'
import { sync } from 'vuex-router-sync'
import { translate as t, translatePlural as n } from '@nextcloud/l10n'
import { t, n } from '@nextcloud/l10n'

import SettingsApp from './views/SettingsApp.vue'
import router from './router/index.ts'
import { useStore } from './store/index.js'
import { getCSPNonce } from '@nextcloud/auth'
import { PiniaVuePlugin, createPinia } from 'pinia'

Vue.use(VTooltip, { defaultHtml: false })

const store = useStore()
sync(store, router)

// CSP config for webpack dynamic chunk loading
// eslint-disable-next-line camelcase
__webpack_nonce__ = getCSPNonce()

// bind to window
Vue.prototype.t = t
Vue.prototype.n = n

// Setup Vue plugins
Vue.use(PiniaVuePlugin)
Vue.use(VTooltipPlugin, { defaultHtml: false })
Vue.use(Vuex)

// Setup stores
const pinia = createPinia()
const store = useStore()
sync(store, router)

export default new Vue({
router,
Expand Down
19 changes: 10 additions & 9 deletions apps/settings/src/mixins/AppManagement.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,16 @@ export default {
.catch((error) => { showError(error) })
}
},
remove(appId, removeData = false) {
if (this.app?.app_api) {
this.appApiStore.uninstallApp(appId, removeData)
.then(() => { rebuildNavigation() })
.catch((error) => { showError(error) })
} else {
this.$store.dispatch('appApiApps/uninstallApp', { appId, removeData })
.then((response) => { rebuildNavigation() })
.catch((error) => { showError(error) })
async remove(appId, removeData = false) {
try {
if (this.app?.app_api) {
await this.appApiStore.uninstallApp(appId, removeData)
} else {
await this.$store.dispatch('uninstallApp', { appId, removeData })
}
await rebuildNavigation()
} catch (error) {
showError(error)
}
},
install(appId) {
Expand Down
5 changes: 1 addition & 4 deletions apps/settings/src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import Vue from 'vue'
import Vuex, { Store } from 'vuex'
import { Store } from 'vuex'
import users from './users.js'
import apps from './apps.js'
import settings from './users-settings.js'
import oc from './oc.js'
import { showError } from '@nextcloud/dialogs'

Vue.use(Vuex)

const debug = process.env.NODE_ENV !== 'production'

const mutations = {
Expand Down
4 changes: 2 additions & 2 deletions dist/settings-apps-view-4529.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/settings-apps-view-4529.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/settings-vue-settings-apps-users-management.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/settings-vue-settings-apps-users-management.js.map

Large diffs are not rendered by default.

0 comments on commit e517e7d

Please sign in to comment.