@fmidev/smartmet-alert-client 4.4.19 → 4.7.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +2 -14
- package/.github/workflows/test.yaml +26 -0
- package/.nvmrc +1 -0
- package/AGENTS.md +26 -0
- package/index.html +1 -1
- package/package.json +80 -22
- package/src/AlertClientVue.vue +160 -0
- package/src/App.vue +154 -296
- package/src/assets/img/ui/arrow-down.svg +4 -11
- package/src/assets/img/ui/arrow-up.svg +4 -11
- package/src/assets/img/ui/clear.svg +7 -21
- package/src/assets/img/ui/close.svg +4 -15
- package/src/assets/img/ui/toggle-selected.svg +5 -6
- package/src/assets/img/ui/toggle-unselected.svg +5 -6
- package/src/assets/img/warning/cold-weather.svg +3 -6
- package/src/assets/img/warning/flood-level-3.svg +4 -7
- package/src/assets/img/warning/forest-fire-weather.svg +2 -6
- package/src/assets/img/warning/grass-fire-weather.svg +2 -6
- package/src/assets/img/warning/hot-weather.svg +3 -6
- package/src/assets/img/warning/pedestrian-safety.svg +3 -7
- package/src/assets/img/warning/rain.svg +2 -7
- package/src/assets/img/warning/sea-icing.svg +2 -6
- package/src/assets/img/warning/sea-thunder-storm.svg +2 -5
- package/src/assets/img/warning/sea-water-height-high-water.svg +3 -8
- package/src/assets/img/warning/sea-water-height-shallow-water.svg +3 -7
- package/src/assets/img/warning/sea-wave-height.svg +4 -7
- package/src/assets/img/warning/sea-wind-legend.svg +2 -5
- package/src/assets/img/warning/sea-wind.svg +2 -5
- package/src/assets/img/warning/several.svg +2 -5
- package/src/assets/img/warning/thunder-storm.svg +2 -5
- package/src/assets/img/warning/traffic-weather.svg +2 -6
- package/src/assets/img/warning/uv-note.svg +2 -6
- package/src/assets/img/warning/wind.svg +2 -5
- package/src/components/AlertClient.vue +330 -251
- package/src/components/CollapsiblePanel.vue +281 -0
- package/src/components/DayLarge.vue +146 -110
- package/src/components/DaySmall.vue +97 -81
- package/src/components/Days.vue +229 -159
- package/src/components/DescriptionWarning.vue +63 -38
- package/src/components/GrayScaleToggle.vue +58 -54
- package/src/components/Legend.vue +102 -325
- package/src/components/MapLarge.vue +574 -351
- package/src/components/MapSmall.vue +137 -122
- package/src/components/PopupRow.vue +24 -12
- package/src/components/Region.vue +168 -118
- package/src/components/RegionWarning.vue +40 -33
- package/src/components/Regions.vue +189 -105
- package/src/components/Warning.vue +70 -45
- package/src/components/Warnings.vue +136 -72
- package/src/composables/useAlertClient.ts +360 -0
- package/src/composables/useConfig.ts +573 -0
- package/src/composables/useFields.ts +66 -0
- package/src/composables/useI18n.ts +62 -0
- package/src/composables/useKeyCodes.ts +16 -0
- package/src/composables/useMapPaths.ts +477 -0
- package/src/composables/useUtils.ts +683 -0
- package/src/composables/useWarningsProcessor.ts +1007 -0
- package/src/data/geometries.json +993 -0
- package/src/{main.js → main.ts} +1 -0
- package/src/mixins/geojsonsvg.d.ts +57 -0
- package/src/mixins/geojsonsvg.js +5 -3
- package/src/plugins/index.ts +5 -0
- package/src/scss/_utilities.scss +193 -0
- package/src/scss/constants.scss +2 -1
- package/src/scss/warningImages.scss +8 -3
- package/src/types/index.ts +509 -0
- package/src/vite-env.d.ts +23 -0
- package/src/vue.ts +41 -0
- package/svgo.config.js +45 -0
- package/tests/README.md +430 -0
- package/tests/fixtures/mockWarningData.ts +152 -0
- package/tests/integration/warning-flow.spec.ts +445 -0
- package/tests/setup.ts +41 -0
- package/tests/unit/components/AlertClient.spec.ts +701 -0
- package/tests/unit/components/DayLarge.spec.ts +348 -0
- package/tests/unit/components/DaySmall.spec.ts +352 -0
- package/tests/unit/components/Days.spec.ts +548 -0
- package/tests/unit/components/DescriptionWarning.spec.ts +385 -0
- package/tests/unit/components/GrayScaleToggle.spec.ts +318 -0
- package/tests/unit/components/Legend.spec.ts +295 -0
- package/tests/unit/components/MapLarge.spec.ts +448 -0
- package/tests/unit/components/MapSmall.spec.ts +367 -0
- package/tests/unit/components/PopupRow.spec.ts +270 -0
- package/tests/unit/components/Region.spec.ts +373 -0
- package/tests/unit/components/RegionWarning.snapshot.spec.ts +361 -0
- package/tests/unit/components/RegionWarning.spec.ts +381 -0
- package/tests/unit/components/Regions.spec.ts +503 -0
- package/tests/unit/components/Warning.snapshot.spec.ts +483 -0
- package/tests/unit/components/Warning.spec.ts +489 -0
- package/tests/unit/components/Warnings.spec.ts +343 -0
- package/tests/unit/components/__snapshots__/RegionWarning.snapshot.spec.ts.snap +41 -0
- package/tests/unit/components/__snapshots__/Warning.snapshot.spec.ts.snap +433 -0
- package/tests/unit/composables/useConfig.spec.ts +279 -0
- package/tests/unit/composables/useI18n.spec.ts +116 -0
- package/tests/unit/composables/useKeyCodes.spec.ts +27 -0
- package/tests/unit/composables/useUtils.spec.ts +213 -0
- package/tsconfig.json +43 -0
- package/tsconfig.node.json +11 -0
- package/vite.config.js +96 -26
- package/vitest.config.js +40 -0
- package/dist/favicon.ico +0 -0
- package/dist/index.dark.html +0 -20
- package/dist/index.en.html +0 -15
- package/dist/index.fi.html +0 -15
- package/dist/index.html +0 -15
- package/dist/index.js +0 -281
- package/dist/index.mjs +0 -281
- package/dist/index.mjs.map +0 -1
- package/dist/index.relative.html +0 -19
- package/dist/index.start.html +0 -20
- package/dist/index.sv.html +0 -15
- package/playwright.config.ts +0 -18
- package/public/index.relative.html +0 -19
- package/public/index.start.html +0 -20
- package/src/mixins/config.js +0 -1378
- package/src/mixins/fields.js +0 -26
- package/src/mixins/i18n.js +0 -25
- package/src/mixins/keycodes.js +0 -10
- package/src/mixins/panzoom.js +0 -900
- package/src/mixins/utils.js +0 -900
- package/src/plugins/index.js +0 -3
- package/test/snapshot.test.ts +0 -126
- package/vitest.config.ts +0 -6
package/src/App.vue
CHANGED
|
@@ -1,315 +1,173 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<AlertClient
|
|
3
3
|
v-if="visible"
|
|
4
|
-
:refresh-interval="
|
|
5
|
-
:default-day="
|
|
6
|
-
:static-days="
|
|
4
|
+
:refresh-interval="refreshIntervalNormalized"
|
|
5
|
+
:default-day="selectedDayNormalized"
|
|
6
|
+
:static-days="staticDaysNormalized"
|
|
7
7
|
:start-from="startFrom"
|
|
8
|
-
:region-list-enabled="
|
|
9
|
-
:gray-scale-selector="
|
|
8
|
+
:region-list-enabled="regionListEnabledNormalized"
|
|
9
|
+
:gray-scale-selector="grayScaleSelectorNormalized"
|
|
10
10
|
:current-time="currentTime"
|
|
11
11
|
:warnings-data="warningsData"
|
|
12
|
-
:daily-warning-types="
|
|
13
|
-
:geometry-id="
|
|
14
|
-
:language="language"
|
|
12
|
+
:daily-warning-types="dailyWarningTypesNormalized"
|
|
13
|
+
:geometry-id="geometryIdNormalized"
|
|
14
|
+
:language="language as Language"
|
|
15
15
|
:theme="themeClass"
|
|
16
|
-
:sleep="
|
|
16
|
+
:sleep="sleepNormalized"
|
|
17
17
|
:loading="loading"
|
|
18
|
-
:spinner-enabled="
|
|
18
|
+
:spinner-enabled="spinnerEnabledNormalized"
|
|
19
19
|
@loaded="onLoaded"
|
|
20
|
-
@
|
|
20
|
+
@theme-changed="onThemeChanged"
|
|
21
21
|
@update-warnings="fetchWarnings" />
|
|
22
22
|
</template>
|
|
23
|
-
<script>
|
|
24
|
-
|
|
23
|
+
<script setup lang="ts">
|
|
24
|
+
/**
|
|
25
|
+
* Web component wrapper for AlertClient.
|
|
26
|
+
* All props are strings (HTML attribute limitation).
|
|
27
|
+
* Use AlertClientVue.vue for native Vue usage with proper types.
|
|
28
|
+
*/
|
|
29
|
+
import { computed, toRef, onMounted, type Ref } from 'vue'
|
|
25
30
|
|
|
26
31
|
import AlertClient from './components/AlertClient.vue'
|
|
27
|
-
import
|
|
28
|
-
import
|
|
32
|
+
import { useAlertClient, toBool, toNum } from './composables/useAlertClient'
|
|
33
|
+
import type { Language, WarningsData } from '@/types'
|
|
29
34
|
|
|
30
|
-
|
|
35
|
+
// Define component name for web component registration
|
|
36
|
+
defineOptions({
|
|
31
37
|
name: 'App',
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
baseUrl
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
},
|
|
160
|
-
weatherWarningsType() {
|
|
161
|
-
return 'weather_finland_active_all'
|
|
162
|
-
},
|
|
163
|
-
floodWarningsType() {
|
|
164
|
-
return 'flood_finland_active_all'
|
|
165
|
-
},
|
|
166
|
-
weatherUpdatedQuery() {
|
|
167
|
-
return this.weatherUpdated || `${this.query}${this.weatherUpdatedType}`
|
|
168
|
-
},
|
|
169
|
-
floodUpdatedQuery() {
|
|
170
|
-
return this.floodUpdated || `${this.query}${this.floodUpdatedType}`
|
|
171
|
-
},
|
|
172
|
-
weatherWarningsQuery() {
|
|
173
|
-
return this.weatherWarnings || `${this.query}${this.weatherWarningsType}`
|
|
174
|
-
},
|
|
175
|
-
floodWarningsQuery() {
|
|
176
|
-
return (
|
|
177
|
-
this.floodWarnings ||
|
|
178
|
-
`${this.query}${this.floodWarningsType}${this.floodFilter}`
|
|
179
|
-
)
|
|
180
|
-
},
|
|
181
|
-
query() {
|
|
182
|
-
return '?service=WFS&version=1.0.0&request=GetFeature&maxFeatures=1000&outputFormat=application%2Fjson&typeName='
|
|
183
|
-
},
|
|
184
|
-
floodSupportedSeverities() {
|
|
185
|
-
return ['moderate', 'severe', 'extreme']
|
|
186
|
-
},
|
|
187
|
-
floodFilter() {
|
|
188
|
-
return `${this.floodSupportedSeverities.reduce(
|
|
189
|
-
(filter, severity, index) =>
|
|
190
|
-
`${filter + (index === 0 ? '' : ',')}%27${severity.toUpperCase()}%27`,
|
|
191
|
-
'&cql_filter=severity%20IN%20('
|
|
192
|
-
)})%20AND%20language=%27${this.capLanguage()}%27`
|
|
193
|
-
},
|
|
194
|
-
capLanguage() {
|
|
195
|
-
return () =>
|
|
196
|
-
({
|
|
197
|
-
fi: 'fi-FI',
|
|
198
|
-
sv: 'sv-SV',
|
|
199
|
-
en: 'en-US',
|
|
200
|
-
})[this.language]
|
|
201
|
-
},
|
|
202
|
-
currentTime() {
|
|
203
|
-
if (this.refreshedAt) {
|
|
204
|
-
return this.refreshedAt
|
|
205
|
-
}
|
|
206
|
-
if (this.currentDate) {
|
|
207
|
-
return new Date(this.currentDate).getTime()
|
|
208
|
-
}
|
|
209
|
-
return Date.now()
|
|
210
|
-
},
|
|
211
|
-
},
|
|
212
|
-
created() {
|
|
213
|
-
if (this.warnings) {
|
|
214
|
-
this.warningsData = JSON.parse(this.warnings)
|
|
215
|
-
}
|
|
216
|
-
},
|
|
217
|
-
mounted() {
|
|
218
|
-
if (this.fontScale != null && this.fontScale.trim() !== ''
|
|
219
|
-
&& Number(this.fontScale) !== 1) {
|
|
220
|
-
const newFontScale = Number(this.fontScale)
|
|
221
|
-
if (!Number.isNaN(newFontScale)) {
|
|
222
|
-
let originalFontSize
|
|
223
|
-
if (
|
|
224
|
-
typeof window !== 'undefined' &&
|
|
225
|
-
typeof document !== 'undefined' &&
|
|
226
|
-
document.documentElement &&
|
|
227
|
-
window.getComputedStyle
|
|
228
|
-
) {
|
|
229
|
-
const htmlElement = document.documentElement
|
|
230
|
-
const computedStyle = window.getComputedStyle(htmlElement)
|
|
231
|
-
originalFontSize = parseFloat(computedStyle.fontSize)
|
|
232
|
-
}
|
|
233
|
-
if (originalFontSize == null || Number.isNaN(originalFontSize)) {
|
|
234
|
-
originalFontSize = 16 // Fallback
|
|
235
|
-
}
|
|
236
|
-
const scaledFontSize = newFontScale * originalFontSize
|
|
237
|
-
const newFontSize = Math.round(scaledFontSize * 100) / 100
|
|
238
|
-
document.documentElement.style.fontSize = `${newFontSize}px`
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
},
|
|
242
|
-
serverPrefetch() {
|
|
243
|
-
if (!this.warnings) {
|
|
244
|
-
return this.fetchWarnings()
|
|
245
|
-
}
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
// Default geometry ID from config
|
|
41
|
+
const DEFAULT_GEOMETRY_ID = '2021'
|
|
42
|
+
|
|
43
|
+
// Props definition - all strings for web component compatibility
|
|
44
|
+
const props = withDefaults(
|
|
45
|
+
defineProps<{
|
|
46
|
+
currentDate?: string
|
|
47
|
+
baseUrl?: string
|
|
48
|
+
selectedDay?: string
|
|
49
|
+
regionListEnabled?: string
|
|
50
|
+
spinnerEnabled?: string
|
|
51
|
+
grayScaleSelector?: string
|
|
52
|
+
staticDays?: string
|
|
53
|
+
startFrom?: string
|
|
54
|
+
weatherUpdated?: string
|
|
55
|
+
floodUpdated?: string
|
|
56
|
+
weatherWarnings?: string
|
|
57
|
+
floodWarnings?: string
|
|
58
|
+
warnings?: string
|
|
59
|
+
dailyWarningTypes?: string
|
|
60
|
+
refreshInterval?: string
|
|
61
|
+
geometryId?: string
|
|
62
|
+
language?: string
|
|
63
|
+
theme?: string
|
|
64
|
+
fontScale?: string
|
|
65
|
+
sleep?: string
|
|
66
|
+
debugMode?: string
|
|
67
|
+
}>(),
|
|
68
|
+
{
|
|
69
|
+
currentDate: '',
|
|
70
|
+
baseUrl: 'https://www.ilmatieteenlaitos.fi/geoserver/alert/ows',
|
|
71
|
+
selectedDay: '0',
|
|
72
|
+
regionListEnabled: 'true',
|
|
73
|
+
spinnerEnabled: 'true',
|
|
74
|
+
grayScaleSelector: 'true',
|
|
75
|
+
staticDays: 'true',
|
|
76
|
+
startFrom: '',
|
|
77
|
+
weatherUpdated: '',
|
|
78
|
+
floodUpdated: '',
|
|
79
|
+
weatherWarnings: '',
|
|
80
|
+
floodWarnings: '',
|
|
81
|
+
warnings: '',
|
|
82
|
+
dailyWarningTypes: '',
|
|
83
|
+
refreshInterval: '900000', // 1000 * 60 * 15
|
|
84
|
+
geometryId: DEFAULT_GEOMETRY_ID,
|
|
85
|
+
language: (import.meta.env.VITE_LANGUAGE as string) || 'fi',
|
|
86
|
+
theme: 'light',
|
|
87
|
+
fontScale: '1',
|
|
88
|
+
sleep: 'true',
|
|
89
|
+
debugMode: 'false',
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
// String-to-type normalizers for web component props
|
|
94
|
+
const selectedDayNormalized = computed(() => toNum(props.selectedDay, 0))
|
|
95
|
+
const regionListEnabledNormalized = computed(() =>
|
|
96
|
+
toBool(props.regionListEnabled, true)
|
|
97
|
+
)
|
|
98
|
+
const grayScaleSelectorNormalized = computed(() =>
|
|
99
|
+
toBool(props.grayScaleSelector, true)
|
|
100
|
+
)
|
|
101
|
+
const staticDaysNormalized = computed(() => toBool(props.staticDays, true))
|
|
102
|
+
const dailyWarningTypesNormalized = computed<string[]>(() => {
|
|
103
|
+
if (props.dailyWarningTypes) {
|
|
104
|
+
return props.dailyWarningTypes.split(',').map((item) => item.trim())
|
|
105
|
+
}
|
|
106
|
+
return []
|
|
107
|
+
})
|
|
108
|
+
const refreshIntervalNormalized = computed(() =>
|
|
109
|
+
toNum(props.refreshInterval, 900000)
|
|
110
|
+
)
|
|
111
|
+
const geometryIdNormalized = computed(() => toNum(props.geometryId, 2021))
|
|
112
|
+
const sleepNormalized = computed(() => toBool(props.sleep, true))
|
|
113
|
+
const spinnerEnabledNormalized = computed(() =>
|
|
114
|
+
toBool(props.spinnerEnabled, true)
|
|
115
|
+
)
|
|
116
|
+
const debugModeNormalized = computed(() => toBool(props.debugMode, false))
|
|
117
|
+
|
|
118
|
+
// Computed refs for language (needs proper typing for composable)
|
|
119
|
+
const languageRef = computed(() => props.language as Language)
|
|
120
|
+
|
|
121
|
+
// Computed ref for warnings data (parse JSON string if provided)
|
|
122
|
+
const warningsRef = computed<WarningsData | string | null>(() => {
|
|
123
|
+
if (!props.warnings) return null
|
|
124
|
+
return props.warnings
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
// Setup composable with refs to props
|
|
128
|
+
const {
|
|
129
|
+
loading,
|
|
130
|
+
themeClass,
|
|
131
|
+
warningsData,
|
|
132
|
+
visible,
|
|
133
|
+
currentTime,
|
|
134
|
+
onLoaded,
|
|
135
|
+
onThemeChanged,
|
|
136
|
+
fetchWarnings,
|
|
137
|
+
initializeWarnings,
|
|
138
|
+
applyFontScale,
|
|
139
|
+
} = useAlertClient({
|
|
140
|
+
baseUrl: toRef(props, 'baseUrl'),
|
|
141
|
+
language: languageRef as Ref<Language>,
|
|
142
|
+
theme: toRef(props, 'theme'),
|
|
143
|
+
warnings: warningsRef,
|
|
144
|
+
currentDate: toRef(props, 'currentDate'),
|
|
145
|
+
fontScale: toRef(props, 'fontScale'),
|
|
146
|
+
debugMode: debugModeNormalized,
|
|
147
|
+
weatherUpdated: toRef(props, 'weatherUpdated'),
|
|
148
|
+
floodUpdated: toRef(props, 'floodUpdated'),
|
|
149
|
+
weatherWarnings: toRef(props, 'weatherWarnings'),
|
|
150
|
+
floodWarnings: toRef(props, 'floodWarnings'),
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
// Initialize warnings from props (equivalent to created hook)
|
|
154
|
+
initializeWarnings()
|
|
155
|
+
|
|
156
|
+
// Apply font scale on mount
|
|
157
|
+
onMounted(() => {
|
|
158
|
+
applyFontScale()
|
|
159
|
+
})
|
|
160
|
+
|
|
161
|
+
// Expose methods for external access (web component API)
|
|
162
|
+
defineExpose({
|
|
163
|
+
show: () => {
|
|
164
|
+
visible.value = true
|
|
246
165
|
},
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
if (loaded !== 0) {
|
|
250
|
-
this.loading = loaded === -1 ? -1 : 0
|
|
251
|
-
}
|
|
252
|
-
},
|
|
253
|
-
onThemeChanged(newTheme) {
|
|
254
|
-
this.themeClass = `${
|
|
255
|
-
newTheme != null && newTheme.length > 0 ? newTheme : this.theme
|
|
256
|
-
}-theme`
|
|
257
|
-
},
|
|
258
|
-
fetchWarnings() {
|
|
259
|
-
if (this.warnings) {
|
|
260
|
-
return
|
|
261
|
-
}
|
|
262
|
-
this.loading = 1
|
|
263
|
-
if (this.debugMode.toLowerCase() !== 'false') {
|
|
264
|
-
console.log(`Updating warnings at ${new Date()}`)
|
|
265
|
-
}
|
|
266
|
-
const queries = new Map()
|
|
267
|
-
.set(
|
|
268
|
-
`${this.baseUrl}${this.weatherUpdatedQuery}`,
|
|
269
|
-
this.weatherUpdatedType
|
|
270
|
-
)
|
|
271
|
-
.set(`${this.baseUrl}${this.floodUpdatedQuery}`, this.floodUpdatedType)
|
|
272
|
-
.set(
|
|
273
|
-
`${this.baseUrl}${this.weatherWarningsQuery}`,
|
|
274
|
-
this.weatherWarningsType
|
|
275
|
-
)
|
|
276
|
-
.set(
|
|
277
|
-
`${this.baseUrl}${this.floodWarningsQuery}`,
|
|
278
|
-
this.floodWarningsType
|
|
279
|
-
)
|
|
280
|
-
const responseData = {}
|
|
281
|
-
return Promise.allSettled(
|
|
282
|
-
[...queries.keys()].map(async (query) =>
|
|
283
|
-
fetch(query).then((response) =>
|
|
284
|
-
response
|
|
285
|
-
.json()
|
|
286
|
-
.then((json) => {
|
|
287
|
-
const currentTime = Date.now()
|
|
288
|
-
if (this.updatedAt != null) {
|
|
289
|
-
this.refreshedAt = currentTime
|
|
290
|
-
}
|
|
291
|
-
this.updatedAt = currentTime
|
|
292
|
-
responseData[queries.get(query)] = json
|
|
293
|
-
})
|
|
294
|
-
.catch((error) => {
|
|
295
|
-
this.loading = -1
|
|
296
|
-
console.log(error)
|
|
297
|
-
})
|
|
298
|
-
)
|
|
299
|
-
)
|
|
300
|
-
).then(() => {
|
|
301
|
-
this.warningsData = responseData
|
|
302
|
-
})
|
|
303
|
-
},
|
|
304
|
-
show() {
|
|
305
|
-
this.visible = true
|
|
306
|
-
},
|
|
307
|
-
hide() {
|
|
308
|
-
this.visible = false
|
|
309
|
-
},
|
|
166
|
+
hide: () => {
|
|
167
|
+
visible.value = false
|
|
310
168
|
},
|
|
311
|
-
}
|
|
169
|
+
})
|
|
312
170
|
</script>
|
|
313
|
-
<style>
|
|
314
|
-
@import '
|
|
171
|
+
<style lang="scss">
|
|
172
|
+
@import './scss/utilities.scss';
|
|
315
173
|
</style>
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
<g id="Symbols" transform="translate(-732.000000, -738.000000)" stroke="#ffffff" stroke-width="1.5">
|
|
6
|
-
<g id="arrow-down-symbol" transform="translate(733.000000, 739.000000)">
|
|
7
|
-
<polyline id="fill-1" transform="translate(6.500000, 3.000000) rotate(-270.000000) translate(-6.500000, -3.000000) " points="3.5 -3.5 9.5 3 3.5 9.5"></polyline>
|
|
8
|
-
</g>
|
|
9
|
-
</g>
|
|
10
|
-
</g>
|
|
11
|
-
</svg>
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="8">
|
|
2
|
+
<title>arrow-down-symbol</title>
|
|
3
|
+
<path fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M14 1 7.5 7 1 1"/>
|
|
4
|
+
</svg>
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
<g id="Symbols" transform="translate(-670.000000, -738.000000)" stroke="#ffffff" stroke-width="1.5">
|
|
6
|
-
<g id="arrow-up-symbol" transform="translate(671.000000, 739.000000)">
|
|
7
|
-
<polyline id="fill-1" transform="translate(6.500000, 3.000000) scale(1, -1) rotate(-270.000000) translate(-6.500000, -3.000000) " points="3.5 -3.5 9.5 3 3.5 9.5"></polyline>
|
|
8
|
-
</g>
|
|
9
|
-
</g>
|
|
10
|
-
</g>
|
|
11
|
-
</svg>
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="8">
|
|
2
|
+
<title>arrow-up-symbol</title>
|
|
3
|
+
<path fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M14 7 7.5 1 1 7"/>
|
|
4
|
+
</svg>
|
|
@@ -1,21 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
<g id="varoitukset-tablet-aktiivinen-varoitussymboli-v1" transform="translate(-710.000000, -241.000000)">
|
|
9
|
-
<g id="legenda" transform="translate(514.000000, 240.000000)">
|
|
10
|
-
<g id="poista-valinnat-linkki" transform="translate(106.000000, 1.000000)">
|
|
11
|
-
<g id="close-icon" transform="translate(90.000000, 0.000000)">
|
|
12
|
-
<circle id="oval" fill="#56B8E5" cx="7" cy="7" r="7"></circle>
|
|
13
|
-
<g id="Group" transform="translate(7.156854, 7.156854) rotate(-315.000000) translate(-7.156854, -7.156854) translate(3.156854, 3.156854)" fill="#FFFFFF">
|
|
14
|
-
<path d="M4.5,4.5 L4.5,7 C4.5,7.27614237 4.27614237,7.5 4,7.5 C3.72385763,7.5 3.5,7.27614237 3.5,7 L3.5,4.5 L1,4.5 C0.723857625,4.5 0.5,4.27614237 0.5,4 C0.5,3.72385763 0.723857625,3.5 1,3.5 L3.5,3.5 L3.5,1 C3.5,0.723857625 3.72385763,0.5 4,0.5 C4.27614237,0.5 4.5,0.723857625 4.5,1 L4.5,3.5 L7,3.5 C7.27614237,3.5 7.5,3.72385763 7.5,4 C7.5,4.27614237 7.27614237,4.5 7,4.5 L4.5,4.5 L4.5,4.5 Z" id="x"></path>
|
|
15
|
-
</g>
|
|
16
|
-
</g>
|
|
17
|
-
</g>
|
|
18
|
-
</g>
|
|
19
|
-
</g>
|
|
20
|
-
</g>
|
|
21
|
-
</svg>
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14">
|
|
2
|
+
<title>close icon</title>
|
|
3
|
+
<g fill="none" fill-rule="evenodd">
|
|
4
|
+
<circle cx="7" cy="7" r="7" fill="#56b8e5"/>
|
|
5
|
+
<path fill="#fff" d="M7.157 7.864 5.389 9.632a.5.5 0 0 1-.707-.707L6.45 7.157 4.682 5.389a.5.5 0 0 1 .707-.707L7.157 6.45l1.768-1.768a.5.5 0 0 1 .707.707L7.864 7.157l1.768 1.768a.5.5 0 0 1-.707.707z"/>
|
|
6
|
+
</g>
|
|
7
|
+
</svg>
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
<desc>Created with Sketch.</desc>
|
|
6
|
-
<defs></defs>
|
|
7
|
-
<g id="icons" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round">
|
|
8
|
-
<g id="Symbols" transform="translate(-793.000000, -735.000000)" stroke="#000000" stroke-width="1.5">
|
|
9
|
-
<g id="close-symbol" transform="translate(794.000000, 736.000000)">
|
|
10
|
-
<path d="M0,9.19238816 L9.19238816,0" id="fill-2"></path>
|
|
11
|
-
<path d="M0,0 L9.19238816,9.19238816" id="fill-1"></path>
|
|
12
|
-
</g>
|
|
13
|
-
</g>
|
|
14
|
-
</g>
|
|
15
|
-
</svg>
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="11" height="11">
|
|
2
|
+
<title>close-symbol</title>
|
|
3
|
+
<path fill="none" stroke="#000" stroke-linecap="round" stroke-width="1.5" d="M1 10.192 10.192 1M1 1l9.192 9.192"/>
|
|
4
|
+
</svg>
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
<svg width="55" height="30" viewBox="0 0 55 30" xmlns="http://www.w3.org/2000/svg">
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="55" height="30">
|
|
3
2
|
<defs>
|
|
4
3
|
<clipPath id="outer-clip">
|
|
5
|
-
<rect
|
|
4
|
+
<rect width="55" height="20" y="5" rx="4" ry="4"/>
|
|
6
5
|
</clipPath>
|
|
7
6
|
<clipPath id="inner-clip">
|
|
8
|
-
<path d="
|
|
7
|
+
<path d="M35 5h16a4 4 0 0 1 4 4v12a4 4 0 0 1-4 4H35Z"/>
|
|
9
8
|
</clipPath>
|
|
10
9
|
</defs>
|
|
11
|
-
<rect
|
|
12
|
-
<path
|
|
10
|
+
<rect width="55" height="20" y="5" fill="#767676" stroke="#767676" clip-path="url(#outer-clip)" rx="4" ry="4"/>
|
|
11
|
+
<path fill="#fff" stroke="#767676" d="M35 5h16a4 4 0 0 1 4 4v12a4 4 0 0 1-4 4H35Z" clip-path="url(#inner-clip)"/>
|
|
13
12
|
</svg>
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
<svg width="55" height="30" viewBox="0 0 55 30" xmlns="http://www.w3.org/2000/svg">
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="55" height="30">
|
|
3
2
|
<defs>
|
|
4
3
|
<clipPath id="outer-clip">
|
|
5
|
-
<rect
|
|
4
|
+
<rect width="55" height="20" y="5" rx="4" ry="4"/>
|
|
6
5
|
</clipPath>
|
|
7
6
|
<clipPath id="inner-clip">
|
|
8
|
-
<path d="
|
|
7
|
+
<path d="M4 5h16v20H4a4 4 0 0 1-4-4V9a4 4 0 0 1 4-4"/>
|
|
9
8
|
</clipPath>
|
|
10
9
|
</defs>
|
|
11
|
-
<rect
|
|
12
|
-
<path
|
|
10
|
+
<rect width="55" height="20" y="5" fill="#ebebeb" stroke="#767676" clip-path="url(#outer-clip)" rx="4" ry="4"/>
|
|
11
|
+
<path fill="#fff" stroke="#767676" d="M4 5h16v20H4a4 4 0 0 1-4-4V9a4 4 0 0 1 4-4Z" clip-path="url(#inner-clip)"/>
|
|
13
12
|
</svg>
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
<path style="stroke:rgba(255, 255, 255, 1.0);stroke-width: 2.5px;paint-order: stroke;fill-rule:evenodd;fill:rgb(13.333333%,12.156863%,12.54902%);fill-opacity:1;" d="M 13.828125 21.453125 C 12.722656 21.453125 11.820312 20.554688 11.820312 19.445312 C 11.820312 18.882812 12.050781 18.359375 12.46875 17.976562 L 12.46875 17.972656 C 12.589844 17.859375 12.667969 17.699219 12.667969 17.519531 L 12.667969 7.382812 C 12.667969 6.742188 13.1875 6.222656 13.828125 6.222656 C 14.46875 6.222656 14.992188 6.742188 14.992188 7.382812 L 14.992188 17.519531 C 14.992188 17.699219 15.070312 17.859375 15.191406 17.972656 L 15.191406 17.976562 C 15.609375 18.359375 15.835938 18.882812 15.835938 19.445312 C 15.835938 20.554688 14.9375 21.453125 13.828125 21.453125 Z M 17.503906 9.894531 C 17.792969 9.894531 18.023438 9.660156 18.023438 9.375 C 18.023438 9.089844 17.792969 8.855469 17.503906 8.855469 L 16.234375 8.855469 L 16.234375 8.203125 L 17.503906 8.203125 C 17.792969 8.203125 18.023438 7.96875 18.023438 7.683594 C 18.023438 7.398438 17.792969 7.164062 17.503906 7.164062 L 16.226562 7.164062 C 16.113281 5.941406 15.082031 4.976562 13.828125 4.976562 C 12.503906 4.976562 11.425781 6.058594 11.425781 7.382812 L 11.425781 17.265625 C 10.882812 17.859375 10.578125 18.640625 10.578125 19.445312 C 10.578125 21.238281 12.035156 22.699219 13.828125 22.699219 C 15.621094 22.699219 17.082031 21.238281 17.082031 19.445312 C 17.082031 18.640625 16.777344 17.859375 16.234375 17.265625 L 16.234375 11.585938 L 17.503906 11.585938 C 17.792969 11.585938 18.023438 11.355469 18.023438 11.066406 C 18.023438 10.78125 17.792969 10.550781 17.503906 10.550781 L 16.234375 10.550781 L 16.234375 9.894531 Z M 17.503906 9.894531 "/>
|
|
5
|
-
<path style="stroke:rgba(255, 255, 255, 1.0);stroke-width: 1px;paint-order: stroke;fill-rule:evenodd;fill:rgb(13.333333%,12.156863%,12.54902%);fill-opacity:1;" d="M 14.367188 18.234375 L 14.367188 12.691406 C 14.367188 12.390625 14.128906 12.152344 13.828125 12.152344 C 13.53125 12.152344 13.289062 12.390625 13.289062 12.691406 L 13.289062 18.234375 C 12.824219 18.441406 12.5 18.90625 12.5 19.445312 C 12.5 20.179688 13.097656 20.773438 13.828125 20.773438 C 14.5625 20.773438 15.15625 20.179688 15.15625 19.445312 C 15.15625 18.90625 14.832031 18.441406 14.367188 18.234375 "/>
|
|
6
|
-
</g>
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28">
|
|
2
|
+
<path fill="#221f20" fill-rule="evenodd" stroke="#fff" stroke-width="2.5" d="M13.828 21.453a2.01 2.01 0 0 1-2.008-2.008c0-.562.23-1.086.649-1.468v-.004a.62.62 0 0 0 .199-.453V7.383a1.16 1.16 0 0 1 2.324 0V17.52c0 .18.078.34.2.453v.004c.417.382.644.906.644 1.468 0 1.11-.899 2.008-2.008 2.008Zm3.676-11.558a.52.52 0 1 0 0-1.04h-1.27v-.652h1.27a.52.52 0 1 0 0-1.039h-1.277a2.414 2.414 0 0 0-2.399-2.187 2.41 2.41 0 0 0-2.402 2.406v9.883a3.24 3.24 0 0 0-.848 2.18 3.256 3.256 0 0 0 3.25 3.253 3.26 3.26 0 0 0 3.254-3.254 3.24 3.24 0 0 0-.848-2.18v-5.68h1.27a.517.517 0 1 0 0-1.034h-1.27v-.656Zm0 0" paint-order="stroke"/>
|
|
3
|
+
<path fill="#221f20" fill-rule="evenodd" stroke="#fff" d="M14.367 18.234v-5.543c0-.3-.238-.539-.539-.539a.54.54 0 0 0-.539.54v5.542a1.327 1.327 0 1 0 1.867 1.211c0-.539-.324-1.004-.789-1.21" paint-order="stroke"/>
|
|
7
4
|
</svg>
|