Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(settings): Split account management and app store views into chunks
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
  • Loading branch information
susnux committed Mar 11, 2024
commit 1100e908b79ddecd1198c682ac3dcc41f2871122
70 changes: 70 additions & 0 deletions apps/settings/src/app-types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/**
* @copyright Copyright (c) 2024 Ferdinand Thiessen <opensource@fthiessen.de>
*
* @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/>.
*/

export interface IAppstoreCategory {
/**
* The category ID
*/
id: string
/**
* The display name (can be localized)
*/
displayName: string
/**
* Inline SVG path
*/
icon: string
}

export interface IAppstoreAppRelease {
version: string
translations: {
[key: string]: {
changelog: string
}
}
}

export interface IAppstoreApp {
id: string
name: string
summary: string
description: string
licence: string
author: string[] | Record<string, string>
level: number
version: string
category: string|string[]

preview?: string
screenshot?: string

active: boolean
internal: boolean
removeable: boolean
installed: boolean
canInstall: boolean
canUninstall: boolean
isCompatible: boolean

appstoreData: Record<string, never>
releases: IAppstoreAppRelease[]
}
32 changes: 31 additions & 1 deletion apps/settings/src/components/AppList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
</template>

<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'
Expand All @@ -149,7 +150,19 @@ export default {
AppItem,
NcButton,
},
props: ['category'],

props: {
category: {
type: String,
required: true,
},
},

data() {
return {
search: '',
}
},
computed: {
counter() {
return this.apps.filter(app => app.update).length
Expand Down Expand Up @@ -247,7 +260,24 @@ export default {
}
},
},

beforeDestroy() {
unsubscribe('nextcloud:unified-search.search', this.setSearch)
unsubscribe('nextcloud:unified-search.reset', this.resetSearch)
},

beforeCreate() {
subscribe('nextcloud:unified-search.search', this.setSearch)
subscribe('nextcloud:unified-search.reset', this.resetSearch)
},

methods: {
setSearch(value) {
this.search = value
},
resetSearch() {
this.search = ''
},
toggleBundle(id) {
if (this.allBundlesEnabled(id)) {
return this.disableBundle(id)
Expand Down
1 change: 0 additions & 1 deletion apps/settings/src/store/apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ const state = {
categories: [],
updateCount: loadState('settings', 'appstoreUpdateCount', 0),
loading: {},
loadingList: false,
gettingCategoriesPromise: null,
}

Expand Down
73 changes: 50 additions & 23 deletions apps/settings/src/views/AppStore.vue
Original file line number Diff line number Diff line change
@@ -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()
Expand All @@ -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>
Loading