diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-10-23 19:28:49 +0200 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-10-28 12:01:58 +0100 |
commit | bcaf95425acf1d9463dd14ce91764c5b21a5b460 (patch) | |
tree | 2fb2ea45bfbdc57cce0d260700bf5078443a7789 /apps/settings/src | |
parent | e8dbf022c96f7695b26d35869aeca9236b314567 (diff) | |
download | nextcloud-server-bcaf95425acf1d9463dd14ce91764c5b21a5b460.tar.gz nextcloud-server-bcaf95425acf1d9463dd14ce91764c5b21a5b460.zip |
fix(app-store): Update update count in navigation
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps/settings/src')
-rw-r--r-- | apps/settings/src/components/AppList.vue | 16 | ||||
-rw-r--r-- | apps/settings/src/components/AppList/AppItem.vue | 6 | ||||
-rw-r--r-- | apps/settings/src/mixins/AppManagement.js | 5 | ||||
-rw-r--r-- | apps/settings/src/views/AppStoreNavigation.vue | 5 |
4 files changed, 26 insertions, 6 deletions
diff --git a/apps/settings/src/components/AppList.vue b/apps/settings/src/components/AppList.vue index 2372b461f57..58e261ef685 100644 --- a/apps/settings/src/components/AppList.vue +++ b/apps/settings/src/components/AppList.vue @@ -140,9 +140,11 @@ <script> import { subscribe, unsubscribe } from '@nextcloud/event-bus' +import { useAppsStore } from '../store/apps-store' import AppItem from './AppList/AppItem.vue' import pLimit from 'p-limit' import NcButton from '@nextcloud/vue/dist/Components/NcButton.js' +import AppManagement from '../mixins/AppManagement' export default { name: 'AppList', @@ -151,6 +153,8 @@ export default { NcButton, }, + mixins: [AppManagement], + props: { category: { type: String, @@ -158,6 +162,13 @@ export default { }, }, + setup() { + const store = useAppsStore() + return { + store, + } + }, + data() { return { search: '', @@ -304,8 +315,9 @@ export default { const limit = pLimit(1) this.apps .filter(app => app.update) - .map(app => limit(() => this.$store.dispatch('updateApp', { appId: app.id })), - ) + .map((app) => limit(() => { + this.update(app.id) + })) }, }, } diff --git a/apps/settings/src/components/AppList/AppItem.vue b/apps/settings/src/components/AppList/AppItem.vue index 08faa06f1cd..695a595347b 100644 --- a/apps/settings/src/components/AppList/AppItem.vue +++ b/apps/settings/src/components/AppList/AppItem.vue @@ -111,6 +111,8 @@ </template> <script> +import { useAppsStore } from '../../store/apps-store.js' + import AppScore from './AppScore.vue' import AppLevelBadge from './AppLevelBadge.vue' import AppManagement from '../../mixins/AppManagement.js' @@ -151,6 +153,10 @@ export default { default: false, }, }, + setup() { + const store = useAppsStore() + return { store } + }, data() { return { isSelected: false, diff --git a/apps/settings/src/mixins/AppManagement.js b/apps/settings/src/mixins/AppManagement.js index c63041f45c9..9f7e8f090af 100644 --- a/apps/settings/src/mixins/AppManagement.js +++ b/apps/settings/src/mixins/AppManagement.js @@ -121,8 +121,11 @@ export default { }, update(appId) { this.$store.dispatch('updateApp', { appId }) - .then((response) => { rebuildNavigation() }) .catch((error) => { showError(error) }) + .then(() => { + rebuildNavigation() + this.store.updateCount = Math.max(this.store.updateCount - 1, 0) + }) }, }, } diff --git a/apps/settings/src/views/AppStoreNavigation.vue b/apps/settings/src/views/AppStoreNavigation.vue index b7ba24c3e4b..a35cd94da95 100644 --- a/apps/settings/src/views/AppStoreNavigation.vue +++ b/apps/settings/src/views/AppStoreNavigation.vue @@ -35,12 +35,12 @@ <NcIconSvgWrapper :path="APPSTORE_CATEGORY_ICONS.disabled" /> </template> </NcAppNavigationItem> - <NcAppNavigationItem v-if="updateCount > 0" + <NcAppNavigationItem v-if="store.updateCount > 0" id="app-category-updates" :to="{ name: 'apps-category', params: { category: 'updates' } }" :name="APPS_SECTION_ENUM.updates"> <template #counter> - <NcCounterBubble>{{ updateCount }}</NcCounterBubble> + <NcCounterBubble>{{ store.updateCount }}</NcCounterBubble> </template> <template #icon> <NcIconSvgWrapper :path="APPSTORE_CATEGORY_ICONS.updates" /> @@ -114,7 +114,6 @@ import NcLoadingIcon from '@nextcloud/vue/dist/Components/NcLoadingIcon.js' import APPSTORE_CATEGORY_ICONS from '../constants/AppstoreCategoryIcons.ts' -const updateCount = loadState<number>('settings', 'appstoreUpdateCount', 0) const appstoreEnabled = loadState<boolean>('settings', 'appstoreEnabled', true) const developerDocsUrl = loadState<string>('settings', 'appstoreDeveloperDocs', '') |