2020-10-11 11:50:16 +00:00
|
|
|
<!--
|
|
|
|
- Copyright (c) 2020. The Nextcloud Bookmarks contributors.
|
|
|
|
-
|
|
|
|
- This file is licensed under the Affero General Public License version 3 or later. See the COPYING file.
|
|
|
|
-->
|
|
|
|
|
|
|
|
<template>
|
2020-10-12 11:47:02 +00:00
|
|
|
<DashboardWidget :items="items"
|
|
|
|
:loading="loading"
|
|
|
|
:show-more-text="t('bookmarks', 'Bookmarks')"
|
|
|
|
:show-more-url="moreUrl"
|
|
|
|
:empty-content-message="t('bookmarks', 'No bookmarks found')" />
|
2020-10-11 11:50:16 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { DashboardWidget } from '@nextcloud/vue-dashboard'
|
|
|
|
import { generateUrl } from '@nextcloud/router'
|
|
|
|
import { actions } from '../store'
|
|
|
|
export default {
|
|
|
|
name: 'Dashboard',
|
|
|
|
components: { DashboardWidget },
|
|
|
|
computed: {
|
|
|
|
loading() {
|
2020-10-12 11:47:02 +00:00
|
|
|
return Boolean(this.$store.state.loading.bookmarks)
|
2020-10-11 11:50:16 +00:00
|
|
|
},
|
|
|
|
items() {
|
|
|
|
return this.$store.state.bookmarks.map(bookmark => ({
|
|
|
|
id: bookmark.id,
|
|
|
|
targetUrl: bookmark.url,
|
|
|
|
avatarUrl: generateUrl(`/apps/bookmarks/bookmark/${bookmark.id}/favicon`),
|
|
|
|
mainText: bookmark.title,
|
|
|
|
subText: bookmark.url,
|
|
|
|
}))
|
|
|
|
},
|
2020-10-12 11:47:02 +00:00
|
|
|
moreUrl() {
|
|
|
|
return generateUrl('/apps/bookmarks/')
|
|
|
|
},
|
2020-10-11 11:50:16 +00:00
|
|
|
},
|
|
|
|
async mounted() {
|
|
|
|
await this.$store.dispatch(actions.FILTER_BY_RECENT)
|
|
|
|
await this.$store.dispatch(actions.FETCH_PAGE)
|
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|