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 {}
</script>
<style>
</style>
<style></style>

View file

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

View file

@ -22,10 +22,10 @@ import { Component, Vue } from "@/ovd-vue";
@Component
export default class ImageCarousel extends Vue {
private urls: string[] = require("@/assets/image_testdata.json");
private height = 300;
private contain = false;
private speed = 10000;
public urls: string[] = require("@/assets/image_testdata.json");
public height = 300;
public contain = false;
public speed = 10000;
public created(): void {
super.created();
@ -39,7 +39,7 @@ export default class ImageCarousel extends Vue {
// Update Images
this.$ovdashboard.api_get_list("image/list", (names) => {
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
export default class Message extends Vue {
private html = require("@/assets/message_testdata.json");
public html = require("@/assets/message_testdata.json");
public created(): void {
super.created();
@ -21,7 +21,7 @@ export default class Message extends Vue {
// Update Message
this.$ovdashboard.api_get_string(
"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
let hash = 0;
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);
}

View file

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

View file

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

View file

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

View file

@ -13,11 +13,11 @@ export class CalendarModel extends Model {
public constructor(json_data: CalendarData) {
super();
this.title = json_data.title
this.title = json_data.title;
this.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>
<script lang="ts">
import { Component, Prop, Vue } from "vue-property-decorator";
import { DateTime } from "luxon";
import { Component, Prop, Vue } from "vue-property-decorator";
@Component
export default class EventDate extends Vue {
@Prop()
private readonly date!: DateTime;
private get day(): string {
public get day(): string {
return this.date.toFormat("dd.");
}
private get month(): string {
public get month(): string {
return this.date.toFormat("MM.");
}
private get time(): string {
public get time(): string {
return this.date.toLocaleString(DateTime.TIME_24_SIMPLE);
}
}

View file

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

View file

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

View file

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

View file

@ -23,10 +23,10 @@ import { Component, Vue } from "@/ovd-vue";
@Component
export default class THWLogo extends Vue {
private above = "Technisches Hilfswerk";
private below = "OV Musterstadt";
public above = "Technisches Hilfswerk";
public below = "OV Musterstadt";
private get logo_url(): string {
public get logo_url(): string {
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 {
private title = "<h1>TITLE</h1>";
public title = "<h1>TITLE</h1>";
public created(): void {
super.created();

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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