@opengeoweb/sigmet-airmet 19.1.0 → 19.1.1
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/dist/README.md +114 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +12359 -0
- package/dist/src/index.d.ts +18 -0
- package/dist/src/lib/api/api.d.ts +17 -0
- package/dist/src/lib/api/hooks.d.ts +16 -0
- package/dist/src/lib/api/testApi.d.ts +20 -0
- package/dist/src/lib/components/ComponentsLookUp/AirmetComponentsLookUp.d.ts +11 -0
- package/dist/src/lib/components/ComponentsLookUp/AviationProductApiWrapper.d.ts +8 -0
- package/dist/src/lib/components/ComponentsLookUp/SigmetComponentsLookUp.d.ts +11 -0
- package/dist/src/lib/components/ComponentsLookUp/index.d.ts +2 -0
- package/dist/src/lib/components/ConfigurationDemo/configurations.d.ts +7 -0
- package/dist/src/lib/components/MapViewGeoJson/MapViewGeoJson.d.ts +14 -0
- package/dist/src/lib/components/MapViewGeoJson/constants.d.ts +41 -0
- package/dist/src/lib/components/MapViewGeoJson/index.d.ts +1 -0
- package/dist/src/lib/components/MetInfoWrapper/DownloadSigmetAirmetConfigWrapper.d.ts +7 -0
- package/dist/src/lib/components/MetInfoWrapper/MetInfoWrapper.d.ts +15 -0
- package/dist/src/lib/components/MetInfoWrapper/index.d.ts +2 -0
- package/dist/src/lib/components/MetInfoWrapper/utils.d.ts +13 -0
- package/dist/src/lib/components/ProductForms/AirmetForm/AirmetForm.d.ts +19 -0
- package/dist/src/lib/components/ProductForms/ProductForm.styles.d.ts +125 -0
- package/dist/src/lib/components/ProductForms/ProductFormDialog.d.ts +12 -0
- package/dist/src/lib/components/ProductForms/ProductFormDialogContent.d.ts +18 -0
- package/dist/src/lib/components/ProductForms/ProductFormFields/Change.d.ts +4 -0
- package/dist/src/lib/components/ProductForms/ProductFormFields/CloudLevels.d.ts +12 -0
- package/dist/src/lib/components/ProductForms/ProductFormFields/DrawTools.d.ts +11 -0
- package/dist/src/lib/components/ProductForms/ProductFormFields/IssuedAt.d.ts +7 -0
- package/dist/src/lib/components/ProductForms/ProductFormFields/Levels.d.ts +16 -0
- package/dist/src/lib/components/ProductForms/ProductFormFields/ObservationForecast.d.ts +4 -0
- package/dist/src/lib/components/ProductForms/ProductFormFields/ObservationForecastTime.d.ts +7 -0
- package/dist/src/lib/components/ProductForms/ProductFormFields/Phenomenon.d.ts +6 -0
- package/dist/src/lib/components/ProductForms/ProductFormFields/ProductFormFieldLayout.d.ts +8 -0
- package/dist/src/lib/components/ProductForms/ProductFormFields/Progress.d.ts +19 -0
- package/dist/src/lib/components/ProductForms/ProductFormFields/RadioButtonAndLabel.d.ts +8 -0
- package/dist/src/lib/components/ProductForms/ProductFormFields/SelectFIR.d.ts +12 -0
- package/dist/src/lib/components/ProductForms/ProductFormFields/StartGeometry.d.ts +15 -0
- package/dist/src/lib/components/ProductForms/ProductFormFields/SurfaceVisibility.d.ts +10 -0
- package/dist/src/lib/components/ProductForms/ProductFormFields/SurfaceWind.d.ts +8 -0
- package/dist/src/lib/components/ProductForms/ProductFormFields/Tac.d.ts +9 -0
- package/dist/src/lib/components/ProductForms/ProductFormFields/Type.d.ts +4 -0
- package/dist/src/lib/components/ProductForms/ProductFormFields/ValidFrom.d.ts +10 -0
- package/dist/src/lib/components/ProductForms/ProductFormFields/ValidUntil.d.ts +5 -0
- package/dist/src/lib/components/ProductForms/ProductFormFields/VolcanicFields.d.ts +8 -0
- package/dist/src/lib/components/ProductForms/ProductFormFields/index.d.ts +17 -0
- package/dist/src/lib/components/ProductForms/ProductFormLayout.d.ts +11 -0
- package/dist/src/lib/components/ProductForms/ProductFormTac.d.ts +18 -0
- package/dist/src/lib/components/ProductForms/SigmetForm/SigmetCancelVolcanicMovements.d.ts +8 -0
- package/dist/src/lib/components/ProductForms/SigmetForm/SigmetForm.d.ts +20 -0
- package/dist/src/lib/components/ProductForms/index.d.ts +2 -0
- package/dist/src/lib/components/ProductForms/useStoredGeoJSONHandling.d.ts +26 -0
- package/dist/src/lib/components/ProductForms/utils.d.ts +89 -0
- package/dist/src/lib/components/ProductList/ProductList.d.ts +13 -0
- package/dist/src/lib/components/ProductList/ProductListRow.d.ts +11 -0
- package/dist/src/lib/components/ProductList/index.d.ts +2 -0
- package/dist/src/lib/components/Providers/Providers.d.ts +11 -0
- package/dist/src/lib/components/Providers/index.d.ts +1 -0
- package/dist/src/lib/hooks/useShortTestHelpers.d.ts +4 -0
- package/dist/src/lib/types.d.ts +399 -0
- package/dist/src/lib/utils/config/index.d.ts +4 -0
- package/dist/src/lib/utils/i18n.d.ts +7 -0
- package/dist/src/lib/utils/mockdata/fakeAirmetList.d.ts +9 -0
- package/dist/src/lib/utils/mockdata/fakeSigmetList.d.ts +13 -0
- package/dist/src/lib/utils/mockdata/index.d.ts +3 -0
- package/dist/src/lib/utils/testUtils.d.ts +16 -0
- package/package.json +2 -1
package/dist/README.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+

|
|
2
|
+

|
|
3
|
+
|
|
4
|
+
# Content
|
|
5
|
+
|
|
6
|
+
- [Installation](#installation)
|
|
7
|
+
- [Use](#use)
|
|
8
|
+
- [API](#api)
|
|
9
|
+
- [Configuration](#configuration)
|
|
10
|
+
- [Configuration file location](#configuration-file-location)
|
|
11
|
+
- [Configuration schema location](#configuration-schema-location)
|
|
12
|
+
- [Configuration typescript types](#configuration-typescript-types)
|
|
13
|
+
- [Add a new configuration key](#add-a-new-configuration-key)
|
|
14
|
+
- [Using a new configuration key](#using-a-new-configuration-key)
|
|
15
|
+
- [Documentation](#documentation)
|
|
16
|
+
|
|
17
|
+
<small><i><a href='http://ecotrust-canada.github.io/markdown-toc/'>Table of contents generated with markdown-toc</a></i></small>
|
|
18
|
+
|
|
19
|
+
# sigmet-airmet
|
|
20
|
+
|
|
21
|
+
React component library with Sigmet and Airmet components for the opengeoweb project.
|
|
22
|
+
This library was generated with [Nx](https://nx.dev).
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
npm install @opengeoweb/sigmet-airmet
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Use
|
|
31
|
+
|
|
32
|
+
You can use any component exported from sigmet-airmet by importing them, for example:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
import { MetInfoWrapper } from '@opengeoweb/sigmet-airmet'
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Configuration
|
|
39
|
+
|
|
40
|
+
Every country has different rules for aviation so a configuration file is required to let the module work correctly. Airmet uses basic configuration which has been expanded for sigmet to contain more custom properties. The validation rules are stored in schema files following the conventions of https://json-schema.org/. The configuration file is fetched from the backend.
|
|
41
|
+
|
|
42
|
+
#### Configuration file location
|
|
43
|
+
|
|
44
|
+
These are the default configuration files for both products. They are being used in the stories and snapshots.
|
|
45
|
+
|
|
46
|
+
- airmet: `libs/sigmet-airmet/src/lib/utils/config/airmet.config.json`
|
|
47
|
+
- sigmet: `libs/sigmet-airmet/src/lib/utils/config/sigmet.config.json`
|
|
48
|
+
|
|
49
|
+
#### Configuration typescript types
|
|
50
|
+
|
|
51
|
+
The `SigmetConfig` and `AirmetConfig` types can be found in `libs/sigmet-airmet/src/lib/types.ts` and are leading in defining the configuration files.
|
|
52
|
+
|
|
53
|
+
#### Add a new configuration key
|
|
54
|
+
|
|
55
|
+
Follow these steps to add a new key to the configuration file.
|
|
56
|
+
|
|
57
|
+
In this example, we're going to add a new property called `my_new_config`: an array with strings that is used by sigmet and airmet.
|
|
58
|
+
|
|
59
|
+
1. Since the new prop is used by both sigmet and airmet, we want to add it to the `FIRArea` typescript type. Inside `libs/sigmet-airmet/src/lib/types.ts` add the following:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
export type FIRArea = {
|
|
63
|
+
// ...rest of props
|
|
64
|
+
units: AllowedUnits[];
|
|
65
|
+
my_new_config: string[];
|
|
66
|
+
};
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
If you now run `nx typecheck sigmet-airmet` it will fail, and that's expected as we added a new required prop but we have not added it to our configs. We will fix this later
|
|
70
|
+
|
|
71
|
+
2. Add `my_new_config` to the configuration files. After this both stories of sigmet and airmet should work again without errors:
|
|
72
|
+
|
|
73
|
+
- inside `libs/sigmet-airmet/src/lib/utils/config/sigmet.config.json` add `"my_new_config": ["test"]`
|
|
74
|
+
- inside `libs/sigmet-airmet/src/lib/utils/config/airmet.config.json` add `"my_new_config": ["test"]`
|
|
75
|
+
|
|
76
|
+
3. Next fix the typescript errors. When running `nx typecheck sigmet-airmet` it will complain on missing props inside the `libs/sigmet-airmet/src/lib/components/ProductForms/utils.spec.tsx` test. Add the new config keys to config examples. After this typescript should be fixed. We will add tests later for this file when we want to use the new property.
|
|
77
|
+
|
|
78
|
+
4. Last but not least, don't forget to add the new keys in other configs (here and in opmet-backend).
|
|
79
|
+
|
|
80
|
+
#### Using a new configuration key
|
|
81
|
+
|
|
82
|
+
Every config key can be used throughout the aviationmodule. If we have a new property that we want to use, follow these steps.
|
|
83
|
+
|
|
84
|
+
1. Create a new method inside `libs/sigmet-airmet/src/lib/components/ProductForms/utils.tsx`. This method should have the config as param to extract the value to use inside the code. Afterwards add the tests in `libs/sigmet-airmet/src/lib/components/ProductForms/utils.spec.tsx`.
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
export const getMyNewConfigTest = (
|
|
88
|
+
fir: string,
|
|
89
|
+
config: ProductConfig,
|
|
90
|
+
): string[] => {
|
|
91
|
+
const {
|
|
92
|
+
my_new_config,
|
|
93
|
+
} = config.fir_areas[fir];
|
|
94
|
+
|
|
95
|
+
return my_new_config;
|
|
96
|
+
};
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
2. Decide on which component the configuration should be used. Let's take `StartGeometry` as example. This component needs a `productConfig` prop. Open the component and extend the props of the component with `ConfigurableFormFieldProps` like `interface StartGeometryProps extends ConfigurableFormFieldProps` and remove unneeded double props. The `StartGeometry` component is imported in `[Sigmet/Airmet]Form`, in these files pass the `productConfig` key. Afterwards you can use the prop inside `StartGeometry` like
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
const StartGeometry: React.FC<StartGeometryProps> = ({
|
|
103
|
+
// other props
|
|
104
|
+
setDrawModeType,
|
|
105
|
+
productConfig
|
|
106
|
+
}: StartGeometryProps) => {
|
|
107
|
+
const myConfigValues = getMyNewConfigTest(productConfig)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
3. After all is working add the unit tests and make sure typescript linting will pass again, as `ConfigurableFormFieldProps` makes sure you're not forgetting to pass the config.
|
|
111
|
+
|
|
112
|
+
### TypeScript Documentation
|
|
113
|
+
|
|
114
|
+
- [TypeScript Docs](https://opengeoweb.gitlab.io/opengeoweb/typescript-docs/sigmet-airmet/)
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./src/index";
|