-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Addition of station table and station form.
- Loading branch information
1 parent
edca91b
commit dbb3978
Showing
20 changed files
with
1,525 additions
and
76 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[ | ||
{"name": "Africa", "id": "I", "description": "Region I - Africa"}, | ||
{"name": "Asia", "id": "II", "description": "Region II - Asia"}, | ||
{"name": "South America", "id": "III", "description": "Region III - South America"}, | ||
{"name": "North America, Central America and the Caribbean", "id": "IV", "description": "Region IV - North America, Central America and the Caribbean"}, | ||
{"name": "South-West Pacific", "id": "V", "description": "South-West Pacific"}, | ||
{"name": "Europe", "id": "VI", "description": "Europe"} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[ | ||
{"name": "Air (fixed)", "id": "Air (fixed)", "description": "Airborne station/platform, at fixed position"}, | ||
{"name": "Air (mobile)", "id": "Air (mobile)", "description": "Airborne station/platform, moving around"}, | ||
{"name": "Lake/River (fixed)", "id": "Lake/River (fixed)", "description": "Station/platform at lake/river surface, at fixed position"}, | ||
{"name": "Lake/River (mobile)", "id": "Lake/River (mobile)", "description": "Station/platform at lake/river surface, moving around"}, | ||
{"name": "Land (fixed)", "id": "Land (fixed)", "description": "Station/platform on solid terrain, at fixed position"}, | ||
{"name": "Land (mobile)", "id": "Land (mobile)", "description": "Station/platform on solid terrain, moving around"}, | ||
{"name": "Land (on ice)", "id": "Land (on ice)", "description": "Station/platform on ice-covered ground, moving with the ice"}, | ||
{"name": "Sea (fixed)", "id": "Sea (fixed)", "description": "Station/platform at sea surface, at fixed position"}, | ||
{"name": "Sea (mobile)", "id": "Sea (mobile)", "description": "Station/platform at sea surface, moving around"}, | ||
{"name": "Sea (on ice)", "id": "Sea (on ice)", "description": "Station/platform on floating ice, moving with the ice"}, | ||
{"name": "Space-based", "id": "Space-based", "description": "Satellite platform in orbit"}, | ||
{"name": "Underwater (fixed)", "id": "Underwater (fixed)", "description": "Station/platform under water, at fixed horizontal position"}, | ||
{"name": "Underwater (mobile)", "id": "Underwater (mobile)", "description": "Station/platform under water, moving around also horizontally"}, | ||
{"name": "unknown", "id": "unknown", "description": "The station/platform type is unknown."} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[ | ||
{ | ||
"name": "Operational", | ||
"id": "operational", | ||
"description": "The station fully complies with the reporting obligations of the observation programme/network concerned." | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[ | ||
{"name": "Algeria", "id": "Algeria", "description": "Algeria"}, | ||
{"name": "Congo", "id": "Congo", "description": "Congo"}, | ||
{"name": "Italy", "id": "Italy", "description": "Italy"}, | ||
{"name": "Malawi", "id": "Malawi", "description": "Malawi"}, | ||
{"name": "Romania", "id": "Romania", "description": "Romania"} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<template> | ||
<div v-if="! errorMessage"> | ||
<v-autocomplete | ||
v-if="(options !== null)" | ||
:items="options" | ||
item-title="name" | ||
item-value="id" | ||
label="Type of observing facility" | ||
v-model="selected" | ||
:readonly="readonly" | ||
:hint="selected ? selected.description : 'Select facility type'" | ||
persistent-hint | ||
return-object | ||
/> | ||
</div> | ||
<div v-else class="error"> | ||
<v-text-field class="text-error" read-only :hint="props.defaultHint" persistent-hint>{{ errorMessage }}</v-text-field> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { defineComponent, ref, onBeforeMount, watch, onErrorCaptured, computed} from 'vue'; | ||
import {VAutocomplete, VTextField} from 'vuetify/lib/components/index.mjs'; | ||
export default defineComponent({ | ||
name: 'FacilityTypeSelector', | ||
components: { | ||
VAutocomplete, VTextField | ||
}, | ||
props: { | ||
modelValue: {}, | ||
readonly: false | ||
}, | ||
emits: ["update:modelValue"], | ||
setup(props, {emit}){ | ||
const apiUrl = "/code_lists/facilityType.json"; | ||
const options = ref(null); | ||
const selected = ref(null); | ||
const errorMessage = ref(null); | ||
const fetchOptions = async () => { | ||
try { | ||
const response = await fetch(apiUrl); | ||
if (!response.ok) { | ||
throw new Error(`HTTP error! Status: ${response.status}`); | ||
} | ||
const data = await response.json(); | ||
options.value = data; // Assuming the API response contains the options in the expected format | ||
} catch (error) { | ||
errorMessage.value = 'Error fetching facility type options.'; | ||
console.error('Error fetching facility type options:', error); | ||
} | ||
}; | ||
onBeforeMount( async () => { | ||
await fetchOptions() ; | ||
// update if we have an initial value | ||
if( props.modelValue.length ){ | ||
selected.value = options.value.find(option => option.id === props.modelValue) ; | ||
} | ||
}); | ||
watch( selected, (newValue) => { | ||
if( selected.value ){ | ||
emit("update:modelValue", newValue); | ||
} | ||
}); | ||
return {selected, options, errorMessage}; | ||
} | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<template> | ||
<v-card style="width: 100%; height: 100%; min-height: 400px" :id="id" ></v-card> | ||
</template> | ||
|
||
<script> | ||
import { defineComponent, ref, computed, onMounted, watch } from 'vue'; | ||
import { VCard, VCardTitle, VCardText } from 'vuetify/lib/components/index.mjs'; | ||
import "leaflet/dist/leaflet.css"; | ||
import L from 'leaflet' | ||
// geojson validator | ||
import * as gjv from 'geojson-validation'; | ||
export default defineComponent({ | ||
name: "LocatorMap", | ||
props: { | ||
center: { | ||
type: Object, | ||
default: () => ({ lat: -6.155595235231087, lng: 106.84202325990253}) | ||
}, | ||
zoom: { | ||
type: Number, | ||
default: 10 | ||
}, | ||
id: { | ||
type: String, | ||
default: "map" | ||
}, | ||
longitude: { | ||
type: Number, | ||
default: 0 | ||
}, | ||
latitude: { | ||
type: Number, | ||
default: 0 | ||
} | ||
}, | ||
data(){ | ||
return { | ||
} | ||
}, | ||
components: { | ||
VCard, | ||
VCardTitle, | ||
VCardText, | ||
}, | ||
setup( props, {emit} ) { | ||
const mapContainer = ref(null); | ||
const map = ref(null); | ||
const markerLayer = ref(null); | ||
mapContainer.value = props.id; | ||
const geom = computed( () => ({ | ||
type: "Feature", | ||
geometry: { | ||
type: "Point", | ||
coordinates: [props.longitude, props.latitude] | ||
}, | ||
properties: {} | ||
})); | ||
onMounted( () =>{ | ||
map.value = L.map(props.id, {zoomAnimation:false, fadeAnimation:true, markerZoomAnimation:true}).setView( props.center, props.zoom ); | ||
map.value.attributionControl.setPrefix('<a href="https://leafletjs.com/">Leaflet</a>') | ||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {attribution: '© OpenStreetMap contributors'}).addTo(map.value); | ||
// check whether we have a location to show | ||
if( geom.value.geometry ){ | ||
updateMarker(); | ||
}; | ||
emit('mapLoaded', map.value); | ||
}); | ||
const updateMarker = async () => { | ||
if( markerLayer.value ){ | ||
markerLayer.value.remove(); | ||
} | ||
// now check whether the new marker is valid and plot | ||
if( ! (isNaN(geom.value.geometry.coordinates[0]) || isNaN(geom.value.geometry.coordinates[1])) ){ | ||
if( gjv.isFeature(geom.value) ){ | ||
markerLayer.value = L.geoJSON(geom.value).addTo(map.value); | ||
map.value.fitBounds(markerLayer.value.getBounds()); | ||
map.value.setZoom(12); | ||
} | ||
} | ||
}; | ||
watch( geom, () => { | ||
updateMarker(); | ||
}) | ||
return {mapContainer}; | ||
} | ||
}) | ||
</script> |
Oops, something went wrong.