mirror of
https://github.com/Sebclem/hassio-nextcloud-backup.git
synced 2024-11-26 02:52:59 +01:00
Compare commits
No commits in common. "a178ef246de9749e07398c544f1aa381346e8f1d" and "2aa53310368d1ff1a48b5d124f665d79482812f1" have entirely different histories.
a178ef246d
...
2aa5331036
@ -5,14 +5,6 @@ const messageRouter = express.Router();
|
|||||||
|
|
||||||
messageRouter.get('/', (req, res, next)=>{
|
messageRouter.get('/', (req, res, next)=>{
|
||||||
res.json(messageManager.get())
|
res.json(messageManager.get())
|
||||||
});
|
})
|
||||||
|
|
||||||
messageRouter.patch('/:messageId/readed', (req, res, next)=>{
|
|
||||||
if(messageManager.markReaded(req.params.messageId)){
|
|
||||||
res.json(messageManager.get());
|
|
||||||
}else{
|
|
||||||
res.status(404).send();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export default messageRouter;
|
export default messageRouter;
|
||||||
|
@ -40,19 +40,6 @@ class MessageManager {
|
|||||||
public get(){
|
public get(){
|
||||||
return this.messages;
|
return this.messages;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getById(id: string){
|
|
||||||
return this.messages.find(value=>value.id == id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public markReaded(id: string){
|
|
||||||
const index = this.messages.findIndex(value=>value.id == id);
|
|
||||||
if(index == -1){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
this.messages[index].viewed = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,13 +3,7 @@
|
|||||||
<navbar-component></navbar-component>
|
<navbar-component></navbar-component>
|
||||||
<message-bar></message-bar>
|
<message-bar></message-bar>
|
||||||
<webdav-settings-menu></webdav-settings-menu>
|
<webdav-settings-menu></webdav-settings-menu>
|
||||||
<v-main class="mx-12">
|
<v-main> </v-main>
|
||||||
<v-row>
|
|
||||||
<v-col cols="6" offset="6">
|
|
||||||
<cloud-list></cloud-list>
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
</v-main>
|
|
||||||
</v-app>
|
</v-app>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -17,7 +11,6 @@
|
|||||||
import NavbarComponent from "./components/NavbarComponent.vue";
|
import NavbarComponent from "./components/NavbarComponent.vue";
|
||||||
import MessageBar from "./components/MessageBar.vue";
|
import MessageBar from "./components/MessageBar.vue";
|
||||||
import WebdavSettingsMenu from "./components/settings/WebdavConfigMenu.vue";
|
import WebdavSettingsMenu from "./components/settings/WebdavConfigMenu.vue";
|
||||||
import CloudList from "./components/cloud/CloudList.vue";
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
<v-btn
|
<v-btn
|
||||||
color="success"
|
color="success"
|
||||||
variant="text"
|
variant="text"
|
||||||
@click="markReaded(item.id)"
|
@click.stop
|
||||||
icon
|
icon
|
||||||
v-if="!item.viewed"
|
v-if="!item.viewed"
|
||||||
size="small"
|
size="small"
|
||||||
@ -66,7 +66,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import * as messageService from "@/services/messageService";
|
import { getMessages } from "@/services/messageService";
|
||||||
import { useMessageStore } from "@/stores/message";
|
import { useMessageStore } from "@/stores/message";
|
||||||
import { MessageType } from "@/types/messages";
|
import { MessageType } from "@/types/messages";
|
||||||
import { DateTime } from "luxon";
|
import { DateTime } from "luxon";
|
||||||
@ -76,10 +76,10 @@ import { onBeforeUnmount, ref } from "vue";
|
|||||||
const messagesStore = useMessageStore();
|
const messagesStore = useMessageStore();
|
||||||
const { messages } = storeToRefs(messagesStore);
|
const { messages } = storeToRefs(messagesStore);
|
||||||
|
|
||||||
const interval = setInterval(refreshMessages, 2000);
|
const interval = setInterval(refreshMessages, 1000);
|
||||||
|
|
||||||
function refreshMessages() {
|
function refreshMessages() {
|
||||||
messageService.getMessages().then((values) => {
|
getMessages().then((values) => {
|
||||||
messages.value = values;
|
messages.value = values;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -142,12 +142,6 @@ function getTimeDelta(time: string) {
|
|||||||
const show = ref<boolean[]>([]);
|
const show = ref<boolean[]>([]);
|
||||||
refreshMessages();
|
refreshMessages();
|
||||||
|
|
||||||
function markReaded(id: string) {
|
|
||||||
messageService.markRead(id).then((values) => {
|
|
||||||
messages.value = values;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
clearInterval(interval);
|
clearInterval(interval);
|
||||||
});
|
});
|
||||||
|
@ -10,14 +10,9 @@
|
|||||||
</v-app-bar-title>
|
</v-app-bar-title>
|
||||||
<v-spacer></v-spacer>
|
<v-spacer></v-spacer>
|
||||||
<v-btn icon id="message-btn" >
|
<v-btn icon id="message-btn" >
|
||||||
<v-badge
|
<v-badge color="error" :content="countUnreadMessages">
|
||||||
color="error"
|
<v-icon :class="{ shake: haveUnreadMessages }">mdi-bell</v-icon>
|
||||||
:content="countUnreadMessages"
|
|
||||||
v-if="haveUnreadMessages"
|
|
||||||
>
|
|
||||||
<v-icon class="shake">mdi-bell</v-icon>
|
|
||||||
</v-badge>
|
</v-badge>
|
||||||
<v-icon v-else>mdi-bell</v-icon>
|
|
||||||
</v-btn>
|
</v-btn>
|
||||||
<v-menu width="210px">
|
<v-menu width="210px">
|
||||||
<template v-slot:activator="{ props }">
|
<template v-slot:activator="{ props }">
|
||||||
|
@ -1,103 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div>
|
|
||||||
<v-card elevation="10" class="mt-10" border>
|
|
||||||
<v-card-title class="text-center"> Cloud </v-card-title>
|
|
||||||
<v-divider></v-divider>
|
|
||||||
<v-card-text>
|
|
||||||
<v-row>
|
|
||||||
<v-col>
|
|
||||||
<v-card variant="outlined" elevation="5" color="grey-darken-2">
|
|
||||||
<v-card-title class="text-center text-white">Auto</v-card-title>
|
|
||||||
<v-divider color="grey-darken-3"></v-divider>
|
|
||||||
<v-card-text class="pa-0">
|
|
||||||
<v-list variant="tonal" class="pa-0">
|
|
||||||
<v-list-item
|
|
||||||
v-if="autoBackups.length == 0"
|
|
||||||
class="text-center text-subtitle-2 text-disabled"
|
|
||||||
>Folder is empty</v-list-item
|
|
||||||
>
|
|
||||||
<template v-for="(item, index) in autoBackups" :key="item.id">
|
|
||||||
<v-divider
|
|
||||||
v-if="index != 0"
|
|
||||||
color="grey-darken-3"
|
|
||||||
></v-divider>
|
|
||||||
<v-list-item>
|
|
||||||
<v-list-item-title>{{ item.name }}</v-list-item-title>
|
|
||||||
<template v-slot:append>
|
|
||||||
<v-btn variant="text" icon color="secondary">
|
|
||||||
<v-icon>mdi-information</v-icon>
|
|
||||||
</v-btn>
|
|
||||||
<v-btn variant="text" icon color="red">
|
|
||||||
<v-icon>mdi-trash-can</v-icon>
|
|
||||||
</v-btn>
|
|
||||||
</template>
|
|
||||||
</v-list-item>
|
|
||||||
</template>
|
|
||||||
</v-list>
|
|
||||||
</v-card-text>
|
|
||||||
</v-card>
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
<v-row>
|
|
||||||
<v-col>
|
|
||||||
<v-card variant="outlined" elevation="5" color="grey-darken-2">
|
|
||||||
<v-card-title class="text-center text-white">Manual</v-card-title>
|
|
||||||
<v-divider color="grey-darken-3"></v-divider>
|
|
||||||
<v-card-text class="pa-0">
|
|
||||||
<v-list variant="tonal" class="pa-0">
|
|
||||||
<v-list-item
|
|
||||||
v-if="manualBackups.length == 0"
|
|
||||||
class="text-center text-subtitle-2 text-disabled"
|
|
||||||
>Folder is empty</v-list-item
|
|
||||||
>
|
|
||||||
<template
|
|
||||||
v-for="(item, index) in manualBackups"
|
|
||||||
:key="item.id"
|
|
||||||
>
|
|
||||||
<v-divider
|
|
||||||
v-if="index != 0"
|
|
||||||
color="grey-darken-3"
|
|
||||||
></v-divider>
|
|
||||||
<v-list-item>
|
|
||||||
<v-list-item-title>{{ item.name }}</v-list-item-title>
|
|
||||||
<template v-slot:append>
|
|
||||||
<v-btn variant="text" icon color="secondary">
|
|
||||||
<v-icon>mdi-information</v-icon>
|
|
||||||
</v-btn>
|
|
||||||
<v-btn variant="text" icon color="red">
|
|
||||||
<v-icon>mdi-trash-can</v-icon>
|
|
||||||
</v-btn>
|
|
||||||
</template>
|
|
||||||
</v-list-item>
|
|
||||||
</template>
|
|
||||||
</v-list>
|
|
||||||
</v-card-text>
|
|
||||||
</v-card>
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
</v-card-text>
|
|
||||||
</v-card>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { ref } from "vue";
|
|
||||||
import type { WebdavBackup } from "@/types/webdav";
|
|
||||||
import {
|
|
||||||
getAutoBackupList,
|
|
||||||
getManualBackupList,
|
|
||||||
} from "@/services/webdavService";
|
|
||||||
|
|
||||||
const autoBackups = ref<WebdavBackup[]>([]);
|
|
||||||
const manualBackups = ref<WebdavBackup[]>([]);
|
|
||||||
function refreshBackup() {
|
|
||||||
getAutoBackupList().then((value) => {
|
|
||||||
autoBackups.value = value;
|
|
||||||
});
|
|
||||||
getManualBackupList().then((value) => {
|
|
||||||
manualBackups.value = value;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
refreshBackup();
|
|
||||||
</script>
|
|
@ -8,8 +8,7 @@ import { createVuetify } from "vuetify";
|
|||||||
const darkTheme = {
|
const darkTheme = {
|
||||||
dark: true,
|
dark: true,
|
||||||
colors: {
|
colors: {
|
||||||
primary: "#0091ea", //light-blue accent-4
|
primary: "#0091ea",
|
||||||
accent: "#FF6F00", //amber darken-4
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4,7 +4,3 @@ import kyClient from "./kyClient";
|
|||||||
export function getMessages() {
|
export function getMessages() {
|
||||||
return kyClient.get("messages").json<Message[]>();
|
return kyClient.get("messages").json<Message[]>();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function markRead(id: string) {
|
|
||||||
return kyClient.patch(`messages/${encodeURI(id)}/readed`).json<Message[]>();
|
|
||||||
}
|
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
import type { WebdavBackup } from "@/types/webdav";
|
|
||||||
import kyClient from "./kyClient";
|
|
||||||
|
|
||||||
export function getAutoBackupList() {
|
|
||||||
return kyClient.get("webdav/backup/auto").json<WebdavBackup[]>();
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getManualBackupList() {
|
|
||||||
return kyClient.get("webdav/backup/manual").json<WebdavBackup[]>();
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
import type { DateTime } from "luxon";
|
|
||||||
|
|
||||||
export interface WebdavBackup {
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
size: number;
|
|
||||||
lastEdit: DateTime;
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user