2019-10-19 16:58:10 +03:00
|
|
|
<template>
|
2020-06-26 04:39:14 -07:00
|
|
|
<v-app>
|
|
|
|
|
<v-app-bar
|
|
|
|
|
app
|
|
|
|
|
dense
|
|
|
|
|
clipped-left
|
2020-06-28 03:11:09 -07:00
|
|
|
color="#006492"
|
2020-06-26 04:39:14 -07:00
|
|
|
dark
|
|
|
|
|
>
|
|
|
|
|
<img
|
|
|
|
|
class="imgClass"
|
|
|
|
|
src="./assets/logo.png"
|
|
|
|
|
>
|
|
|
|
|
<div class="flex-grow-1" />
|
|
|
|
|
<v-toolbar-items>
|
|
|
|
|
<v-tabs
|
2020-06-28 03:11:09 -07:00
|
|
|
background-color="#006492"
|
2020-06-26 04:39:14 -07:00
|
|
|
dark
|
|
|
|
|
height="48"
|
2020-06-28 03:11:09 -07:00
|
|
|
slider-color="#ffd843"
|
2020-06-26 04:39:14 -07:00
|
|
|
>
|
|
|
|
|
<v-tab to="vision">
|
|
|
|
|
Vision
|
|
|
|
|
</v-tab>
|
|
|
|
|
<v-tab to="settings">
|
|
|
|
|
Settings
|
|
|
|
|
</v-tab>
|
|
|
|
|
</v-tabs>
|
|
|
|
|
</v-toolbar-items>
|
|
|
|
|
</v-app-bar>
|
|
|
|
|
<v-content>
|
|
|
|
|
<v-container
|
|
|
|
|
fluid
|
|
|
|
|
fill-height
|
|
|
|
|
>
|
|
|
|
|
<v-layout>
|
|
|
|
|
<v-flex>
|
|
|
|
|
<router-view @save="startTimer" />
|
|
|
|
|
<v-snackbar
|
|
|
|
|
v-model="saveSnackbar"
|
|
|
|
|
:timeout="1000"
|
|
|
|
|
top
|
2020-06-28 03:11:09 -07:00
|
|
|
color="#ffd843"
|
2020-06-26 04:39:14 -07:00
|
|
|
>
|
|
|
|
|
<div style="text-align: center;width: 100%;">
|
|
|
|
|
<h4>Saved All changes</h4>
|
|
|
|
|
</div>
|
|
|
|
|
</v-snackbar>
|
|
|
|
|
<div v-if="isLogger">
|
|
|
|
|
<keep-alive>
|
|
|
|
|
<log-view
|
|
|
|
|
class="loggerClass"
|
|
|
|
|
:log="log"
|
|
|
|
|
/>
|
|
|
|
|
</keep-alive>
|
|
|
|
|
</div>
|
|
|
|
|
</v-flex>
|
|
|
|
|
</v-layout>
|
|
|
|
|
</v-container>
|
|
|
|
|
</v-content>
|
|
|
|
|
</v-app>
|
2019-03-10 22:29:29 +02:00
|
|
|
</template>
|
2019-03-18 00:23:31 +02:00
|
|
|
|
2019-03-10 22:29:29 +02:00
|
|
|
<script>
|
2020-06-26 04:39:14 -07:00
|
|
|
import logView from '@femessage/log-viewer'
|
|
|
|
|
|
2019-10-29 23:58:06 +02:00
|
|
|
export default {
|
|
|
|
|
name: 'App',
|
2020-06-26 04:39:14 -07:00
|
|
|
components: {
|
|
|
|
|
logView
|
|
|
|
|
},
|
|
|
|
|
data: () => ({
|
|
|
|
|
timer: undefined,
|
|
|
|
|
isLogger: false,
|
|
|
|
|
log: ""
|
|
|
|
|
}),
|
|
|
|
|
computed: {
|
|
|
|
|
saveSnackbar: {
|
|
|
|
|
get() {
|
|
|
|
|
return this.$store.state.saveBar;
|
|
|
|
|
},
|
|
|
|
|
set(value) {
|
|
|
|
|
this.$store.commit("saveBar", value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
document.addEventListener("keydown", e => {
|
|
|
|
|
switch (e.key) {
|
|
|
|
|
case '`' :
|
|
|
|
|
this.isLogger = !this.isLogger;
|
|
|
|
|
break;
|
|
|
|
|
case "z":
|
|
|
|
|
if (e.ctrlKey && this.$store.getters.canUndo) {
|
|
|
|
|
this.$store.dispatch('undo', {vm: this});
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case "y":
|
|
|
|
|
if (e.ctrlKey && this.$store.getters.canRedo) {
|
|
|
|
|
this.$store.dispatch('redo', {vm: this});
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.$options.sockets.onmessage = (data) => {
|
|
|
|
|
try {
|
|
|
|
|
let message = this.$msgPack.decode(data.data);
|
|
|
|
|
for (let prop in message) {
|
|
|
|
|
if (message.hasOwnProperty(prop)) {
|
|
|
|
|
this.handleMessage(prop, message[prop]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('error: ' + data.data + " , " + error);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2019-10-29 23:58:06 +02:00
|
|
|
methods: {
|
|
|
|
|
handleMessage(key, value) {
|
|
|
|
|
if (this.$store.state.hasOwnProperty(key)) {
|
|
|
|
|
this.$store.commit(key, value);
|
|
|
|
|
} else if (this.$store.state.pipeline.hasOwnProperty(key)) {
|
2020-05-25 22:46:44 +03:00
|
|
|
this.$store.commit('mutatePipeline', {'key': key, 'value': value});
|
2019-10-29 23:58:06 +02:00
|
|
|
} else {
|
|
|
|
|
switch (key) {
|
|
|
|
|
default: {
|
|
|
|
|
console.log(key + " : " + value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-11-01 17:10:48 +02:00
|
|
|
},
|
|
|
|
|
saveSettings() {
|
|
|
|
|
clearInterval(this.timer);
|
|
|
|
|
this.saveSnackbar = true;
|
|
|
|
|
this.handleInput("command", "save");
|
|
|
|
|
},
|
|
|
|
|
startTimer() {
|
|
|
|
|
if (this.timer !== undefined) {
|
|
|
|
|
clearInterval(this.timer);
|
|
|
|
|
}
|
|
|
|
|
this.timer = setInterval(this.saveSettings, 4000);
|
2020-06-26 04:39:14 -07:00
|
|
|
},
|
|
|
|
|
logMessage({message, level}) {
|
|
|
|
|
const colors = ["\u001b[31m", "\u001b[32m", "\u001b[33m", "\u001b[34m"]
|
|
|
|
|
const reset = "\u001b[0m"
|
|
|
|
|
this.log += `${colors[level]}${message}${reset}\n`
|
2019-11-09 21:26:02 +02:00
|
|
|
}
|
2019-09-16 23:54:31 +03:00
|
|
|
}
|
2019-10-29 23:58:06 +02:00
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
.imgClass {
|
|
|
|
|
width: auto;
|
|
|
|
|
height: 45px;
|
|
|
|
|
vertical-align: middle;
|
|
|
|
|
padding-right: 5px;
|
2019-10-19 16:58:10 +03:00
|
|
|
}
|
2019-03-18 00:23:31 +02:00
|
|
|
|
2020-06-26 04:39:14 -07:00
|
|
|
.loggerClass {
|
|
|
|
|
position: absolute;
|
|
|
|
|
bottom: 0;
|
|
|
|
|
height: 25% !important;
|
|
|
|
|
left: 0;
|
|
|
|
|
right: 0;
|
|
|
|
|
box-shadow: #282828 0 0 5px 1px;
|
|
|
|
|
background-color: #2b2b2b;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
::-webkit-scrollbar {
|
|
|
|
|
width: 0.5em;
|
|
|
|
|
border-radius: 5px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
::-webkit-scrollbar-track {
|
|
|
|
|
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
|
|
|
|
|
border-radius: 10px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
::-webkit-scrollbar-thumb {
|
2020-06-28 03:11:09 -07:00
|
|
|
background-color: #ffd843;
|
2020-06-26 04:39:14 -07:00
|
|
|
border-radius: 10px;
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-29 23:58:06 +02:00
|
|
|
.container {
|
2020-06-28 03:11:09 -07:00
|
|
|
background-color: #232c37;
|
2019-10-29 23:58:06 +02:00
|
|
|
padding: 0 !important;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#title {
|
2020-06-28 03:11:09 -07:00
|
|
|
color: #ffd843;
|
2019-10-29 23:58:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
span {
|
|
|
|
|
color: white;
|
|
|
|
|
}
|
2019-03-16 21:47:34 +02:00
|
|
|
</style>
|