2022-09-09 16:23:04 +00:00
|
|
|
<template>
|
2022-09-09 16:38:12 +00:00
|
|
|
<v-app>
|
2022-09-15 15:04:01 +00:00
|
|
|
<v-layout column fill-height>
|
2022-09-13 15:46:54 +00:00
|
|
|
<TitleBar
|
|
|
|
:logo_above="logo_above"
|
|
|
|
:logo_below="logo_below"
|
|
|
|
:title="title_html"
|
|
|
|
/>
|
2022-09-15 17:48:55 +00:00
|
|
|
<Dashboard>
|
|
|
|
<template slot="message">
|
2022-09-15 20:30:25 +00:00
|
|
|
<div class="d-flex flex-column fill-height pb-sm-12">
|
2022-09-15 19:45:34 +00:00
|
|
|
<Message :html="message_html" />
|
|
|
|
<ImageCarousel
|
|
|
|
class="mt-auto"
|
|
|
|
v-if="image_urls.length > 0"
|
|
|
|
:speed="image_speed"
|
|
|
|
:height="image_height"
|
|
|
|
:contain="image_contain"
|
|
|
|
:urls="image_urls"
|
|
|
|
/>
|
|
|
|
</div>
|
2022-09-15 17:48:55 +00:00
|
|
|
</template>
|
|
|
|
<template slot="calendars">
|
2022-09-15 18:01:10 +00:00
|
|
|
<CalendarCarousel :speed="calendar_speed" :data="calendar_data" />
|
2022-09-15 17:48:55 +00:00
|
|
|
<DashboardInfo
|
2022-09-15 20:30:25 +00:00
|
|
|
class="pb-12 pb-sm-0"
|
2022-09-15 17:48:55 +00:00
|
|
|
:server_host="server_host"
|
|
|
|
:server_name="server_name"
|
|
|
|
:version="dashboard_version"
|
|
|
|
:lan_ip="dashboard_ip"
|
|
|
|
/>
|
|
|
|
</template>
|
2022-09-13 21:30:20 +00:00
|
|
|
</Dashboard>
|
2022-09-15 15:04:01 +00:00
|
|
|
<TickerBar
|
|
|
|
v-if="ticker_html !== ''"
|
|
|
|
:content="ticker_html"
|
2022-09-15 22:14:45 +00:00
|
|
|
:color="ticker_color"
|
2022-09-15 15:04:01 +00:00
|
|
|
/>
|
|
|
|
</v-layout>
|
2022-09-09 16:38:12 +00:00
|
|
|
</v-app>
|
2022-09-09 16:23:04 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2022-09-11 23:28:37 +00:00
|
|
|
import { Component, Vue } from "vue-property-decorator";
|
2022-09-16 22:02:23 +00:00
|
|
|
import { EventData } from "./components/calendar/EventModel";
|
2022-09-16 14:50:45 +00:00
|
|
|
import { CalendarData } from "./components/calendar/CalendarModel";
|
2022-09-15 19:30:48 +00:00
|
|
|
|
|
|
|
import TitleBar from "./components/title/TitleBar.vue";
|
2022-09-13 01:54:02 +00:00
|
|
|
import Dashboard from "./components/Dashboard.vue";
|
2022-09-15 17:48:55 +00:00
|
|
|
import ImageCarousel from "./components/ImageCarousel.vue";
|
2022-09-15 19:30:48 +00:00
|
|
|
import Message from "./components/Message.vue";
|
|
|
|
import CalendarCarousel from "./components/calendar/CalendarCarousel.vue";
|
|
|
|
import DashboardInfo from "./components/DashboardInfo.vue";
|
2022-09-12 13:01:58 +00:00
|
|
|
import TickerBar from "./components/TickerBar.vue";
|
2022-09-09 16:23:04 +00:00
|
|
|
|
2022-09-11 23:28:37 +00:00
|
|
|
@Component({
|
2022-09-09 16:23:04 +00:00
|
|
|
components: {
|
2022-09-15 19:30:48 +00:00
|
|
|
TitleBar,
|
2022-09-13 01:54:02 +00:00
|
|
|
Dashboard,
|
2022-09-15 17:48:55 +00:00
|
|
|
ImageCarousel,
|
2022-09-15 19:30:48 +00:00
|
|
|
Message,
|
|
|
|
CalendarCarousel,
|
|
|
|
DashboardInfo,
|
2022-09-12 13:01:58 +00:00
|
|
|
TickerBar,
|
2022-09-09 16:23:04 +00:00
|
|
|
},
|
2022-09-11 23:28:37 +00:00
|
|
|
})
|
|
|
|
export default class App extends Vue {
|
2022-09-16 14:29:55 +00:00
|
|
|
private interval?: number;
|
|
|
|
|
|
|
|
// API data
|
2022-09-13 15:46:54 +00:00
|
|
|
private logo_above = "Technisches Hilfswerk";
|
|
|
|
private logo_below = "OV Musterstadt";
|
2022-09-11 23:28:37 +00:00
|
|
|
private title_html = "<h1>changeme</h1>";
|
2022-09-15 18:01:10 +00:00
|
|
|
|
2022-09-16 14:50:45 +00:00
|
|
|
private image_urls: string[] = require("@/assets/image_testdata.json");
|
2022-09-15 18:08:04 +00:00
|
|
|
private image_height = 300;
|
|
|
|
private image_contain = false;
|
2022-09-15 18:01:10 +00:00
|
|
|
private image_speed = 10000;
|
2022-09-15 19:30:48 +00:00
|
|
|
private message_html = require("@/assets/lipsum.json");
|
2022-09-15 18:01:10 +00:00
|
|
|
|
2022-09-16 14:50:45 +00:00
|
|
|
private calendar_data: CalendarData[] = require("@/assets/calendar_testdata.json");
|
2022-09-15 18:01:10 +00:00
|
|
|
private calendar_speed = 10000;
|
2022-09-15 16:25:58 +00:00
|
|
|
private server_host = "https://oekzident.de";
|
|
|
|
private server_name = "OEKZident";
|
|
|
|
private dashboard_version = "0.0.1";
|
|
|
|
private dashboard_ip = "0.0.0.0";
|
2022-09-15 18:01:10 +00:00
|
|
|
|
|
|
|
private ticker_html = "<p>changeme</p>";
|
2022-09-15 22:14:45 +00:00
|
|
|
private ticker_color = "primary";
|
2022-09-15 22:51:50 +00:00
|
|
|
|
|
|
|
private update(): void {
|
2022-09-16 14:02:18 +00:00
|
|
|
// Update Logo Config
|
2022-09-16 21:45:59 +00:00
|
|
|
type LogoConfig = {
|
|
|
|
above: string;
|
|
|
|
below: string;
|
|
|
|
};
|
|
|
|
|
2022-09-16 22:29:03 +00:00
|
|
|
this.$ovdashboard.api_get_object<LogoConfig>("misc/config/logo", (cfg) => {
|
|
|
|
this.logo_above = cfg.above;
|
|
|
|
this.logo_below = cfg.below;
|
2022-09-16 22:02:23 +00:00
|
|
|
});
|
2022-09-16 14:02:18 +00:00
|
|
|
|
|
|
|
// Update Title
|
2022-09-16 22:29:03 +00:00
|
|
|
this.$ovdashboard.api_get_string("text/get/html/title", (title) => {
|
|
|
|
this.title_html = title;
|
2022-09-16 14:23:10 +00:00
|
|
|
});
|
2022-09-16 14:02:18 +00:00
|
|
|
|
|
|
|
// Update Images
|
2022-09-16 22:29:03 +00:00
|
|
|
this.$ovdashboard.api_get_list("image/list", (names) => {
|
|
|
|
this.image_urls = names.map((name: string) =>
|
2022-09-19 09:17:53 +00:00
|
|
|
this.$ovdashboard.api_url(`image/get/${name}`)
|
2022-09-16 14:50:45 +00:00
|
|
|
);
|
|
|
|
});
|
2022-09-16 14:02:18 +00:00
|
|
|
|
|
|
|
// Update Image Config
|
2022-09-16 21:45:59 +00:00
|
|
|
type ImageConfig = {
|
|
|
|
height: number;
|
|
|
|
contain: boolean;
|
|
|
|
speed: number;
|
|
|
|
};
|
|
|
|
|
2022-09-16 22:29:03 +00:00
|
|
|
this.$ovdashboard.api_get_object<ImageConfig>("image/config", (cfg) => {
|
|
|
|
this.image_height = cfg.height;
|
|
|
|
this.image_contain = cfg.contain;
|
|
|
|
this.image_speed = cfg.speed;
|
2022-09-16 22:02:23 +00:00
|
|
|
});
|
2022-09-16 14:02:18 +00:00
|
|
|
|
|
|
|
// Update Message
|
2022-09-16 22:02:23 +00:00
|
|
|
this.$ovdashboard.api_get_string(
|
2022-09-16 21:15:46 +00:00
|
|
|
"text/get/html/message",
|
|
|
|
(data) => (this.message_html = data)
|
|
|
|
);
|
2022-09-16 14:02:18 +00:00
|
|
|
|
2022-09-16 14:50:45 +00:00
|
|
|
// Update Calendar Aggregates
|
2022-09-16 22:29:03 +00:00
|
|
|
this.$ovdashboard.api_get_list("aggregate/list", (names) => {
|
2022-09-16 22:57:12 +00:00
|
|
|
this.$ovdashboard.api_get_object_multi<EventData[]>(
|
2022-09-19 09:17:53 +00:00
|
|
|
names.map((name) => `aggregate/get/${name}`),
|
2022-09-16 22:57:12 +00:00
|
|
|
(calendars) => {
|
2022-09-16 14:59:56 +00:00
|
|
|
this.calendar_data = [];
|
|
|
|
|
2022-09-16 22:29:03 +00:00
|
|
|
for (let i = 0; i < names.length; i++) {
|
2022-09-16 14:59:56 +00:00
|
|
|
this.calendar_data.push({
|
2022-09-16 22:29:03 +00:00
|
|
|
title: names[i],
|
2022-09-16 22:57:12 +00:00
|
|
|
events: calendars[i],
|
2022-09-16 14:59:56 +00:00
|
|
|
});
|
|
|
|
}
|
2022-09-16 22:57:12 +00:00
|
|
|
}
|
|
|
|
);
|
2022-09-16 14:59:56 +00:00
|
|
|
});
|
2022-09-16 14:02:18 +00:00
|
|
|
|
|
|
|
// Update Calendar Config
|
2022-09-16 21:45:59 +00:00
|
|
|
type CalendarConfig = {
|
|
|
|
speed: number;
|
|
|
|
};
|
|
|
|
|
2022-09-16 22:02:23 +00:00
|
|
|
this.$ovdashboard.api_get_object<CalendarConfig>(
|
2022-09-16 21:45:59 +00:00
|
|
|
"calendar/config",
|
|
|
|
(data) => {
|
|
|
|
this.calendar_speed = data.speed;
|
|
|
|
}
|
|
|
|
);
|
2022-09-16 14:02:18 +00:00
|
|
|
|
|
|
|
// Update Server Config
|
2022-09-16 21:45:59 +00:00
|
|
|
type ServerConfig = {
|
|
|
|
host: string;
|
|
|
|
name: string;
|
|
|
|
};
|
|
|
|
|
2022-09-16 22:02:23 +00:00
|
|
|
this.$ovdashboard.api_get_object<ServerConfig>(
|
2022-09-16 21:45:59 +00:00
|
|
|
"misc/config/server",
|
|
|
|
(data) => {
|
|
|
|
this.server_host = data.host;
|
|
|
|
this.server_name = data.name;
|
|
|
|
}
|
|
|
|
);
|
2022-09-16 14:02:18 +00:00
|
|
|
|
|
|
|
// Update Version
|
2022-09-16 22:02:23 +00:00
|
|
|
this.$ovdashboard.api_get_string("misc/version", (data) => {
|
2022-09-16 14:23:10 +00:00
|
|
|
this.dashboard_version = data;
|
|
|
|
});
|
2022-09-16 14:02:18 +00:00
|
|
|
|
|
|
|
// Update IP
|
2022-09-16 22:02:23 +00:00
|
|
|
this.$ovdashboard.api_get_string("misc/lanip", (data) => {
|
2022-09-16 14:23:10 +00:00
|
|
|
this.dashboard_ip = data;
|
|
|
|
});
|
2022-09-16 14:02:18 +00:00
|
|
|
|
|
|
|
// Update Ticker
|
2022-09-16 22:02:23 +00:00
|
|
|
this.$ovdashboard.api_get_string("ticker/html", (data) => {
|
2022-09-16 14:23:10 +00:00
|
|
|
this.ticker_html = data;
|
|
|
|
});
|
2022-09-16 14:02:18 +00:00
|
|
|
|
|
|
|
// Update Ticker Config
|
2022-09-16 21:45:59 +00:00
|
|
|
type TickerConfig = {
|
|
|
|
color: string;
|
|
|
|
};
|
|
|
|
|
2022-09-16 22:02:23 +00:00
|
|
|
this.$ovdashboard.api_get_object<TickerConfig>("ticker/config", (data) => {
|
|
|
|
this.ticker_color = data.color;
|
|
|
|
});
|
2022-09-15 22:51:50 +00:00
|
|
|
}
|
|
|
|
|
2022-09-16 14:29:55 +00:00
|
|
|
public created(): void {
|
2022-09-15 22:51:50 +00:00
|
|
|
this.update();
|
2022-09-16 14:29:55 +00:00
|
|
|
this.interval = setInterval(this.update, 30000);
|
|
|
|
}
|
|
|
|
|
|
|
|
public beforeDestroy(): void {
|
|
|
|
clearInterval(this.interval);
|
2022-09-15 22:51:50 +00:00
|
|
|
}
|
2022-09-11 23:28:37 +00:00
|
|
|
}
|
2022-09-09 16:38:12 +00:00
|
|
|
</script>
|
2022-09-15 19:49:41 +00:00
|
|
|
|
|
|
|
<style>
|
|
|
|
/* Hide scrollbar for Chrome, Safari and Opera */
|
|
|
|
body::-webkit-scrollbar {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Hide scrollbar for IE, Edge and Firefox */
|
|
|
|
body {
|
|
|
|
-ms-overflow-style: none; /* IE and Edge */
|
|
|
|
scrollbar-width: none; /* Firefox */
|
|
|
|
}
|
|
|
|
</style>
|