This commit is contained in:
parent
8a328a1707
commit
a2bd53637b
@ -17,14 +17,41 @@
|
|||||||
<el-button type="primary" @click="addAirline">Confirm</el-button>
|
<el-button type="primary" @click="addAirline">Confirm</el-button>
|
||||||
</span>
|
</span>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
<el-dialog
|
||||||
|
title="Import File"
|
||||||
|
:visible.sync="showImportFile"
|
||||||
|
width="20%"
|
||||||
|
:before-close="handleClose">
|
||||||
|
<span>Beware wip will be overwritten</span>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="20">
|
||||||
|
<el-input
|
||||||
|
placeholder="Please input file"
|
||||||
|
v-model="fileImportName">
|
||||||
|
</el-input>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="4">
|
||||||
|
<file-select @input="fileImportFileName"></file-select>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="showImportFile = false">Cancel</el-button>
|
||||||
|
<el-button type="primary" @click="importFile">Confirm</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
<h1 class="leaflet-sidebar-header">{{ icao }} {{ name }}</h1>
|
<h1 class="leaflet-sidebar-header">{{ icao }} {{ name }}</h1>
|
||||||
<div width="100%" >
|
<div width="100%" >
|
||||||
|
<el-row>
|
||||||
|
<el-button @click="showImportFile = true" v-if="!editing" ><i class="fas fa-file-import"></i></el-button>
|
||||||
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="7"><span class="label"> Airlines :</span></el-col>
|
<el-col :span="7"><span class="label"> Airlines :</span></el-col>
|
||||||
<el-col :span="15">
|
<el-col :span="15">
|
||||||
<el-tag v-for="item in airlines" :key="item.value">{{item.value}}</el-tag>
|
<el-tag v-for="item in airlines" :key="item.value">{{item.value}}</el-tag>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="2"><el-button @click="dialogVisible = true" v-if="editing" ><i class="fas fa-plus"></i></el-button></el-col>
|
<el-col :span="2">
|
||||||
|
<el-button @click="dialogVisible = true" v-if="editing" ><i class="fas fa-plus"></i></el-button>
|
||||||
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
<el-tabs v-model="activeTab" >
|
<el-tabs v-model="activeTab" >
|
||||||
@ -73,17 +100,35 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="js">
|
<script lang="js">
|
||||||
|
import EditButton from './EditButton'
|
||||||
|
import FileSelect from './FileSelect'
|
||||||
import Frequency from './Frequency'
|
import Frequency from './Frequency'
|
||||||
import ParkingList from './ParkingList'
|
import ParkingList from './ParkingList'
|
||||||
|
|
||||||
|
const fs = require('fs')
|
||||||
|
const path = require('path')
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data () {
|
data () {
|
||||||
return {activeTab: 'first', editing: false, dialogVisible: false, airlineCode: ''}
|
return {showImportFile: false, activeTab: 'first', editing: false, dialogVisible: false, airlineCode: '', fileImport: null}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
Frequency, ParkingList
|
EditButton, FileSelect, Frequency, ParkingList
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
fileImportFileName (f) {
|
||||||
|
this.fileImport = f
|
||||||
|
},
|
||||||
|
importFile () {
|
||||||
|
this.showImportFile = false
|
||||||
|
var fDir = this.$store.state.Settings.settings.airportsDirectory
|
||||||
|
var fNew = path.join(fDir, this.icao[0], this.icao[1], this.icao[2], this.icao + '.groundnet.new.xml')
|
||||||
|
|
||||||
|
var editLayer = this.$parent.$parent.$parent.$refs.editLayer
|
||||||
|
fs.copyFile(this.fileImport.path, fNew, () => {
|
||||||
|
editLayer.reload(false)
|
||||||
|
})
|
||||||
|
},
|
||||||
setEditing (editing) {
|
setEditing (editing) {
|
||||||
this.editing = editing
|
this.editing = editing
|
||||||
},
|
},
|
||||||
@ -108,6 +153,13 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
fileImportName: function () {
|
||||||
|
if (this.fileImport !== null) {
|
||||||
|
console.log(this.fileImport)
|
||||||
|
return this.fileImport.path
|
||||||
|
}
|
||||||
|
return 'Please select'
|
||||||
|
},
|
||||||
icao: function () {
|
icao: function () {
|
||||||
return this.$store.state.Airports.currentAirport.icao
|
return this.$store.state.Airports.currentAirport.icao
|
||||||
},
|
},
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<label class="file-select">
|
<label class="file-select">
|
||||||
<div class="select-button">
|
<div class="select-button">
|
||||||
<span v-if="value">Selected File: {{value.name}}</span>
|
...
|
||||||
<span v-else>Select File</span>
|
|
||||||
</div>
|
</div>
|
||||||
<input type="file" @change="handleFileChange"/>
|
<input type="file" @change="handleFileChange"/>
|
||||||
</label>
|
</label>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
|
@ -68,7 +68,6 @@ You should have received a copy of the GNU General Public License along with FG
|
|||||||
|
|
||||||
// https://github.com/KoRiGaN/Vue2Leaflet/issues/103
|
// https://github.com/KoRiGaN/Vue2Leaflet/issues/103
|
||||||
delete L.Icon.Default.prototype._getIconUrl
|
delete L.Icon.Default.prototype._getIconUrl
|
||||||
|
|
||||||
L.Icon.Default.mergeOptions({
|
L.Icon.Default.mergeOptions({
|
||||||
iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'),
|
iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'),
|
||||||
iconUrl: require('leaflet/dist/images/marker-icon.png'),
|
iconUrl: require('leaflet/dist/images/marker-icon.png'),
|
||||||
@ -80,6 +79,26 @@ You should have received a copy of the GNU General Public License along with FG
|
|||||||
props: [],
|
props: [],
|
||||||
created () {
|
created () {
|
||||||
this.loadingInstance = null
|
this.loadingInstance = null
|
||||||
|
this.$store.watch(
|
||||||
|
function (state) {
|
||||||
|
return state.Loading.icao
|
||||||
|
},
|
||||||
|
(newValue, oldValue) => {
|
||||||
|
// debugger
|
||||||
|
console.log('setIcaoLoading ' + oldValue + ' => ' + newValue + ' ' + this.groundnetLoaded + ' ' + this.pavementLoaded + ' ' + this.loadingInstance)
|
||||||
|
if (newValue !== oldValue && newValue !== '') {
|
||||||
|
this.groundnetLoaded = newValue
|
||||||
|
if ((this.loadingInstance === null || this.loadingInstance === undefined)) {
|
||||||
|
this.loadingInstance = Loading.service({ fullscreen: false })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
,
|
||||||
|
{
|
||||||
|
deep: false,
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
)
|
||||||
this.$store.watch(
|
this.$store.watch(
|
||||||
function (state) {
|
function (state) {
|
||||||
return state.Loading.groundnetLoaded
|
return state.Loading.groundnetLoaded
|
||||||
@ -89,11 +108,6 @@ You should have received a copy of the GNU General Public License along with FG
|
|||||||
console.log('groundnetLoaded ' + oldValue + ' => ' + newValue + ' ' + this.groundnetLoaded + ' ' + this.pavementLoaded + ' ' + this.loadingInstance)
|
console.log('groundnetLoaded ' + oldValue + ' => ' + newValue + ' ' + this.groundnetLoaded + ' ' + this.pavementLoaded + ' ' + this.loadingInstance)
|
||||||
if (newValue !== oldValue) {
|
if (newValue !== oldValue) {
|
||||||
this.groundnetLoaded = newValue
|
this.groundnetLoaded = newValue
|
||||||
if (!(this.groundnetLoaded &&
|
|
||||||
this.pavementLoaded) &&
|
|
||||||
(this.loadingInstance === null || this.loadingInstance === undefined)) {
|
|
||||||
this.loadingInstance = Loading.service({ fullscreen: false })
|
|
||||||
}
|
|
||||||
if (this.groundnetLoaded &&
|
if (this.groundnetLoaded &&
|
||||||
this.pavementLoaded &&
|
this.pavementLoaded &&
|
||||||
this.loadingInstance !== null) {
|
this.loadingInstance !== null) {
|
||||||
@ -116,11 +130,6 @@ You should have received a copy of the GNU General Public License along with FG
|
|||||||
console.log('pavementLoaded ' + oldValue + ' => ' + newValue + ' ' + this.groundnetLoaded + ' ' + this.pavementLoaded + ' ' + this.loadingInstance)
|
console.log('pavementLoaded ' + oldValue + ' => ' + newValue + ' ' + this.groundnetLoaded + ' ' + this.pavementLoaded + ' ' + this.loadingInstance)
|
||||||
if (newValue !== oldValue) {
|
if (newValue !== oldValue) {
|
||||||
this.pavementLoaded = newValue
|
this.pavementLoaded = newValue
|
||||||
if (!(this.groundnetLoaded &&
|
|
||||||
this.pavementLoaded) &&
|
|
||||||
(this.loadingInstance === null || this.loadingInstance === undefined)) {
|
|
||||||
this.loadingInstance = Loading.service({ fullscreen: false })
|
|
||||||
}
|
|
||||||
if (this.groundnetLoaded &&
|
if (this.groundnetLoaded &&
|
||||||
this.pavementLoaded &&
|
this.pavementLoaded &&
|
||||||
this.loadingInstance !== null) {
|
this.loadingInstance !== null) {
|
||||||
@ -146,6 +155,7 @@ You should have received a copy of the GNU General Public License along with FG
|
|||||||
.filter(feature => this.visible(feature))
|
.filter(feature => this.visible(feature))
|
||||||
.map(feature => feature.properties.icao)
|
.map(feature => feature.properties.icao)
|
||||||
if (airportsToLoad.length > 0 && airportsToLoad[0] !== this.editingAirport && this.zoom > 12) {
|
if (airportsToLoad.length > 0 && airportsToLoad[0] !== this.editingAirport && this.zoom > 12) {
|
||||||
|
this.$store.dispatch('setIcaoLoading', airportsToLoad[0])
|
||||||
this.$nextTick(() => { // Loading should be closed asynchronously
|
this.$nextTick(() => { // Loading should be closed asynchronously
|
||||||
this.$refs.pavementLayer.load(airportsToLoad[0])
|
this.$refs.pavementLayer.load(airportsToLoad[0])
|
||||||
this.$refs.editLayer.load(airportsToLoad[0])
|
this.$refs.editLayer.load(airportsToLoad[0])
|
||||||
|
@ -12,9 +12,12 @@ You should have received a copy of the GNU General Public License along with FG
|
|||||||
|
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
|
|
||||||
const state = { groundnetLoaded: false, pavementLoaded: false }
|
const state = { icao: '', groundnetLoaded: false, pavementLoaded: false }
|
||||||
|
|
||||||
const mutations = {
|
const mutations = {
|
||||||
|
SET_ICAO_LOADING (state, icao) {
|
||||||
|
Vue.set(state, 'icao', icao)
|
||||||
|
},
|
||||||
SET_GROUNDNET_LOADED (state, loaded) {
|
SET_GROUNDNET_LOADED (state, loaded) {
|
||||||
Vue.set(state, 'groundnetLoaded', loaded)
|
Vue.set(state, 'groundnetLoaded', loaded)
|
||||||
},
|
},
|
||||||
@ -24,6 +27,9 @@ const mutations = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const actions = {
|
const actions = {
|
||||||
|
async setIcaoLoading (context, p) {
|
||||||
|
context.commit('SET_ICAO_LOADING', p)
|
||||||
|
},
|
||||||
async setGroundnetLoaded (context, p) {
|
async setGroundnetLoaded (context, p) {
|
||||||
context.commit('SET_GROUNDNET_LOADED', p)
|
context.commit('SET_GROUNDNET_LOADED', p)
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user