Fix lint issues

pull/482/head
Bastien Wirtz 2022-07-03 21:59:57 +02:00
parent b4207f2782
commit 59994bfee8
5 changed files with 37 additions and 32 deletions

View File

@ -11,4 +11,7 @@ module.exports = {
env: { env: {
"vue/setup-compiler-macros": true, "vue/setup-compiler-macros": true,
}, },
rules: {
"vue/multi-word-component-names": "off",
},
}; };

View File

@ -56,7 +56,9 @@ export default {
// extra check to make sure we're not offline // extra check to make sure we're not offline
let that = this; let that = this;
const aliveCheckUrl = `${window.location.origin}${window.location.pathname}/index.html?t=${new Date().valueOf()}`; const aliveCheckUrl = `${window.location.origin}${
window.location.pathname
}/index.html?t=${new Date().valueOf()}`;
return fetch(aliveCheckUrl, { return fetch(aliveCheckUrl, {
method: "HEAD", method: "HEAD",
cache: "no-store", cache: "no-store",

View File

@ -22,7 +22,7 @@
<div v-else> <div v-else>
<p class="title is-4">{{ name }}</p> <p class="title is-4">{{ name }}</p>
<p class="subtitle is-6"> <p class="subtitle is-6">
{{ temp | tempSuffix(this.item.units) }} {{ temperature }}
</p> </p>
</div> </div>
</div> </div>
@ -50,6 +50,19 @@ export default {
conditions: null, conditions: null,
error: false, error: false,
}), }),
computed: {
temperature: function () {
if (!this.temp) return "";
let unit = "K";
if (this.item.type === "metric") {
unit = "°C";
} else if (this.item.type === "imperial") {
unit = "°F";
}
return `${this.temp} ${unit}`;
},
},
created() { created() {
this.fetchWeather(); this.fetchWeather();
}, },
@ -86,19 +99,6 @@ export default {
}); });
}, },
}, },
filters: {
tempSuffix: function (value, type) {
if (!value) return "";
let unit = "K";
if (type === "metric") {
unit = "°C";
} else if (type === "imperial") {
unit = "°F";
}
return `${value} ${unit}`;
},
},
}; };
</script> </script>

View File

@ -99,6 +99,7 @@ export default {
}, },
}, },
created() { created() {
/* eslint-disable */
this.item.url = `${this.item.url}/status/${this.dashboard}`; this.item.url = `${this.item.url}/status/${this.dashboard}`;
this.fetchStatus(); this.fetchStatus();
}, },

View File

@ -1,4 +1,4 @@
import { VitePWA } from 'vite-plugin-pwa' import { VitePWA } from "vite-plugin-pwa";
import { fileURLToPath, URL } from "url"; import { fileURLToPath, URL } from "url";
import { defineConfig } from "vite"; import { defineConfig } from "vite";
@ -10,30 +10,30 @@ export default defineConfig({
assetsDir: "resources", assetsDir: "resources",
}, },
plugins: [ plugins: [
vue(), vue(),
VitePWA({ VitePWA({
registerType: 'autoUpdate', registerType: "autoUpdate",
useCredentials: true, useCredentials: true,
manifestFilename: "assets/manifest.json", manifestFilename: "assets/manifest.json",
manifest: { manifest: {
name: 'Homer dashboard', name: "Homer dashboard",
short_name: 'Homer', short_name: "Homer",
description: 'Home Server Dashboard', description: "Home Server Dashboard",
theme_color: '#3367D6', theme_color: "#3367D6",
icons: [ icons: [
{ {
src: 'pwa-192x192.png', src: "pwa-192x192.png",
sizes: '192x192', sizes: "192x192",
type: 'image/png' type: "image/png",
}, },
{ {
src: 'pwa-512x512.png', src: "pwa-512x512.png",
sizes: '512x512', sizes: "512x512",
type: 'image/png' type: "image/png",
} },
], ],
}, },
}) }),
], ],
resolve: { resolve: {
alias: { alias: {
@ -41,4 +41,3 @@ export default defineConfig({
}, },
}, },
}); });