Merge branch 'master' of gitlab.com:mcrapts/sensor-web-v2
This commit is contained in:
7
.prettierrc
Normal file
7
.prettierrc
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"semi": false,
|
||||||
|
"arrowParens": "always",
|
||||||
|
"singleQuote": true,
|
||||||
|
"printWidth": 120,
|
||||||
|
"trailingComma": "none"
|
||||||
|
}
|
||||||
@@ -3,5 +3,5 @@ WORKDIR /app
|
|||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN npm install
|
RUN npm install
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN npm run build
|
RUN npm run build --modern
|
||||||
CMD ["node", "server"]
|
CMD ["node", "server"]
|
||||||
9476
package-lock.json
generated
9476
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
25
package.json
25
package.json
@@ -13,22 +13,21 @@
|
|||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"highcharts": "^7.1.2",
|
"highcharts": "^7.1.2",
|
||||||
"mongodb": "^3.2.7",
|
"mongodb": "^3.2.7",
|
||||||
"vue": "^2.6.10",
|
"vue": "^3.0.3",
|
||||||
"vue-router": "^3.0.3",
|
"vue-router": "^4.0.0-rc.5"
|
||||||
"vuex": "^3.0.1"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vue/cli-plugin-babel": "^3.8.0",
|
"@vue/cli-plugin-babel": "^4.5.4",
|
||||||
"@vue/cli-plugin-eslint": "^3.8.0",
|
"@vue/cli-plugin-eslint": "^4.5.4",
|
||||||
"@vue/cli-service": "^3.8.0",
|
"@vue/cli-service": "^4.5.4",
|
||||||
|
"@vue/compiler-sfc": "^3.0.3",
|
||||||
"@vue/eslint-config-standard": "^4.0.0",
|
"@vue/eslint-config-standard": "^4.0.0",
|
||||||
"babel-eslint": "^10.0.1",
|
"babel-eslint": "^10.1.0",
|
||||||
"bulma": "^0.7.5",
|
"bulma": "^0.7.5",
|
||||||
"eslint": "^5.16.0",
|
"eslint": "^6.7.2",
|
||||||
"eslint-plugin-vue": "^5.0.0",
|
"eslint-plugin-vue": "^7.1.0",
|
||||||
"node-sass": "^4.9.0",
|
"node-sass": "^4.12.0",
|
||||||
"sass-loader": "^7.1.0",
|
"sass-loader": "^8.0.2"
|
||||||
"vue-template-compiler": "^2.6.10"
|
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"root": true,
|
"root": true,
|
||||||
@@ -36,7 +35,7 @@
|
|||||||
"node": true
|
"node": true
|
||||||
},
|
},
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:vue/essential",
|
"plugin:vue/vue3-essential",
|
||||||
"@vue/standard"
|
"@vue/standard"
|
||||||
],
|
],
|
||||||
"rules": {
|
"rules": {
|
||||||
|
|||||||
67
src/App.vue
67
src/App.vue
@@ -1,68 +1,3 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="app">
|
<router-view></router-view>
|
||||||
<NavBar :activeType="type" @setType="setType"></NavBar>
|
|
||||||
<section class="section">
|
|
||||||
<TimeWindows :activeWindow="window" @setWindow="setWindow"></TimeWindows>
|
|
||||||
<Chart :window="window" :type="type"></Chart>
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
<script>
|
|
||||||
import NavBar from '@/components/NavBar'
|
|
||||||
import TimeWindows from '@/components/TimeWindows'
|
|
||||||
import Chart from '@/components/Chart'
|
|
||||||
export default {
|
|
||||||
components: {
|
|
||||||
NavBar,
|
|
||||||
TimeWindows,
|
|
||||||
Chart
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
type: null,
|
|
||||||
window: {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
const { type, window } = this.$route.params
|
|
||||||
if (type) this.type = type
|
|
||||||
if (window) this.window = window
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
setType(type) {
|
|
||||||
this.type = type
|
|
||||||
this.updateRoute()
|
|
||||||
},
|
|
||||||
setWindow(window) {
|
|
||||||
this.window = window
|
|
||||||
this.updateRoute()
|
|
||||||
},
|
|
||||||
updateRoute() {
|
|
||||||
if (this.type) {
|
|
||||||
this.$router.push({
|
|
||||||
name: 'view',
|
|
||||||
params: {
|
|
||||||
type: this.type,
|
|
||||||
window: this.window.label ? this.window.label.replace(' ', '-') : undefined
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<style scoped>
|
|
||||||
#app {
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
#app,
|
|
||||||
.section {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
flex-grow: 1;
|
|
||||||
}
|
|
||||||
.section {
|
|
||||||
padding-bottom: 0;
|
|
||||||
padding-top: 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="chart-container">
|
<div class="chart-container">
|
||||||
<Loader v-if="loading"></Loader>
|
<Loader v-if="loading"></Loader>
|
||||||
<div class="chart" ref="chart" v-else></div>
|
<div class="chart" id="chart" ref="chart" v-else></div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import { ref, watch, toRefs, nextTick } from 'vue'
|
||||||
import Highcharts from 'highcharts'
|
import Highcharts from 'highcharts'
|
||||||
import 'highcharts/css/highcharts.scss'
|
import 'highcharts/css/highcharts.scss'
|
||||||
import Loader from '@/components/Loader'
|
import Loader from '@/components/Loader'
|
||||||
@@ -20,46 +21,39 @@ export default {
|
|||||||
components: {
|
components: {
|
||||||
Loader
|
Loader
|
||||||
},
|
},
|
||||||
data() {
|
setup(props) {
|
||||||
return {
|
const data = ref([])
|
||||||
data: [],
|
const loading = ref(false)
|
||||||
loading: false
|
const chart = ref(null)
|
||||||
}
|
const { window, type } = toRefs(props)
|
||||||
},
|
|
||||||
methods: {
|
const fetchData = async () => {
|
||||||
async fetchData() {
|
if (window.value && type.value) {
|
||||||
if (this.window.label) {
|
loading.value = true
|
||||||
this.loading = true
|
|
||||||
const typeApi = {
|
const typeApi = {
|
||||||
temperatuur: 'temperature',
|
temperatuur: 'temperature',
|
||||||
luchtvochtigheid: 'humidity'
|
luchtvochtigheid: 'humidity'
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const [start, end] = [this.window.getStart(), this.window.getEnd()]
|
const [start, end] = [window.value.getStart(), window.value.getEnd()]
|
||||||
const sample = Math.round(((end - start) / 60) / 288) || 1
|
const sample = Math.round((end - start) / 60 / 288) || 1
|
||||||
const host = process.env.NODE_ENV === 'development' ? 'http://localhost:3000' : ''
|
const host = process.env.NODE_ENV === 'development' ? 'http://localhost:3000' : ''
|
||||||
const fetchUrl = `${host}/type/${typeApi[this.type]}/startDate/${start}/endDate/${end}/sample/${sample}`
|
const fetchUrl = `${host}/type/${typeApi[type.value]}/startDate/${start}/endDate/${end}/sample/${sample}`
|
||||||
const response = await fetch(fetchUrl)
|
const response = await fetch(fetchUrl)
|
||||||
this.data = await response.json()
|
data.value = await response.json()
|
||||||
this.loading = false
|
loading.value = false
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
renderChart() {
|
const renderChart = () => {
|
||||||
const type = this.type
|
const chartData = data.value.map(({ date, value }) => ({ x: date * 1000, y: value }))
|
||||||
const data = this.data.map(({ date, value }) => ({ x: date * 1000, y: value }))
|
Highcharts.chart(chart.value, {
|
||||||
Highcharts.chart(this.$refs.chart, {
|
|
||||||
chart: { styledMode: true, marginBottom: 25 },
|
chart: { styledMode: true, marginBottom: 25 },
|
||||||
title: { text: '' },
|
title: { text: '' },
|
||||||
legend: { enabled: false },
|
legend: { enabled: false },
|
||||||
plotOptions: {
|
plotOptions: { series: { animation: false, marker: { enabled: false } } },
|
||||||
series: {
|
|
||||||
animation: false,
|
|
||||||
marker: { enabled: false }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
xAxis: {
|
xAxis: {
|
||||||
type: 'datetime',
|
type: 'datetime',
|
||||||
dateTimeLabelFormats: {
|
dateTimeLabelFormats: {
|
||||||
@@ -69,41 +63,42 @@ export default {
|
|||||||
hour: '%H:%M',
|
hour: '%H:%M',
|
||||||
day: '%a %e %b',
|
day: '%a %e %b',
|
||||||
week: '%e %b',
|
week: '%e %b',
|
||||||
month: '%b \'%y',
|
month: "%b '%y",
|
||||||
year: '%Y'
|
year: '%Y'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
labels: {
|
labels: {
|
||||||
formatter() {
|
formatter() {
|
||||||
const suffix = type === 'temperatuur' ? '°C' : '%'
|
const suffix = type.value === 'temperatuur' ? '°C' : '%'
|
||||||
return this.value + suffix
|
return this.value + suffix
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
title: { enabled: false },
|
title: { enabled: false },
|
||||||
minTickInterval: 0.1
|
minTickInterval: 0.1
|
||||||
},
|
},
|
||||||
series: [{ name: capitalizeFirstLetter(type), data }],
|
series: [{ name: capitalizeFirstLetter(type.value), data: chartData }],
|
||||||
credits: { enabled: false }
|
credits: { enabled: false }
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
watch([window, type], ([newWindow, newType], [oldWindow, oldType]) => {
|
||||||
watch: {
|
if (newWindow !== oldWindow || newType !== oldType) {
|
||||||
window() {
|
fetchData()
|
||||||
this.fetchData()
|
}
|
||||||
},
|
})
|
||||||
type() {
|
watch(data, () => {
|
||||||
this.fetchData()
|
nextTick(() => renderChart())
|
||||||
},
|
})
|
||||||
data() {
|
return {
|
||||||
this.$nextTick(() => this.renderChart())
|
loading,
|
||||||
|
chart
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
@import "@/style/_variables.scss";
|
@import '@/style/_variables.scss';
|
||||||
.chart-container {
|
.chart-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|||||||
74
src/components/Main.vue
Normal file
74
src/components/Main.vue
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
<template>
|
||||||
|
<div id="app">
|
||||||
|
<NavBar :activeType="type" @set-type="setType"></NavBar>
|
||||||
|
<section class="section">
|
||||||
|
<TimeWindows :activeWindow="window" @set-window="setWindow"></TimeWindows>
|
||||||
|
<Chart :window="window" :type="type"></Chart>
|
||||||
|
</section>
|
||||||
|
<router-view></router-view>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
|
import NavBar from '@/components/NavBar'
|
||||||
|
import TimeWindows from '@/components/TimeWindows'
|
||||||
|
import Chart from '@/components/Chart'
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
NavBar,
|
||||||
|
TimeWindows,
|
||||||
|
Chart
|
||||||
|
},
|
||||||
|
setup() {
|
||||||
|
const type = ref(null)
|
||||||
|
const window = ref({})
|
||||||
|
const router = useRouter()
|
||||||
|
const currentRoute = router.currentRoute
|
||||||
|
if (currentRoute.value.params.type) type.value = currentRoute.value.params.type
|
||||||
|
if (currentRoute.value.params.window) window.value = { label: currentRoute.value.params.window }
|
||||||
|
console.log(type.value, window.value)
|
||||||
|
const updateRoute = () => {
|
||||||
|
if (type.value) {
|
||||||
|
const route = {
|
||||||
|
name: 'view',
|
||||||
|
params: {
|
||||||
|
type: type.value,
|
||||||
|
window: window.value.label ? window.value.label.replace(' ', '-') : undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
router.push(route)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const setType = (newType) => {
|
||||||
|
type.value = newType
|
||||||
|
updateRoute()
|
||||||
|
}
|
||||||
|
const setWindow = (newWindow) => {
|
||||||
|
window.value = newWindow
|
||||||
|
updateRoute()
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
type,
|
||||||
|
window,
|
||||||
|
setType,
|
||||||
|
setWindow
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
#app {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
#app,
|
||||||
|
.section {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
flex-grow: 1;
|
||||||
|
}
|
||||||
|
.section {
|
||||||
|
padding-bottom: 0;
|
||||||
|
padding-top: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
aria-label="menu"
|
aria-label="menu"
|
||||||
aria-expanded="false"
|
aria-expanded="false"
|
||||||
data-target="navbarBasicExample"
|
data-target="navbarBasicExample"
|
||||||
:class="{'is-active': toggled}"
|
:class="{ 'is-active': toggled }"
|
||||||
@click="toggleMenu"
|
@click="toggleMenu"
|
||||||
>
|
>
|
||||||
<span aria-hidden="true"></span>
|
<span aria-hidden="true"></span>
|
||||||
@@ -17,60 +17,58 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="navbar-menu" :class="{'is-active': toggled}">
|
<div class="navbar-menu" :class="{ 'is-active': toggled }">
|
||||||
<div class="navbar-start">
|
<div class="navbar-start">
|
||||||
<a
|
<a
|
||||||
class="navbar-item"
|
class="navbar-item"
|
||||||
:class="{'is-active': type === activeType}"
|
:class="{ 'is-active': type === activeType }"
|
||||||
:key="type"
|
:key="type"
|
||||||
v-for="type in navTypes"
|
v-for="type in navTypes"
|
||||||
@click="setType(type)"
|
@click="setType(type)"
|
||||||
>{{capitalizeFirstLetter(type)}}</a>
|
>{{ capitalizeFirstLetter(type) }}</a
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import { ref, onMounted } from 'vue'
|
||||||
import { capitalizeFirstLetter } from '@/utils/helpers'
|
import { capitalizeFirstLetter } from '@/utils/helpers'
|
||||||
export default {
|
export default {
|
||||||
props: ['activeType'],
|
props: ['activeType'],
|
||||||
data() {
|
setup(props, { emit }) {
|
||||||
|
const toggled = ref(false)
|
||||||
|
const navTypes = ref(['temperatuur', 'luchtvochtigheid'])
|
||||||
|
onMounted(() => {
|
||||||
|
if (!props.activeType) {
|
||||||
|
emit('set-type', navTypes.value[0])
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const toggleMenu = () => {
|
||||||
|
toggled.value = !toggled.value
|
||||||
|
}
|
||||||
|
const setType = (type) => {
|
||||||
|
toggled.value = false
|
||||||
|
emit('set-type', type)
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
toggled: false
|
capitalizeFirstLetter,
|
||||||
}
|
navTypes,
|
||||||
},
|
toggled,
|
||||||
computed: {
|
toggleMenu,
|
||||||
navTypes() {
|
setType
|
||||||
return ['temperatuur', 'luchtvochtigheid']
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
if (!this.activeType) {
|
|
||||||
this.$emit('setType', this.navTypes[0])
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
toggleMenu() {
|
|
||||||
this.toggled = !this.toggled
|
|
||||||
},
|
|
||||||
capitalizeFirstLetter(string) {
|
|
||||||
return capitalizeFirstLetter(string)
|
|
||||||
},
|
|
||||||
setType(type) {
|
|
||||||
this.toggled = false
|
|
||||||
this.$emit('setType', type)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@import "@/style/_variables.scss";
|
@import '@/style/_variables.scss';
|
||||||
.nav-title {
|
.nav-title {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
@media screen and (max-width: $navbar-breakpoint) {
|
@media screen and (max-width: $navbar-breakpoint) {
|
||||||
.navbar {
|
.navbar {
|
||||||
position: relative
|
position: relative;
|
||||||
}
|
}
|
||||||
.navbar-menu {
|
.navbar-menu {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|||||||
@@ -4,75 +4,83 @@
|
|||||||
<li
|
<li
|
||||||
v-for="window in windows"
|
v-for="window in windows"
|
||||||
:key="window.label"
|
:key="window.label"
|
||||||
@click="$emit('setWindow', window)"
|
@click="$emit('set-window', window)"
|
||||||
:class="{'is-active': window.label === activeWindow.label}"
|
:class="{ 'is-active': window.label === activeWindow.label }"
|
||||||
>
|
>
|
||||||
<a>{{window.label}}</a>
|
<a>{{ window.label }}</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import { ref, onMounted } from 'vue'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
activeWindow: {
|
activeWindow: {
|
||||||
type: [Object, String]
|
type: Object
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
setup(props, { emit }) {
|
||||||
return {
|
const windows = ref([
|
||||||
windows: [{
|
{
|
||||||
label: 'afgelopen uur',
|
label: 'afgelopen uur',
|
||||||
getStart: () => dayjs().subtract(1, 'hour').unix(),
|
getStart: () => dayjs().subtract(1, 'hour').unix(),
|
||||||
getEnd: () => dayjs().unix(),
|
getEnd: () => dayjs().unix(),
|
||||||
format: 'HH:mm',
|
format: 'HH:mm',
|
||||||
interval: 4
|
interval: 4
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
label: '24 uur',
|
label: '24 uur',
|
||||||
getStart: () => dayjs().subtract(1, 'days').unix(),
|
getStart: () => dayjs().subtract(1, 'days').unix(),
|
||||||
getEnd: () => dayjs().unix(),
|
getEnd: () => dayjs().unix(),
|
||||||
format: 'HH:mm',
|
format: 'HH:mm',
|
||||||
interval: 4
|
interval: 4
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
label: 'vandaag',
|
label: 'vandaag',
|
||||||
getStart: () => dayjs().startOf('day').add(1, 'day').subtract(24, 'hours').unix(),
|
getStart: () => dayjs().startOf('day').add(1, 'day').subtract(24, 'hours').unix(),
|
||||||
getEnd: () => dayjs().unix(),
|
getEnd: () => dayjs().unix(),
|
||||||
format: 'HH:mm',
|
format: 'HH:mm',
|
||||||
interval: 4
|
interval: 4
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
label: '3 dagen',
|
label: '3 dagen',
|
||||||
getStart: () => dayjs().startOf('day').add(1, 'day').subtract(3, 'days').unix(),
|
getStart: () => dayjs().startOf('day').add(1, 'day').subtract(3, 'days').unix(),
|
||||||
getEnd: () => dayjs().unix(),
|
getEnd: () => dayjs().unix(),
|
||||||
format: 'ddd D/M',
|
format: 'ddd D/M',
|
||||||
interval: 24
|
interval: 24
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
label: 'week',
|
label: 'week',
|
||||||
getStart: () => dayjs().startOf('day').add(1, 'day').subtract(7, 'days').unix(),
|
getStart: () => dayjs().startOf('day').add(1, 'day').subtract(7, 'days').unix(),
|
||||||
getEnd: () => dayjs().unix(),
|
getEnd: () => dayjs().unix(),
|
||||||
format: 'ddd D/M',
|
format: 'ddd D/M',
|
||||||
interval: 24
|
interval: 24
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
label: 'maand',
|
label: 'maand',
|
||||||
getStart: () => dayjs().startOf('day').add(1, 'day').subtract(1, 'months').unix(),
|
getStart: () => dayjs().startOf('day').add(1, 'day').subtract(1, 'months').unix(),
|
||||||
getEnd: () => dayjs().unix(),
|
getEnd: () => dayjs().unix(),
|
||||||
format: 'ddd D/M',
|
format: 'ddd D/M',
|
||||||
interval: 24
|
interval: 24
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
label: 'jaar',
|
label: 'jaar',
|
||||||
getStart: () => dayjs().startOf('day').add(1, 'day').subtract(1, 'year').unix(),
|
getStart: () => dayjs().startOf('day').add(1, 'day').subtract(1, 'year').unix(),
|
||||||
getEnd: () => dayjs().unix(),
|
getEnd: () => dayjs().unix(),
|
||||||
format: 'ddd D/M',
|
format: 'ddd D/M',
|
||||||
interval: 24 * 7
|
interval: 24 * 7
|
||||||
}]
|
|
||||||
}
|
}
|
||||||
},
|
])
|
||||||
mounted() {
|
onMounted(() => {
|
||||||
if (typeof this.activeWindow === 'string') {
|
const activeWindow = !props.activeWindow.label
|
||||||
const window = this.windows.find(w => w.label === this.activeWindow.replace('-', ' '))
|
? windows.value[1]
|
||||||
this.$emit('setWindow', window)
|
: windows.value.find((w) => w.label === props.activeWindow.label.replace('-', ' '))
|
||||||
} else if (!this.activeWindow.label) {
|
emit('set-window', activeWindow)
|
||||||
this.$emit('setWindow', this.windows[1])
|
})
|
||||||
|
return {
|
||||||
|
windows
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
13
src/main.js
13
src/main.js
@@ -1,13 +1,8 @@
|
|||||||
import Vue from 'vue'
|
import { createApp } from 'vue'
|
||||||
import App from '@/App'
|
import App from '@/App'
|
||||||
import router from '@/router'
|
import router from '@/router'
|
||||||
import store from '@/store'
|
|
||||||
import '@/style/style.scss'
|
import '@/style/style.scss'
|
||||||
|
|
||||||
Vue.config.productionTip = false
|
const app = createApp(App)
|
||||||
|
app.use(router)
|
||||||
new Vue({
|
app.mount('body')
|
||||||
router,
|
|
||||||
store,
|
|
||||||
render: h => h(App)
|
|
||||||
}).$mount('#app')
|
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
import Vue from 'vue'
|
import { createRouter, createWebHistory } from 'vue-router'
|
||||||
import Router from 'vue-router'
|
import Main from '@/components/Main'
|
||||||
|
export default createRouter({
|
||||||
Vue.use(Router)
|
history: createWebHistory(),
|
||||||
|
|
||||||
export default new Router({
|
|
||||||
mode: 'history',
|
|
||||||
base: process.env.BASE_URL,
|
base: process.env.BASE_URL,
|
||||||
routes: [
|
routes: [
|
||||||
{
|
{
|
||||||
path: '/:type/:window?',
|
path: '/:type?/:window?',
|
||||||
name: 'view'
|
name: 'view',
|
||||||
|
component: Main
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|||||||
16
src/store.js
16
src/store.js
@@ -1,16 +0,0 @@
|
|||||||
import Vue from 'vue'
|
|
||||||
import Vuex from 'vuex'
|
|
||||||
|
|
||||||
Vue.use(Vuex)
|
|
||||||
|
|
||||||
export default new Vuex.Store({
|
|
||||||
state: {
|
|
||||||
|
|
||||||
},
|
|
||||||
mutations: {
|
|
||||||
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
|
|
||||||
}
|
|
||||||
})
|
|
||||||
Reference in New Issue
Block a user