WIP
This commit is contained in:
parent
cb2f9c69ab
commit
59d58b05ab
@ -1,21 +1,26 @@
|
||||
<template>
|
||||
<div>
|
||||
<span>
|
||||
<el-row>
|
||||
<el-col :span="6" class='text'>
|
||||
<el-col :span="3" class='text'>
|
||||
{{airport.icao}}
|
||||
</el-col>
|
||||
<el-col :span="10" class='text'>
|
||||
<el-col :span="6" class='text'>
|
||||
{{date}}
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-button @click="goto">Goto</el-button>
|
||||
<el-col :span="6" class='text'>
|
||||
{{upload_date}}
|
||||
</el-col>
|
||||
<el-col :span="9">
|
||||
<el-button @click="goto" class="button"><i class="fas fa-bullseye"></i></el-button>
|
||||
<el-button @click="remove" tooltip="Remove wip file" class="button"><i class="fas fa-trash-alt"></i></el-button>
|
||||
<el-button @click="upload" tooltip="Upload to groundweb" class="button"><i class="fas fa-upload"></i></el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="js">
|
||||
import {removeWip} from '../loaders/groundnet_functions'
|
||||
|
||||
/* eslint-disable */
|
||||
export default {
|
||||
name: 'airport',
|
||||
@ -34,6 +39,12 @@
|
||||
if (airports.length > 0) {
|
||||
this.$store.commit('CENTER', [airports[0].geometry.coordinates[1], airports[0].geometry.coordinates[0]])
|
||||
}
|
||||
},
|
||||
remove() {
|
||||
removeWip(this.$store.state.Settings.settings.airportsDirectory, this.airport.icao)
|
||||
this.$store.dispatch('removeWip', this.airport.icao);
|
||||
},
|
||||
upload() {
|
||||
|
||||
}
|
||||
},
|
||||
@ -41,6 +52,14 @@
|
||||
date: function () {
|
||||
var d = new Date(this.airport.time)
|
||||
return d.toLocaleDateString() + ' ' + d.toLocaleTimeString()
|
||||
},
|
||||
upload_date: function () {
|
||||
if( this.airport.upload !== undefined ) {
|
||||
var d = new Date(this.airport.upload)
|
||||
return d.toLocaleDateString() + ' ' + d.toLocaleTimeString()
|
||||
} else {
|
||||
return "-"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -52,4 +71,8 @@
|
||||
.text {
|
||||
padding: 10px;
|
||||
}
|
||||
.button {
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
}
|
||||
</style>
|
||||
|
@ -602,6 +602,7 @@
|
||||
node.extensions();
|
||||
}
|
||||
},
|
||||
// Finde nearest node
|
||||
closestLayerSnap (eventLatlng, snap) {
|
||||
var layers = []
|
||||
this.groundnetLayerGroup.eachLayer((layer) => {
|
||||
|
@ -62,6 +62,8 @@
|
||||
parent.$refs.upload.message == e.srcElement.statusText
|
||||
} else if(JSON.parse(e.srcElement.response).message.match('[A-Z0-9]* Imported Successfully')) {
|
||||
Vue.set(parent, 'uploadVisible', false)
|
||||
parent.$store.commit('UPLOAD_WIP', parent.$store.state.Airports.currentAirport.icao)
|
||||
|
||||
} else if(JSON.parse(e.srcElement.response).message === 'XML Errors') {
|
||||
var response = JSON.parse(e.srcElement.response);
|
||||
if (response.validationErrors) {
|
||||
|
@ -7,12 +7,15 @@
|
||||
</h1>
|
||||
<div>
|
||||
<el-row>
|
||||
<el-col :span="6" class="text">
|
||||
<el-col :span="3" class="text">
|
||||
ICAO
|
||||
</el-col>
|
||||
<el-col :span="10" class="text">
|
||||
<el-col :span="7" class="text">
|
||||
Edited
|
||||
</el-col>
|
||||
<el-col :span="9" class="text">
|
||||
Uploaded
|
||||
</el-col>
|
||||
<el-col :span="6" class="text">
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -40,7 +43,7 @@
|
||||
},
|
||||
computed: {
|
||||
wip: function () {
|
||||
return this.$store.state.Settings.wip.sort((p, p2) => { return p.date > p2.date })
|
||||
return this.$store.state.Settings.wip
|
||||
}
|
||||
}
|
||||
}
|
||||
|
10
src/renderer/loaders/groundnet_functions.js
Normal file
10
src/renderer/loaders/groundnet_functions.js
Normal file
@ -0,0 +1,10 @@
|
||||
/* eslint-disable */
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
exports.removeWip = function (fDir, icao) {
|
||||
var fNew = path.join(fDir, icao[0], icao[1], icao[2], icao + '.groundnet.new.xml');
|
||||
if( fs.existsSync(fNew) ) {
|
||||
fs.unlinkSync(fNew);
|
||||
}
|
||||
}
|
@ -44,6 +44,19 @@ const mutations = {
|
||||
} else {
|
||||
Object.assign(item, airport)
|
||||
}
|
||||
state.wip.sort((p, p2) => { return p.date > p2.date })
|
||||
},
|
||||
'UPLOAD_WIP' (state, icao) {
|
||||
const item = state.wip.find((e) => e.icao === icao)
|
||||
item.upload = Date.now()
|
||||
state.wip.sort((p, p2) => { return p.date > p2.date })
|
||||
},
|
||||
'REMOVE_WIP' (state, icao) {
|
||||
const item = state.wip.find((e) => e.icao === icao)
|
||||
const index = state.wip.indexOf(item)
|
||||
if (index > -1) {
|
||||
state.wip.splice(index, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,6 +74,9 @@ const actions = {
|
||||
},
|
||||
async addWip (context, airport) {
|
||||
context.commit('ADD_WIP', airport)
|
||||
},
|
||||
async removeWip (context, icao) {
|
||||
context.commit('REMOVE_WIP', icao)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user