#54 code clean up

pull/1/head
Thomas Ballmann 3 years ago
parent 0d67bdd530
commit f8af7762a6

@ -1,32 +0,0 @@
<template>
<v-container>
<v-row class="text-center">
<v-col cols="12">
<v-img
:src="require('../assets/logo.png')"
class="my-3"
contain
height="200"
/>
</v-col>
<v-col class="mb-4">
<h1 class="display-2 font-weight-bold mb-3">
paperdash.io Display
</h1>
</v-col>
</v-row>
</v-container>
</template>
<script>
export default {
name: 'HelloWorld',
data: () => ({
ecosystem: [],
importantLinks: [],
whatsNext: [],
}),
}
</script>

@ -4,19 +4,6 @@
timeout="-1"
>
{{ notifications }}
<!--
<template v-slot:action="{ attrs }">
<v-btn
color="pink"
text
v-bind="attrs"
@click="snackbar = false"
>
Close
</v-btn>
</template>
-->
</v-snackbar>
</template>

@ -18,7 +18,7 @@
</template>
<script>
import weatherFindLocation from '@/components/WeatherFindLocation'
import weatherFindLocation from '@/components/Weather/FindLocation'
export default {
components: {

@ -28,7 +28,6 @@
<v-col cols="6">
<v-img
:src="currentConditionIcon"
alt
width="92"
/>
</v-col>
@ -149,7 +148,7 @@
this.isUpdatingData = true
weatherApi.updateWeather(() => {
// TODO reload json
// TODO trigger esp weather data reload
this.isUpdatingData = false
this.loadData()

@ -6,7 +6,7 @@
:loading="isLoading"
:search-input.sync="searchInput"
no-filter
_hide-no-data
hide-no-data
item-text="name"
item-value="id"
label="Location"

@ -3,6 +3,7 @@ import App from './App.vue'
import router from './router'
import store from './store'
import vuetify from './plugins/vuetify'
import './plugins/tools'
Vue.config.productionTip = false

@ -0,0 +1,77 @@
import Vue from 'vue'
// usage: {{ file.size | prettyBytes }}
Vue.filter('prettyBytes', function (num) {
// jacked from: https://github.com/sindresorhus/pretty-bytes
if (typeof num !== 'number' || isNaN(num)) {
throw new TypeError('Expected a number')
}
var exponent
var unit
var neg = num < 0
var units = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
if (neg) {
num = -num
}
if (num < 1) {
return (neg ? '-' : '') + num + ' B'
}
exponent = Math.min(Math.floor(Math.log(num) / Math.log(1000)), units.length - 1)
num = (num / Math.pow(1000, exponent)).toFixed(2) * 1
unit = units[exponent]
return (neg ? '-' : '') + num + ' ' + unit
})
/**
* Vue filter to round the decimal to the given place.
* http://jsfiddle.net/bryan_k/3ova17y9/
*
* @param {String} value The value string.
* @param {Number} decimals The number of decimal places.
*/
Vue.filter('round', function (value, decimals) {
if (!value) {
value = 0
}
if (!decimals) {
decimals = 0
}
value = Math.round(value * Math.pow(10, decimals)) / Math.pow(10, decimals)
return value
})
/**
* usage: {{ wifi.rssi | wifiIcon(wifi.secure) }}
* @param {Number} rssi rssi value
* @param {Boolean} secure Is wifi protected
*/
Vue.filter('wifiIcon', function (rssi, secure) {
let icon = '$signalWifi'
// strength
if (rssi >= -67) {
icon += 4
} else if (rssi >= -70) {
icon += 3
} else if (rssi >= -80) {
icon += 2
} else if (rssi >= -90) {
icon += 1
} else {
icon += 0
}
// secure
if (secure !== 0 && rssi >= -90) {
icon += 'Lock'
}
return icon
})

@ -96,82 +96,6 @@ const MY_ICONS = {
Vue.use(Vuetify)
// usage: {{ file.size | prettyBytes }}
Vue.filter('prettyBytes', function (num) {
// jacked from: https://github.com/sindresorhus/pretty-bytes
if (typeof num !== 'number' || isNaN(num)) {
throw new TypeError('Expected a number')
}
var exponent
var unit
var neg = num < 0
var units = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
if (neg) {
num = -num
}
if (num < 1) {
return (neg ? '-' : '') + num + ' B'
}
exponent = Math.min(Math.floor(Math.log(num) / Math.log(1000)), units.length - 1)
num = (num / Math.pow(1000, exponent)).toFixed(2) * 1
unit = units[exponent]
return (neg ? '-' : '') + num + ' ' + unit
})
/**
* Vue filter to round the decimal to the given place.
* http://jsfiddle.net/bryan_k/3ova17y9/
*
* @param {String} value The value string.
* @param {Number} decimals The number of decimal places.
*/
Vue.filter('round', function (value, decimals) {
if (!value) {
value = 0
}
if (!decimals) {
decimals = 0
}
value = Math.round(value * Math.pow(10, decimals)) / Math.pow(10, decimals)
return value
})
/**
* usage: {{ wifi.rssi | wifiIcon(wifi.secure) }}
* @param {Number} rssi rssi value
* @param {Boolean} secure Is wifi protected
*/
Vue.filter('wifiIcon', function (rssi, secure) {
let icon = '$signalWifi'
// strength
if (rssi >= -67) {
icon += 4
} else if (rssi >= -70) {
icon += 3
} else if (rssi >= -80) {
icon += 2
} else if (rssi >= -90) {
icon += 1
} else {
icon += 0
}
// secure
if (secure !== 0 && rssi >= -90) {
icon += 'Lock'
}
return icon
})
const opts = {
icons: {
iconfont: '',

@ -53,7 +53,7 @@
<script>
import { mapState, mapMutations, mapActions } from 'vuex'
import SetupPanel from '@/components/SetupPanel'
import SetupPanel from '@/components/Setup/BasePanel'
import DeviceSimulator from '@/components/DeviceSimulator'
export default {
@ -96,7 +96,7 @@
this.$router.push('/setup/done')
},
stepBack () {
this.$router.push('/setup/weather')
this.$router.push('/setup/name')
},
},
}

@ -31,7 +31,7 @@
<script>
import { mapState } from 'vuex'
import SetupPanel from '@/components/SetupPanel'
import SetupPanel from '@/components/Setup/BasePanel'
import DeviceSimulator from '@/components/DeviceSimulator'
export default {

@ -10,12 +10,6 @@
Give it a name
</template>
<p
class="text-center"
>
TODO:Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam
</p>
<v-card-text>
<v-text-field
v-model="form.name"
@ -49,7 +43,7 @@
<script>
import { mapState, mapMutations, mapActions } from 'vuex'
import randomNames from '@/assets/fantasyNames.json'
import SetupPanel from '@/components/SetupPanel'
import SetupPanel from '@/components/Setup/BasePanel'
export default {
components: { SetupPanel },

@ -27,7 +27,7 @@
</template>
<script>
import SetupPanel from '@/components/SetupPanel'
import SetupPanel from '@/components/Setup/BasePanel'
const SvgCase = () => import('@/assets/case_editor.svg?inline')
export default {

@ -54,8 +54,8 @@
<script>
import { mapState, mapMutations, mapActions } from 'vuex'
import weatherFindLocation from '@/components/WeatherFindLocation'
import SetupPanel from '@/components/SetupPanel'
import weatherFindLocation from '@/components/Weather/FindLocation'
import SetupPanel from '@/components/Setup/BasePanel'
export default {
components: {

@ -90,8 +90,8 @@
<script>
import apiDevice from '@/api/device'
import setupWifiConnect from '@/components/SetupWifiConnect'
import SetupPanel from '@/components/SetupPanel'
import setupWifiConnect from '@/components/Setup/WifiConnect'
import SetupPanel from '@/components/Setup/BasePanel'
export default {
components: {
@ -138,7 +138,7 @@
setTimeout(() => {
// phone should be back in regular wifi
// search for device via mDNS
window.location = 'http://paperdash-display.local'
window.location = 'http://paperdash-epd.local'
}, 5000)
})
},

@ -73,7 +73,7 @@
<script>
import { mapState, mapActions, mapMutations } from 'vuex'
import WeatherFindLocation from '@/components/WeatherFindLocation'
import WeatherFindLocation from '@/components/Weather/FindLocation'
export default {
components: {
WeatherFindLocation,

@ -135,7 +135,7 @@
<script>
import { mapState } from 'vuex'
import setupWifiConnect from '@/components/SetupWifiConnect'
import setupWifiConnect from '@/components/Setup/WifiConnect'
import apiDevice from '@/api/device'
export default {

Loading…
Cancel
Save