Use @nextcloud/vue-dashboard
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
6
package-lock.json
generated
6
package-lock.json
generated
@@ -3852,9 +3852,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@nextcloud/vue-dashboard": {
|
"@nextcloud/vue-dashboard": {
|
||||||
"version": "0.1.6",
|
"version": "0.1.8",
|
||||||
"resolved": "https://registry.npmjs.org/@nextcloud/vue-dashboard/-/vue-dashboard-0.1.6.tgz",
|
"resolved": "https://registry.npmjs.org/@nextcloud/vue-dashboard/-/vue-dashboard-0.1.8.tgz",
|
||||||
"integrity": "sha512-AgJMFYLuWWKi7U5TE+Zjta02OzS83nMgmgQZOjvP92VV/TwcxMnUo/3eJRaNrAnoRej4x1hjdroQC8PgDbZqzQ==",
|
"integrity": "sha512-OGr1oK/WF9+bYHK8dE8Vjwh3IDNamN+9MSti1VO7zuUSm5A9EGCzAghR7zzCG4O43rAJEDcvnQwsYIiA6g4Yrw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@nextcloud/vue": "^2.3.0",
|
"@nextcloud/vue": "^2.3.0",
|
||||||
"core-js": "^3.6.4",
|
"core-js": "^3.6.4",
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
"@nextcloud/moment": "^1.1.1",
|
"@nextcloud/moment": "^1.1.1",
|
||||||
"@nextcloud/router": "^1.1.0",
|
"@nextcloud/router": "^1.1.0",
|
||||||
"@nextcloud/vue": "^2.6.0",
|
"@nextcloud/vue": "^2.6.0",
|
||||||
"@nextcloud/vue-dashboard": "^0.1.6",
|
"@nextcloud/vue-dashboard": "^0.1.8",
|
||||||
"blueimp-md5": "^2.17.0",
|
"blueimp-md5": "^2.17.0",
|
||||||
"dompurify": "^2.0.12",
|
"dompurify": "^2.0.12",
|
||||||
"lodash": "^4.17.20",
|
"lodash": "^4.17.20",
|
||||||
|
|||||||
@@ -21,27 +21,41 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<DashboardWidget :items="cards"
|
||||||
<a v-for="card in assignedCardsDashboard"
|
:show-more-url="showMoreUrl"
|
||||||
:key="card.id"
|
:loading="loading"
|
||||||
:href="cardLink(card)"
|
@hide="() => {}"
|
||||||
|
@markDone="() => {}">
|
||||||
|
<template v-slot:default="{ item }">
|
||||||
|
<a :key="item.id"
|
||||||
|
:href="cardLink(item)"
|
||||||
|
target="_blank"
|
||||||
class="card">
|
class="card">
|
||||||
<div class="card--header">
|
<div class="card--header">
|
||||||
<DueDate class="right" :card="card" />
|
<DueDate class="right" :card="item" />
|
||||||
<span>{{ card.title }}</span>
|
<span class="title">{{ item.title }}</span>
|
||||||
</div>
|
</div>
|
||||||
<ul v-if="card.labels && card.labels.length"
|
<ul v-if="item.labels && item.labels.length"
|
||||||
class="labels"
|
class="labels">
|
||||||
@click="openCard">
|
<li v-for="label in item.labels" :key="label.id" :style="labelStyle(label)">
|
||||||
<li v-for="label in card.labels" :key="label.id" :style="labelStyle(label)">
|
|
||||||
<span>{{ label.title }}</span>
|
<span>{{ label.title }}</span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</template>
|
||||||
|
<template v-slot:empty-content>
|
||||||
|
<EmptyContent
|
||||||
|
id="deck-widget-empty-content"
|
||||||
|
icon="icon-deck">
|
||||||
|
{{ t('deck', 'No upcoming cards') }}
|
||||||
|
</EmptyContent>
|
||||||
|
</template>
|
||||||
|
</DashboardWidget>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { DashboardWidget } from '@nextcloud/vue-dashboard'
|
||||||
|
import EmptyContent from '@nextcloud/vue/dist/Components/EmptyContent'
|
||||||
import { mapGetters } from 'vuex'
|
import { mapGetters } from 'vuex'
|
||||||
import labelStyle from './../mixins/labelStyle'
|
import labelStyle from './../mixins/labelStyle'
|
||||||
import DueDate from '../components/cards/badges/DueDate'
|
import DueDate from '../components/cards/badges/DueDate'
|
||||||
@@ -51,27 +65,44 @@ export default {
|
|||||||
name: 'Dashboard',
|
name: 'Dashboard',
|
||||||
components: {
|
components: {
|
||||||
DueDate,
|
DueDate,
|
||||||
|
EmptyContent,
|
||||||
|
DashboardWidget,
|
||||||
},
|
},
|
||||||
mixins: [ labelStyle ],
|
mixins: [ labelStyle ],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
loading: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters([
|
...mapGetters([
|
||||||
'withDueDashboard',
|
|
||||||
'assignedCardsDashboard',
|
'assignedCardsDashboard',
|
||||||
]),
|
]),
|
||||||
cards() {
|
cards() {
|
||||||
return [
|
const list = [
|
||||||
...this.withDueDashboard,
|
|
||||||
...this.assignedCardsDashboard,
|
...this.assignedCardsDashboard,
|
||||||
]
|
].filter((card) => {
|
||||||
|
return card.duedate !== null
|
||||||
|
})
|
||||||
|
list.sort((a, b) => {
|
||||||
|
return (new Date(a.duedate)).getTime() - (new Date(b.duedate)).getTime()
|
||||||
|
})
|
||||||
|
return list
|
||||||
},
|
},
|
||||||
cardLink() {
|
cardLink() {
|
||||||
return (card) => {
|
return (card) => {
|
||||||
return generateUrl('/apps/deck') + `#/board/${card.boardId}/card/${card.id}`
|
return generateUrl('/apps/deck') + `#/board/${card.boardId}/card/${card.id}`
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
showMoreUrl() {
|
||||||
|
return this.cards.length > 7 ? generateUrl('/apps/deck') : null
|
||||||
|
},
|
||||||
},
|
},
|
||||||
beforeMount() {
|
beforeMount() {
|
||||||
this.$store.dispatch('loadAssignDashboard')
|
this.loading = true
|
||||||
|
this.$store.dispatch('loadAssignDashboard').then(() => {
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -82,8 +113,8 @@ export default {
|
|||||||
.card {
|
.card {
|
||||||
display: block;
|
display: block;
|
||||||
border-radius: var(--border-radius-large);
|
border-radius: var(--border-radius-large);
|
||||||
margin-bottom: 8px;
|
padding: 8px;
|
||||||
padding: 5px;
|
height: 60px;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: var(--color-background-hover);
|
background-color: var(--color-background-hover);
|
||||||
@@ -92,10 +123,11 @@ export default {
|
|||||||
|
|
||||||
.card--header {
|
.card--header {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
margin-bottom: 5px;
|
.title {
|
||||||
span {
|
overflow: hidden;
|
||||||
display: inline-block;
|
text-overflow: ellipsis;
|
||||||
padding: 5px;
|
white-space: nowrap;
|
||||||
|
display: block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,7 +137,9 @@ export default {
|
|||||||
|
|
||||||
.duedate::v-deep {
|
.duedate::v-deep {
|
||||||
.due {
|
.due {
|
||||||
margin: 0;
|
margin: 0 0 0 10px;
|
||||||
|
padding: 2px 4px;
|
||||||
|
font-size: 90%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user