kopia lustrzana https://github.com/manuelkasper/sotlas-frontend
Allow -XXX style references in alerts
rodzic
05765e9562
commit
62219867eb
|
@ -5,7 +5,7 @@
|
||||||
</header>
|
</header>
|
||||||
<section class="modal-card-body">
|
<section class="modal-card-body">
|
||||||
<b-field label="Callsign" :message="isOwnCallsign ? '' : 'You are posting an alert for someone else\'s callsign'" :type="isOwnCallsign ? '' : 'is-info'">
|
<b-field label="Callsign" :message="isOwnCallsign ? '' : 'You are posting an alert for someone else\'s callsign'" :type="isOwnCallsign ? '' : 'is-info'">
|
||||||
<b-input type="text" class="callsign" v-model="callsign" pattern="[a-zA-Z0-9/]{3,}" validation-message="Invalid callsign" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" required />
|
<b-input type="text" class="callsign" v-model="callsign" pattern="[a-zA-Z0-9\/]{3,}" validation-message="Invalid callsign" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" required />
|
||||||
</b-field>
|
</b-field>
|
||||||
|
|
||||||
<b-field label="Summit reference" :message="summitDisplay" :type="summitType" :class="summitLabelClass" expanded>
|
<b-field label="Summit reference" :message="summitDisplay" :type="summitType" :class="summitLabelClass" expanded>
|
||||||
|
@ -122,7 +122,10 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isInputValid () {
|
isInputValid () {
|
||||||
return /^[a-zA-Z0-9/]{3,}$/.test(this.callsign) && this.summit !== null && this.isSummitValid(this.summit) && this.date && /^\d\d:\d\d$/.test(this.time) && this.freqMode.length > 0 && (this.freqMode.join(', ').length <= 40 || this.freqMode.join(',').length <= 40)
|
return /^[a-zA-Z0-9/]{3,}$/.test(this.callsign) &&
|
||||||
|
(this.summitCodeXxx || (this.summit !== null && this.isSummitValid(this.summit))) &&
|
||||||
|
this.date && /^\d\d:\d\d$/.test(this.time) &&
|
||||||
|
this.freqMode.length > 0 && (this.freqMode.join(', ').length <= 40 || this.freqMode.join(',').length <= 40)
|
||||||
},
|
},
|
||||||
summitLabelClass () {
|
summitLabelClass () {
|
||||||
if (!this.summit || this.isSummitValid(this.summit)) {
|
if (!this.summit || this.isSummitValid(this.summit)) {
|
||||||
|
@ -149,11 +152,17 @@ export default {
|
||||||
handler () {
|
handler () {
|
||||||
if (this.summitCode) {
|
if (this.summitCode) {
|
||||||
// Shorthand input
|
// Shorthand input
|
||||||
let summitRegex = /^([A-Z0-9]{1,8})[/ ]([A-Z]{2})[- ]?([0-9]{3})$/i
|
let summitRegex = /^([A-Z0-9]{1,8})[/ ]([A-Z]{2})[- ]?([0-9]{3}|xxx)$/i
|
||||||
let matches = this.summitCode.match(summitRegex)
|
let matches = this.summitCode.match(summitRegex)
|
||||||
if (matches) {
|
if (matches) {
|
||||||
this.summitCode = (matches[1] + '/' + matches[2] + '-' + matches[3]).toUpperCase()
|
this.summitCode = (matches[1] + '/' + matches[2] + '-' + matches[3]).toUpperCase()
|
||||||
|
if (matches[3].toUpperCase() === 'XXX') {
|
||||||
|
this.summitInvalid = false
|
||||||
|
this.summitCodeXxx = true
|
||||||
|
this.summit = null
|
||||||
|
} else {
|
||||||
this.summitLoading = true
|
this.summitLoading = true
|
||||||
|
this.summitCodeXxx = false
|
||||||
axios.get(process.env.VUE_APP_API_URL + '/summits/' + this.summitCode)
|
axios.get(process.env.VUE_APP_API_URL + '/summits/' + this.summitCode)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.summitLoading = false
|
this.summitLoading = false
|
||||||
|
@ -165,6 +174,7 @@ export default {
|
||||||
this.summitInvalid = true
|
this.summitInvalid = true
|
||||||
this.summit = null
|
this.summit = null
|
||||||
})
|
})
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.summit = null
|
this.summit = null
|
||||||
this.summitInvalid = false
|
this.summitInvalid = false
|
||||||
|
@ -344,6 +354,7 @@ export default {
|
||||||
comments: '',
|
comments: '',
|
||||||
summit: null,
|
summit: null,
|
||||||
summitInvalid: false,
|
summitInvalid: false,
|
||||||
|
summitCodeXxx: false,
|
||||||
summitLoading: false,
|
summitLoading: false,
|
||||||
timeZone: 'utc',
|
timeZone: 'utc',
|
||||||
posting: false
|
posting: false
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<template v-slot:title>Alerts</template>
|
<template v-slot:title>Alerts</template>
|
||||||
<template v-slot:title-right>
|
<template v-slot:title-right>
|
||||||
<div class="action-button">
|
<div class="action-button">
|
||||||
<b-button type="is-info" icon-left="plus" @click="$refs.alertsList.addAlert()" :disabled="!authenticated">Add</b-button>
|
<b-button type="is-info" icon-left="plus" @click="$refs.alertsList.addAlert()">Add</b-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue