@opengeoweb/taf 2.2.1 → 2.3.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 +376 -257
- package/index.umd.js +397 -272
- package/lib/components/TafForm/TafForm.d.ts +2 -1
- package/lib/components/TafForm/TafFormButtons/TafFormOptionsButton.d.ts +11 -0
- package/lib/components/TafForm/TafFormButtons/TafFormOptionsButton.spec.d.ts +1 -0
- package/lib/components/TafForm/TafFormRow/types.d.ts +3 -2
- package/lib/components/TafForm/TafFormWrapper.stories.d.ts +20 -0
- package/lib/components/TafForm/utils.d.ts +4 -2
- package/lib/components/TafLayout/LocationTabs/LocationTabs.d.ts +10 -0
- package/lib/components/TafLayout/LocationTabs/LocationTabs.spec.d.ts +1 -0
- package/lib/components/TafLayout/LocationTabs/LocationTabs.stories.d.ts +13 -0
- package/lib/components/TafLayout/LocationTabs/index.d.ts +1 -0
- package/lib/components/TafLayout/StatusIcon.d.ts +8 -0
- package/lib/components/TafLayout/StatusIcon.spec.d.ts +1 -0
- package/lib/components/TafLayout/TabPanel/TabPanel.d.ts +8 -0
- package/lib/components/TafLayout/TabPanel/TabPanel.spec.d.ts +1 -0
- package/lib/components/TafLayout/TabPanel/index.d.ts +1 -0
- package/lib/components/TafLayout/TacOverview/TacContainer.d.ts +9 -0
- package/lib/components/TafLayout/TacOverview/TacContainer.spec.d.ts +1 -0
- package/lib/components/TafLayout/TacOverview/TacOverview.d.ts +9 -0
- package/lib/components/TafLayout/TacOverview/TacOverview.spec.d.ts +1 -0
- package/lib/components/TafLayout/TacOverview/TacOverview.stories.d.ts +13 -0
- package/lib/components/TafLayout/TacOverview/index.d.ts +1 -0
- package/lib/components/TafLayout/TafHeader.d.ts +6 -0
- package/lib/components/TafLayout/TafHeader.spec.d.ts +1 -0
- package/lib/components/TafLayout/TafLayout.d.ts +7 -0
- package/lib/components/TafLayout/TafLayout.stories.d.ts +7 -0
- package/lib/components/TafLayout/TopTabs/TopTabs.d.ts +11 -0
- package/lib/components/TafLayout/TopTabs/TopTabs.spec.d.ts +1 -0
- package/lib/components/TafLayout/TopTabs/TopTabs.stories.d.ts +13 -0
- package/lib/components/TafLayout/TopTabs/index.d.ts +1 -0
- package/lib/components/TafLayout/utils.d.ts +18 -0
- package/lib/components/TafLayout/utils.spec.d.ts +1 -0
- package/lib/components/TafList/TafListAccordion.d.ts +1 -1
- package/lib/components/TafList/TafListButtons.d.ts +2 -1
- package/lib/types.d.ts +15 -0
- package/lib/utils/testUtils.d.ts +8 -0
- package/package.json +5 -5
- package/lib/components/TafForm/TafForm.styles.d.ts +0 -1
package/index.esm.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { TextField, SvgIcon, Grid, Box, Tooltip, Chip, Typography, Button, IconButton, Dialog, DialogTitle, DialogContent, Card, Accordion, AccordionSummary, AccordionDetails, Skeleton, Backdrop, CircularProgress } from '@mui/material';
|
|
4
4
|
import makeStyles from '@mui/styles/makeStyles';
|
|
5
5
|
import moment from 'moment';
|
|
6
|
-
import { useIsMounted, useDraftFormHelpers, ToolContainerDraggable, useConfirmationDialog, usePreventBrowserClose, StatusTag, AlertBanner, ConfirmationServiceProvider, usePoller, isAxiosError, getAxiosErrorMessage } from '@opengeoweb/shared';
|
|
7
|
-
import {
|
|
6
|
+
import { useIsMounted, ToggleMenu, useDraftFormHelpers, ToolContainerDraggable, useConfirmationDialog, usePreventBrowserClose, StatusTag, AlertBanner, ConfirmationServiceProvider, usePoller, isAxiosError, getAxiosErrorMessage } from '@opengeoweb/shared';
|
|
7
|
+
import { DragIndicator, Close, InfoOutlined, Create, CheckCircle, Schedule, OpenInNew, ExpandMore } from '@mui/icons-material';
|
|
8
8
|
import { useApiContext, useApi, createApiInstance } from '@opengeoweb/api';
|
|
9
9
|
import { getDeepProperty, ReactHookFormHiddenInput, ReactHookFormProvider } from '@opengeoweb/form-fields';
|
|
10
10
|
import { useFormContext, Controller, useFieldArray } from 'react-hook-form';
|
|
11
11
|
import { ReactSortable, Sortable } from 'react-sortablejs';
|
|
12
|
+
import { isEqual } from 'lodash';
|
|
12
13
|
|
|
13
14
|
function _typeof(obj) {
|
|
14
15
|
"@babel/helpers - typeof";
|
|
@@ -202,32 +203,47 @@ var location_indicator_mwo = "EHDB";
|
|
|
202
203
|
var locations = {
|
|
203
204
|
EHAM: {
|
|
204
205
|
validity_duration: 30,
|
|
205
|
-
activity_period: 6
|
|
206
|
+
activity_period: 6,
|
|
207
|
+
label: "Schiphol"
|
|
206
208
|
},
|
|
207
209
|
EHRD: {
|
|
208
210
|
validity_duration: 30,
|
|
209
|
-
activity_period: 6
|
|
211
|
+
activity_period: 6,
|
|
212
|
+
label: "Rotterdam"
|
|
210
213
|
},
|
|
211
214
|
EHGG: {
|
|
212
215
|
validity_duration: 30,
|
|
213
|
-
activity_period: 6
|
|
216
|
+
activity_period: 6,
|
|
217
|
+
label: "Eelde"
|
|
214
218
|
},
|
|
215
219
|
EHBK: {
|
|
216
220
|
validity_duration: 30,
|
|
217
|
-
activity_period: 6
|
|
221
|
+
activity_period: 6,
|
|
222
|
+
label: "Maastricht"
|
|
218
223
|
},
|
|
219
224
|
EHLE: {
|
|
220
225
|
validity_duration: 30,
|
|
221
|
-
activity_period: 6
|
|
226
|
+
activity_period: 6,
|
|
227
|
+
label: "Lelystad"
|
|
222
228
|
},
|
|
223
229
|
TNCB: {
|
|
224
230
|
validity_duration: 30,
|
|
225
|
-
activity_period: 6
|
|
231
|
+
activity_period: 6,
|
|
232
|
+
label: "Bonaire"
|
|
226
233
|
}
|
|
227
234
|
};
|
|
235
|
+
var locationOrder = [
|
|
236
|
+
"EHAM",
|
|
237
|
+
"EHRD",
|
|
238
|
+
"EHLE",
|
|
239
|
+
"EHGG",
|
|
240
|
+
"EHBK",
|
|
241
|
+
"TNCB"
|
|
242
|
+
];
|
|
228
243
|
var tafConfig = {
|
|
229
244
|
location_indicator_mwo: location_indicator_mwo,
|
|
230
|
-
locations: locations
|
|
245
|
+
locations: locations,
|
|
246
|
+
locationOrder: locationOrder
|
|
231
247
|
};
|
|
232
248
|
|
|
233
249
|
/*! *****************************************************************************
|
|
@@ -2501,10 +2517,24 @@ var getConfirmationDialogTitle = function getConfirmationDialogTitle(action) {
|
|
|
2501
2517
|
if (action === 'AMEND') return 'This TAF is an amendment';
|
|
2502
2518
|
if (action === 'CORRECT') return 'This TAF is a correction';
|
|
2503
2519
|
return 'Cancel TAF';
|
|
2504
|
-
};
|
|
2505
|
-
|
|
2506
|
-
|
|
2520
|
+
}; // Check if the amended/corrected TAF has been changed. Only compare the fields users are able to fill in
|
|
2521
|
+
// (i.e. exclude baseforecast valid time as that gets updated when doing an amendment automatically outside of the users influence)
|
|
2522
|
+
|
|
2523
|
+
var isTafAmendedCorrectedChanged = function isTafAmendedCorrectedChanged(isFormDirty, originalTaf, currentTaf) {
|
|
2524
|
+
var originalBaseF = originalTaf.baseForecast,
|
|
2525
|
+
originalChG = originalTaf.changeGroups;
|
|
2526
|
+
var currentBaseF = currentTaf.baseForecast,
|
|
2527
|
+
currentChG = currentTaf.changeGroups;
|
|
2528
|
+
|
|
2529
|
+
originalBaseF.valid;
|
|
2530
|
+
var originalNoValid = __rest(originalBaseF, ["valid"]);
|
|
2531
|
+
|
|
2532
|
+
currentBaseF.valid;
|
|
2533
|
+
var currentNoValid = __rest(currentBaseF, ["valid"]);
|
|
2507
2534
|
|
|
2535
|
+
return isFormDirty && (!isEqual(originalNoValid, currentNoValid) || !isEqual(originalChG, currentChG));
|
|
2536
|
+
};
|
|
2537
|
+
var getConfirmationDialogContent = function getConfirmationDialogContent(action, isFormDirty) {
|
|
2508
2538
|
switch (action) {
|
|
2509
2539
|
case 'DISCARD':
|
|
2510
2540
|
return 'Are you sure you would like to discard this TAF? Any changes made will be lost';
|
|
@@ -2514,7 +2544,7 @@ var getConfirmationDialogContent = function getConfirmationDialogContent(action)
|
|
|
2514
2544
|
|
|
2515
2545
|
case 'AMEND':
|
|
2516
2546
|
case 'CORRECT':
|
|
2517
|
-
return isFormDirty ? 'Do you want to publish it?' : 'Are you sure you want to publish the TAF? You did not make any changes!';
|
|
2547
|
+
return isFormDirty() ? 'Do you want to publish it?' : 'Are you sure you want to publish the TAF? You did not make any changes!';
|
|
2518
2548
|
|
|
2519
2549
|
default:
|
|
2520
2550
|
return 'Are you sure you want to cancel this TAF?';
|
|
@@ -2534,83 +2564,6 @@ var getConfirmationDialogButtonLabel = function getConfirmationDialogButtonLabel
|
|
|
2534
2564
|
}
|
|
2535
2565
|
};
|
|
2536
2566
|
|
|
2537
|
-
var useStyles$9 = makeStyles(function (theme) {
|
|
2538
|
-
return {
|
|
2539
|
-
textFieldGridItem: {
|
|
2540
|
-
marginRight: 4
|
|
2541
|
-
},
|
|
2542
|
-
textFieldRoot: {
|
|
2543
|
-
'&.Mui-disabled::before': {
|
|
2544
|
-
borderBottom: 'none'
|
|
2545
|
-
},
|
|
2546
|
-
'&:after': {
|
|
2547
|
-
borderBottomColor: '#3f51b5'
|
|
2548
|
-
}
|
|
2549
|
-
},
|
|
2550
|
-
textFieldInput: {
|
|
2551
|
-
fontSize: '14px',
|
|
2552
|
-
paddingLeft: 1,
|
|
2553
|
-
paddingRight: 1,
|
|
2554
|
-
color: '#051039',
|
|
2555
|
-
WebkitTextFillColor: '#051039',
|
|
2556
|
-
'&.Mui-disabled': {
|
|
2557
|
-
backgroundColor: 'white'
|
|
2558
|
-
}
|
|
2559
|
-
},
|
|
2560
|
-
textFieldLabel: {
|
|
2561
|
-
fontSize: '14px'
|
|
2562
|
-
},
|
|
2563
|
-
textFieldLabelShrink: {
|
|
2564
|
-
transform: 'translate(2px, 10px) scale(0.75) !important'
|
|
2565
|
-
},
|
|
2566
|
-
formRow: {
|
|
2567
|
-
marginTop: 8,
|
|
2568
|
-
backgroundColor: theme.palette.common.white,
|
|
2569
|
-
position: 'relative',
|
|
2570
|
-
'&.sortable-chosen': {
|
|
2571
|
-
boxShadow: theme.shadows[1]
|
|
2572
|
-
},
|
|
2573
|
-
'&.sortable-ghost': {
|
|
2574
|
-
opacity: 0.5
|
|
2575
|
-
}
|
|
2576
|
-
},
|
|
2577
|
-
tacTitle: {
|
|
2578
|
-
fontSize: '20px',
|
|
2579
|
-
fontWeight: 500
|
|
2580
|
-
},
|
|
2581
|
-
tacText: {
|
|
2582
|
-
fontSize: '14px',
|
|
2583
|
-
color: '#000000'
|
|
2584
|
-
},
|
|
2585
|
-
tacLine: {
|
|
2586
|
-
margin: '0',
|
|
2587
|
-
padding: '.1em .1em .1em 0.8em',
|
|
2588
|
-
textIndent: '-0.7em',
|
|
2589
|
-
borderRadius: '3px'
|
|
2590
|
-
},
|
|
2591
|
-
addButton: {
|
|
2592
|
-
marginRight: '48px'
|
|
2593
|
-
},
|
|
2594
|
-
lifecycleButtons: {
|
|
2595
|
-
marginTop: '40px',
|
|
2596
|
-
marginBottom: '16px'
|
|
2597
|
-
},
|
|
2598
|
-
actionButton: {
|
|
2599
|
-
marginRight: '16px'
|
|
2600
|
-
},
|
|
2601
|
-
lastButton: {
|
|
2602
|
-
marginRight: '90px'
|
|
2603
|
-
},
|
|
2604
|
-
backdrop: {
|
|
2605
|
-
zIndex: 1500,
|
|
2606
|
-
color: '#fff'
|
|
2607
|
-
},
|
|
2608
|
-
emptyButtonContainer: {
|
|
2609
|
-
minWidth: 96
|
|
2610
|
-
}
|
|
2611
|
-
};
|
|
2612
|
-
});
|
|
2613
|
-
|
|
2614
2567
|
var getTafErrors = function getTafErrors(name, errors) {
|
|
2615
2568
|
var nameAsArray = name.split('.');
|
|
2616
2569
|
|
|
@@ -2631,15 +2584,48 @@ var getTafErrors = function getTafErrors(name, errors) {
|
|
|
2631
2584
|
var getDisplayValue = function getDisplayValue(value, disabled) {
|
|
2632
2585
|
return disabled && !value ? '-' : value;
|
|
2633
2586
|
};
|
|
2587
|
+
var useStyles$8 = makeStyles(function (theme) {
|
|
2588
|
+
return {
|
|
2589
|
+
textFieldInput: {
|
|
2590
|
+
height: 46,
|
|
2591
|
+
width: 56,
|
|
2592
|
+
textAlign: 'center',
|
|
2593
|
+
fontSize: 10,
|
|
2594
|
+
fontWeight: 500,
|
|
2595
|
+
paddingLeft: 0,
|
|
2596
|
+
paddingRight: 0,
|
|
2597
|
+
marginBotom: '2px',
|
|
2598
|
+
'&.Mui-disabled': {
|
|
2599
|
+
'-webkit-text-fill-color': theme.palette.geowebColors.typographyAndIcons.text,
|
|
2600
|
+
color: theme.palette.geowebColors.typographyAndIcons.text,
|
|
2601
|
+
'&:before': {
|
|
2602
|
+
border: 'none'
|
|
2603
|
+
}
|
|
2604
|
+
}
|
|
2605
|
+
},
|
|
2606
|
+
textFieldLabel: {
|
|
2607
|
+
fontSize: '10px',
|
|
2608
|
+
'&.Mui-disabled': {
|
|
2609
|
+
color: theme.palette.geowebColors.captions.captionStatus.rgba
|
|
2610
|
+
},
|
|
2611
|
+
whiteSpace: 'nowrap',
|
|
2612
|
+
maxWidth: '100%'
|
|
2613
|
+
},
|
|
2614
|
+
textFieldLabelShrink: {
|
|
2615
|
+
transform: 'translate(2px, 10px) scale(0.75) !important',
|
|
2616
|
+
letterSpacing: '0.33px'
|
|
2617
|
+
}
|
|
2618
|
+
};
|
|
2619
|
+
});
|
|
2634
2620
|
var BaseTextField = /*#__PURE__*/React__default.memo(function (props) {
|
|
2635
|
-
var classes = useStyles$
|
|
2621
|
+
var classes = useStyles$8();
|
|
2636
2622
|
return /*#__PURE__*/React__default.createElement(TextField, Object.assign({
|
|
2637
2623
|
type: "text",
|
|
2638
2624
|
variant: "filled",
|
|
2639
2625
|
InputProps: {
|
|
2640
2626
|
classes: {
|
|
2641
|
-
|
|
2642
|
-
|
|
2627
|
+
root: classes.textFieldInput,
|
|
2628
|
+
input: classes.textFieldInput
|
|
2643
2629
|
}
|
|
2644
2630
|
},
|
|
2645
2631
|
InputLabelProps: {
|
|
@@ -2647,6 +2633,10 @@ var BaseTextField = /*#__PURE__*/React__default.memo(function (props) {
|
|
|
2647
2633
|
root: classes.textFieldLabel,
|
|
2648
2634
|
shrink: classes.textFieldLabelShrink
|
|
2649
2635
|
}
|
|
2636
|
+
},
|
|
2637
|
+
sx: {
|
|
2638
|
+
marginRight: '2px',
|
|
2639
|
+
marginBottom: '2px'
|
|
2650
2640
|
}
|
|
2651
2641
|
}, props));
|
|
2652
2642
|
}, function (prevProps, nextProps) {
|
|
@@ -2672,7 +2662,6 @@ var TafFormTextField = function TafFormTextField(_ref) {
|
|
|
2672
2662
|
autoComplete = _ref$autoComplete === void 0 ? [] : _ref$autoComplete,
|
|
2673
2663
|
_ref$autoFocus = _ref.autoFocus,
|
|
2674
2664
|
autoFocus = _ref$autoFocus === void 0 ? false : _ref$autoFocus;
|
|
2675
|
-
var classes = useStyles$9();
|
|
2676
2665
|
|
|
2677
2666
|
var _useFormContext = useFormContext(),
|
|
2678
2667
|
control = _useFormContext.control,
|
|
@@ -2729,11 +2718,7 @@ var TafFormTextField = function TafFormTextField(_ref) {
|
|
|
2729
2718
|
inputRef.current.disabled = false;
|
|
2730
2719
|
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
2731
2720
|
}, []);
|
|
2732
|
-
return /*#__PURE__*/React__default.createElement(
|
|
2733
|
-
item: true,
|
|
2734
|
-
xs: true,
|
|
2735
|
-
className: classes.textFieldGridItem
|
|
2736
|
-
}, /*#__PURE__*/React__default.createElement(Controller, {
|
|
2721
|
+
return /*#__PURE__*/React__default.createElement(Controller, {
|
|
2737
2722
|
render: function render(_props) {
|
|
2738
2723
|
var displayValue = formatter ? formatter(_props.value) : getDisplayValue(_props.value, disabled);
|
|
2739
2724
|
return /*#__PURE__*/React__default.createElement(BaseTextField, {
|
|
@@ -2761,7 +2746,7 @@ var TafFormTextField = function TafFormTextField(_ref) {
|
|
|
2761
2746
|
defaultValue: defaultValue,
|
|
2762
2747
|
rules: rules,
|
|
2763
2748
|
onFocus: onFocusField
|
|
2764
|
-
})
|
|
2749
|
+
});
|
|
2765
2750
|
};
|
|
2766
2751
|
|
|
2767
2752
|
/* *
|
|
@@ -2825,6 +2810,70 @@ var validateProbabilityField = function validateProbabilityField(value) {
|
|
|
2825
2810
|
return isValid ? true : invalidProbabilityMessage;
|
|
2826
2811
|
};
|
|
2827
2812
|
|
|
2813
|
+
/* *
|
|
2814
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2815
|
+
* you may not use this file except in compliance with the License.
|
|
2816
|
+
* You may obtain a copy of the License at
|
|
2817
|
+
*
|
|
2818
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2819
|
+
*
|
|
2820
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2821
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2822
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2823
|
+
* See the License for the specific language governing permissions and
|
|
2824
|
+
* limitations under the License.
|
|
2825
|
+
*
|
|
2826
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2827
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
2828
|
+
* */
|
|
2829
|
+
var AddIcon = /*#__PURE__*/React.createElement(SvgIcon, null, /*#__PURE__*/React.createElement("path", {
|
|
2830
|
+
d: "M10.647 10.647h6.82a1.276 1.276 0 1 0 0-2.552h-6.82v-6.82a1.276 1.276 0 1 0-2.552 0v6.82h-6.82a1.276 1.276 0 1 0 0 2.552h6.82v6.82a1.274 1.274 0 0 0 1.276 1.275c.705 0 1.276-.571 1.276-1.276v-6.82z"
|
|
2831
|
+
}));
|
|
2832
|
+
var DeleteIcon = /*#__PURE__*/React.createElement(SvgIcon, null, /*#__PURE__*/React.createElement("path", {
|
|
2833
|
+
d: "M17.504 8.228c.588 0 1.027.48.973 1.066l-.876 9.64A1.197 1.197 0 0 1 16.434 20H8.41c-.59 0-1.115-.48-1.167-1.066l-.877-9.64a.962.962 0 0 1 .973-1.066zm-2.115 1.228a.82.82 0 0 0-.819.82v7.674a.818.818 0 0 0 1.638 0v-7.675a.819.819 0 0 0-.819-.819zm-2.968 0a.819.819 0 0 0-.819.82v7.674a.818.818 0 1 0 1.638 0v-7.675a.82.82 0 0 0-.82-.819zm-2.968 0a.819.819 0 0 0-.818.82v7.674a.818.818 0 1 0 1.637 0v-7.675a.82.82 0 0 0-.82-.819zM13.432 4c.21 0 .404.168.436.376l.107.758 3.256-.01a1.606 1.606 0 0 1 1.61 1.6l.001.535-12.841.038L6 6.76a1.605 1.605 0 0 1 1.6-1.61l3.262-.008.103-.758a.454.454 0 0 1 .434-.38z"
|
|
2834
|
+
}));
|
|
2835
|
+
var CrossIcon = /*#__PURE__*/React.createElement(SvgIcon, null, /*#__PURE__*/React.createElement("path", {
|
|
2836
|
+
d: "m13.805 12 4.821-4.822a1.276 1.276 0 1 0-1.804-1.804L12 10.195 7.178 5.374a1.276 1.276 0 1 0-1.804 1.804L10.196 12l-4.822 4.822a1.276 1.276 0 1 0 1.804 1.805L12 13.805l4.822 4.822a1.274 1.274 0 0 0 1.804 0c.499-.5.499-1.306 0-1.805L13.805 12z"
|
|
2837
|
+
}));
|
|
2838
|
+
|
|
2839
|
+
var TafFormOptionsButton = function TafFormOptionsButton(_ref) {
|
|
2840
|
+
var isChangeGroup = _ref.isChangeGroup,
|
|
2841
|
+
addChangeGroupBelow = _ref.addChangeGroupBelow,
|
|
2842
|
+
addChangeGroupAbove = _ref.addChangeGroupAbove,
|
|
2843
|
+
removeChangeGroup = _ref.removeChangeGroup,
|
|
2844
|
+
clearRow = _ref.clearRow,
|
|
2845
|
+
index = _ref.index;
|
|
2846
|
+
var insertAbove = {
|
|
2847
|
+
text: 'Insert 1 row above',
|
|
2848
|
+
icon: AddIcon,
|
|
2849
|
+
action: addChangeGroupAbove
|
|
2850
|
+
};
|
|
2851
|
+
var insertBelow = {
|
|
2852
|
+
text: 'Insert 1 row below',
|
|
2853
|
+
icon: AddIcon,
|
|
2854
|
+
action: addChangeGroupBelow
|
|
2855
|
+
};
|
|
2856
|
+
var deleteRow = {
|
|
2857
|
+
text: 'Delete row',
|
|
2858
|
+
icon: DeleteIcon,
|
|
2859
|
+
action: removeChangeGroup
|
|
2860
|
+
};
|
|
2861
|
+
var clear = {
|
|
2862
|
+
text: 'Clear row',
|
|
2863
|
+
icon: CrossIcon,
|
|
2864
|
+
action: clearRow
|
|
2865
|
+
};
|
|
2866
|
+
var menuItemsBaseForecast = [insertBelow, clear];
|
|
2867
|
+
var menuItemsChangeGroup = [insertAbove, insertBelow, deleteRow, clear];
|
|
2868
|
+
return /*#__PURE__*/React.createElement(ToggleMenu, {
|
|
2869
|
+
buttonTestId: "tafFormOptions[".concat(index, "]"),
|
|
2870
|
+
buttonSx: {
|
|
2871
|
+
margin: '14px 10px'
|
|
2872
|
+
},
|
|
2873
|
+
menuItems: isChangeGroup ? menuItemsChangeGroup : menuItemsBaseForecast
|
|
2874
|
+
});
|
|
2875
|
+
};
|
|
2876
|
+
|
|
2828
2877
|
var getDefaultValue = function getDefaultValue(fieldName, data) {
|
|
2829
2878
|
if (!data) {
|
|
2830
2879
|
return '';
|
|
@@ -2845,17 +2894,16 @@ var TafFormRow = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
|
|
|
2845
2894
|
disabled = _a$disabled === void 0 ? false : _a$disabled,
|
|
2846
2895
|
_a$index = _a.index,
|
|
2847
2896
|
index = _a$index === void 0 ? -1 : _a$index,
|
|
2848
|
-
_a$lastRow = _a.lastRow,
|
|
2849
|
-
lastRow = _a$lastRow === void 0 ? false : _a$lastRow,
|
|
2850
2897
|
onRemoveChangeGroup = _a.onRemoveChangeGroup,
|
|
2851
2898
|
_a$field = _a.field,
|
|
2852
2899
|
field = _a$field === void 0 ? null : _a$field,
|
|
2853
2900
|
_a$dragHandle = _a.dragHandle,
|
|
2854
2901
|
dragHandle = _a$dragHandle === void 0 ? null : _a$dragHandle,
|
|
2855
|
-
|
|
2856
|
-
|
|
2902
|
+
onAddChangeGroupBelow = _a.onAddChangeGroupBelow,
|
|
2903
|
+
onAddChangeGroupAbove = _a.onAddChangeGroupAbove,
|
|
2904
|
+
onClearRow = _a.onClearRow,
|
|
2905
|
+
props = __rest(_a, ["isChangeGroup", "disabled", "index", "onRemoveChangeGroup", "field", "dragHandle", "onAddChangeGroupBelow", "onAddChangeGroupAbove", "onClearRow"]);
|
|
2857
2906
|
|
|
2858
|
-
var classes = useStyles$9();
|
|
2859
2907
|
var namePrefix = !isChangeGroup ? 'baseForecast' : "changeGroups[".concat(index, "]");
|
|
2860
2908
|
var fieldNames = getFieldNames(isChangeGroup, index);
|
|
2861
2909
|
|
|
@@ -2971,14 +3019,38 @@ var TafFormRow = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
|
|
|
2971
3019
|
return validFields;
|
|
2972
3020
|
};
|
|
2973
3021
|
|
|
2974
|
-
var
|
|
2975
|
-
|
|
2976
|
-
}, [
|
|
3022
|
+
var addChangeGroupBelow = React__default.useCallback(function () {
|
|
3023
|
+
onAddChangeGroupBelow(index);
|
|
3024
|
+
}, [onAddChangeGroupBelow, index]);
|
|
3025
|
+
var addChangeGroupAbove = React__default.useCallback(function () {
|
|
3026
|
+
onAddChangeGroupAbove(index);
|
|
3027
|
+
}, [onAddChangeGroupAbove, index]);
|
|
3028
|
+
var clearRow = React__default.useCallback(function () {
|
|
3029
|
+
onClearRow(index);
|
|
3030
|
+
}, [onClearRow, index]);
|
|
2977
3031
|
return /*#__PURE__*/React__default.createElement(Grid, Object.assign({
|
|
3032
|
+
sx: {
|
|
3033
|
+
marginTop: '8px',
|
|
3034
|
+
backgroundColor: 'geowebColors.cards.cardContainer',
|
|
3035
|
+
position: 'relative',
|
|
3036
|
+
'&.sortable-chosen': {
|
|
3037
|
+
boxShadow: 1
|
|
3038
|
+
},
|
|
3039
|
+
'&.sortable-ghost': {
|
|
3040
|
+
opacity: 0.5
|
|
3041
|
+
}
|
|
3042
|
+
},
|
|
3043
|
+
justifyContent: "flex-start",
|
|
2978
3044
|
"data-testid": "row-".concat(namePrefix),
|
|
2979
3045
|
container: true,
|
|
2980
3046
|
ref: ref
|
|
2981
|
-
}, props),
|
|
3047
|
+
}, props), /*#__PURE__*/React__default.createElement(Grid, {
|
|
3048
|
+
item: true,
|
|
3049
|
+
xs: 11
|
|
3050
|
+
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
3051
|
+
container: true,
|
|
3052
|
+
justifyContent: "flex-end"
|
|
3053
|
+
}, !isChangeGroup && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(TafFormTextField, {
|
|
2982
3054
|
label: "Type",
|
|
2983
3055
|
name: fieldNames.messageType,
|
|
2984
3056
|
disabled: true
|
|
@@ -2991,13 +3063,12 @@ var TafFormRow = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
|
|
|
2991
3063
|
label: "Issue time",
|
|
2992
3064
|
name: "issueDate",
|
|
2993
3065
|
disabled: true
|
|
2994
|
-
})), isChangeGroup && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
display: 'flex'
|
|
3066
|
+
})), isChangeGroup && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Box, {
|
|
3067
|
+
sx: {
|
|
3068
|
+
width: 56,
|
|
3069
|
+
marginRight: '2px'
|
|
2999
3070
|
}
|
|
3000
|
-
}, dragHandle), /*#__PURE__*/React__default.createElement(TafFormTextField, {
|
|
3071
|
+
}, !disabled && dragHandle), /*#__PURE__*/React__default.createElement(TafFormTextField, {
|
|
3001
3072
|
label: "Prob",
|
|
3002
3073
|
name: fieldNames.probability,
|
|
3003
3074
|
disabled: disabled,
|
|
@@ -3235,33 +3306,19 @@ var TafFormRow = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
|
|
|
3235
3306
|
}
|
|
3236
3307
|
}
|
|
3237
3308
|
}
|
|
3238
|
-
}),
|
|
3239
|
-
className: classes.emptyButtonContainer,
|
|
3309
|
+
}))), !disabled && /*#__PURE__*/React__default.createElement(Grid, {
|
|
3240
3310
|
item: true,
|
|
3241
|
-
xs:
|
|
3242
|
-
},
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
}, /*#__PURE__*/React__default.createElement(Add, null))), isChangeGroup && !disabled && /*#__PURE__*/React__default.createElement(Grid, {
|
|
3248
|
-
item: true
|
|
3249
|
-
}, /*#__PURE__*/React__default.createElement(IconButton, {
|
|
3250
|
-
"aria-label": "add",
|
|
3251
|
-
"data-testid": "add-changeGroup",
|
|
3252
|
-
onClick: addChangeGroup,
|
|
3253
|
-
size: "large"
|
|
3254
|
-
}, /*#__PURE__*/React__default.createElement(Add, null)), /*#__PURE__*/React__default.createElement(IconButton, Object.assign({
|
|
3255
|
-
"aria-label": "delete",
|
|
3256
|
-
"data-testid": "remove-changeGroup",
|
|
3257
|
-
onClick: function onClick() {
|
|
3311
|
+
xs: 1
|
|
3312
|
+
}, /*#__PURE__*/React__default.createElement(TafFormOptionsButton, {
|
|
3313
|
+
isChangeGroup: isChangeGroup,
|
|
3314
|
+
addChangeGroupBelow: addChangeGroupBelow,
|
|
3315
|
+
addChangeGroupAbove: addChangeGroupAbove,
|
|
3316
|
+
removeChangeGroup: function removeChangeGroup() {
|
|
3258
3317
|
return onRemoveChangeGroup(index);
|
|
3259
|
-
}
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
}
|
|
3263
|
-
size: "large"
|
|
3264
|
-
}), /*#__PURE__*/React__default.createElement(Delete, null))));
|
|
3318
|
+
},
|
|
3319
|
+
clearRow: clearRow,
|
|
3320
|
+
index: index
|
|
3321
|
+
})));
|
|
3265
3322
|
});
|
|
3266
3323
|
|
|
3267
3324
|
/* *
|
|
@@ -3310,7 +3367,8 @@ var buttonStyle = function buttonStyle(color) {
|
|
|
3310
3367
|
},
|
|
3311
3368
|
'&:focus': {
|
|
3312
3369
|
backgroundColor: buttonColor
|
|
3313
|
-
}
|
|
3370
|
+
},
|
|
3371
|
+
fontSize: 12
|
|
3314
3372
|
};
|
|
3315
3373
|
};
|
|
3316
3374
|
|
|
@@ -3382,7 +3440,7 @@ var ThumbsUp = function ThumbsUp(props) {
|
|
|
3382
3440
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3383
3441
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
3384
3442
|
* */
|
|
3385
|
-
var useStyles$
|
|
3443
|
+
var useStyles$7 = makeStyles({
|
|
3386
3444
|
paneContent: {
|
|
3387
3445
|
marginTop: '16px',
|
|
3388
3446
|
marginLeft: '24px'
|
|
@@ -3464,15 +3522,15 @@ var IssuesPane = function IssuesPane(_ref3) {
|
|
|
3464
3522
|
handleClose = _ref3.handleClose,
|
|
3465
3523
|
_ref3$errorList = _ref3.errorList,
|
|
3466
3524
|
errorList = _ref3$errorList === void 0 ? [] : _ref3$errorList;
|
|
3467
|
-
var classes = useStyles$
|
|
3525
|
+
var classes = useStyles$7();
|
|
3468
3526
|
return /*#__PURE__*/React.createElement(ToolContainerDraggable, {
|
|
3469
3527
|
startSize: {
|
|
3470
3528
|
width: '577px',
|
|
3471
3529
|
height: '200px'
|
|
3472
3530
|
},
|
|
3473
3531
|
startPosition: {
|
|
3474
|
-
|
|
3475
|
-
top:
|
|
3532
|
+
right: 20,
|
|
3533
|
+
top: 50
|
|
3476
3534
|
},
|
|
3477
3535
|
minWidth: 300,
|
|
3478
3536
|
onClose: handleClose,
|
|
@@ -3562,7 +3620,6 @@ var filterDuplicateErrors = function filterDuplicateErrors(errors) {
|
|
|
3562
3620
|
var TafFormButtons = function TafFormButtons(_ref) {
|
|
3563
3621
|
var tafAction = _ref.tafAction,
|
|
3564
3622
|
onTafFormButtonPress = _ref.onTafFormButtonPress;
|
|
3565
|
-
var classes = useStyles$9();
|
|
3566
3623
|
|
|
3567
3624
|
var _useFormContext = useFormContext(),
|
|
3568
3625
|
errors = _useFormContext.errors;
|
|
@@ -3582,30 +3639,35 @@ var TafFormButtons = function TafFormButtons(_ref) {
|
|
|
3582
3639
|
container: true,
|
|
3583
3640
|
justifyContent: "space-between",
|
|
3584
3641
|
alignItems: "center",
|
|
3585
|
-
|
|
3642
|
+
sx: {
|
|
3643
|
+
margin: '10px 0px 22px 0px'
|
|
3644
|
+
}
|
|
3586
3645
|
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
3587
3646
|
item: true
|
|
3588
3647
|
}, /*#__PURE__*/React__default.createElement(IssuesButton, {
|
|
3589
3648
|
sumOfErrors: errorList.length,
|
|
3590
3649
|
togglePane: toggleIssuesPane
|
|
3591
|
-
})), /*#__PURE__*/React__default.createElement(Grid, {
|
|
3650
|
+
}))), /*#__PURE__*/React__default.createElement(Grid, {
|
|
3651
|
+
container: true,
|
|
3652
|
+
justifyContent: "flex-end",
|
|
3653
|
+
sx: {
|
|
3654
|
+
paddingRight: '28px'
|
|
3655
|
+
}
|
|
3656
|
+
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
3592
3657
|
item: true
|
|
3593
3658
|
}, /*#__PURE__*/React__default.createElement(Button, {
|
|
3594
3659
|
"data-testid": "discardtaf",
|
|
3595
|
-
variant: "
|
|
3596
|
-
color: "secondary",
|
|
3597
|
-
type: "button",
|
|
3598
|
-
className: classes.actionButton,
|
|
3660
|
+
variant: "tertiary",
|
|
3599
3661
|
onClick: function onClick() {
|
|
3600
3662
|
// Simply discard the changes and close the dialog.
|
|
3601
3663
|
onTafFormButtonPress('DISCARD');
|
|
3602
3664
|
}
|
|
3603
3665
|
}, "Discard"), /*#__PURE__*/React__default.createElement(Button, {
|
|
3604
3666
|
"data-testid": "savedrafttaf",
|
|
3605
|
-
variant: "
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3667
|
+
variant: "tertiary",
|
|
3668
|
+
sx: {
|
|
3669
|
+
margin: '0px 10px'
|
|
3670
|
+
},
|
|
3609
3671
|
onClick: function onClick() {
|
|
3610
3672
|
/* Save the TAF as draft:
|
|
3611
3673
|
if action NEW or DRAFT - new status will be DRAFT -- default
|
|
@@ -3632,10 +3694,7 @@ var TafFormButtons = function TafFormButtons(_ref) {
|
|
|
3632
3694
|
}
|
|
3633
3695
|
}, "Save"), /*#__PURE__*/React__default.createElement(Button, {
|
|
3634
3696
|
"data-testid": "publishtaf",
|
|
3635
|
-
variant: "
|
|
3636
|
-
color: "secondary",
|
|
3637
|
-
type: "button",
|
|
3638
|
-
className: classes.lastButton,
|
|
3697
|
+
variant: "tertiary",
|
|
3639
3698
|
onClick: function onClick() {
|
|
3640
3699
|
/* Publish the TAF:
|
|
3641
3700
|
if action NEW or DRAFT - new status will be PUBLISHED -- default
|
|
@@ -3683,7 +3742,7 @@ var TafFormButtons = function TafFormButtons(_ref) {
|
|
|
3683
3742
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3684
3743
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
3685
3744
|
* */
|
|
3686
|
-
var useStyles$
|
|
3745
|
+
var useStyles$6 = makeStyles(function () {
|
|
3687
3746
|
return {
|
|
3688
3747
|
dragHandle: {
|
|
3689
3748
|
backgroundColor: 'transparent',
|
|
@@ -3703,7 +3762,7 @@ var DragHandle = function DragHandle(_ref) {
|
|
|
3703
3762
|
_ref$isDisabled = _ref.isDisabled,
|
|
3704
3763
|
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
3705
3764
|
index = _ref.index;
|
|
3706
|
-
var classes = useStyles$
|
|
3765
|
+
var classes = useStyles$6(isSorting);
|
|
3707
3766
|
return /*#__PURE__*/React__default.createElement(IconButton, {
|
|
3708
3767
|
className: "".concat(classes.dragHandle, " handle"),
|
|
3709
3768
|
"data-testid": "dragHandle-".concat(index),
|
|
@@ -3713,6 +3772,62 @@ var DragHandle = function DragHandle(_ref) {
|
|
|
3713
3772
|
}, /*#__PURE__*/React__default.createElement(DragIndicator, null));
|
|
3714
3773
|
};
|
|
3715
3774
|
|
|
3775
|
+
/* *
|
|
3776
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3777
|
+
* you may not use this file except in compliance with the License.
|
|
3778
|
+
* You may obtain a copy of the License at
|
|
3779
|
+
*
|
|
3780
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3781
|
+
*
|
|
3782
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3783
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3784
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3785
|
+
* See the License for the specific language governing permissions and
|
|
3786
|
+
* limitations under the License.
|
|
3787
|
+
*
|
|
3788
|
+
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3789
|
+
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
3790
|
+
* */
|
|
3791
|
+
|
|
3792
|
+
var TafListButtons = function TafListButtons(_ref) {
|
|
3793
|
+
var uuid = _ref.uuid,
|
|
3794
|
+
canBe = _ref.canBe,
|
|
3795
|
+
onClickTafActionButton = _ref.onClickTafActionButton,
|
|
3796
|
+
_ref$testId = _ref.testId,
|
|
3797
|
+
testId = _ref$testId === void 0 ? 'taflist-canbebuttons' : _ref$testId;
|
|
3798
|
+
return !canBe.includes('CANCELLED') && !canBe.includes('CORRECTED') && !canBe.includes('AMENDED') ? null : /*#__PURE__*/React__default.createElement(Grid, {
|
|
3799
|
+
container: true,
|
|
3800
|
+
justifyContent: "flex-end",
|
|
3801
|
+
alignItems: "center",
|
|
3802
|
+
"data-testid": testId,
|
|
3803
|
+
sx: {
|
|
3804
|
+
margin: '10px 0px 22px 0px',
|
|
3805
|
+
paddingRight: '28px'
|
|
3806
|
+
}
|
|
3807
|
+
}, canBe.includes('CANCELLED') && /*#__PURE__*/React__default.createElement(Button, {
|
|
3808
|
+
"data-testid": "canceltaf",
|
|
3809
|
+
variant: "tertiary",
|
|
3810
|
+
onClick: function onClick() {
|
|
3811
|
+
return onClickTafActionButton('CANCEL', uuid);
|
|
3812
|
+
}
|
|
3813
|
+
}, "Cancel"), canBe.includes('CORRECTED') && /*#__PURE__*/React__default.createElement(Button, {
|
|
3814
|
+
"data-testid": "correctaf",
|
|
3815
|
+
variant: "tertiary",
|
|
3816
|
+
sx: {
|
|
3817
|
+
margin: '0px 10px'
|
|
3818
|
+
},
|
|
3819
|
+
onClick: function onClick() {
|
|
3820
|
+
return onClickTafActionButton('CORRECT', uuid);
|
|
3821
|
+
}
|
|
3822
|
+
}, "Correct"), canBe.includes('AMENDED') && /*#__PURE__*/React__default.createElement(Button, {
|
|
3823
|
+
"data-testid": "amendtaf",
|
|
3824
|
+
variant: "tertiary",
|
|
3825
|
+
onClick: function onClick() {
|
|
3826
|
+
return onClickTafActionButton('AMEND', uuid);
|
|
3827
|
+
}
|
|
3828
|
+
}, "Amend"));
|
|
3829
|
+
};
|
|
3830
|
+
|
|
3716
3831
|
var noop = function noop() {};
|
|
3717
3832
|
|
|
3718
3833
|
var emptyChangegroup = {
|
|
@@ -3739,11 +3854,12 @@ var TafForm = function TafForm(_ref) {
|
|
|
3739
3854
|
tafAction = _ref.tafAction,
|
|
3740
3855
|
_ref$staticTAC = _ref.staticTAC,
|
|
3741
3856
|
staticTAC = _ref$staticTAC === void 0 ? '' : _ref$staticTAC,
|
|
3857
|
+
tafFromBackend = _ref.tafFromBackend,
|
|
3742
3858
|
_ref$onFormAction = _ref.onFormAction,
|
|
3743
3859
|
onFormAction = _ref$onFormAction === void 0 ? function () {
|
|
3744
3860
|
return null;
|
|
3745
3861
|
} : _ref$onFormAction;
|
|
3746
|
-
var
|
|
3862
|
+
var originalTaf = tafFromBackend.taf;
|
|
3747
3863
|
var confirmDialog = useConfirmationDialog();
|
|
3748
3864
|
|
|
3749
3865
|
var _useDraftFormHelpers = useDraftFormHelpers(),
|
|
@@ -3762,7 +3878,8 @@ var TafForm = function TafForm(_ref) {
|
|
|
3762
3878
|
watch = _useFormContext.watch,
|
|
3763
3879
|
trigger = _useFormContext.trigger,
|
|
3764
3880
|
formState = _useFormContext.formState,
|
|
3765
|
-
getValues = _useFormContext.getValues
|
|
3881
|
+
getValues = _useFormContext.getValues,
|
|
3882
|
+
setValue = _useFormContext.setValue;
|
|
3766
3883
|
|
|
3767
3884
|
var isFormDirty = formState.isDirty,
|
|
3768
3885
|
errors = formState.errors;
|
|
@@ -3808,7 +3925,9 @@ var TafForm = function TafForm(_ref) {
|
|
|
3808
3925
|
var showConfirmDialog = function showConfirmDialog(action) {
|
|
3809
3926
|
return confirmDialog({
|
|
3810
3927
|
title: getConfirmationDialogTitle(action),
|
|
3811
|
-
description: getConfirmationDialogContent(action,
|
|
3928
|
+
description: getConfirmationDialogContent(action, function () {
|
|
3929
|
+
return isTafAmendedCorrectedChanged(isFormDirty, originalTaf, convertTafValuesToObject(getValues()));
|
|
3930
|
+
}),
|
|
3812
3931
|
confirmLabel: getConfirmationDialogButtonLabel(action)
|
|
3813
3932
|
});
|
|
3814
3933
|
};
|
|
@@ -3846,6 +3965,15 @@ var TafForm = function TafForm(_ref) {
|
|
|
3846
3965
|
})();
|
|
3847
3966
|
break;
|
|
3848
3967
|
|
|
3968
|
+
default:
|
|
3969
|
+
onFormAction(action);
|
|
3970
|
+
break;
|
|
3971
|
+
}
|
|
3972
|
+
}; // TODO: https://gitlab.com/opengeoweb/opengeoweb/-/issues/1906 hookup actions
|
|
3973
|
+
|
|
3974
|
+
|
|
3975
|
+
var onTafViewModeButtonPress = function onTafViewModeButtonPress(action) {
|
|
3976
|
+
switch (action) {
|
|
3849
3977
|
default:
|
|
3850
3978
|
onFormAction(action);
|
|
3851
3979
|
break;
|
|
@@ -3881,22 +4009,56 @@ var TafForm = function TafForm(_ref) {
|
|
|
3881
4009
|
|
|
3882
4010
|
|
|
3883
4011
|
var focusFirstInput = function focusFirstInput(rowIndex) {
|
|
3884
|
-
var
|
|
4012
|
+
var selector = rowIndex === -1 ? "[name=\"baseForecast.wind\"]" : "[name=\"changeGroups[".concat(rowIndex, "].probability\"]");
|
|
4013
|
+
var nextRowFirstInput = document.querySelector(selector);
|
|
3885
4014
|
|
|
3886
4015
|
if (nextRowFirstInput) {
|
|
3887
4016
|
nextRowFirstInput.focus();
|
|
3888
4017
|
}
|
|
4018
|
+
}; // adding rows and validation don't work well combined, with always skipping validation of fields of rows above the one the inserted row. A setTimeout prevents this issue
|
|
4019
|
+
|
|
4020
|
+
|
|
4021
|
+
var setFocusAndValidate = function setFocusAndValidate(rowIndex) {
|
|
4022
|
+
return setTimeout(function () {
|
|
4023
|
+
focusFirstInput(rowIndex);
|
|
4024
|
+
trigger(); // trigger all fields validation
|
|
4025
|
+
}, 0);
|
|
3889
4026
|
};
|
|
3890
4027
|
|
|
3891
4028
|
var onAddRow = function onAddRow() {
|
|
3892
4029
|
var rowIndex = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;
|
|
3893
|
-
var
|
|
3894
|
-
|
|
4030
|
+
var above = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
4031
|
+
var newRowIndex = above ? rowIndex : rowIndex + 1;
|
|
4032
|
+
insert(newRowIndex, emptyChangegroup, false);
|
|
4033
|
+
setFocusAndValidate(newRowIndex);
|
|
4034
|
+
};
|
|
3895
4035
|
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
4036
|
+
var _onClearRow = function onClearRow() {
|
|
4037
|
+
var rowIndex = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;
|
|
4038
|
+
var isChangeGroup = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
4039
|
+
confirmDialog({
|
|
4040
|
+
title: 'Clear row',
|
|
4041
|
+
description: 'Are you sure you want to clear this row?',
|
|
4042
|
+
confirmLabel: 'Yes'
|
|
4043
|
+
}).then(function () {
|
|
4044
|
+
if (isChangeGroup) {
|
|
4045
|
+
remove(rowIndex);
|
|
4046
|
+
insert(rowIndex, emptyChangegroup, false);
|
|
4047
|
+
} else {
|
|
4048
|
+
var baseForecastFields = getFieldNames(false, -1);
|
|
4049
|
+
setValue(baseForecastFields.wind, '');
|
|
4050
|
+
setValue(baseForecastFields.visibility, '');
|
|
4051
|
+
setValue(baseForecastFields.weather1, '');
|
|
4052
|
+
setValue(baseForecastFields.weather2, '');
|
|
4053
|
+
setValue(baseForecastFields.weather3, '');
|
|
4054
|
+
setValue(baseForecastFields.cloud1, '');
|
|
4055
|
+
setValue(baseForecastFields.cloud2, '');
|
|
4056
|
+
setValue(baseForecastFields.cloud3, '');
|
|
4057
|
+
setValue(baseForecastFields.cloud4, '');
|
|
4058
|
+
}
|
|
4059
|
+
|
|
4060
|
+
setFocusAndValidate(rowIndex);
|
|
4061
|
+
});
|
|
3900
4062
|
};
|
|
3901
4063
|
|
|
3902
4064
|
React__default.useEffect(function () {
|
|
@@ -3910,22 +4072,34 @@ var TafForm = function TafForm(_ref) {
|
|
|
3910
4072
|
|
|
3911
4073
|
}, []);
|
|
3912
4074
|
return /*#__PURE__*/React__default.createElement("form", {
|
|
4075
|
+
"data-testid": "taf-form",
|
|
3913
4076
|
onSubmit: handleSubmit(onSubmit),
|
|
3914
4077
|
onBlur: onFormBlur
|
|
3915
4078
|
}, /*#__PURE__*/React__default.createElement(Typography, {
|
|
3916
|
-
|
|
4079
|
+
sx: {
|
|
4080
|
+
fontSize: '20px',
|
|
4081
|
+
fontWeight: 500
|
|
4082
|
+
}
|
|
3917
4083
|
}, "TAC"), /*#__PURE__*/React__default.createElement(Typography, {
|
|
3918
|
-
|
|
3919
|
-
|
|
4084
|
+
sx: {
|
|
4085
|
+
fontSize: '14px',
|
|
4086
|
+
margin: '8px 0px'
|
|
4087
|
+
},
|
|
4088
|
+
"data-testid": "form-tac-message"
|
|
3920
4089
|
}, TAC.split('\n').map(function (line) {
|
|
3921
|
-
return /*#__PURE__*/React__default.createElement(
|
|
4090
|
+
return /*#__PURE__*/React__default.createElement(Box, {
|
|
4091
|
+
component: "span",
|
|
3922
4092
|
key: line,
|
|
3923
|
-
|
|
3924
|
-
|
|
4093
|
+
"data-testid": "tafform-tac-message-line",
|
|
4094
|
+
sx: {
|
|
4095
|
+
textIndent: '-0.7em',
|
|
4096
|
+
borderRadius: '3px'
|
|
4097
|
+
}
|
|
3925
4098
|
}, line);
|
|
3926
4099
|
})), /*#__PURE__*/React__default.createElement(TafFormRow, {
|
|
3927
4100
|
disabled: isDisabled,
|
|
3928
|
-
|
|
4101
|
+
onAddChangeGroupBelow: onAddRow,
|
|
4102
|
+
onClearRow: _onClearRow
|
|
3929
4103
|
}), /*#__PURE__*/React__default.createElement(ReactSortable, {
|
|
3930
4104
|
tag: "div",
|
|
3931
4105
|
list: fields,
|
|
@@ -3943,13 +4117,17 @@ var TafForm = function TafForm(_ref) {
|
|
|
3943
4117
|
}, fields.map(function (item, index) {
|
|
3944
4118
|
return /*#__PURE__*/React__default.createElement(TafFormRow, {
|
|
3945
4119
|
field: item,
|
|
3946
|
-
className: classes.formRow,
|
|
3947
4120
|
key: item.id,
|
|
3948
4121
|
index: index,
|
|
3949
|
-
lastRow: fields.length === index + 1,
|
|
3950
4122
|
disabled: isDisabled,
|
|
3951
4123
|
onRemoveChangeGroup: onRemoverow,
|
|
3952
|
-
|
|
4124
|
+
onAddChangeGroupBelow: onAddRow,
|
|
4125
|
+
onAddChangeGroupAbove: function onAddChangeGroupAbove() {
|
|
4126
|
+
return onAddRow(index, true);
|
|
4127
|
+
},
|
|
4128
|
+
onClearRow: function onClearRow() {
|
|
4129
|
+
return _onClearRow(index, true);
|
|
4130
|
+
},
|
|
3953
4131
|
isChangeGroup: true,
|
|
3954
4132
|
dragHandle: /*#__PURE__*/React__default.createElement(DragHandle, {
|
|
3955
4133
|
isDisabled: fields.length === 1 || isDisabled,
|
|
@@ -3957,9 +4135,15 @@ var TafForm = function TafForm(_ref) {
|
|
|
3957
4135
|
index: index
|
|
3958
4136
|
})
|
|
3959
4137
|
});
|
|
3960
|
-
})),
|
|
4138
|
+
})), // TODO: these buttons should be combined, and the Issuesbuton should be separate
|
|
4139
|
+
!isDisabled ? /*#__PURE__*/React__default.createElement(TafFormButtons, {
|
|
3961
4140
|
tafAction: tafAction,
|
|
3962
4141
|
onTafFormButtonPress: onTafButtonPress
|
|
4142
|
+
}) : /*#__PURE__*/React__default.createElement(TafListButtons, {
|
|
4143
|
+
uuid: originalTaf.uuid,
|
|
4144
|
+
canBe: tafFromBackend.canbe,
|
|
4145
|
+
onClickTafActionButton: onTafViewModeButtonPress,
|
|
4146
|
+
testId: "newtaflist-canbebuttons"
|
|
3963
4147
|
}), hiddenInputFields.map(function (field) {
|
|
3964
4148
|
return /*#__PURE__*/React__default.createElement(ReactHookFormHiddenInput, {
|
|
3965
4149
|
name: field,
|
|
@@ -4059,11 +4243,12 @@ var TafFormWrapper = function TafFormWrapper(_ref) {
|
|
|
4059
4243
|
isDisabled: isDisabled,
|
|
4060
4244
|
tafAction: tafAction,
|
|
4061
4245
|
staticTAC: TAC,
|
|
4062
|
-
onFormAction: onFormAction
|
|
4246
|
+
onFormAction: onFormAction,
|
|
4247
|
+
tafFromBackend: tafFromBackend
|
|
4063
4248
|
}));
|
|
4064
4249
|
};
|
|
4065
4250
|
|
|
4066
|
-
var useStyles$
|
|
4251
|
+
var useStyles$5 = makeStyles({
|
|
4067
4252
|
dialogHeader: {
|
|
4068
4253
|
borderRadius: '3px',
|
|
4069
4254
|
border: 'solid 1px #f6f5f5',
|
|
@@ -4098,7 +4283,7 @@ var ContentDialog = function ContentDialog(_a) {
|
|
|
4098
4283
|
onFormAction = _a.onFormAction,
|
|
4099
4284
|
other = __rest(_a, ["open", "toggleDialogStatus", "titleComponent", "children", "onClose", "alertBanner", "onFormAction"]);
|
|
4100
4285
|
|
|
4101
|
-
var classes = useStyles$
|
|
4286
|
+
var classes = useStyles$5();
|
|
4102
4287
|
return /*#__PURE__*/React.createElement(Dialog, Object.assign({
|
|
4103
4288
|
"data-testid": "contentDialog",
|
|
4104
4289
|
open: open,
|
|
@@ -4191,7 +4376,7 @@ var getDraftTitle = function getDraftTitle(status) {
|
|
|
4191
4376
|
|
|
4192
4377
|
return 'Draft';
|
|
4193
4378
|
};
|
|
4194
|
-
var useStyles$
|
|
4379
|
+
var useStyles$4 = makeStyles({
|
|
4195
4380
|
cardWrapper: {
|
|
4196
4381
|
width: '100%'
|
|
4197
4382
|
},
|
|
@@ -4217,7 +4402,7 @@ var TafListRow = function TafListRow(_ref) {
|
|
|
4217
4402
|
TAC = _ref$TAC === void 0 ? '' : _ref$TAC,
|
|
4218
4403
|
_ref$showTac = _ref.showTac,
|
|
4219
4404
|
showTac = _ref$showTac === void 0 ? false : _ref$showTac;
|
|
4220
|
-
var classes = useStyles$
|
|
4405
|
+
var classes = useStyles$4();
|
|
4221
4406
|
var validTimeDate = moment.utc(taf.validDateStart).format('DD MMM');
|
|
4222
4407
|
var baseTime = moment.utc(taf.baseTime).format('HH:mm');
|
|
4223
4408
|
return /*#__PURE__*/React__default.createElement(Card, {
|
|
@@ -4394,72 +4579,6 @@ var TafFormDialog = function TafFormDialog(_ref) {
|
|
|
4394
4579
|
}, children);
|
|
4395
4580
|
};
|
|
4396
4581
|
|
|
4397
|
-
/* *
|
|
4398
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4399
|
-
* you may not use this file except in compliance with the License.
|
|
4400
|
-
* You may obtain a copy of the License at
|
|
4401
|
-
*
|
|
4402
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4403
|
-
*
|
|
4404
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
4405
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4406
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4407
|
-
* See the License for the specific language governing permissions and
|
|
4408
|
-
* limitations under the License.
|
|
4409
|
-
*
|
|
4410
|
-
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
4411
|
-
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
4412
|
-
* */
|
|
4413
|
-
var useStyles$4 = makeStyles({
|
|
4414
|
-
actionButtons: {
|
|
4415
|
-
paddingRight: '98px',
|
|
4416
|
-
paddingTop: '40px',
|
|
4417
|
-
paddingBottom: '16px'
|
|
4418
|
-
}
|
|
4419
|
-
});
|
|
4420
|
-
|
|
4421
|
-
var TafListButtons = function TafListButtons(_ref) {
|
|
4422
|
-
var uuid = _ref.uuid,
|
|
4423
|
-
canBe = _ref.canBe,
|
|
4424
|
-
onClickTafActionButton = _ref.onClickTafActionButton;
|
|
4425
|
-
var classes = useStyles$4();
|
|
4426
|
-
return !canBe.includes('CANCELLED') && !canBe.includes('CORRECTED') && !canBe.includes('AMENDED') ? null : /*#__PURE__*/React__default.createElement(Grid, {
|
|
4427
|
-
container: true,
|
|
4428
|
-
alignItems: "center",
|
|
4429
|
-
justifyContent: "flex-end",
|
|
4430
|
-
"data-testid": "taflist-canbebuttons",
|
|
4431
|
-
spacing: 1,
|
|
4432
|
-
className: classes.actionButtons
|
|
4433
|
-
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
4434
|
-
item: true
|
|
4435
|
-
}, canBe.includes('CANCELLED') && /*#__PURE__*/React__default.createElement(Button, {
|
|
4436
|
-
"data-testid": "canceltaf",
|
|
4437
|
-
variant: "outlined",
|
|
4438
|
-
color: "secondary",
|
|
4439
|
-
onClick: function onClick() {
|
|
4440
|
-
return onClickTafActionButton(uuid, 'CANCEL');
|
|
4441
|
-
}
|
|
4442
|
-
}, "Cancel")), /*#__PURE__*/React__default.createElement(Grid, {
|
|
4443
|
-
item: true
|
|
4444
|
-
}, canBe.includes('CORRECTED') && /*#__PURE__*/React__default.createElement(Button, {
|
|
4445
|
-
"data-testid": "correctaf",
|
|
4446
|
-
variant: "outlined",
|
|
4447
|
-
color: "secondary",
|
|
4448
|
-
onClick: function onClick() {
|
|
4449
|
-
return onClickTafActionButton(uuid, 'CORRECT');
|
|
4450
|
-
}
|
|
4451
|
-
}, "Correct")), /*#__PURE__*/React__default.createElement(Grid, {
|
|
4452
|
-
item: true
|
|
4453
|
-
}, canBe.includes('AMENDED') && /*#__PURE__*/React__default.createElement(Button, {
|
|
4454
|
-
"data-testid": "amendtaf",
|
|
4455
|
-
variant: "outlined",
|
|
4456
|
-
color: "secondary",
|
|
4457
|
-
onClick: function onClick() {
|
|
4458
|
-
return onClickTafActionButton(uuid, 'AMEND');
|
|
4459
|
-
}
|
|
4460
|
-
}, "Amend")));
|
|
4461
|
-
};
|
|
4462
|
-
|
|
4463
4582
|
var useStyles$3 = makeStyles({
|
|
4464
4583
|
accordion: {
|
|
4465
4584
|
marginBottom: '5px'
|
|
@@ -4521,7 +4640,7 @@ var TafListAccordion = function TafListAccordion(_ref) {
|
|
|
4521
4640
|
} : {}, {
|
|
4522
4641
|
onClick: function onClick() {
|
|
4523
4642
|
if (popOut) {
|
|
4524
|
-
onClickTafActionButton(tafListItem.taf.
|
|
4643
|
+
onClickTafActionButton(fromStatusToAction(tafListItem.taf.status), tafListItem.taf.uuid);
|
|
4525
4644
|
}
|
|
4526
4645
|
},
|
|
4527
4646
|
TransitionProps: {
|
|
@@ -4849,7 +4968,7 @@ var TafWrapper = function TafWrapper() {
|
|
|
4849
4968
|
|
|
4850
4969
|
}, [selectedTafId]);
|
|
4851
4970
|
|
|
4852
|
-
var onClickTafActionButton = function onClickTafActionButton(
|
|
4971
|
+
var onClickTafActionButton = function onClickTafActionButton(action, tafUuid) {
|
|
4853
4972
|
if (action === 'CANCEL') {
|
|
4854
4973
|
confirmDialog({
|
|
4855
4974
|
title: 'Cancel TAF',
|