Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2020-09-11 15:37:08 +02:00
Родитель 77626f5714
Коммит dd8d415473
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 7076EA9751AACDDA
3 изменённых файлов: 31 добавлений и 30 удалений

6
package-lock.json сгенерированный
Просмотреть файл

@ -3353,9 +3353,9 @@
}
},
"@nextcloud/vue-dashboard": {
"version": "0.1.8",
"resolved": "https://registry.npmjs.org/@nextcloud/vue-dashboard/-/vue-dashboard-0.1.8.tgz",
"integrity": "sha512-OGr1oK/WF9+bYHK8dE8Vjwh3IDNamN+9MSti1VO7zuUSm5A9EGCzAghR7zzCG4O43rAJEDcvnQwsYIiA6g4Yrw==",
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@nextcloud/vue-dashboard/-/vue-dashboard-1.0.0.tgz",
"integrity": "sha512-9Ncksq+2iJocI5n+ElT+m9bL+fTNq8XxVPUPwEL5xZZi3jCKibRjAVyE5QRCSPhSh65W19KqyfelQebp33YqmQ==",
"requires": {
"@nextcloud/vue": "^2.3.0",
"core-js": "^3.6.4",

Просмотреть файл

@ -27,7 +27,7 @@
"@nextcloud/moment": "^1.1.1",
"@nextcloud/router": "^1.2.0",
"@nextcloud/vue": "^2.6.5",
"@nextcloud/vue-dashboard": "^0.1.8",
"@nextcloud/vue-dashboard": "^1.0.0",
"attachmediastream": "^2.1.0",
"crypto-js": "^4.0.0",
"debounce": "^1.2.0",

Просмотреть файл

@ -25,17 +25,15 @@
:items="roomOptions"
:show-more-url="''"
:loading="loading"
@hide="() => {}"
@markDone="() => {}">
:show-items-and-empty-content="!hasImportantConversations"
:half-empty-content-message="t('spreed', 'No unread mentions')">
<template v-slot:default="{ item }">
<EmptyContent v-if="item.empty"
class="half-screen"
icon="icon-checkmark">
<template #desc>
{{ t('spreed', 'No unread mentions') }}
</template>
</EmptyContent>
<DashboardWidgetItem v-else :item="getWidgetItem(item)">
<DashboardWidgetItem
:target-url="getItemTargetUrl(item)"
:main-text="getMainText(item)"
:sub-text="getSubText(item)"
:item="item"
v-on="handlers">
<template v-slot:avatar>
<ConversationIcon
:item="item"
@ -79,12 +77,15 @@ const propertySort = (properties) => (a, b) => properties.map(obj => {
export default {
name: 'Dashboard',
components: { DashboardWidget, DashboardWidgetItem, ConversationIcon, EmptyContent },
data() {
return {
roomOptions: [],
hasImportantConversations: false,
loading: true,
}
},
computed: {
callLink() {
return (conversation) => {
@ -116,6 +117,18 @@ export default {
}
},
getItemTargetUrl() {
return (conversation) => {
return generateUrl(`call/${conversation.token}`)
}
},
getMainText() {
return (conversation) => {
return conversation.displayName
}
},
getSubText() {
return (conversation) => {
if (conversation.hasCall) {
@ -129,23 +142,14 @@ export default {
return this.simpleLastChatMessage(conversation.lastMessage)
}
},
getWidgetItem() {
return (conversation) => {
return {
targetUrl: generateUrl(`call/${conversation.token}`),
mainText: conversation.displayName,
subText: this.getSubText(conversation),
conversation,
}
}
},
},
beforeMount() {
this.fetchRooms()
// FIXME: reduce interval if user not active
setInterval(() => this.fetchRooms(), ROOM_POLLING_INTERVAL * 1000)
},
methods: {
fetchRooms() {
axios.get(generateOcsUrl('apps/spreed/api/v2', 2) + 'room').then((response) => {
@ -159,17 +163,14 @@ export default {
this.roomOptions = importantRooms.slice(0, 7)
this.hasImportantConversations = true
} else {
const items = rooms.sort(propertySort(['-lastActivity'])).slice(0, 4)
items.unshift({
empty: true,
})
this.roomOptions = items
this.roomOptions = rooms.sort(propertySort(['-lastActivity'])).slice(0, 5)
this.hasImportantConversations = false
}
this.loading = false
})
},
clickStartNew() {
window.location = generateUrl('/apps/spreed')
},