From 1100e908b79ddecd1198c682ac3dcc41f2871122 Mon Sep 17 00:00:00 2001
From: Ferdinand Thiessen <opensource@fthiessen.de>
Date: Thu, 22 Feb 2024 16:45:42 +0100
Subject: feat(settings): Split account management and app store views into
 chunks

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
---
 apps/settings/src/views/AppStore.vue | 73 ++++++++++++++++++++++++------------
 1 file changed, 50 insertions(+), 23 deletions(-)

(limited to 'apps/settings/src/views/AppStore.vue')

diff --git a/apps/settings/src/views/AppStore.vue b/apps/settings/src/views/AppStore.vue
index 06c47611238..3c3c53d4330 100644
--- a/apps/settings/src/views/AppStore.vue
+++ b/apps/settings/src/views/AppStore.vue
@@ -1,42 +1,51 @@
 <!--
-  - @copyright Copyright (c) 2018 Julius Härtl <jus@bitgrid.net>
-  -
-  - @author Julius Härtl <jus@bitgrid.net>
-  - @author Ferdinand Thiessen <opensource@fthiessen.de>
-  -
-  - @license AGPL-3.0-or-later
-  -
-  - 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 <http://www.gnu.org/licenses/>.
-  -
-  -->
+	- @copyright Copyright (c) 2018 Julius Härtl <jus@bitgrid.net>
+	-
+	- @author Julius Härtl <jus@bitgrid.net>
+	- @author Ferdinand Thiessen <opensource@fthiessen.de>
+	-
+	- @license AGPL-3.0-or-later
+	-
+	- 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 <http://www.gnu.org/licenses/>.
+	-
+	-->
 
 <template>
 	<!-- Apps list -->
 	<NcAppContent class="app-settings-content"
 		:page-heading="pageHeading">
-		<AppList :category="currentCategory" />
+		<NcEmptyContent v-if="isLoading"
+			class="empty-content__loading"
+			:name="t('settings', 'Loading app list')">
+			<template #icon>
+				<NcLoadingIcon :size="64" />
+			</template>
+		</NcEmptyContent>
+		<AppList v-else :category="currentCategory" />
 	</NcAppContent>
 </template>
 
 <script setup lang="ts">
 import { translate as t } from '@nextcloud/l10n'
-import { computed, watch } from 'vue'
+import { computed, getCurrentInstance, onBeforeMount, watch } from 'vue'
 import { useRoute } from 'vue-router/composables'
 import { APPS_SECTION_ENUM } from '../constants/AppsConstants.js'
 import { useAppsStore } from '../store/apps-store'
 
 import NcAppContent from '@nextcloud/vue/dist/Components/NcAppContent.js'
+import NcEmptyContent from '@nextcloud/vue/dist/Components/NcEmptyContent.js'
+import NcLoadingIcon from '@nextcloud/vue/dist/Components/NcLoadingIcon.js'
 import AppList from '../components/AppList.vue'
 
 const route = useRoute()
@@ -60,4 +69,22 @@ const pageHeading = computed(() => {
 watch([pageHeading], () => {
 	window.document.title = `${pageHeading.value} - Apps - Nextcloud`
 })
+
+// TODO this part should be migrated to pinia
+const instance = getCurrentInstance()
+/** Is the app list loading */
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+const isLoading = computed(() => (instance?.proxy as any).$store.getters.loading('list'))
+onBeforeMount(() => {
+	// eslint-disable-next-line @typescript-eslint/no-explicit-any
+	(instance?.proxy as any).$store.dispatch('getCategories', { shouldRefetchCategories: true });
+	// eslint-disable-next-line @typescript-eslint/no-explicit-any
+	(instance?.proxy as any).$store.dispatch('getAllApps')
+})
 </script>
+
+<style scoped>
+.empty-content__loading {
+	height: 100%;
+}
+</style>
-- 
cgit v1.2.3

