@opengeoweb/warnings 9.30.0 → 9.31.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/index.esm.js +57 -22
- package/package.json +2 -2
- package/src/lib/aviation-api/api.d.ts +7 -0
- package/src/lib/aviation-api/hooks.d.ts +4 -0
- package/src/lib/components/PublicWarningsForm/PublicWarningsForm.d.ts +2 -5
- package/src/lib/components/PublicWarningsForm/PublicWarningsFormConnect.d.ts +2 -5
- package/src/lib/components/PublicWarningsFormDialog/PublicWarningsFormDialogConnect.d.ts +2 -6
- package/src/lib/components/WarningsMapView/WarningsMapView.d.ts +2 -5
- package/src/lib/store/publicWarningForm/types.d.ts +1 -0
- package/src/lib/utils/testUtils.d.ts +4 -0
package/index.esm.js
CHANGED
|
@@ -2,24 +2,24 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
2
2
|
import { useDispatch, useSelector } from 'react-redux';
|
|
3
3
|
import { Polygons, Share, ExitDomain, Edit, Delete, CoastalEvent, TemperatureLow, TemperatureHigh, Rain, Snow, Lightning, Fog, Wind, Thunderstorm, VulcanicEruption, Haze, FreezingPrecipitation, ModerateAircraftIcing, SevereAircraftIcing, ModerateTurbulence, SevereTurbulence, SandStorm, RadioactiveMaterials, DrawPolygon, Visibility, Add, breakpoints, Close, Options, ChevronDown, ChevronUp, Copy, Success, Expire, Remove } from '@opengeoweb/theme';
|
|
4
4
|
import { uiTypes, uiActions, getSingularDrawtoolDrawLayerId, drawtoolSelectors, layerSelectors, uiSelectors, mapStoreActions, drawtoolActions, layerActions, useSetupDialog } from '@opengeoweb/store';
|
|
5
|
-
import { defaultPolygon, emptyGeoJSON, MapControlButton, getIcon, rewindGeometry, getGeoJSONPropertyValue, currentlySupportedDrawModes, MapView, MapViewLayer,
|
|
5
|
+
import { defaultPolygon, emptyGeoJSON, MapControlButton, getIcon, rewindGeometry, getGeoJSONPropertyValue, currentlySupportedDrawModes, defaultLayers, MapView, MapViewLayer, getFeatureExtent } from '@opengeoweb/webmap-react';
|
|
6
6
|
import { SHARED_NAMESPACE, useConfirmationDialog, ToggleMenu, dateUtils, calculateStartSize, ToolContainerDraggable, AlertBanner, ConfirmationDialog, getAxiosErrorMessage, usePrevious, CustomIconButton, CustomTooltip, Avatar, getInitials, SwitchButton, CustomToggleButton, Filter, getPosition, FilterChip, FilterListItem, FilterLabel, StatusTag, LastUpdateTime, ErrorBoundary, pollingIntervalTimeout, isAxiosError as isAxiosError$1 } from '@opengeoweb/shared';
|
|
7
7
|
import { createEntityAdapter, createSlice, createSelector, createListenerMiddleware, isAnyOf } from '@reduxjs/toolkit';
|
|
8
8
|
import i18n from 'i18next';
|
|
9
9
|
import { useTranslation } from 'react-i18next';
|
|
10
10
|
import '@opengeoweb/core';
|
|
11
11
|
import { FORM_FIELDS_NAMESPACE, useDraftFormHelpers, ReactHookFormSelect, ReactHookFormHiddenInput, isValidGeoJsonCoordinates, ReactHookFormTextField, ReactHookFormProvider, defaultFormOptions, errorMessages, ReactHookFormDateTime, isXHoursBefore, isXHoursAfter, isEmpty } from '@opengeoweb/form-fields';
|
|
12
|
-
import {
|
|
12
|
+
import { LayerType, generateMapId, getWMJSMapById, getGeoCoordFromLatLong, WMBBOX } from '@opengeoweb/webmap';
|
|
13
13
|
import { snackbarActions, snackbarTypes } from '@opengeoweb/snackbar';
|
|
14
14
|
import * as React from 'react';
|
|
15
15
|
import React__default, { useState, useEffect, useRef } from 'react';
|
|
16
16
|
import { styled, Box, Typography, ListItem, Grid2, Paper, ListItemButton, Stack, LinearProgress, Button, MenuItem, FormHelperText, Tabs, Tab, Card, CardContent, CircularProgress, Menu, DialogTitle, DialogContent, Switch, ListItemIcon, Checkbox, ListItemText } from '@mui/material';
|
|
17
17
|
import { VariableSizeList } from 'react-window';
|
|
18
18
|
import AutoSizer from 'react-virtualized-auto-sizer';
|
|
19
|
-
import { getApi, createApiInstance, createNonAuthApiInstance, createFakeApiInstance, ApiProvider, ProductStatus,
|
|
19
|
+
import { getApi, createApiInstance, createNonAuthApiInstance, createFakeApiInstance, ApiProvider, ProductStatus, getHeaders, useAuthQuery } from '@opengeoweb/api';
|
|
20
20
|
import { useFormContext } from 'react-hook-form';
|
|
21
21
|
import { isEqual, cloneDeep, clamp, debounce } from 'lodash';
|
|
22
|
-
import { useAuthenticationContext } from '@opengeoweb/authentication';
|
|
22
|
+
import { useAuthenticationContext, getConfig } from '@opengeoweb/authentication';
|
|
23
23
|
import { produce } from 'immer';
|
|
24
24
|
import { isAxiosError } from 'axios';
|
|
25
25
|
|
|
@@ -11349,9 +11349,13 @@ const zoomToFeature = (mapId, geojsonFeature) => {
|
|
|
11349
11349
|
};
|
|
11350
11350
|
const WarningsMapView = ({
|
|
11351
11351
|
geojsonFeature,
|
|
11352
|
-
|
|
11352
|
+
defaultMapPreset,
|
|
11353
11353
|
isSnapshot: _isSnapshot = false
|
|
11354
11354
|
}) => {
|
|
11355
|
+
var _a, _b;
|
|
11356
|
+
const defaultBbox = defaultMapPreset === null || defaultMapPreset === void 0 ? void 0 : defaultMapPreset.proj;
|
|
11357
|
+
const defaultBaseLayer = ((_a = defaultMapPreset === null || defaultMapPreset === void 0 ? void 0 : defaultMapPreset.layers) === null || _a === void 0 ? void 0 : _a.find(layer => layer.layerType === LayerType.baseLayer)) || defaultLayers.baseLayerGrey;
|
|
11358
|
+
const defaultOverLayer = ((_b = defaultMapPreset === null || defaultMapPreset === void 0 ? void 0 : defaultMapPreset.layers) === null || _b === void 0 ? void 0 : _b.find(layer => layer.layerType === LayerType.overLayer)) || defaultLayers.overLayer;
|
|
11355
11359
|
const mapId = React.useRef(`WarningsMapView_${generateMapId()}`).current;
|
|
11356
11360
|
const warningLayer = {
|
|
11357
11361
|
id: `${mapId}geojsonfeature`,
|
|
@@ -11386,9 +11390,9 @@ const WarningsMapView = ({
|
|
|
11386
11390
|
},
|
|
11387
11391
|
holdShiftToScroll: true
|
|
11388
11392
|
}, {
|
|
11389
|
-
children: [!_isSnapshot && jsx(MapViewLayer, Object.assign({},
|
|
11393
|
+
children: [!_isSnapshot && jsx(MapViewLayer, Object.assign({}, defaultBaseLayer, {
|
|
11390
11394
|
id: `${mapId}_baseLayer`
|
|
11391
|
-
})), warningLayer.geojson && jsx(MapViewLayer, Object.assign({}, warningLayer)), !_isSnapshot && jsx(MapViewLayer, Object.assign({},
|
|
11395
|
+
})), warningLayer.geojson && jsx(MapViewLayer, Object.assign({}, warningLayer)), !_isSnapshot && jsx(MapViewLayer, Object.assign({}, defaultOverLayer, {
|
|
11392
11396
|
id: `${mapId}_overlayer`
|
|
11393
11397
|
}))]
|
|
11394
11398
|
}))
|
|
@@ -11600,7 +11604,7 @@ const getWarningGeoJSONWithColor = (level, geoJSON) => {
|
|
|
11600
11604
|
});
|
|
11601
11605
|
};
|
|
11602
11606
|
const Form = ({
|
|
11603
|
-
|
|
11607
|
+
defaultMapPreset,
|
|
11604
11608
|
onSaveForm: _onSaveForm = () => {},
|
|
11605
11609
|
onPublishForm: _onPublishForm = () => {},
|
|
11606
11610
|
object,
|
|
@@ -11742,7 +11746,7 @@ const Form = ({
|
|
|
11742
11746
|
}, {
|
|
11743
11747
|
children: jsx(WarningsMapView, {
|
|
11744
11748
|
geojsonFeature: geoJSONFeature,
|
|
11745
|
-
|
|
11749
|
+
defaultMapPreset: defaultMapPreset,
|
|
11746
11750
|
isSnapshot: _isSnapshot
|
|
11747
11751
|
})
|
|
11748
11752
|
})), jsx(Grid2, Object.assign({
|
|
@@ -11998,7 +12002,7 @@ var PublicWarningStatus;
|
|
|
11998
12002
|
})(PublicWarningStatus || (PublicWarningStatus = {}));
|
|
11999
12003
|
|
|
12000
12004
|
const PublicWarningsFormConnect = ({
|
|
12001
|
-
|
|
12005
|
+
defaultMapPreset
|
|
12002
12006
|
}) => {
|
|
12003
12007
|
const publicWarning = useSelector(store => getPublicWarning(store));
|
|
12004
12008
|
const publicWarningObject = useSelector(store => getPublicWarningObject(store));
|
|
@@ -12059,7 +12063,7 @@ const PublicWarningsFormConnect = ({
|
|
|
12059
12063
|
isReadOnly: isReadOnly,
|
|
12060
12064
|
error: publicWarningFormError,
|
|
12061
12065
|
onFormDirty: onFormDirty,
|
|
12062
|
-
|
|
12066
|
+
defaultMapPreset: defaultMapPreset,
|
|
12063
12067
|
onAddObject: onAddObject
|
|
12064
12068
|
});
|
|
12065
12069
|
};
|
|
@@ -13723,7 +13727,7 @@ const PublicWarningsFormDialogConnect = ({
|
|
|
13723
13727
|
bounds,
|
|
13724
13728
|
source: _source = 'app',
|
|
13725
13729
|
startPosition,
|
|
13726
|
-
|
|
13730
|
+
defaultMapPreset
|
|
13727
13731
|
}) => {
|
|
13728
13732
|
const warningsApi = getWarningsApi();
|
|
13729
13733
|
const {
|
|
@@ -13826,7 +13830,7 @@ const PublicWarningsFormDialogConnect = ({
|
|
|
13826
13830
|
publicWarningEditor: publicWarningEditor
|
|
13827
13831
|
}, {
|
|
13828
13832
|
children: jsx(PublicWarningsFormConnect, {
|
|
13829
|
-
|
|
13833
|
+
defaultMapPreset: defaultMapPreset
|
|
13830
13834
|
})
|
|
13831
13835
|
})), jsx(AreaObjectLoaderConnect, {})]
|
|
13832
13836
|
});
|
|
@@ -14597,7 +14601,8 @@ const transformAirmetToWarningFormat = apiAirmet => {
|
|
|
14597
14601
|
validUntil: airmet.validDateEnd,
|
|
14598
14602
|
level: 'AIR',
|
|
14599
14603
|
probability: 0,
|
|
14600
|
-
incident: airmet.sequence
|
|
14604
|
+
incident: airmet.sequence,
|
|
14605
|
+
firName: airmet.firName
|
|
14601
14606
|
}
|
|
14602
14607
|
};
|
|
14603
14608
|
};
|
|
@@ -14619,7 +14624,8 @@ const transformSigmetToWarningFormat = apiSigmet => {
|
|
|
14619
14624
|
validUntil: sigmet.validDateEnd,
|
|
14620
14625
|
level: 'SIG',
|
|
14621
14626
|
probability: 0,
|
|
14622
|
-
incident: sigmet.sequence
|
|
14627
|
+
incident: sigmet.sequence,
|
|
14628
|
+
firName: sigmet.firName
|
|
14623
14629
|
}
|
|
14624
14630
|
};
|
|
14625
14631
|
};
|
|
@@ -14722,9 +14728,9 @@ const WarningListItem = _a => {
|
|
|
14722
14728
|
} = useWarningsTranslation();
|
|
14723
14729
|
const phenomenonDetails = allPhenomenaDict[warning.warningDetail.phenomenon];
|
|
14724
14730
|
const objectNameText = ((_c = (_b = warning.warningDetail.areas) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.objectName) || '-';
|
|
14731
|
+
const objectHoverText = warning.warningDetail.firName ? warning.warningDetail.firName : objectNameText;
|
|
14725
14732
|
const {
|
|
14726
|
-
ref: objectNameRef
|
|
14727
|
-
isOverflowing: isObjectNameOverflowing
|
|
14733
|
+
ref: objectNameRef
|
|
14728
14734
|
} = useOverflowCheck(objectNameText);
|
|
14729
14735
|
const phenomenonText = (phenomenonDetails === null || phenomenonDetails === void 0 ? void 0 : phenomenonDetails.translationKey) ? t(phenomenonDetails.translationKey) : '-';
|
|
14730
14736
|
const {
|
|
@@ -14923,8 +14929,8 @@ const WarningListItem = _a => {
|
|
|
14923
14929
|
whiteSpace: 'nowrap'
|
|
14924
14930
|
}
|
|
14925
14931
|
}, {
|
|
14926
|
-
children:
|
|
14927
|
-
title:
|
|
14932
|
+
children: jsx(CustomTooltip, Object.assign({
|
|
14933
|
+
title: objectHoverText,
|
|
14928
14934
|
placement: "top",
|
|
14929
14935
|
sx: {
|
|
14930
14936
|
zIndex: 1000
|
|
@@ -14933,9 +14939,7 @@ const WarningListItem = _a => {
|
|
|
14933
14939
|
children: jsx("span", {
|
|
14934
14940
|
children: objectNameText
|
|
14935
14941
|
})
|
|
14936
|
-
}))
|
|
14937
|
-
children: objectNameText
|
|
14938
|
-
})
|
|
14942
|
+
}))
|
|
14939
14943
|
}))
|
|
14940
14944
|
})), jsx(WarningListColumnContent, Object.assign({
|
|
14941
14945
|
title: t('warning-list-header-status'),
|
|
@@ -15536,6 +15540,37 @@ const ConfirmDeleteWarningDialog = ({
|
|
|
15536
15540
|
}));
|
|
15537
15541
|
};
|
|
15538
15542
|
|
|
15543
|
+
const config = getConfig();
|
|
15544
|
+
const airmetBaseUrl = config.GW_AIRMET_BASE_URL;
|
|
15545
|
+
const sigmetBaseUrl = config.GW_SIGMET_BASE_URL;
|
|
15546
|
+
// API
|
|
15547
|
+
const getAirmetList = auth => fetch(`${airmetBaseUrl}/airmetlist`, {
|
|
15548
|
+
headers: getHeaders(auth)
|
|
15549
|
+
}).then(r => r.json());
|
|
15550
|
+
const getSigmetList = auth => fetch(`${sigmetBaseUrl}/sigmetlist`, {
|
|
15551
|
+
headers: getHeaders(auth)
|
|
15552
|
+
}).then(r => r.json());
|
|
15553
|
+
|
|
15554
|
+
/* *
|
|
15555
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
15556
|
+
* you may not use this file except in compliance with the License.
|
|
15557
|
+
* You may obtain a copy of the License at
|
|
15558
|
+
*
|
|
15559
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
15560
|
+
*
|
|
15561
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15562
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15563
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15564
|
+
* See the License for the specific language governing permissions and
|
|
15565
|
+
* limitations under the License.
|
|
15566
|
+
*
|
|
15567
|
+
* Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
15568
|
+
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
15569
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
15570
|
+
* */
|
|
15571
|
+
const useAirmetList = () => useAuthQuery(['airmet-list'], getAirmetList);
|
|
15572
|
+
const useSigmetList = () => useAuthQuery(['sigmet-list'], getSigmetList);
|
|
15573
|
+
|
|
15539
15574
|
const PublicWarningListConnect = () => {
|
|
15540
15575
|
const {
|
|
15541
15576
|
t
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/warnings",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.31.0",
|
|
4
4
|
"description": "GeoWeb warinings library for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"@opengeoweb/snackbar": "*",
|
|
23
23
|
"react-window": "^1.8.10",
|
|
24
24
|
"react-virtualized-auto-sizer": "^1.0.20",
|
|
25
|
-
"axios": "1.
|
|
25
|
+
"axios": "^1.7.7",
|
|
26
26
|
"@opengeoweb/core": "*",
|
|
27
27
|
"@opengeoweb/webmap": "*",
|
|
28
28
|
"@opengeoweb/authentication": "*",
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Credentials } from '@opengeoweb/authentication';
|
|
2
|
+
import { AirmetConfig, AirmetFromBackend, SigmetConfig, SigmetFromBackend } from '@opengeoweb/api';
|
|
3
|
+
export declare const getAirmetList: (auth: Credentials) => Promise<AirmetFromBackend[]>;
|
|
4
|
+
export declare const getSigmetList: (auth: Credentials) => Promise<SigmetFromBackend[]>;
|
|
5
|
+
export declare const getlocalProductConfig: <T extends SigmetConfig | AirmetConfig>(configUrl: string) => Promise<T>;
|
|
6
|
+
export declare const getAirmetConfig: (auth: Credentials) => Promise<AirmetConfig>;
|
|
7
|
+
export declare const getSigmetConfig: (auth: Credentials) => Promise<SigmetConfig>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
|
+
import { AirmetFromBackend, SigmetFromBackend } from '@opengeoweb/api';
|
|
3
|
+
export declare const useAirmetList: () => UseQueryResult<AirmetFromBackend[]>;
|
|
4
|
+
export declare const useSigmetList: () => UseQueryResult<SigmetFromBackend[]>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { MapPreset } from '@opengeoweb/store';
|
|
3
3
|
import { PublicWarningDetail } from '../../store/publicWarningForm/types';
|
|
4
4
|
import { BaseDrawingListItem, DrawingListItem } from '../../store/drawings/types';
|
|
5
5
|
import { FormAction, FormError } from '../../store/publicWarningForm/reducer';
|
|
@@ -14,10 +14,7 @@ interface FormData extends PublicWarningDetail {
|
|
|
14
14
|
export declare const prepareFormValues: (data: FormData) => PublicWarningDetail;
|
|
15
15
|
interface FormProps {
|
|
16
16
|
formAction?: FormAction;
|
|
17
|
-
|
|
18
|
-
srs: string;
|
|
19
|
-
bbox: Bbox;
|
|
20
|
-
};
|
|
17
|
+
defaultMapPreset?: MapPreset;
|
|
21
18
|
onSaveForm?: (formValues: PublicWarningDetail) => void;
|
|
22
19
|
onPublishForm?: (formValues: PublicWarningDetail) => void;
|
|
23
20
|
object?: DrawingListItem;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { MapPreset } from '@opengeoweb/store';
|
|
3
3
|
interface PublicWarningsFormConnectProps {
|
|
4
|
-
|
|
5
|
-
srs: string;
|
|
6
|
-
bbox: Bbox;
|
|
7
|
-
};
|
|
4
|
+
defaultMapPreset?: MapPreset;
|
|
8
5
|
}
|
|
9
6
|
export declare const PublicWarningsFormConnect: React.FC<PublicWarningsFormConnectProps>;
|
|
10
7
|
export {};
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { uiTypes } from '@opengeoweb/store';
|
|
2
|
+
import { uiTypes, MapPreset } from '@opengeoweb/store';
|
|
3
3
|
import { ConfirmationOptions, Position } from '@opengeoweb/shared';
|
|
4
4
|
import { TFunction } from 'i18next';
|
|
5
|
-
import { Bbox } from '@opengeoweb/webmap';
|
|
6
5
|
export declare const warningFormConfirmationOptions: (t: TFunction) => ConfirmationOptions;
|
|
7
6
|
export declare const isAlreadyEdited: (publicWarningEditor: string | undefined, username: string | undefined) => boolean;
|
|
8
7
|
export declare const PublicWarningsFormDialogConnect: React.FC<{
|
|
9
8
|
bounds?: string;
|
|
10
9
|
source?: uiTypes.Source;
|
|
11
10
|
startPosition?: Position;
|
|
12
|
-
|
|
13
|
-
srs: string;
|
|
14
|
-
bbox: Bbox;
|
|
15
|
-
};
|
|
11
|
+
defaultMapPreset?: MapPreset;
|
|
16
12
|
}>;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { Bbox } from '@opengeoweb/webmap';
|
|
3
2
|
import { FeatureCollection } from 'geojson';
|
|
3
|
+
import { MapPreset } from '@opengeoweb/store';
|
|
4
4
|
export declare const zoomToFeature: (mapId: string, geojsonFeature: FeatureCollection | undefined) => void;
|
|
5
5
|
interface WarningsMapViewProps {
|
|
6
6
|
geojsonFeature: FeatureCollection | undefined;
|
|
7
|
-
|
|
8
|
-
srs: string;
|
|
9
|
-
bbox: Bbox;
|
|
10
|
-
};
|
|
7
|
+
defaultMapPreset?: MapPreset;
|
|
11
8
|
isSnapshot?: boolean;
|
|
12
9
|
}
|
|
13
10
|
export declare const WarningsMapView: React.FC<WarningsMapViewProps>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Store } from '@reduxjs/toolkit';
|
|
2
|
+
import { uiTypes, WebMapStateModuleState } from '@opengeoweb/store';
|
|
3
|
+
import { WarningModuleStore } from '../store/types';
|
|
4
|
+
export declare const createMockStore: (mockState: WarningModuleStore & uiTypes.UIModuleState & WebMapStateModuleState) => Store;
|