Status for groundweb upload

This commit is contained in:
portree_kid 2020-06-24 20:57:21 +02:00
parent c221699b16
commit a9019340a4
6 changed files with 70 additions and 25 deletions

View File

@ -80,6 +80,7 @@
methods: {
upload() {
this.uploadVisible = true
this.$refs.upload.status()
this.$refs.upload.check()
},
zoomout() {

View File

@ -79,6 +79,7 @@
<el-col :span="7">
<span class="label">Coordinates :</span>
</el-col>
<el-col :span="17">
<el-popover
placement="top-start"
title="E-Mail"
@ -86,17 +87,23 @@
trigger="hover"
content="D.DDD, DMS, DM supported"
>
<el-col :span="17">
<el-input placeholder="Please input" v-model="coordinates" :disabled="!editing"></el-input>
</el-col>
<el-input placeholder="Please input" v-model="coordinates" slot="reference" :disabled="!editing"></el-input>
</el-popover>
</el-col>
</el-row>
<el-row>
<el-col :span="7">
<span class="label">Heading :</span>
</el-col>
<el-col :span="17">
<el-input-number v-model="heading" :min="-361" :max="720" :step="0.1" :precision="1" :disabled="!editing"></el-input-number>
<el-input-number
v-model="heading"
:min="-361"
:max="720"
:step="0.1"
:precision="1"
:disabled="!editing"
></el-input-number>
</el-col>
</el-row>
<el-row>
@ -329,4 +336,10 @@
align-items: center;
font-weight: bold;
}
.el-popover--plain {
padding: 10px 10px;
}
.el-popover__title {
display: none;
}
</style>

View File

@ -53,6 +53,9 @@
</el-col>
</el-row>
<el-row>
<el-col :span="7" class="label">Author E-Mail : </el-col>
<el-col :span="17">
<el-popover
placement="top-start"
title="E-Mail"
@ -60,14 +63,14 @@
trigger="hover"
content="Only used as a committer/author for Github. This e-mail is only visible via GIT."
>
<el-col :span="7" class="label">Author E-Mail : </el-col>
<el-col :span="17">
<el-input placeholder="Please input your email" v-model="email"></el-input>
</el-col>
<el-input placeholder="Please input your email" slot="reference" v-model="email"></el-input>
</el-popover>
</el-col>
</el-row>
<el-row>
<el-col :span="7" class="label">Author Name : </el-col>
<el-col :span="17">
<el-popover
placement="top-start"
title="Goto"
@ -75,19 +78,24 @@
trigger="hover"
content="This is saved to the file and is therefore distributed via Terrasync."
>
<el-col :span="7" class="label">Author Name : </el-col>
<el-col :span="17">
<el-input placeholder="Please input your Name" v-model="email"></el-input>
</el-col>
<el-input placeholder="Please input your Name" slot="reference" v-model="name"></el-input>
</el-popover>
</el-col>
</el-row>
<el-row>
<el-col :span="7" class="label"></el-col>
<el-col :span="17">
<el-button @click="debug" class="button">
<el-popover
placement="top-start"
title="Debug"
width="200"
trigger="hover"
content="Opens the JavaScript Debugger for troubleshooting"
>
<el-button @click="debug" class="button" slot="reference" >
<i class="fas fa-bug"></i> Debugger
</el-button>
</el-popover>
</el-col>
</el-row>
</div>

View File

@ -1,11 +1,13 @@
<template>
<el-dialog title="Upload" :visible.sync="visible" width="30%" center>
<el-progress :percentage="Number(((progress / max)*100).toPrecision(3))" v-if="max>0"></el-progress>
<el-dialog :title="title" :visible.sync="visible" width="30%" center>
<span v-if="max>0">
<el-progress :percentage="Number(((progress / max)*100).toPrecision(3))" v-if="max>0"></el-progress>
</span>
<span v-if="results.length>0" style="color: red">{{results.length}} Errors please correct first</span><br/>
<span style="center">Upload {{icao}} to groundweb.</span><br/>
<span style="center">E-Mail : {{this.$store.state.Settings.settings.email}}</span><br/>
<span style="center"><el-checkbox v-model="gplv2">I agree to release the groundnet under GPL v2</el-checkbox></span><br/>
<span style="center" v-if="message.length>0">{{message}}</span><br/>
<span style="center" v-if="message">{{message}}</span><br/>
<span style="error" v-if="error">{{message}}</span><br/>
<span slot="footer" class="dialog-footer">
<el-button @click="upload" :disabled="!comittable">Ok</el-button>
</span>
@ -16,6 +18,7 @@
/* eslint-disable */
import Vue from 'vue'
import fileUrl from 'file-url'
import axios from 'axios'
const fs = require('fs')
const path = require('path')
@ -26,10 +29,26 @@
},
data () {
return {
gplv2: false, message: '', progress: 0, max: 0
gplv2: false, message: null, error: false, progress: 0, max: 0, azure: false
}
},
methods: {
reqListener(e) {
if(JSON.parse(e.srcElement.response).status==='OK') {
this.message = null;
this.azure = true;
} else {
this.message = 'Azure down';
}
},
status () {
var xhr = new XMLHttpRequest();
this.message = 'Checking for Groundweb health'
xhr.open('GET', 'http://groundweb.azurewebsites.net/groundnets/status', true);
xhr.addEventListener("load", this.reqListener);
xhr.send();
},
upload () {
var f = path.join(this.$store.state.Settings.settings.airportsDirectory,
this.icao[0],
@ -163,7 +182,7 @@
worker.terminate()
worker.view.max = 0
worker.view.checkDialogVisible = false
clearInterval(this.polling)
clearInterval(this.polling)
this.checking = false
} else if (e.data.length > 0) {
if (e.data[0] === 'max') {
@ -191,6 +210,9 @@
Vue.set(this.$parent, 'uploadVisible', newValue)
}
},
title: function () {
return `Upload ${this.$parent.$parent.$parent.icao} to groundweb.`
},
icao: {
get: function () {
return this.$parent.$parent.$parent.icao
@ -199,7 +221,7 @@
}
},
comittable: function () {
return this.$store.state.Check.results.filter(a => a.id>=0).length === 0 && this.gplv2 && this.max === 0
return this.$store.state.Check.results.filter(a => a.id>=0).length === 0 && this.gplv2 && this.max === 0 && this.azure
},
results: function () {
return this.$store.state.Check.results.filter(a => a.id>=0)
@ -210,5 +232,6 @@
</script>
<style scoped lang="scss">
.center { text-align: center;}
.center { text-align: center; vertical-align: middle;}
.error { text-align: center; background-color: red;}
</style>

View File

@ -77,7 +77,7 @@ exports.writeGroundnetXML = function (fDir, icao, featureList) {
var frequencies = [];
var version = new Date().toUTCString() + ' by FlightgearAirports';
var email = store.default.state.Settings.settings.name;
var name = store.default.state.Settings.settings.name;

View File

@ -1,6 +1,6 @@
/* eslint-disable */
const state = {
settings: { flightgearDirectory: '.', testDirectory: '.', email: 'x', phi_url: 'http://localhost:8080' },
settings: { flightgearDirectory: '.', testDirectory: '.', email: 'flightgearairports@example.org', name: 'unknown', phi_url: 'http://localhost:8080' },
zoom: 14,
center: [47.413220, -1.219482],
bounds: undefined,