Skip to content

Commit

Permalink
ran the formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
jwomeara committed Sep 12, 2024
1 parent eff201f commit 088d0f1
Show file tree
Hide file tree
Showing 26 changed files with 847 additions and 488 deletions.
4 changes: 1 addition & 3 deletions service/src/main/frontend/quasar.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,7 @@ module.exports = configure(function (ctx) {
// directives: [],

// Quasar plugins
plugins: [
'Notify'
],
plugins: ['Notify'],
},

// animations: 'all', // --- includes all animations
Expand Down
6 changes: 4 additions & 2 deletions service/src/main/frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
import { onMounted } from 'vue';
onMounted(() => {
const basePath = process.env.BACKEND_BASE_PATH ? process.env.BACKEND_BASE_PATH : '/';
const basePath = process.env.BACKEND_BASE_PATH
? process.env.BACKEND_BASE_PATH
: '/';
const link = document.createElement('link');
link.rel = 'stylesheet';
Expand All @@ -19,4 +21,4 @@ onMounted(() => {
script.src = basePath + 'map/webjars/leaflet/1.8.0/leaflet.js';
document.head.appendChild(script);
});
</script>
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,3 @@ defineProps<AddContentPanelProps>();
const appState = appStateStore();
</script>

125 changes: 68 additions & 57 deletions service/src/main/frontend/src/components/BasemapItem.vue
Original file line number Diff line number Diff line change
@@ -1,69 +1,80 @@
<template>
<q-item class="q-pa-sm" clickable v-ripple @click="itemClick">
<q-item-section avatar dense>
<q-radio ref="radio" v-model="selection" :val="basemap.title" @click="enableBasemap" />
</q-item-section>
<q-item-section>
<q-item-label lines="1">
{{ displayLabel }}
</q-item-label>
<q-item-label caption lines="3">
<div v-html="caption" />
</q-item-label>
</q-item-section>
<q-item-section side>
<div style="width: 64px; height: 64px; overflow: hidden;">
<img :src="thumbnailUrl" />
</div>
</q-item-section>
</q-item>
</template>

<script setup lang="ts">
import { ref, Ref } from 'vue';
import { basemapsStore, Basemap } from 'stores/basemaps-store'
import { simpleMapStore } from 'stores/simple-map-store'
import { QRadio } from 'quasar';
<q-item class="q-pa-sm" clickable v-ripple @click="itemClick">
<q-item-section avatar dense>
<q-radio
ref="radio"
v-model="selection"
:val="basemap.title"
@click="enableBasemap"
/>
</q-item-section>
<q-item-section>
<q-item-label lines="1">
{{ displayLabel }}
</q-item-label>
<q-item-label caption lines="3">
<div v-html="caption" />
</q-item-label>
</q-item-section>
<q-item-section side>
<div style="width: 64px; height: 64px; overflow: hidden">
<img :src="thumbnailUrl" />
</div>
</q-item-section>
</q-item>
</template>

interface BasemapItem {
basemap: Basemap;
selection: Ref<string>;
}
<script setup lang="ts">
import { ref, Ref } from 'vue';
import { basemapsStore, Basemap } from 'stores/basemaps-store';
import { simpleMapStore } from 'stores/simple-map-store';
import { QRadio } from 'quasar';
const radio = ref<QRadio>();
interface BasemapItem {
basemap: Basemap;
selection: Ref<string>;
}
const leafletMap = simpleMapStore;
const basemaps = basemapsStore();
const radio = ref<QRadio>();
const props = defineProps<BasemapItem>();
const basemap = props.basemap;
const selection = props.selection;
const leafletMap = simpleMapStore;
const basemaps = basemapsStore();
const displayLabel = ref(props.basemap.title);
const caption = ref((props.basemap.tileLayer.getAttribution) ? props.basemap.tileLayer.getAttribution() : '');
const props = defineProps<BasemapItem>();
const thumbnailUrl = createThumbnailUrl();
const basemap = props.basemap;
const selection = props.selection;
function createThumbnailUrl() {
let url = basemap.urlTemplate.replace('{x}', '18').replace('{y}', '24').replace('{z}', '6');
if (!url.endsWith('.png')) {
url += '.png';
}
return url;
}
const displayLabel = ref(props.basemap.title);
const caption = ref(
props.basemap.tileLayer.getAttribution
? props.basemap.tileLayer.getAttribution()
: ''
);
function itemClick() {
radio.value?.set();
enableBasemap();
}
const thumbnailUrl = createThumbnailUrl();
function enableBasemap() {
// if we aren't currently selected then set the basemap, otherwise do nothing
if (basemaps.getBasemap.title != basemap.title) {
basemaps.setBasemap(basemap);
leafletMap.setBasemap(basemap);
}
function createThumbnailUrl() {
let url = basemap.urlTemplate
.replace('{x}', '18')
.replace('{y}', '24')
.replace('{z}', '6');
if (!url.endsWith('.png')) {
url += '.png';
}
return url;
}
</script>
function itemClick() {
radio.value?.set();
enableBasemap();
}
function enableBasemap() {
// if we aren't currently selected then set the basemap, otherwise do nothing
if (basemaps.getBasemap.title != basemap.title) {
basemaps.setBasemap(basemap);
leafletMap.setBasemap(basemap);
}
}
</script>
27 changes: 19 additions & 8 deletions service/src/main/frontend/src/components/BasemapsPanel.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<template>
<div style="height: 100%; width: 500px; max-width: 500px; background: white; display: flex; flex-direction: column">
<div
style="
height: 100%;
width: 500px;
max-width: 500px;
background: white;
display: flex;
flex-direction: column;
"
>
<q-card square class="bg-secondary text-white q-px-md q-py-sm">
<q-card-section horizontal>
<div class="text-h6" style="flex-grow: 1">Basemaps</div>
Expand All @@ -12,13 +21,16 @@
/>
</q-card-section>
</q-card>
<q-scroll-area style="flex-grow: 1;" content-style="width: 500px; max-weidth: 500px;">
<q-list bordered separator style="width: 500px; max-width: 500px;">
<q-scroll-area
style="flex-grow: 1"
content-style="width: 500px; max-weidth: 500px;"
>
<q-list bordered separator style="width: 500px; max-width: 500px">
<BasemapItem
v-for="basemap in basemaps.getBasemaps"
:key="basemap.title"
v-bind="{ basemap: basemap, selection: selectionRef() }"
/>
v-for="basemap in basemaps.getBasemaps"
:key="basemap.title"
v-bind="{ basemap: basemap, selection: selectionRef() }"
/>
</q-list>
</q-scroll-area>
</div>
Expand All @@ -38,5 +50,4 @@ const selection = ref(basemaps.getBasemap.title);
function selectionRef(): Ref<string> {
return selection;
}
</script>
49 changes: 36 additions & 13 deletions service/src/main/frontend/src/components/CardLoading.vue
Original file line number Diff line number Diff line change
@@ -1,19 +1,43 @@
<template>
<q-card v-if="loadingState!=DONE" class="absolute-full column flex-center" style="background-color: transparent;">
<q-card
v-if="loadingState != DONE"
class="absolute-full column flex-center"
style="background-color: transparent"
>
<!-- if loading, show the spinner -->
<q-spinner v-if="loadingState==LOADING" size="6em" color="secondary"/>
<q-spinner v-if="loadingState == LOADING" size="6em" color="secondary" />

<!-- if success, show the success dialog -->
<q-icon v-if="loadingState==SUCCESS" name="check_circle" size="6em" color="green"/>

<q-icon
v-if="loadingState == SUCCESS"
name="check_circle"
size="6em"
color="green"
/>

<!-- if failure, show the failure dialog -->
<q-icon v-if="loadingState==FAILURE" name="warning" size="6em" color="red"/>

<q-icon
v-if="loadingState == FAILURE"
name="warning"
size="6em"
color="red"
/>

<!-- display the loading message -->
<p style="font-size:18px;">{{ loadingMessage }}</p>
<p style="font-size: 18px">{{ loadingMessage }}</p>

<!-- if not loading, show the done button -->
<q-btn v-if="loadingState!=LOADING" label="Done" color="white" text-color="black" @click="loadingState=DONE; loadingMessage=''; $emit('doneClick');"/>
<q-btn
v-if="loadingState != LOADING"
label="Done"
color="white"
text-color="black"
@click="
loadingState = DONE;
loadingMessage = '';
$emit('doneClick');
"
/>
</q-card>
</template>

Expand All @@ -29,7 +53,7 @@ export interface CardLoadingMethods {
const LOADING = 'loading';
const SUCCESS = 'success';
const FAILURE = 'failure';
const DONE = 'done'
const DONE = 'done';
const loadingState = ref<string>(DONE);
const loadingMessage = ref<string>('');
Expand All @@ -40,20 +64,19 @@ const cardLoadingMethods: CardLoadingMethods = {
loadingMessage.value = message;
},
success(message: string){
success(message: string) {
loadingState.value = SUCCESS;
loadingMessage.value = message;
},
failure(message: string) {
loadingState.value = FAILURE;
loadingMessage.value = message;
}
},
};
defineEmits(['doneClick']);
defineExpose(cardLoadingMethods);
</script>

<style>
</style>
<style></style>
19 changes: 14 additions & 5 deletions service/src/main/frontend/src/components/ConfigPanel.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
<template>
<AddContentPanel v-if="appStateStore().getConfigPanelSelection === 'Add'" :supportedGeometries="supportedGeometries" />
<ContentPanel v-else-if="appStateStore().getConfigPanelSelection === 'Content'" />
<BasemapPanel v-else-if="appStateStore().getConfigPanelSelection === 'Basemaps'" />
<GeoToolboxPanel v-else-if="appStateStore().getConfigPanelSelection === 'Geo Toolbox'" :supportedGeometries="supportedGeometries" />
<AddContentPanel
v-if="appStateStore().getConfigPanelSelection === 'Add'"
:supportedGeometries="supportedGeometries"
/>
<ContentPanel
v-else-if="appStateStore().getConfigPanelSelection === 'Content'"
/>
<BasemapPanel
v-else-if="appStateStore().getConfigPanelSelection === 'Basemaps'"
/>
<GeoToolboxPanel
v-else-if="appStateStore().getConfigPanelSelection === 'Geo Toolbox'"
:supportedGeometries="supportedGeometries"
/>
</template>

<script setup lang="ts">
Expand All @@ -16,5 +26,4 @@ export interface ConfigPanelProps {
supportedGeometries: string[];
}
defineProps<ConfigPanelProps>();
</script>
47 changes: 33 additions & 14 deletions service/src/main/frontend/src/components/ContentPanel.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<template>
<div style="height: 100%; width: 500px; max-width: 500px; background: white; display: flex; flex-direction: column">
<div
style="
height: 100%;
width: 500px;
max-width: 500px;
background: white;
display: flex;
flex-direction: column;
"
>
<q-card square class="bg-secondary text-white q-px-md q-py-sm">
<q-card-section horizontal>
<div class="text-h6" style="flex-grow: 1">Content</div>
Expand All @@ -14,20 +23,31 @@
</q-card>
<q-bar dark class="bg-primary text-white">
<q-btn dense flat icon="home" @click="initContent" />
<q-btn v-if="content.getFeatureChain.length > 0" dense flat icon="arrow_back" @click="content.navigateBack" />
<GeoNav
v-if="content.getFeatureChain.length > 0"
v-bind="content.getRootFeature"
/>
<q-btn
v-if="content.getFeatureChain.length > 0"
dense
flat
icon="arrow_back"
@click="content.navigateBack"
/>
<GeoNav
v-if="content.getFeatureChain.length > 0"
v-bind="content.getRootFeature"
/>
</q-bar>
<q-scroll-area style="flex-grow: 1;" content-style="width: 500px; max-weidth: 500px;">
<q-list bordered separator style="width: 500px; max-width: 500px;">
<q-item-label v-if="content.getFeatureChain.length > 1" header>{{ getLabel(content.getCurrentFeature) }}</q-item-label>
<q-scroll-area
style="flex-grow: 1"
content-style="width: 500px; max-weidth: 500px;"
>
<q-list bordered separator style="width: 500px; max-width: 500px">
<q-item-label v-if="content.getFeatureChain.length > 1" header>{{
getLabel(content.getCurrentFeature)
}}</q-item-label>
<GeoItem
v-for="typedFeature in content.getContent"
:key="getLabel(typedFeature)"
v-bind="{feature: typedFeature}"
/>
v-for="typedFeature in content.getContent"
:key="getLabel(typedFeature)"
v-bind="{ feature: typedFeature }"
/>
</q-list>
</q-scroll-area>
</div>
Expand All @@ -52,5 +72,4 @@ function initContent() {
onMounted(() => {
initContent();
});
</script>
Loading

0 comments on commit 088d0f1

Please sign in to comment.