fix linter errors

This commit is contained in:
Jörn-Michael Miehe 2023-10-26 22:28:59 +00:00
parent 4e63dccbf0
commit c654a5a322
21 changed files with 76 additions and 94 deletions

View file

@ -18,5 +18,4 @@ import { Component, Vue } from "vue-property-decorator";
export default class Dashboard extends Vue {} export default class Dashboard extends Vue {}
</script> </script>
<style> <style></style>
</style>

View file

@ -18,10 +18,10 @@ import { Component, Vue } from "@/ovd-vue";
@Component @Component
export default class DashboardInfo extends Vue { export default class DashboardInfo extends Vue {
private server_host = "https://oekzident.de"; public server_host = "https://oekzident.de";
private server_name = "OEKZident"; public server_name = "OEKZident";
private version = "0.0.1"; public version = "0.0.1";
private lan_ip = "0.0.0.0"; public lan_ip = "0.0.0.0";
public created(): void { public created(): void {
super.created(); super.created();
@ -43,7 +43,7 @@ export default class DashboardInfo extends Vue {
(data) => { (data) => {
this.server_host = data.host; this.server_host = data.host;
this.server_name = data.name; this.server_name = data.name;
} },
); );
// Update Version // Update Version

View file

@ -22,10 +22,10 @@ import { Component, Vue } from "@/ovd-vue";
@Component @Component
export default class ImageCarousel extends Vue { export default class ImageCarousel extends Vue {
private urls: string[] = require("@/assets/image_testdata.json"); public urls: string[] = require("@/assets/image_testdata.json");
private height = 300; public height = 300;
private contain = false; public contain = false;
private speed = 10000; public speed = 10000;
public created(): void { public created(): void {
super.created(); super.created();
@ -39,7 +39,7 @@ export default class ImageCarousel extends Vue {
// Update Images // Update Images
this.$ovdashboard.api_get_list("image/list", (names) => { this.$ovdashboard.api_get_list("image/list", (names) => {
this.urls = names.map((name: string) => this.urls = names.map((name: string) =>
this.$ovdashboard.api_url(`image/get/${name}`) this.$ovdashboard.api_url(`image/get/${name}`),
); );
}); });

View file

@ -7,7 +7,7 @@ import { Component, Vue } from "@/ovd-vue";
@Component @Component
export default class Message extends Vue { export default class Message extends Vue {
private html = require("@/assets/message_testdata.json"); public html = require("@/assets/message_testdata.json");
public created(): void { public created(): void {
super.created(); super.created();
@ -21,7 +21,7 @@ export default class Message extends Vue {
// Update Message // Update Message
this.$ovdashboard.api_get_string( this.$ovdashboard.api_get_string(
"text/get/html/message", "text/get/html/message",
(data) => (this.html = data) (data) => (this.html = data),
); );
} }
} }

View file

@ -5,7 +5,7 @@ export class Model {
// source: https://gist.github.com/hyamamoto/fd435505d29ebfa3d9716fd2be8d42f0?permalink_comment_id=2775538#gistcomment-2775538 // source: https://gist.github.com/hyamamoto/fd435505d29ebfa3d9716fd2be8d42f0?permalink_comment_id=2775538#gistcomment-2775538
let hash = 0; let hash = 0;
for (let i = 0; i < str.length; i++) for (let i = 0; i < str.length; i++)
hash = Math.imul(31, hash) + str.charCodeAt(i) | 0; hash = (Math.imul(31, hash) + str.charCodeAt(i)) | 0;
return new Uint32Array([hash])[0].toString(36); return new Uint32Array([hash])[0].toString(36);
} }

View file

@ -15,17 +15,14 @@ import Color from "color";
@Component @Component
export default class TickerBar extends Vue { export default class TickerBar extends Vue {
private content = "<p>changeme</p>"; public content = "<p>changeme</p>";
private color = "primary"; public color = "primary";
@Ref("content")
private readonly _content!: HTMLDivElement;
@Ref("marquee") @Ref("marquee")
private readonly _marquee!: HTMLSpanElement; private readonly _marquee!: HTMLSpanElement;
private get is_dark(): boolean { public get is_dark(): boolean {
return this.footer_color.isDark(); return this.footer_color.isDark();
} }

View file

@ -4,11 +4,11 @@
{{ title }} {{ title }}
</span> </span>
<template v-for="(event, index) in events"> <template v-for="(event, index) in events">
<EventItem :event="event" :key="event.hash" /> <EventItem :event="event" :key="`event-${index}`" />
<v-divider <v-divider
v-if="index < events.length - 1" v-if="index < events.length - 1"
class="mx-5" class="mx-5"
:key="`${event.hash}-div`" :key="`event-div-${index}`"
/> />
</template> </template>
</v-list> </v-list>
@ -16,8 +16,8 @@
<script lang="ts"> <script lang="ts">
import { Component, Prop, Vue } from "vue-property-decorator"; import { Component, Prop, Vue } from "vue-property-decorator";
import { EventData } from "./EventModel";
import EventItem from "./EventItem.vue"; import EventItem from "./EventItem.vue";
import { EventData } from "./EventModel";
@Component({ @Component({
components: { components: {
@ -26,10 +26,10 @@ import EventItem from "./EventItem.vue";
}) })
export default class Calendar extends Vue { export default class Calendar extends Vue {
@Prop({ default: "CALENDAR" }) @Prop({ default: "CALENDAR" })
private readonly title!: string; public readonly title!: string;
@Prop({ default: () => [] }) @Prop({ default: () => [] })
private readonly events!: EventData[]; public readonly events!: EventData[];
} }
</script> </script>

View file

@ -29,7 +29,7 @@ export default class CalendarCarousel extends Vue {
private interval?: number; private interval?: number;
private data: CalendarData[] = require("@/assets/calendar_testdata.json"); private data: CalendarData[] = require("@/assets/calendar_testdata.json");
private speed = 10000; public speed = 10000;
@Ref("main") @Ref("main")
private readonly _main?: Vue; private readonly _main?: Vue;
@ -98,7 +98,7 @@ export default class CalendarCarousel extends Vue {
this.interval = setInterval(this.update_height, 10000); this.interval = setInterval(this.update_height, 10000);
} }
private get calendars(): CalendarModel[] { public get calendars(): CalendarModel[] {
const arr = []; const arr = [];
for (const json_data of this.data) { for (const json_data of this.data) {

View file

@ -13,11 +13,11 @@ export class CalendarModel extends Model {
public constructor(json_data: CalendarData) { public constructor(json_data: CalendarData) {
super(); super();
this.title = json_data.title this.title = json_data.title;
this.events = []; this.events = [];
for (const event_data of json_data.events) { for (const event_data of json_data.events) {
this.events.push(new EventModel(event_data)) this.events.push(new EventModel(event_data));
} }
} }
} }

View file

@ -17,23 +17,23 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { Component, Prop, Vue } from "vue-property-decorator";
import { DateTime } from "luxon"; import { DateTime } from "luxon";
import { Component, Prop, Vue } from "vue-property-decorator";
@Component @Component
export default class EventDate extends Vue { export default class EventDate extends Vue {
@Prop() @Prop()
private readonly date!: DateTime; private readonly date!: DateTime;
private get day(): string { public get day(): string {
return this.date.toFormat("dd."); return this.date.toFormat("dd.");
} }
private get month(): string { public get month(): string {
return this.date.toFormat("MM."); return this.date.toFormat("MM.");
} }
private get time(): string { public get time(): string {
return this.date.toLocaleString(DateTime.TIME_24_SIMPLE); return this.date.toLocaleString(DateTime.TIME_24_SIMPLE);
} }
} }

View file

@ -12,15 +12,7 @@
{{ event.description }} {{ event.description }}
</v-list-item-subtitle> </v-list-item-subtitle>
<v-list-item-subtitle <v-list-item-subtitle
class=" class="d-inline-block text-truncate thw-heading-font blue-grey--text text--darken-1 font-weight-bold ma-0"
d-inline-block
text-truncate
thw-heading-font
blue-grey--text
text--darken-1
font-weight-bold
ma-0
"
> >
{{ data_string }} {{ data_string }}
</v-list-item-subtitle> </v-list-item-subtitle>
@ -29,10 +21,10 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { Component, Prop, Vue } from "vue-property-decorator";
import { DateTime, DurationLikeObject } from "luxon"; import { DateTime, DurationLikeObject } from "luxon";
import { EventModel } from "./EventModel"; import { Component, Prop, Vue } from "vue-property-decorator";
import EventDate from "./EventDate.vue"; import EventDate from "./EventDate.vue";
import { EventModel } from "./EventModel";
@Component({ @Component({
components: { components: {
@ -41,11 +33,11 @@ import EventDate from "./EventDate.vue";
}) })
export default class EventItem extends Vue { export default class EventItem extends Vue {
@Prop() @Prop()
private readonly event!: EventModel; public readonly event!: EventModel;
private get data_string(): string { public get data_string(): string {
const locale_string = this.event.start.toLocaleString( const locale_string = this.event.start.toLocaleString(
DateTime.DATETIME_MED_WITH_WEEKDAY DateTime.DATETIME_MED_WITH_WEEKDAY,
); );
// decide which duration units to include // decide which duration units to include
@ -72,5 +64,4 @@ export default class EventItem extends Vue {
} }
</script> </script>
<style> <style></style>
</style>

View file

@ -19,12 +19,10 @@ export class EventModel extends Model {
this.summary = json_data.summary; this.summary = json_data.summary;
this.description = json_data.description; this.description = json_data.description;
this.start = DateTime this.start = DateTime.fromISO(json_data.dtstart).setLocale(
.fromISO(json_data.dtstart) navigator.language,
.setLocale(navigator.language); );
const end = DateTime const end = DateTime.fromISO(json_data.dtend).setLocale(navigator.language);
.fromISO(json_data.dtend)
.setLocale(navigator.language);
this.duration = end.diff(this.start); this.duration = end.diff(this.start);
} }

View file

@ -3,12 +3,12 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { Component, Prop, Vue } from "vue-property-decorator";
import { DateTime } from "luxon"; import { DateTime } from "luxon";
import { Component, Prop, Vue } from "vue-property-decorator";
@Component @Component
export default class Clock extends Vue { export default class Clock extends Vue {
private formatted = ""; public formatted = "";
private interval?: number; private interval?: number;
@Prop({ required: true }) @Prop({ required: true })

View file

@ -23,10 +23,10 @@ import { Component, Vue } from "@/ovd-vue";
@Component @Component
export default class THWLogo extends Vue { export default class THWLogo extends Vue {
private above = "Technisches Hilfswerk"; public above = "Technisches Hilfswerk";
private below = "OV Musterstadt"; public below = "OV Musterstadt";
private get logo_url(): string { public get logo_url(): string {
return this.$ovdashboard.api_url("file/get/logo"); return this.$ovdashboard.api_url("file/get/logo");
} }

View file

@ -38,7 +38,7 @@ import THWLogo from "./THWLogo.vue";
}, },
}) })
export default class TitleBar extends Vue { export default class TitleBar extends Vue {
private title = "<h1>TITLE</h1>"; public title = "<h1>TITLE</h1>";
public created(): void { public created(): void {
super.created(); super.created();

View file

@ -1,10 +1,9 @@
import { OVDashboardPlugin } from "@/plugins/ovdashboard"; import { OVDashboardPlugin } from "@/plugins/ovdashboard";
declare module 'vue/types/vue' { declare module "vue/types/vue" {
interface Vue { interface Vue {
$ovdashboard: OVDashboardPlugin; $ovdashboard: OVDashboardPlugin;
} }
} }
export {}; export {};

View file

@ -1,11 +1,11 @@
import Vue, { VNode } from 'vue' import Vue, { VNode } from "vue";
declare global { declare global {
namespace JSX { namespace JSX {
interface Element extends VNode {} interface Element extends VNode {}
interface ElementClass extends Vue {} interface ElementClass extends Vue {}
interface IntrinsicElements { interface IntrinsicElements {
[elem: string]: any [elem: string]: any;
} }
} }
} }

View file

@ -1,4 +1,4 @@
declare module '*.vue' { declare module "*.vue" {
import Vue from 'vue' import Vue from "vue";
export default Vue export default Vue;
} }

View file

@ -1,4 +1,4 @@
declare module 'vuetify/lib/framework' { declare module "vuetify/lib/framework" {
import Vuetify from 'vuetify' import Vuetify from "vuetify";
export default Vuetify export default Vuetify;
} }

View file

@ -1,5 +1,5 @@
import axios, { AxiosInstance, AxiosPromise } from 'axios'; import axios, { AxiosInstance, AxiosPromise } from "axios";
import Vue from 'vue'; import Vue from "vue";
export class OVDashboardPlugin { export class OVDashboardPlugin {
private axios: AxiosInstance; private axios: AxiosInstance;
@ -28,7 +28,6 @@ export class OVDashboardPlugin {
private get api_baseurl(): string { private get api_baseurl(): string {
if (process.env.NODE_ENV === "production") { if (process.env.NODE_ENV === "production") {
return `//${window.location.host}/api`; return `//${window.location.host}/api`;
} else if (process.env.NODE_ENV !== "development") { } else if (process.env.NODE_ENV !== "development") {
console.warn("Unexpected NODE_ENV value"); console.warn("Unexpected NODE_ENV value");
} }
@ -52,10 +51,7 @@ export class OVDashboardPlugin {
return this.axios.get<T>(this.api_url(endpoint)); return this.axios.get<T>(this.api_url(endpoint));
} }
private api_get<T>( private api_get<T>(endpoint: string, on_success: (data: T) => void): void {
endpoint: string,
on_success: (data: T) => void
): void {
this.api_get_prepare<T>(endpoint) this.api_get_prepare<T>(endpoint)
.then((response) => on_success(response.data)) .then((response) => on_success(response.data))
.catch(this.fail(endpoint)); .catch(this.fail(endpoint));
@ -63,7 +59,7 @@ export class OVDashboardPlugin {
public api_get_string( public api_get_string(
endpoint: string, endpoint: string,
on_success: (data: string) => void on_success: (data: string) => void,
): void { ): void {
this.api_get<string>(endpoint, (data) => { this.api_get<string>(endpoint, (data) => {
if (typeof data !== "string") { if (typeof data !== "string") {
@ -84,7 +80,7 @@ export class OVDashboardPlugin {
public api_get_list( public api_get_list(
endpoint: string, endpoint: string,
on_success: (data: string[]) => void on_success: (data: string[]) => void,
): void { ): void {
this.api_get(endpoint, (data) => { this.api_get(endpoint, (data) => {
if (!this.check_array<string>(data)) { if (!this.check_array<string>(data)) {
@ -105,7 +101,7 @@ export class OVDashboardPlugin {
public api_get_object<Type extends object>( public api_get_object<Type extends object>(
endpoint: string, endpoint: string,
on_success: (data: Type) => void on_success: (data: Type) => void,
): void { ): void {
this.api_get<Type>(endpoint, (data) => { this.api_get<Type>(endpoint, (data) => {
if (!this.check_object(data)) { if (!this.check_object(data)) {
@ -119,9 +115,11 @@ export class OVDashboardPlugin {
public api_get_object_multi<Type extends object>( public api_get_object_multi<Type extends object>(
endpoints: string[], endpoints: string[],
on_success: (data: Type[]) => void on_success: (data: Type[]) => void,
): void { ): void {
const promises = endpoints.map((endpoint) => this.api_get_prepare<Type>(endpoint)); const promises = endpoints.map((endpoint) =>
this.api_get_prepare<Type>(endpoint),
);
Promise.all(promises) Promise.all(promises)
.then((responses) => { .then((responses) => {

View file

@ -1,5 +1,5 @@
import Vue from 'vue'; import Vue from "vue";
import Vuetify from 'vuetify/lib/framework'; import Vuetify from "vuetify/lib/framework";
Vue.use(Vuetify); Vue.use(Vuetify);