Update Stats on Save
This commit is contained in:
parent
64685aa1d1
commit
8fcd1f64fb
@ -1,3 +1,14 @@
|
|||||||
|
<!--
|
||||||
|
Copyright 2020 Keith Paterson
|
||||||
|
|
||||||
|
This file is part of FG Airports.
|
||||||
|
|
||||||
|
FG Airports is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
FG Airports is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along with FG Airports. If not, see http://www.gnu.org/licenses/.
|
||||||
|
-->
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<el-row>
|
<el-row>
|
||||||
|
@ -22,18 +22,33 @@
|
|||||||
<ParkingList></ParkingList>
|
<ParkingList></ParkingList>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="Statistics" name="third">
|
<el-tab-pane label="Statistics" name="third">
|
||||||
|
<el-row><el-col :span="8"><span class="label">Traffic :</span></el-col></el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="8">Flights :</el-col>
|
<el-col :span="8">Flights :</el-col>
|
||||||
<el-col :span="4">{{ flights }}</el-col>
|
<el-col :span="4">{{ flights }}</el-col>
|
||||||
<el-col :span="8">Parking Positions :</el-col>
|
|
||||||
<el-col :span="4">{{ parking }}</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="8">Groundnet Nodes :</el-col>
|
|
||||||
<el-col :span="4">{{groundnet}}</el-col>
|
|
||||||
<el-col :span="8"></el-col>
|
<el-col :span="8"></el-col>
|
||||||
<el-col :span="4"></el-col>
|
<el-col :span="4"></el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
<el-row><el-col :span="8"><span class="label">GIT/Terrasync :</span></el-col></el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">Parking Positions :</el-col>
|
||||||
|
<el-col :span="4">{{ parking }}</el-col>
|
||||||
|
<el-col :span="8">Groundnet Nodes :</el-col>
|
||||||
|
<el-col :span="4">{{groundnet}}</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row><el-col :span="8"><span class="label">Work :</span></el-col></el-row>
|
||||||
|
<el-row v-if="wip">
|
||||||
|
<el-col :span="8">Work Parking Positions :</el-col>
|
||||||
|
<el-col :span="4">{{ wipparking }}</el-col>
|
||||||
|
<el-col :span="8">Work Groundnet Nodes :</el-col>
|
||||||
|
<el-col :span="4">{{wipgroundnet}}</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row v-if="wip">
|
||||||
|
<el-col :span="4">Saved :</el-col>
|
||||||
|
<el-col :span="8" class="text">{{date}}</el-col>
|
||||||
|
<el-col :span="4">Uploaded :</el-col>
|
||||||
|
<el-col :span="8" class="text">{{upload_date}}</el-col>
|
||||||
|
</el-row>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</div>
|
</div>
|
||||||
@ -94,6 +109,34 @@ export default {
|
|||||||
parking: function () {
|
parking: function () {
|
||||||
return this.$store.state.Airports.currentAirport.parking
|
return this.$store.state.Airports.currentAirport.parking
|
||||||
},
|
},
|
||||||
|
wipgroundnet: function () {
|
||||||
|
return this.$store.state.Airports.currentAirport.wipgroundnet
|
||||||
|
},
|
||||||
|
wipparking: function () {
|
||||||
|
return this.$store.state.Airports.currentAirport.wipparking
|
||||||
|
},
|
||||||
|
wip: function () {
|
||||||
|
// .icao
|
||||||
|
var wip = this.$store.state.Settings.wip.filter(w => w.icao === this.$store.state.Airports.currentAirport.icao)
|
||||||
|
if (wip.length > 0) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
},
|
||||||
|
date: function () {
|
||||||
|
var wip = this.$store.state.Settings.wip.filter(w => w.icao === this.$store.state.Airports.currentAirport.icao)
|
||||||
|
var d = new Date(wip[0].time)
|
||||||
|
return d.toLocaleDateString() + ' ' + d.toLocaleTimeString()
|
||||||
|
},
|
||||||
|
upload_date: function () {
|
||||||
|
var wip = this.$store.state.Settings.wip.filter(w => w.icao === this.$store.state.Airports.currentAirport.icao)
|
||||||
|
if (wip[0].upload !== undefined) {
|
||||||
|
var d = new Date(wip[0].upload)
|
||||||
|
return d.toLocaleDateString() + ' ' + d.toLocaleTimeString()
|
||||||
|
} else {
|
||||||
|
return '-'
|
||||||
|
}
|
||||||
|
},
|
||||||
airport: {
|
airport: {
|
||||||
get: function () {
|
get: function () {
|
||||||
return this.$store.state.Airports.currentAirport !== undefined
|
return this.$store.state.Airports.currentAirport !== undefined
|
||||||
|
@ -142,8 +142,42 @@ You should have received a copy of the GNU General Public License along with FG
|
|||||||
saveDefered () {
|
saveDefered () {
|
||||||
this.$parent.$parent.$refs.editLayer.save()
|
this.$parent.$parent.$refs.editLayer.save()
|
||||||
this.$parent.$parent.$refs.editLayer.disableEdit()
|
this.$parent.$parent.$refs.editLayer.disableEdit()
|
||||||
|
this.scanGroundnets()
|
||||||
Vue.set(this, 'saveDialogVisible', false)
|
Vue.set(this, 'saveDialogVisible', false)
|
||||||
},
|
},
|
||||||
|
scanGroundnets () {
|
||||||
|
try {
|
||||||
|
const winURL = process.env.NODE_ENV === 'development'
|
||||||
|
? `http://localhost:9080/src/renderer/utils/worker.js`
|
||||||
|
: `file://${process.resourcesPath}/workers/worker.js`
|
||||||
|
console.log('make a worker: ', path.resolve(__dirname, 'worker.js'))
|
||||||
|
|
||||||
|
var icao = this.$parent.$parent.$refs.editLayer.icao
|
||||||
|
const worker = new Worker(winURL)
|
||||||
|
|
||||||
|
var aptDir = path.join(this.$store.state.Settings.settings.airportsDirectory, icao[0], icao[1], icao[2]);
|
||||||
|
worker.postMessage(['scan', aptDir ])
|
||||||
|
// the reply
|
||||||
|
var store = this.$store
|
||||||
|
worker.onmessage = function (e) {
|
||||||
|
if (e.data === 'scanStarted') {
|
||||||
|
this.progress = 0
|
||||||
|
this.max = 0
|
||||||
|
} else if (e.data === 'DONE') {
|
||||||
|
console.log('DONE')
|
||||||
|
store.dispatch('getAirports')
|
||||||
|
worker.terminate()
|
||||||
|
} else if (e.data.length > 0) {
|
||||||
|
if (e.data[0] === 'max') {
|
||||||
|
}
|
||||||
|
if (e.data[0] === 'progress') {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err)
|
||||||
|
}
|
||||||
|
},
|
||||||
pollData () {
|
pollData () {
|
||||||
var workery = this.worker
|
var workery = this.worker
|
||||||
var view = this
|
var view = this
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
/* eslint-disable */
|
/*
|
||||||
// const fs = require('fs');
|
Copyright 2020 Keith Paterson
|
||||||
// const path = require('path');
|
|
||||||
// const math = require('mathjs');
|
|
||||||
// const util = require('util');
|
|
||||||
// const airports = require('./airports.js');
|
|
||||||
// const homedir = require('os').homedir();
|
|
||||||
// const apt = require('apt.js');
|
|
||||||
|
|
||||||
|
This file is part of FG Airports.
|
||||||
|
|
||||||
|
FG Airports is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
FG Airports is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along with FG Airports. If not, see http://www.gnu.org/licenses/.
|
||||||
|
*/
|
||||||
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Iterates over an array with a async function and await
|
* Iterates over an array with a async function and await
|
||||||
* @param {*} array The array being iterated over
|
* @param {*} array The array being iterated over
|
||||||
@ -342,7 +345,7 @@ function store(icao, airline, value) {
|
|||||||
async function readGroundnet(f, features) {
|
async function readGroundnet(f, features) {
|
||||||
var promise = new Promise(function (resolve, reject) {
|
var promise = new Promise(function (resolve, reject) {
|
||||||
try {
|
try {
|
||||||
var filename = path.basename(f).match('^([^.]+)\\.([^.]+)\\.([^.]+)');
|
var filename = path.basename(f).match('^([^.]+)\\.([^.]+)(\\.new)?\\.([^.]+)');
|
||||||
if (filename == null) {
|
if (filename == null) {
|
||||||
resolve("File didn't match");
|
resolve("File didn't match");
|
||||||
}
|
}
|
||||||
@ -430,13 +433,20 @@ async function readGroundnet(f, features) {
|
|||||||
logger('info', 'groundnet : ' + filename[1]);
|
logger('info', 'groundnet : ' + filename[1]);
|
||||||
if (dat['?xml'].groundnet) {
|
if (dat['?xml'].groundnet) {
|
||||||
var nodes = dat['?xml'].groundnet.TaxiNodes;
|
var nodes = dat['?xml'].groundnet.TaxiNodes;
|
||||||
|
var parkingnodes = dat['?xml'].groundnet.parkingList;
|
||||||
if (nodes && nodes.node) {
|
if (nodes && nodes.node) {
|
||||||
logger('info', nodes);
|
logger('info', nodes);
|
||||||
}
|
}
|
||||||
feature['properties']['groundnet'] = nodes && nodes.node ? nodes.node.length : 0;
|
if(filename [3] === '.new') {
|
||||||
var nodes = dat['?xml'].groundnet.parkingList;
|
feature['properties']['wipgroundnet'] = nodes && nodes.node ? nodes.node.length : 0;
|
||||||
//debugger;
|
//debugger;
|
||||||
feature['properties']['parking'] = nodes && nodes.Parking ? nodes.Parking.length : 0;
|
feature['properties']['wipparking'] = parkingnodes && parkingnodes.Parking ? parkingnodes.Parking.length : 0;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
feature['properties']['groundnet'] = nodes && nodes.node ? nodes.node.length : 0;
|
||||||
|
//debugger;
|
||||||
|
feature['properties']['parking'] = parkingnodes && parkingnodes.Parking ? parkingnodes.Parking.length : 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (filename[2] == 'ils') {
|
} else if (filename[2] == 'ils') {
|
||||||
logger('info', 'ils : ' + filename[1]);
|
logger('info', 'ils : ' + filename[1]);
|
||||||
|
Loading…
Reference in New Issue
Block a user