@opengeoweb/taf 2.1.0 → 2.1.4
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/assets/icons.d.ts +1 -1
- package/{taf.esm.js → index.esm.js} +404 -215
- package/{taf.umd.js → index.umd.js} +493 -299
- package/lib/components/ContentDialog/ContentDialog.d.ts +1 -1
- package/lib/components/IssuesPane/IssuesPane.styles.d.ts +1 -1
- package/lib/components/TafForm/TafForm.styles.d.ts +1 -1
- package/lib/components/TafForm/TafFormRow/DragHandle.d.ts +1 -1
- package/lib/components/TafForm/TafFormRow/TafFormTextField.d.ts +1 -1
- package/lib/components/TafForm/TafFormRow/clouds.d.ts +8 -5
- package/lib/components/TafForm/TafFormRow/types.d.ts +2 -1
- package/lib/components/TafForm/TafFormRow/validField.d.ts +4 -2
- package/lib/components/TafForm/TafFormRow/wind.d.ts +6 -2
- package/lib/components/TafForm/TafFormWrapper.stories.d.ts +20 -4
- package/lib/components/TafForm/utils.d.ts +1 -1
- package/lib/components/TafList/TafListSection.stories.d.ts +12 -0
- package/lib/storyshots/Storyshots.spec.d.ts +1 -0
- package/lib/utils/mockdata/fakeTafList.d.ts +8 -0
- package/lib/utils/testUtils.d.ts +6 -0
- package/package.json +13 -14
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@material
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'react', '@material
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Taf = {}, global.React, global.
|
|
5
|
-
})(this, (function (exports, React,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@mui/material'), require('@mui/styles/makeStyles'), require('moment'), require('@opengeoweb/shared'), require('@mui/icons-material'), require('@opengeoweb/api'), require('@opengeoweb/form-fields'), require('react-hook-form'), require('react-sortablejs')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'react', '@mui/material', '@mui/styles/makeStyles', 'moment', '@opengeoweb/shared', '@mui/icons-material', '@opengeoweb/api', '@opengeoweb/form-fields', 'react-hook-form', 'react-sortablejs'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Taf = {}, global.React, global.material, global.makeStyles, global.moment, global.shared, global.iconsMaterial, global.api, global.formFields, global.reactHookForm, global.reactSortablejs));
|
|
5
|
+
})(this, (function (exports, React, material, makeStyles, moment, shared, iconsMaterial, api, formFields, reactHookForm, reactSortablejs) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
|
|
27
27
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
28
28
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
29
|
+
var makeStyles__default = /*#__PURE__*/_interopDefaultLegacy(makeStyles);
|
|
29
30
|
var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
|
|
30
31
|
|
|
31
32
|
/*! *****************************************************************************
|
|
@@ -133,10 +134,14 @@
|
|
|
133
134
|
return ar;
|
|
134
135
|
}
|
|
135
136
|
|
|
136
|
-
function __spreadArray(to, from) {
|
|
137
|
-
for (var i = 0,
|
|
138
|
-
|
|
139
|
-
|
|
137
|
+
function __spreadArray(to, from, pack) {
|
|
138
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
139
|
+
if (ar || !(i in from)) {
|
|
140
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
141
|
+
ar[i] = from[i];
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
140
145
|
}
|
|
141
146
|
|
|
142
147
|
/* *
|
|
@@ -228,20 +233,20 @@
|
|
|
228
233
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
229
234
|
* */
|
|
230
235
|
var FORMAT_DAYS_HOURS = 'DDHH';
|
|
231
|
-
var
|
|
236
|
+
var FORMAT_DAYS_HOURS_MINUTES = 'DDHHmm'; // formatters
|
|
232
237
|
|
|
233
238
|
var formatValidToString = function formatValidToString(valid) {
|
|
234
239
|
// Ensure end of valid period if midnight is shown as 24 and not 00
|
|
235
240
|
var endHours = moment__default["default"].utc(valid.end).format('kk');
|
|
236
241
|
var endDate = endHours === '24' ? moment__default["default"].utc(valid.end).add(-1, 'day').format('DD') : moment__default["default"].utc(valid.end).format('DD');
|
|
237
|
-
return valid.end ? moment__default["default"].utc(valid.start).format(FORMAT_DAYS_HOURS) + "/" + endDate + endHours : moment__default["default"].utc(valid.start).format(
|
|
242
|
+
return valid.end ? moment__default["default"].utc(valid.start).format(FORMAT_DAYS_HOURS) + "/" + endDate + endHours : moment__default["default"].utc(valid.start).format(FORMAT_DAYS_HOURS_MINUTES);
|
|
238
243
|
};
|
|
239
244
|
|
|
240
245
|
var getSections = function getSections(value, format) {
|
|
241
246
|
return {
|
|
242
247
|
day: parseInt(value.substring(0, 2), 10),
|
|
243
248
|
hour: parseInt(value.substring(2, 4), 10),
|
|
244
|
-
min: format ===
|
|
249
|
+
min: format === FORMAT_DAYS_HOURS_MINUTES ? parseInt(value.substring(4), 10) : 0
|
|
245
250
|
};
|
|
246
251
|
};
|
|
247
252
|
|
|
@@ -271,7 +276,7 @@
|
|
|
271
276
|
var tafStartMoment = moment__default["default"].utc(tafStart);
|
|
272
277
|
var tafEndMoment = moment__default["default"].utc(tafEnd);
|
|
273
278
|
var startEnd = trimmedValue.split('/');
|
|
274
|
-
var format = trimmedValue.indexOf('/') === -1 ?
|
|
279
|
+
var format = trimmedValue.indexOf('/') === -1 ? FORMAT_DAYS_HOURS_MINUTES : FORMAT_DAYS_HOURS;
|
|
275
280
|
var startSections = getSections(startEnd[0], format);
|
|
276
281
|
var start = getValidityTimeStamp('start', startSections, tafStartMoment, tafEndMoment).format('YYYY-MM-DDTHH:mm:ss[Z]'); // If we only have start value - return that otherwise, also get end time
|
|
277
282
|
|
|
@@ -296,7 +301,8 @@
|
|
|
296
301
|
var invalidValidityPeriodMessage = 'Invalid validity period, validity end time has to be after validity start time';
|
|
297
302
|
var invalidValidityEndTimeMessage = 'Invalid validity end time, change group validity must lie within the TAF validity period';
|
|
298
303
|
var invalidChangeValidInterFieldMessage = 'Invalid validity period, expected DDHH/DDHH for BECMG and TEMPO or DDHHmm for FM';
|
|
299
|
-
var invalidBECMGDurationValidInterFieldMessage = 'Invalid validity period, for BECMG only validity periods with a duration of 1, 2, 3 or 4 hours are allowed';
|
|
304
|
+
var invalidBECMGDurationValidInterFieldMessage = 'Invalid validity period, for BECMG only validity periods with a duration of 1, 2, 3 or 4 hours are allowed';
|
|
305
|
+
var invalidChangeGroupOverlapsWithFM = 'The valid time of a change group cannot overlap with the valid time of a following FM group. This change group should end before or at the hour of the start of the FM group'; // Validations
|
|
300
306
|
// Ensure all individual sections are correct (DD HH mm etc)
|
|
301
307
|
|
|
302
308
|
var validateValidSections = function validateValidSections(sections, isStartEnd) {
|
|
@@ -320,7 +326,7 @@
|
|
|
320
326
|
var tafStartMoment = moment__default["default"].utc(tafStart);
|
|
321
327
|
var tafEndMoment = moment__default["default"].utc(tafEnd);
|
|
322
328
|
var startEnd = value.split('/');
|
|
323
|
-
var format = value.indexOf('/') === -1 ?
|
|
329
|
+
var format = value.indexOf('/') === -1 ? FORMAT_DAYS_HOURS_MINUTES : FORMAT_DAYS_HOURS;
|
|
324
330
|
var validateMsg = []; // Validate start time
|
|
325
331
|
|
|
326
332
|
var startSections = getSections(startEnd[0], format); // Validate individual sections for start
|
|
@@ -398,7 +404,7 @@
|
|
|
398
404
|
var tafStartMoment = moment__default["default"].utc(tafStart);
|
|
399
405
|
var tafEndMoment = moment__default["default"].utc(tafEnd);
|
|
400
406
|
var startEnd = trimmedValue.split('/');
|
|
401
|
-
var format = trimmedValue.indexOf('/') === -1 ?
|
|
407
|
+
var format = trimmedValue.indexOf('/') === -1 ? FORMAT_DAYS_HOURS_MINUTES : FORMAT_DAYS_HOURS; // Validate start time
|
|
402
408
|
|
|
403
409
|
var startSections = getSections(startEnd[0], format);
|
|
404
410
|
var startTimestamp = getValidityTimeStamp('start', startSections, tafStartMoment, tafEndMoment);
|
|
@@ -418,17 +424,17 @@
|
|
|
418
424
|
var invalidPreviousChangeGroupIsBeforeMessage = 'Valid time should be after previous valid time';
|
|
419
425
|
var invalidPreviousChangeGroupOrderMessage = "When valid times are equal, the change/probability order should be: " + validProbChangeOrder.join(', ');
|
|
420
426
|
var invalidPreviousChangeGroupHasSameValue = "When valid times are equal, probability/change can't have the same value as previous row value";
|
|
421
|
-
var validatePreviousChangeGroup = function validatePreviousChangeGroup(currentChangeGroup,
|
|
427
|
+
var validatePreviousChangeGroup = function validatePreviousChangeGroup(currentChangeGroup, previousChangeGroup, tafStart, tafEnd) {
|
|
422
428
|
// extract the needed values from changeGroups
|
|
423
429
|
var valid = currentChangeGroup.valid,
|
|
424
430
|
_a = currentChangeGroup.change,
|
|
425
431
|
change = _a === void 0 ? '' : _a,
|
|
426
432
|
_b = currentChangeGroup.probability,
|
|
427
433
|
probability = _b === void 0 ? '' : _b;
|
|
428
|
-
var previousValid =
|
|
429
|
-
_c =
|
|
434
|
+
var previousValid = previousChangeGroup.valid,
|
|
435
|
+
_c = previousChangeGroup.change,
|
|
430
436
|
previousChange = _c === void 0 ? '' : _c,
|
|
431
|
-
_d =
|
|
437
|
+
_d = previousChangeGroup.probability,
|
|
432
438
|
previousProbability = _d === void 0 ? '' : _d; // get the parsed values
|
|
433
439
|
|
|
434
440
|
var validValue = parseValidToObject(valid, tafStart, tafEnd);
|
|
@@ -462,6 +468,27 @@
|
|
|
462
468
|
}
|
|
463
469
|
}
|
|
464
470
|
|
|
471
|
+
return true;
|
|
472
|
+
}; // validate overlapping validity when one of the following changegroups is FM
|
|
473
|
+
|
|
474
|
+
var validateOverlapWithFM = function validateOverlapWithFM(currentChangeGroup, nextChangeGroups, tafStart, tafEnd) {
|
|
475
|
+
var valid = currentChangeGroup.valid;
|
|
476
|
+
if (!valid || !nextChangeGroups.length) return true;
|
|
477
|
+
var validValue = parseValidToObject(valid, tafStart, tafEnd);
|
|
478
|
+
var currentRowEndTime = moment__default["default"](validValue.end);
|
|
479
|
+
var firstFMChangeGroup = nextChangeGroups.find(function (nextChangeGroup) {
|
|
480
|
+
return nextChangeGroup.change.trim() === 'FM';
|
|
481
|
+
});
|
|
482
|
+
|
|
483
|
+
if (firstFMChangeGroup && firstFMChangeGroup.valid) {
|
|
484
|
+
var FMValidValue = parseValidToObject(firstFMChangeGroup.valid, tafStart, tafEnd);
|
|
485
|
+
var FMStartTime = moment__default["default"](FMValidValue.start);
|
|
486
|
+
|
|
487
|
+
if (currentRowEndTime.isAfter(FMStartTime)) {
|
|
488
|
+
return invalidChangeGroupOverlapsWithFM;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
|
|
465
492
|
return true;
|
|
466
493
|
};
|
|
467
494
|
|
|
@@ -1395,8 +1422,12 @@
|
|
|
1395
1422
|
var invalidWindDirectionStepMessage = 'Invalid wind direction, the direction must be rounded to the nearest step of 10 degrees';
|
|
1396
1423
|
var invalidWindSpeedMessage = 'Invalid wind speed, expected a speed equal to 2 digits or P99';
|
|
1397
1424
|
var invalidWindGustsMessage = 'Invalid wind gusts, expected gusts equal to 2 digits or P99';
|
|
1398
|
-
var invalidWindGustSpeedCombinationMessage = 'Invalid wind,
|
|
1399
|
-
var
|
|
1425
|
+
var invalidWindGustSpeedCombinationMessage = 'Invalid wind gusts, gusts must at least be 10 knots greater than the wind speed';
|
|
1426
|
+
var invalidWindGustSpeedBelow15Message = 'Invalid wind gusts, gusts are only allowed for a minimum wind speed of 15 knots';
|
|
1427
|
+
var invalidGustForWindP99Message = 'Invalid wind speed and gust combination, if wind is P99, gusts can only be empty or P99';
|
|
1428
|
+
var invalidWindSpeedForDirectionZeroMessage = 'Invalid wind speed, if direction is 000, speed can only be 00';
|
|
1429
|
+
var invalidWindSpeedForDirectionNonZeroMessage = 'Invalid wind speed, if direction is not 000, speed can not be 00';
|
|
1430
|
+
var invalidWindVRBWindDirectionMessage = 'Invalid wind direction, VRB can only be used in combination with windspeeds smaller than 4 or in combination with gusts and showers'; // validations
|
|
1400
1431
|
|
|
1401
1432
|
var validateDirection = function validateDirection(value) {
|
|
1402
1433
|
// if not a number
|
|
@@ -1444,8 +1475,29 @@
|
|
|
1444
1475
|
return value === 'KT' || value === '' || invalidWindMessage;
|
|
1445
1476
|
};
|
|
1446
1477
|
|
|
1447
|
-
var validateWindInterSection = function validateWindInterSection(speed, gust) {
|
|
1448
|
-
if (
|
|
1478
|
+
var validateWindInterSection = function validateWindInterSection(speed, gust, direction, weather1Value, weather2Value, weather3Value) {
|
|
1479
|
+
if (direction === '000' && speed !== '00') {
|
|
1480
|
+
return invalidWindSpeedForDirectionZeroMessage;
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
if (direction !== '000' && speed === '00') {
|
|
1484
|
+
return invalidWindSpeedForDirectionNonZeroMessage;
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1487
|
+
if (direction === 'VRB' && (speed === 'P99' || parseInt(speed, 10) > 3)) {
|
|
1488
|
+
// Only allow VRB for speeds smaller than 4 or in combination with gusts and showers (SH, TS, SQ)
|
|
1489
|
+
var allowedWeatherPhenom = ['SH', 'TS', 'SQ'];
|
|
1490
|
+
if (gust === '' || !allowedWeatherPhenom.some(function (allowedPhenom) {
|
|
1491
|
+
return weather1Value.includes(allowedPhenom);
|
|
1492
|
+
}) && !allowedWeatherPhenom.some(function (allowedPhenom) {
|
|
1493
|
+
return weather2Value.includes(allowedPhenom);
|
|
1494
|
+
}) && !allowedWeatherPhenom.some(function (allowedPhenom) {
|
|
1495
|
+
return weather3Value.includes(allowedPhenom);
|
|
1496
|
+
})) return invalidWindVRBWindDirectionMessage;
|
|
1497
|
+
} // Validate gust
|
|
1498
|
+
|
|
1499
|
+
|
|
1500
|
+
if (gust === '') {
|
|
1449
1501
|
return true;
|
|
1450
1502
|
}
|
|
1451
1503
|
|
|
@@ -1453,24 +1505,35 @@
|
|
|
1453
1505
|
return invalidGustForWindP99Message;
|
|
1454
1506
|
}
|
|
1455
1507
|
|
|
1456
|
-
|
|
1508
|
+
if (parseInt(speed, 10) < 15) {
|
|
1509
|
+
return invalidWindGustSpeedBelow15Message;
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1512
|
+
if (gust !== 'P99' && parseInt(gust, 10) - parseInt(speed, 10) < 10) {
|
|
1513
|
+
return invalidWindGustSpeedCombinationMessage;
|
|
1514
|
+
}
|
|
1515
|
+
|
|
1516
|
+
return true;
|
|
1457
1517
|
}; // Main validation function
|
|
1458
1518
|
|
|
1459
1519
|
|
|
1460
|
-
var validateWindField = function validateWindField(value) {
|
|
1461
|
-
var
|
|
1520
|
+
var validateWindField = function validateWindField(value, weatherfield1, weatherfield2, weatherfield3) {
|
|
1521
|
+
var trimmedWindValue = value.trim();
|
|
1522
|
+
var trimmedWeather1Value = weatherfield1.trim();
|
|
1523
|
+
var trimmedWeather2Value = weatherfield2.trim();
|
|
1524
|
+
var trimmedWeather3Value = weatherfield3.trim();
|
|
1462
1525
|
|
|
1463
|
-
if (!
|
|
1526
|
+
if (!trimmedWindValue.length) {
|
|
1464
1527
|
return true;
|
|
1465
1528
|
} // Validate length and ensure it doesn't contain any other characters than numbers and VRB P KT and G
|
|
1466
1529
|
|
|
1467
1530
|
|
|
1468
|
-
if (
|
|
1531
|
+
if (trimmedWindValue.length < 5 || trimmedWindValue.length > 12 || !trimmedWindValue.match(/^[0-9VRBPGKT]+$/)) {
|
|
1469
1532
|
return invalidWindMessage;
|
|
1470
1533
|
} // First validate individual sections
|
|
1471
1534
|
|
|
1472
1535
|
|
|
1473
|
-
var windValidationIndv = extractValidateWindSections(
|
|
1536
|
+
var windValidationIndv = extractValidateWindSections(trimmedWindValue, true);
|
|
1474
1537
|
|
|
1475
1538
|
if (windValidationIndv.validations.length !== 0) {
|
|
1476
1539
|
return windValidationIndv.validations.find(function (error) {
|
|
@@ -1479,7 +1542,7 @@
|
|
|
1479
1542
|
} // Then do any intersection validation
|
|
1480
1543
|
|
|
1481
1544
|
|
|
1482
|
-
return validateWindInterSection(windValidationIndv.speed, windValidationIndv.gust);
|
|
1545
|
+
return validateWindInterSection(windValidationIndv.speed, windValidationIndv.gust, windValidationIndv.direction, trimmedWeather1Value, trimmedWeather2Value, trimmedWeather3Value);
|
|
1483
1546
|
};
|
|
1484
1547
|
|
|
1485
1548
|
var formatSingleCloud = function formatSingleCloud(value) {
|
|
@@ -1528,10 +1591,10 @@
|
|
|
1528
1591
|
var parseSingleCloud = function parseSingleCloud(value) {
|
|
1529
1592
|
if (!value) return null;
|
|
1530
1593
|
var trimmedCloud = value.trim();
|
|
1531
|
-
var cloudType = trimmedCloud.
|
|
1594
|
+
var cloudType = trimmedCloud.substring(6, 9);
|
|
1532
1595
|
return __assign({
|
|
1533
|
-
coverage: trimmedCloud.
|
|
1534
|
-
height: parseInt(trimmedCloud.
|
|
1596
|
+
coverage: trimmedCloud.substring(0, 3),
|
|
1597
|
+
height: parseInt(trimmedCloud.substring(3, 6), 10)
|
|
1535
1598
|
}, cloudType && {
|
|
1536
1599
|
type: cloudType
|
|
1537
1600
|
});
|
|
@@ -1549,20 +1612,22 @@
|
|
|
1549
1612
|
switch (key) {
|
|
1550
1613
|
case 'cloud1':
|
|
1551
1614
|
{
|
|
1552
|
-
|
|
1615
|
+
var trimmedValue = clouds[key].trim();
|
|
1616
|
+
|
|
1617
|
+
if (isVerticalVisibility(trimmedValue)) {
|
|
1553
1618
|
// Parse Vertical Visibility
|
|
1554
1619
|
return __assign(__assign({}, list), (_a = {}, _a[key] = {
|
|
1555
|
-
verticalVisibility: parseInt(
|
|
1620
|
+
verticalVisibility: parseInt(trimmedValue.substring(2, 5), 10)
|
|
1556
1621
|
}, _a));
|
|
1557
1622
|
}
|
|
1558
1623
|
|
|
1559
|
-
if (
|
|
1624
|
+
if (trimmedValue === 'NSC') {
|
|
1560
1625
|
// Parse No Significant Clouds
|
|
1561
|
-
return __assign(__assign({}, list), (_b = {}, _b[key] =
|
|
1626
|
+
return __assign(__assign({}, list), (_b = {}, _b[key] = trimmedValue, _b));
|
|
1562
1627
|
} // Parse Cloud
|
|
1563
1628
|
|
|
1564
1629
|
|
|
1565
|
-
return __assign(__assign({}, list), (_c = {}, _c[key] = parseSingleCloud(
|
|
1630
|
+
return __assign(__assign({}, list), (_c = {}, _c[key] = parseSingleCloud(trimmedValue), _c));
|
|
1566
1631
|
}
|
|
1567
1632
|
|
|
1568
1633
|
default:
|
|
@@ -1590,16 +1655,19 @@
|
|
|
1590
1655
|
var invalidCloudHeightStepsMessage = 'Invalid cloud height, a height above 050 must be rounded to the nearest 1000ft';
|
|
1591
1656
|
var invalidCLoudTypeMessage = 'Invalid cloud type, expected CB or TCU';
|
|
1592
1657
|
var invalidHeightTypeCombinationMessage = 'Invalid cloud input, when cloud height is 050 or higher, CB or TCU is required';
|
|
1593
|
-
var invalidVerticalVisibilityMessage = 'Invalid vertical visibility, expected VV<value> with value consisting of 3 digits
|
|
1658
|
+
var invalidVerticalVisibilityMessage = 'Invalid vertical visibility, expected VV<value> with value consisting of 3 digits';
|
|
1659
|
+
var invalidVerticalVisibilityHeightMessage = 'Invalid vertical visibility, visibility should lie between 001 and 010';
|
|
1660
|
+
var invalidVerticalVisibilityHeightFGMessage = 'Invalid vertical visibility, in case of fog visibility should lie between 001 and 005';
|
|
1594
1661
|
var invalidCloudHeightComparedToPreviousMessage = 'Invalid cloud height, height must be greater than previous cloud group height';
|
|
1595
|
-
var invalidCloud2CoverageTypeCombinationMessage = 'Invalid cloud input, cloud
|
|
1662
|
+
var invalidCloud2CoverageTypeCombinationMessage = 'Invalid cloud input, for the second cloud group (excluding any significant convective cloud groups with CB/TCU) a coverage of FEW is not allowed';
|
|
1596
1663
|
var invalidCloud2WithVerticalVisibilityMessage = 'Invalid cloud input, cloud type is required when Vertical Visibility is given';
|
|
1597
|
-
var invalidCloud3CoverageTypeCombinationMessage = 'Invalid cloud input, cloud
|
|
1664
|
+
var invalidCloud3CoverageTypeCombinationMessage = 'Invalid cloud input, for the third cloud group (excluding any significant convective cloud groups with CB/TCU) a coverage of FEW or SCT is not allowed';
|
|
1598
1665
|
var invalidCloudWithVerticalVisibilityMessage = 'Invalid cloud input, third or fourth cloud group is not allowed when Vertical Visibility is given';
|
|
1599
1666
|
var invalidCloudWithPreviousEmptyCloud = 'Invalid cloud input, value is not allowed when previous cloud group is empty';
|
|
1600
1667
|
var invalidCloudWithNSCMessage = 'Invalid cloud input, other cloud groups are not allowed when No Significant Clouds is given';
|
|
1601
|
-
var
|
|
1602
|
-
var invalidCloudCAVOKMessage = 'Invalid cloud input, when CAVOK is used, cloud groups must be empty';
|
|
1668
|
+
var invalidCloudWithPreviousType = 'Invalid cloud input, only one significant convective cloud group with CB/TCU is allowed';
|
|
1669
|
+
var invalidCloudCAVOKMessage = 'Invalid cloud input, when CAVOK is used, cloud groups must be empty';
|
|
1670
|
+
var invalidCloud4TypeMissingMessage = 'Invalid cloud input for fourth group, CB or TCU required if no other significant convective cloud group present'; // validations
|
|
1603
1671
|
|
|
1604
1672
|
var isLengthValid = function isLengthValid(value) {
|
|
1605
1673
|
var onlyDigitsOrSpecificLetters = RegExp(/^[0-9FEWSCTBKNOVU]+$/);
|
|
@@ -1646,25 +1714,32 @@
|
|
|
1646
1714
|
};
|
|
1647
1715
|
|
|
1648
1716
|
var isVerticalVisibility = function isVerticalVisibility(value) {
|
|
1649
|
-
return value.
|
|
1717
|
+
return value.substring(0, 2) === 'VV';
|
|
1650
1718
|
};
|
|
1651
1719
|
|
|
1652
|
-
var isVerticalVisibilityValid = function isVerticalVisibilityValid(value) {
|
|
1720
|
+
var isVerticalVisibilityValid = function isVerticalVisibilityValid(value, weather1, weather2, weather3) {
|
|
1653
1721
|
// validate if its a number
|
|
1654
1722
|
if (!value.match(/^[0-9]+$/)) {
|
|
1655
|
-
return
|
|
1723
|
+
return invalidVerticalVisibilityMessage;
|
|
1656
1724
|
} // check if its 3 digits
|
|
1657
1725
|
|
|
1658
1726
|
|
|
1659
1727
|
if (value.length !== 3) {
|
|
1660
|
-
return
|
|
1661
|
-
}
|
|
1662
|
-
|
|
1728
|
+
return invalidVerticalVisibilityMessage;
|
|
1729
|
+
}
|
|
1663
1730
|
|
|
1664
1731
|
var intValue = parseInt(value, 10);
|
|
1665
1732
|
|
|
1666
|
-
if (
|
|
1667
|
-
|
|
1733
|
+
if (weather1 !== 'FG' && weather2 !== 'FG' && weather3 !== 'FG') {
|
|
1734
|
+
// value should not be above 10
|
|
1735
|
+
if (intValue < 1 || intValue > 10) {
|
|
1736
|
+
return invalidVerticalVisibilityHeightMessage;
|
|
1737
|
+
}
|
|
1738
|
+
} else if (intValue < 1 || intValue > 5) {
|
|
1739
|
+
// Apply Dutch rule as national exception
|
|
1740
|
+
// In case of fog (FG) the vertical visibility can only be between VV001 up to and including VV005
|
|
1741
|
+
// HEIGHT_VV is: (001-(1)-005). Deze maxima zijn officiële Nederlandse afwijkingen van de WMO/ICAO regelgeving
|
|
1742
|
+
return invalidVerticalVisibilityHeightFGMessage;
|
|
1668
1743
|
}
|
|
1669
1744
|
|
|
1670
1745
|
return true;
|
|
@@ -1681,14 +1756,14 @@
|
|
|
1681
1756
|
} // Validate coverage
|
|
1682
1757
|
|
|
1683
1758
|
|
|
1684
|
-
var coverage = value.
|
|
1759
|
+
var coverage = value.substring(0, 3);
|
|
1685
1760
|
|
|
1686
1761
|
if (!isCoverageValid(coverage)) {
|
|
1687
1762
|
errorMessages.push(invalidCloudCoverageMessage);
|
|
1688
1763
|
} // Validate height
|
|
1689
1764
|
|
|
1690
1765
|
|
|
1691
|
-
var height = value.
|
|
1766
|
+
var height = value.substring(3, 6);
|
|
1692
1767
|
var isValidHeight = isHeightValid(height);
|
|
1693
1768
|
|
|
1694
1769
|
if (isValidHeight !== true) {
|
|
@@ -1697,7 +1772,7 @@
|
|
|
1697
1772
|
} // Validate type
|
|
1698
1773
|
|
|
1699
1774
|
|
|
1700
|
-
var type = value.
|
|
1775
|
+
var type = value.substring(6, 9);
|
|
1701
1776
|
|
|
1702
1777
|
if (!isTypeValid(type)) {
|
|
1703
1778
|
errorMessages.push(invalidCLoudTypeMessage);
|
|
@@ -1716,56 +1791,66 @@
|
|
|
1716
1791
|
};
|
|
1717
1792
|
};
|
|
1718
1793
|
|
|
1719
|
-
var validateFirstCloud = function validateFirstCloud(value, visibilityValue) {
|
|
1720
|
-
var
|
|
1794
|
+
var validateFirstCloud = function validateFirstCloud(value, visibilityValue, weatherfield1, weatherfield2, weatherfield3) {
|
|
1795
|
+
var trimmedValueFirstCloud = value.trim();
|
|
1796
|
+
var trimmedValueVisibility = visibilityValue.trim();
|
|
1797
|
+
var trimmedWeather1Value = weatherfield1.trim();
|
|
1798
|
+
var trimmedWeather2Value = weatherfield2.trim();
|
|
1799
|
+
var trimmedWeather3Value = weatherfield3.trim(); // Field can be left empty
|
|
1721
1800
|
|
|
1722
|
-
if (!
|
|
1801
|
+
if (!trimmedValueFirstCloud.length) {
|
|
1723
1802
|
return true;
|
|
1724
1803
|
}
|
|
1725
1804
|
|
|
1726
|
-
if (
|
|
1805
|
+
if (trimmedValueFirstCloud && trimmedValueVisibility === 'CAVOK') {
|
|
1727
1806
|
return invalidCloudCAVOKMessage;
|
|
1728
1807
|
} // Check for No Signicant Clouds
|
|
1729
1808
|
|
|
1730
1809
|
|
|
1731
|
-
if (
|
|
1810
|
+
if (trimmedValueFirstCloud === 'NSC') {
|
|
1732
1811
|
return true;
|
|
1733
1812
|
} // Validate Vertical Visibility
|
|
1734
1813
|
|
|
1735
1814
|
|
|
1736
|
-
if (isVerticalVisibility(
|
|
1815
|
+
if (isVerticalVisibility(trimmedValueFirstCloud)) {
|
|
1737
1816
|
if ( // Validate length of 5
|
|
1738
|
-
|
|
1739
|
-
!
|
|
1740
|
-
return invalidVerticalVisibilityMessage;
|
|
1741
|
-
}
|
|
1742
|
-
|
|
1743
|
-
var verticalVisibilityValue = trimmedValue.substr(2, 3);
|
|
1744
|
-
|
|
1745
|
-
if (!isVerticalVisibilityValid(verticalVisibilityValue)) {
|
|
1817
|
+
trimmedValueFirstCloud.length !== 5 || // Ensure it only contains digits or VV
|
|
1818
|
+
!trimmedValueFirstCloud.match(/^[0-9V]+$/)) {
|
|
1746
1819
|
return invalidVerticalVisibilityMessage;
|
|
1747
1820
|
}
|
|
1748
1821
|
|
|
1749
|
-
|
|
1822
|
+
var verticalVisibilityValue = trimmedValueFirstCloud.substring(2, 5);
|
|
1823
|
+
return isVerticalVisibilityValid(verticalVisibilityValue, trimmedWeather1Value, trimmedWeather2Value, trimmedWeather3Value);
|
|
1750
1824
|
}
|
|
1751
1825
|
|
|
1752
1826
|
var errorMessages = sharedCloudValidations({
|
|
1753
|
-
value:
|
|
1827
|
+
value: trimmedValueFirstCloud,
|
|
1754
1828
|
canBeNSC: true
|
|
1755
1829
|
}).errorMessages; // Return first error if any
|
|
1756
1830
|
|
|
1757
1831
|
return errorMessages.length ? errorMessages[0] : true;
|
|
1758
1832
|
};
|
|
1759
1833
|
var validateSecondCloud = function validateSecondCloud(firstCloudValue, secondCloudValue, visibilityValue) {
|
|
1760
|
-
var
|
|
1834
|
+
var trimmedValueFirstCloud = firstCloudValue.trim();
|
|
1835
|
+
var trimmedValueSecondCloud = secondCloudValue.trim(); // Field can be left empty
|
|
1761
1836
|
|
|
1762
|
-
if (!
|
|
1837
|
+
if (!trimmedValueSecondCloud.length) {
|
|
1763
1838
|
return true;
|
|
1839
|
+
} // If Cloud1 is NSC, Cloud2 has to be empty
|
|
1840
|
+
|
|
1841
|
+
|
|
1842
|
+
if (trimmedValueFirstCloud === 'NSC' && trimmedValueSecondCloud !== '') {
|
|
1843
|
+
return invalidCloudWithNSCMessage;
|
|
1844
|
+
} // If Cloud1 is empty Cloud2 should be empty
|
|
1845
|
+
|
|
1846
|
+
|
|
1847
|
+
if (trimmedValueFirstCloud === '') {
|
|
1848
|
+
return invalidCloudWithPreviousEmptyCloud;
|
|
1764
1849
|
} // Generic validations
|
|
1765
1850
|
|
|
1766
1851
|
|
|
1767
1852
|
var _a = sharedCloudValidations({
|
|
1768
|
-
value:
|
|
1853
|
+
value: trimmedValueSecondCloud
|
|
1769
1854
|
}),
|
|
1770
1855
|
coverage = _a.coverage,
|
|
1771
1856
|
height = _a.height,
|
|
@@ -1775,32 +1860,32 @@
|
|
|
1775
1860
|
|
|
1776
1861
|
if (errorMessages.length) {
|
|
1777
1862
|
return errorMessages[0];
|
|
1778
|
-
} // Cloud2 specific validations
|
|
1779
|
-
// Without type, coverage can not be FEW
|
|
1863
|
+
} // Cloud2 specific validations - only to be applied when cloud1 does not contain type CB/TCU
|
|
1780
1864
|
|
|
1781
1865
|
|
|
1782
|
-
|
|
1783
|
-
|
|
1866
|
+
var typeCloud1 = trimmedValueFirstCloud.substring(6, 9);
|
|
1867
|
+
|
|
1868
|
+
if (typeCloud1 !== 'CB' && typeCloud1 !== 'TCU') {
|
|
1869
|
+
// Without a type specified in cloud group 1, this group counts as #2 and coverage can not be FEW
|
|
1870
|
+
if (type === '' && coverage === 'FEW') {
|
|
1871
|
+
return invalidCloud2CoverageTypeCombinationMessage;
|
|
1872
|
+
}
|
|
1784
1873
|
} // If Cloud1 is not valid, skip further validation of Cloud2
|
|
1874
|
+
// No need to pass the weatherfields as their content does not influence what happens below
|
|
1785
1875
|
|
|
1786
1876
|
|
|
1787
|
-
if (validateFirstCloud(
|
|
1877
|
+
if (validateFirstCloud(trimmedValueFirstCloud, visibilityValue, '', '', '') !== true) {
|
|
1788
1878
|
return true;
|
|
1789
|
-
} // If Cloud1
|
|
1879
|
+
} // If Cloud1 contains a type, Cloud2 cannot contain a type
|
|
1790
1880
|
|
|
1791
1881
|
|
|
1792
|
-
if (
|
|
1793
|
-
return
|
|
1794
|
-
} // If Cloud1 is empty Cloud2 should be empty
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
if (firstCloudValue === '') {
|
|
1798
|
-
return invalidCloudWithPreviousEmptyCloud;
|
|
1882
|
+
if (type !== '' && typeCloud1 !== '') {
|
|
1883
|
+
return invalidCloudWithPreviousType;
|
|
1799
1884
|
} // Cloud2 height has to be greater than Cloud1 height
|
|
1800
1885
|
|
|
1801
1886
|
|
|
1802
|
-
if (!isVerticalVisibility(
|
|
1803
|
-
var cloud1Height =
|
|
1887
|
+
if (!isVerticalVisibility(trimmedValueFirstCloud)) {
|
|
1888
|
+
var cloud1Height = trimmedValueFirstCloud.substring(3, 6);
|
|
1804
1889
|
|
|
1805
1890
|
if (height <= cloud1Height) {
|
|
1806
1891
|
return invalidCloudHeightComparedToPreviousMessage;
|
|
@@ -1808,22 +1893,34 @@
|
|
|
1808
1893
|
} // If Cloud1 contains Vertical Visibility then Cloud2 type is required
|
|
1809
1894
|
|
|
1810
1895
|
|
|
1811
|
-
if (isVerticalVisibility(
|
|
1896
|
+
if (isVerticalVisibility(trimmedValueFirstCloud) && type === '') {
|
|
1812
1897
|
return invalidCloud2WithVerticalVisibilityMessage;
|
|
1813
1898
|
}
|
|
1814
1899
|
|
|
1815
1900
|
return true;
|
|
1816
1901
|
};
|
|
1817
1902
|
var validateThirdCloud = function validateThirdCloud(firstCloudValue, secondCloudValue, thirdCloudValue, visibilityValue) {
|
|
1818
|
-
var
|
|
1903
|
+
var trimmedValueFirstCloud = firstCloudValue.trim();
|
|
1904
|
+
var trimmedValueSecondCloud = secondCloudValue.trim();
|
|
1905
|
+
var trimmedValueThirdCloud = thirdCloudValue.trim(); // Field can be left empty
|
|
1819
1906
|
|
|
1820
|
-
if (!
|
|
1907
|
+
if (!trimmedValueThirdCloud.length) {
|
|
1821
1908
|
return true;
|
|
1909
|
+
} // If Cloud1 is NSC, Cloud3 has to be empty
|
|
1910
|
+
|
|
1911
|
+
|
|
1912
|
+
if (trimmedValueFirstCloud === 'NSC' && trimmedValueThirdCloud !== '') {
|
|
1913
|
+
return invalidCloudWithNSCMessage;
|
|
1914
|
+
} // If Cloud1 or Cloud2 is empty Cloud3 should be empty
|
|
1915
|
+
|
|
1916
|
+
|
|
1917
|
+
if (trimmedValueFirstCloud === '' || trimmedValueSecondCloud === '') {
|
|
1918
|
+
return invalidCloudWithPreviousEmptyCloud;
|
|
1822
1919
|
} // Generic validations
|
|
1823
1920
|
|
|
1824
1921
|
|
|
1825
1922
|
var _a = sharedCloudValidations({
|
|
1826
|
-
value:
|
|
1923
|
+
value: trimmedValueThirdCloud
|
|
1827
1924
|
}),
|
|
1828
1925
|
coverage = _a.coverage,
|
|
1829
1926
|
height = _a.height,
|
|
@@ -1834,45 +1931,45 @@
|
|
|
1834
1931
|
if (errorMessages.length) {
|
|
1835
1932
|
return errorMessages[0];
|
|
1836
1933
|
} // Cloud3 specific validations
|
|
1837
|
-
// Without type, coverage can not be FEW or SCT
|
|
1934
|
+
// Without a type specified in cloud group 1 or 2, this group counts as #3 and coverage can not be FEW or SCT
|
|
1838
1935
|
|
|
1839
1936
|
|
|
1840
|
-
|
|
1841
|
-
|
|
1937
|
+
var typeCloud1 = trimmedValueFirstCloud.substring(6, 9);
|
|
1938
|
+
var typeCloud2 = trimmedValueSecondCloud.substring(6, 9);
|
|
1939
|
+
|
|
1940
|
+
if (typeCloud1 !== 'CB' && typeCloud1 !== 'TCU' && typeCloud2 !== 'CB' && typeCloud2 !== 'TCU') {
|
|
1941
|
+
if (type === '' && (coverage === 'FEW' || coverage === 'SCT')) {
|
|
1942
|
+
return invalidCloud3CoverageTypeCombinationMessage;
|
|
1943
|
+
}
|
|
1944
|
+
} else if (type === '' && coverage === 'FEW') {
|
|
1945
|
+
// In case we do have a CB/TCU group in one of the previous clouf groups. This cloudgroup should be evaluated as if it was the second group
|
|
1946
|
+
return invalidCloud2CoverageTypeCombinationMessage;
|
|
1842
1947
|
} // If Cloud1 is not valid, skip further validation of Cloud3
|
|
1948
|
+
// No need to pass the weatherfields as their content does not influence what happens below
|
|
1949
|
+
// Since in case of VV the third field should be empty anyways
|
|
1843
1950
|
|
|
1844
1951
|
|
|
1845
|
-
if (validateFirstCloud(
|
|
1952
|
+
if (validateFirstCloud(trimmedValueFirstCloud, visibilityValue, '', '', '') !== true) {
|
|
1846
1953
|
return true;
|
|
1847
|
-
} // If Cloud1 is empty Cloud3 should be empty
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
if (firstCloudValue === '') {
|
|
1851
|
-
return invalidCloudWithPreviousEmptyCloud;
|
|
1852
1954
|
} // If Cloud1 contains Vertical Visibility then Cloud3 should be empty
|
|
1853
1955
|
|
|
1854
1956
|
|
|
1855
|
-
if (isVerticalVisibility(
|
|
1957
|
+
if (isVerticalVisibility(trimmedValueFirstCloud)) {
|
|
1856
1958
|
return invalidCloudWithVerticalVisibilityMessage;
|
|
1857
|
-
} // If Cloud1 is NSC, Cloud3 has to be empty
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
if (firstCloudValue === 'NSC' && trimmedValue !== '') {
|
|
1861
|
-
return invalidCloudWithNSCMessage;
|
|
1862
1959
|
} // If Cloud2 is not valid, skip further validation of Cloud3
|
|
1863
1960
|
|
|
1864
1961
|
|
|
1865
|
-
if (validateSecondCloud(
|
|
1962
|
+
if (validateSecondCloud(trimmedValueFirstCloud, trimmedValueSecondCloud, visibilityValue) !== true) {
|
|
1866
1963
|
return true;
|
|
1867
|
-
} // If
|
|
1964
|
+
} // If one of the previous groups contains a type, Cloud3 cannot contain a type
|
|
1868
1965
|
|
|
1869
1966
|
|
|
1870
|
-
if (
|
|
1871
|
-
return
|
|
1967
|
+
if (type !== '' && (typeCloud1 !== '' || typeCloud2 !== '')) {
|
|
1968
|
+
return invalidCloudWithPreviousType;
|
|
1872
1969
|
} // Cloud3 height has to be greater than Cloud2 height
|
|
1873
1970
|
|
|
1874
1971
|
|
|
1875
|
-
var cloud2Height =
|
|
1972
|
+
var cloud2Height = trimmedValueSecondCloud.substring(3, 6);
|
|
1876
1973
|
|
|
1877
1974
|
if (height <= cloud2Height) {
|
|
1878
1975
|
return invalidCloudHeightComparedToPreviousMessage;
|
|
@@ -1881,17 +1978,31 @@
|
|
|
1881
1978
|
return true;
|
|
1882
1979
|
};
|
|
1883
1980
|
var validateFourthCloud = function validateFourthCloud(firstCloudValue, secondCloudValue, thirdCloudValue, fourthCloudValue, visibilityValue) {
|
|
1884
|
-
var
|
|
1981
|
+
var trimmedValueFirstCloud = firstCloudValue.trim();
|
|
1982
|
+
var trimmedValueSecondCloud = secondCloudValue.trim();
|
|
1983
|
+
var trimmedValueThirdCloud = thirdCloudValue.trim();
|
|
1984
|
+
var trimmedValueFourthCloud = fourthCloudValue.trim(); // Field can be left empty
|
|
1885
1985
|
|
|
1886
|
-
if (!
|
|
1986
|
+
if (!trimmedValueFourthCloud.length) {
|
|
1887
1987
|
return true;
|
|
1988
|
+
} // If Cloud1 is NSC, Cloud4 has to be empty
|
|
1989
|
+
|
|
1990
|
+
|
|
1991
|
+
if (trimmedValueFirstCloud === 'NSC' && trimmedValueFourthCloud !== '') {
|
|
1992
|
+
return invalidCloudWithNSCMessage;
|
|
1993
|
+
} // If Cloud 1, 2 or 3 is empty Cloud4 should be empty
|
|
1994
|
+
|
|
1995
|
+
|
|
1996
|
+
if (trimmedValueFirstCloud === '' || trimmedValueSecondCloud === '' || trimmedValueThirdCloud === '') {
|
|
1997
|
+
return invalidCloudWithPreviousEmptyCloud;
|
|
1888
1998
|
} // Generic validations
|
|
1889
1999
|
|
|
1890
2000
|
|
|
1891
2001
|
var _a = sharedCloudValidations({
|
|
1892
|
-
value:
|
|
2002
|
+
value: trimmedValueFourthCloud
|
|
1893
2003
|
}),
|
|
1894
2004
|
height = _a.height,
|
|
2005
|
+
coverage = _a.coverage,
|
|
1895
2006
|
type = _a.type,
|
|
1896
2007
|
errorMessages = _a.errorMessages; // Return generic errors if any
|
|
1897
2008
|
|
|
@@ -1899,50 +2010,48 @@
|
|
|
1899
2010
|
if (errorMessages.length) {
|
|
1900
2011
|
return errorMessages[0];
|
|
1901
2012
|
} // Cloud4 specific validations
|
|
1902
|
-
//
|
|
2013
|
+
// If none of the previous cloud groups contains a type, the fourth group must contain a type if not empty
|
|
2014
|
+
|
|
1903
2015
|
|
|
2016
|
+
var typeCloud1 = trimmedValueFirstCloud.substring(6, 9);
|
|
2017
|
+
var typeCloud2 = trimmedValueSecondCloud.substring(6, 9);
|
|
2018
|
+
var typeCloud3 = trimmedValueThirdCloud.substring(6, 9);
|
|
1904
2019
|
|
|
1905
|
-
if (
|
|
1906
|
-
|
|
2020
|
+
if (typeCloud1 !== 'CB' && typeCloud1 !== 'TCU' && typeCloud2 !== 'CB' && typeCloud2 !== 'TCU' && typeCloud3 !== 'CB' && typeCloud3 !== 'TCU') {
|
|
2021
|
+
if (type === '') {
|
|
2022
|
+
return invalidCloud4TypeMissingMessage;
|
|
2023
|
+
}
|
|
2024
|
+
} else if (coverage === 'FEW' || coverage === 'SCT') {
|
|
2025
|
+
// We have a CB/TCU group in one of the previous cloud groups. This group should be evaluated as if it was the third group
|
|
2026
|
+
return invalidCloud3CoverageTypeCombinationMessage;
|
|
1907
2027
|
} // If Cloud1 is not valid, skip further validation of Cloud4
|
|
2028
|
+
// No need to pass the weatherfields as their content does not influence what happens below
|
|
2029
|
+
// Since in case of VV the fourth field should be empty anyways
|
|
1908
2030
|
|
|
1909
2031
|
|
|
1910
|
-
if (validateFirstCloud(
|
|
2032
|
+
if (validateFirstCloud(trimmedValueFirstCloud, visibilityValue, '', '', '') !== true) {
|
|
1911
2033
|
return true;
|
|
1912
2034
|
} // If Cloud1 contains Vertical Visibility then Cloud4 should be empty
|
|
1913
2035
|
|
|
1914
2036
|
|
|
1915
|
-
if (isVerticalVisibility(
|
|
2037
|
+
if (isVerticalVisibility(trimmedValueFirstCloud)) {
|
|
1916
2038
|
return invalidCloudWithVerticalVisibilityMessage;
|
|
1917
|
-
} // If Cloud1 is NSC, Cloud4 has to be empty
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
if (firstCloudValue === 'NSC' && trimmedValue !== '') {
|
|
1921
|
-
return invalidCloudWithNSCMessage;
|
|
1922
|
-
} // If Cloud 1, 2 or 3 is empty Cloud4 should be empty
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
if (firstCloudValue === '' || secondCloudValue === '' || thirdCloudValue === '') {
|
|
1926
|
-
return invalidCloudWithPreviousEmptyCloud;
|
|
1927
2039
|
} // If Cloud3 is not valid, skip further validation of Cloud4
|
|
1928
2040
|
|
|
1929
2041
|
|
|
1930
|
-
if (validateThirdCloud(
|
|
2042
|
+
if (validateThirdCloud(trimmedValueFirstCloud, trimmedValueSecondCloud, trimmedValueThirdCloud, visibilityValue) !== true) {
|
|
1931
2043
|
return true;
|
|
1932
|
-
} // If
|
|
1933
|
-
|
|
2044
|
+
} // If one of the previous groups contains a type, Cloud4 cannot contain a type
|
|
1934
2045
|
|
|
1935
|
-
var cloud3Type = thirdCloudValue.substr(6, 3);
|
|
1936
2046
|
|
|
1937
|
-
if (
|
|
1938
|
-
return
|
|
2047
|
+
if (type !== '' && (typeCloud1 !== '' || typeCloud2 !== '' || typeCloud3 !== '')) {
|
|
2048
|
+
return invalidCloudWithPreviousType;
|
|
1939
2049
|
} // Cloud4 height has to be greater than Cloud3 height
|
|
1940
2050
|
|
|
1941
2051
|
|
|
1942
|
-
var cloud3Height =
|
|
2052
|
+
var cloud3Height = trimmedValueThirdCloud.substring(3, 6);
|
|
1943
2053
|
|
|
1944
2054
|
if (height <= cloud3Height) {
|
|
1945
|
-
// Because of the type validations this is automatically enforced for Cloud4, so impossible to end up here but leaving the check in just in case
|
|
1946
2055
|
return invalidCloudHeightComparedToPreviousMessage;
|
|
1947
2056
|
}
|
|
1948
2057
|
|
|
@@ -2351,12 +2460,25 @@
|
|
|
2351
2460
|
if (action === 'CORRECT') return 'This TAF is a correction';
|
|
2352
2461
|
return 'Cancel TAF';
|
|
2353
2462
|
};
|
|
2354
|
-
var getConfirmationDialogContent = function getConfirmationDialogContent(action) {
|
|
2355
|
-
if (
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2463
|
+
var getConfirmationDialogContent = function getConfirmationDialogContent(action, isFormDirty) {
|
|
2464
|
+
if (isFormDirty === void 0) {
|
|
2465
|
+
isFormDirty = true;
|
|
2466
|
+
}
|
|
2467
|
+
|
|
2468
|
+
switch (action) {
|
|
2469
|
+
case 'DISCARD':
|
|
2470
|
+
return 'Are you sure you would like to discard this TAF? Any changes made will be lost';
|
|
2471
|
+
|
|
2472
|
+
case 'PUBLISH':
|
|
2473
|
+
return 'Are you sure you want to publish this TAF?';
|
|
2474
|
+
|
|
2475
|
+
case 'AMEND':
|
|
2476
|
+
case 'CORRECT':
|
|
2477
|
+
return isFormDirty ? 'Do you want to publish it?' : 'Are you sure you want to publish the TAF? You did not make any changes!';
|
|
2478
|
+
|
|
2479
|
+
default:
|
|
2480
|
+
return 'Are you sure you want to cancel this TAF?';
|
|
2481
|
+
}
|
|
2360
2482
|
};
|
|
2361
2483
|
var getConfirmationDialogButtonLabel = function getConfirmationDialogButtonLabel(action) {
|
|
2362
2484
|
switch (action) {
|
|
@@ -2372,34 +2494,28 @@
|
|
|
2372
2494
|
}
|
|
2373
2495
|
};
|
|
2374
2496
|
|
|
2375
|
-
|
|
2376
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2377
|
-
* you may not use this file except in compliance with the License.
|
|
2378
|
-
* You may obtain a copy of the License at
|
|
2379
|
-
*
|
|
2380
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2381
|
-
*
|
|
2382
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2383
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2384
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2385
|
-
* See the License for the specific language governing permissions and
|
|
2386
|
-
* limitations under the License.
|
|
2387
|
-
*
|
|
2388
|
-
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2389
|
-
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
2390
|
-
* */
|
|
2391
|
-
var useStyles$9 = core.makeStyles(function (theme) {
|
|
2497
|
+
var useStyles$9 = makeStyles__default["default"](function (theme) {
|
|
2392
2498
|
return {
|
|
2393
2499
|
textFieldGridItem: {
|
|
2394
2500
|
marginRight: 4
|
|
2395
2501
|
},
|
|
2502
|
+
textFieldRoot: {
|
|
2503
|
+
'&.Mui-disabled::before': {
|
|
2504
|
+
borderBottom: 'none'
|
|
2505
|
+
},
|
|
2506
|
+
'&:after': {
|
|
2507
|
+
borderBottomColor: '#3f51b5'
|
|
2508
|
+
}
|
|
2509
|
+
},
|
|
2396
2510
|
textFieldInput: {
|
|
2397
2511
|
fontSize: '14px',
|
|
2398
2512
|
paddingLeft: 1,
|
|
2399
2513
|
paddingRight: 1,
|
|
2400
2514
|
color: '#051039',
|
|
2401
|
-
WebkitTextFillColor: '#051039'
|
|
2402
|
-
|
|
2515
|
+
WebkitTextFillColor: '#051039',
|
|
2516
|
+
'&.Mui-disabled': {
|
|
2517
|
+
backgroundColor: 'white'
|
|
2518
|
+
}
|
|
2403
2519
|
},
|
|
2404
2520
|
textFieldLabel: {
|
|
2405
2521
|
fontSize: '14px'
|
|
@@ -2433,7 +2549,7 @@
|
|
|
2433
2549
|
borderRadius: '3px'
|
|
2434
2550
|
},
|
|
2435
2551
|
addButton: {
|
|
2436
|
-
marginRight: '
|
|
2552
|
+
marginRight: '48px'
|
|
2437
2553
|
},
|
|
2438
2554
|
lifecycleButtons: {
|
|
2439
2555
|
marginTop: '40px',
|
|
@@ -2448,6 +2564,9 @@
|
|
|
2448
2564
|
backdrop: {
|
|
2449
2565
|
zIndex: 1500,
|
|
2450
2566
|
color: '#fff'
|
|
2567
|
+
},
|
|
2568
|
+
emptyButtonContainer: {
|
|
2569
|
+
minWidth: 96
|
|
2451
2570
|
}
|
|
2452
2571
|
};
|
|
2453
2572
|
});
|
|
@@ -2474,12 +2593,13 @@
|
|
|
2474
2593
|
};
|
|
2475
2594
|
var BaseTextField = /*#__PURE__*/React__default["default"].memo(function (props) {
|
|
2476
2595
|
var classes = useStyles$9();
|
|
2477
|
-
return /*#__PURE__*/React__default["default"].createElement(
|
|
2596
|
+
return /*#__PURE__*/React__default["default"].createElement(material.TextField, __assign({
|
|
2478
2597
|
type: "text",
|
|
2479
2598
|
variant: "filled",
|
|
2480
2599
|
InputProps: {
|
|
2481
2600
|
classes: {
|
|
2482
|
-
input: classes.textFieldInput
|
|
2601
|
+
input: classes.textFieldInput,
|
|
2602
|
+
root: classes.textFieldRoot
|
|
2483
2603
|
}
|
|
2484
2604
|
},
|
|
2485
2605
|
InputLabelProps: {
|
|
@@ -2568,7 +2688,7 @@
|
|
|
2568
2688
|
inputRef.current.disabled = false;
|
|
2569
2689
|
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
2570
2690
|
}, []);
|
|
2571
|
-
return /*#__PURE__*/React__default["default"].createElement(
|
|
2691
|
+
return /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
2572
2692
|
item: true,
|
|
2573
2693
|
xs: true,
|
|
2574
2694
|
className: classes.textFieldGridItem
|
|
@@ -2691,8 +2811,10 @@
|
|
|
2691
2811
|
field = _f === void 0 ? null : _f,
|
|
2692
2812
|
_g = _a.dragHandle,
|
|
2693
2813
|
dragHandle = _g === void 0 ? null : _g,
|
|
2694
|
-
|
|
2814
|
+
onAddChangeGroup = _a.onAddChangeGroup,
|
|
2815
|
+
props = __rest(_a, ["isChangeGroup", "disabled", "index", "lastRow", "onRemoveChangeGroup", "field", "dragHandle", "onAddChangeGroup"]);
|
|
2695
2816
|
|
|
2817
|
+
var classes = useStyles$9();
|
|
2696
2818
|
var namePrefix = !isChangeGroup ? 'baseForecast' : "changeGroups[" + index + "]";
|
|
2697
2819
|
var fieldNames = getFieldNames(isChangeGroup, index);
|
|
2698
2820
|
|
|
@@ -2769,17 +2891,44 @@
|
|
|
2769
2891
|
return true;
|
|
2770
2892
|
}, [index, isChangeGroup, getValues]);
|
|
2771
2893
|
|
|
2772
|
-
var
|
|
2773
|
-
|
|
2774
|
-
|
|
2894
|
+
var getFieldFromRow = function getFieldFromRow(fieldname, rowIndex) {
|
|
2895
|
+
var indexedFieldName = "changeGroups[" + rowIndex + "]." + fieldname;
|
|
2896
|
+
var rowValue = getValues(indexedFieldName);
|
|
2897
|
+
return rowValue ? [indexedFieldName] : [];
|
|
2898
|
+
};
|
|
2899
|
+
|
|
2900
|
+
var getValidFieldFromNextRow = function getValidFieldFromNextRow() {
|
|
2901
|
+
return getFieldFromRow('valid', index + 1);
|
|
2902
|
+
};
|
|
2903
|
+
|
|
2904
|
+
var validateNextRows = React__default["default"].useCallback(function () {
|
|
2905
|
+
if (isChangeGroup) {
|
|
2906
|
+
var _a = getValues(),
|
|
2907
|
+
validDateEnd = _a.validDateEnd,
|
|
2908
|
+
validDateStart = _a.validDateStart,
|
|
2909
|
+
changeGroups = _a.changeGroups;
|
|
2910
|
+
|
|
2911
|
+
var currentChangeGroup = changeGroups[index];
|
|
2912
|
+
var nextChangeGroups = changeGroups.slice(index + 1);
|
|
2913
|
+
return validateOverlapWithFM(currentChangeGroup, nextChangeGroups, validDateStart, validDateEnd);
|
|
2775
2914
|
}
|
|
2776
2915
|
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2916
|
+
return true;
|
|
2917
|
+
}, [index, isChangeGroup, getValues]);
|
|
2918
|
+
|
|
2919
|
+
var getPreviousValidFields = function getPreviousValidFields(rowIndex) {
|
|
2920
|
+
var changeGroups = getValues().changeGroups;
|
|
2921
|
+
var previousChangeGroups = changeGroups.slice(0, rowIndex);
|
|
2922
|
+
var validFields = previousChangeGroups.map(function (_element, index) {
|
|
2923
|
+
return getFieldFromRow('valid', index)[0];
|
|
2924
|
+
});
|
|
2925
|
+
return validFields;
|
|
2780
2926
|
};
|
|
2781
2927
|
|
|
2782
|
-
|
|
2928
|
+
var addChangeGroup = React__default["default"].useCallback(function () {
|
|
2929
|
+
onAddChangeGroup(index);
|
|
2930
|
+
}, [onAddChangeGroup, index]);
|
|
2931
|
+
return /*#__PURE__*/React__default["default"].createElement(material.Grid, __assign({
|
|
2783
2932
|
"data-testid": "row-" + namePrefix,
|
|
2784
2933
|
container: true,
|
|
2785
2934
|
ref: ref
|
|
@@ -2796,7 +2945,7 @@
|
|
|
2796
2945
|
label: "Issue time",
|
|
2797
2946
|
name: "issueDate",
|
|
2798
2947
|
disabled: true
|
|
2799
|
-
})), isChangeGroup && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(
|
|
2948
|
+
})), isChangeGroup && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
2800
2949
|
item: true,
|
|
2801
2950
|
xs: true,
|
|
2802
2951
|
style: {
|
|
@@ -2822,7 +2971,7 @@
|
|
|
2822
2971
|
}],
|
|
2823
2972
|
onBlur: function onBlur() {
|
|
2824
2973
|
if (isChangeGroup) {
|
|
2825
|
-
var nextValidFieldName =
|
|
2974
|
+
var nextValidFieldName = getValidFieldFromNextRow();
|
|
2826
2975
|
trigger(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(subFields)), __read(mainOptionalFields)), __read(mainFields)), __read(nextValidFieldName)));
|
|
2827
2976
|
}
|
|
2828
2977
|
}
|
|
@@ -2852,8 +3001,9 @@
|
|
|
2852
3001
|
}],
|
|
2853
3002
|
onBlur: function onBlur() {
|
|
2854
3003
|
if (isChangeGroup) {
|
|
2855
|
-
var nextValidFieldName =
|
|
2856
|
-
|
|
3004
|
+
var nextValidFieldName = getValidFieldFromNextRow();
|
|
3005
|
+
var previousValidFieldNames = getPreviousValidFields(index);
|
|
3006
|
+
trigger(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(subFields)), __read(mainOptionalFields)), __read(mainFields)), __read(nextValidFieldName)), __read(previousValidFieldNames)));
|
|
2857
3007
|
}
|
|
2858
3008
|
}
|
|
2859
3009
|
})), /*#__PURE__*/React__default["default"].createElement(TafFormTextField, {
|
|
@@ -2871,13 +3021,15 @@
|
|
|
2871
3021
|
validateValidChangeGroupInterField: function validateValidChangeGroupInterField$1(value) {
|
|
2872
3022
|
return isChangeGroup ? validateValidChangeGroupInterField(value, getValues(fieldNames.change), getValues('validDateStart'), getValues('validDateEnd')) : true;
|
|
2873
3023
|
},
|
|
2874
|
-
validatePreviousRow: validatePreviousRow
|
|
3024
|
+
validatePreviousRow: validatePreviousRow,
|
|
3025
|
+
validateNextRows: validateNextRows
|
|
2875
3026
|
}
|
|
2876
3027
|
},
|
|
2877
3028
|
onBlur: function onBlur() {
|
|
2878
3029
|
if (isChangeGroup) {
|
|
2879
|
-
var nextValidFieldName =
|
|
2880
|
-
|
|
3030
|
+
var nextValidFieldName = getValidFieldFromNextRow();
|
|
3031
|
+
var previousValidFieldNames = getPreviousValidFields(index);
|
|
3032
|
+
trigger(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(subFields)), __read(mainOptionalFields)), __read(mainFields)), __read(nextValidFieldName)), __read(previousValidFieldNames)));
|
|
2881
3033
|
}
|
|
2882
3034
|
}
|
|
2883
3035
|
}), /*#__PURE__*/React__default["default"].createElement(TafFormTextField, {
|
|
@@ -2891,7 +3043,9 @@
|
|
|
2891
3043
|
return _validateRequiredMainFields(value, 'Wind');
|
|
2892
3044
|
},
|
|
2893
3045
|
validateRequiredSub: validateRequiredSub,
|
|
2894
|
-
validateWindField: validateWindField
|
|
3046
|
+
validateWindField: function validateWindField$1(value) {
|
|
3047
|
+
return validateWindField(value, getValues(fieldNames.weather1), getValues(fieldNames.weather2), getValues(fieldNames.weather3));
|
|
3048
|
+
}
|
|
2895
3049
|
}
|
|
2896
3050
|
},
|
|
2897
3051
|
onBlur: function onBlur() {
|
|
@@ -2940,7 +3094,7 @@
|
|
|
2940
3094
|
},
|
|
2941
3095
|
onBlur: function onBlur() {
|
|
2942
3096
|
var fields = isChangeGroup ? __spreadArray(__spreadArray([], __read(subFields)), __read(mainFields)) : [];
|
|
2943
|
-
return trigger(__spreadArray(__spreadArray([], __read(fields)), [fieldNames.weather2, fieldNames.weather3]));
|
|
3097
|
+
return trigger(__spreadArray(__spreadArray([], __read(fields)), [fieldNames.weather2, fieldNames.weather3, fieldNames.wind, fieldNames.cloud1]));
|
|
2944
3098
|
}
|
|
2945
3099
|
}), /*#__PURE__*/React__default["default"].createElement(TafFormTextField, {
|
|
2946
3100
|
label: "Weather",
|
|
@@ -2956,7 +3110,7 @@
|
|
|
2956
3110
|
},
|
|
2957
3111
|
onBlur: function onBlur() {
|
|
2958
3112
|
var fields = isChangeGroup ? __spreadArray(__spreadArray([], __read(subFields)), __read(mainFields)) : [];
|
|
2959
|
-
return trigger(__spreadArray(__spreadArray([], __read(fields)), [fieldNames.weather3]));
|
|
3113
|
+
return trigger(__spreadArray(__spreadArray([], __read(fields)), [fieldNames.weather3, fieldNames.wind, fieldNames.cloud1]));
|
|
2960
3114
|
}
|
|
2961
3115
|
}), /*#__PURE__*/React__default["default"].createElement(TafFormTextField, {
|
|
2962
3116
|
label: "Weather",
|
|
@@ -2969,6 +3123,9 @@
|
|
|
2969
3123
|
return validateThirdWeatherField(getValues(fieldNames.weather1), getValues(fieldNames.weather2), value, getValues(fieldNames.visibility));
|
|
2970
3124
|
}
|
|
2971
3125
|
}
|
|
3126
|
+
},
|
|
3127
|
+
onBlur: function onBlur() {
|
|
3128
|
+
return trigger([fieldNames.wind, fieldNames.cloud1]);
|
|
2972
3129
|
}
|
|
2973
3130
|
}), /*#__PURE__*/React__default["default"].createElement(TafFormTextField, {
|
|
2974
3131
|
label: "Cloud",
|
|
@@ -2982,7 +3139,7 @@
|
|
|
2982
3139
|
},
|
|
2983
3140
|
validateRequiredSub: validateRequiredSub,
|
|
2984
3141
|
validateFirstCloud: function validateFirstCloud$1(value) {
|
|
2985
|
-
return validateFirstCloud(value, getValues(fieldNames.visibility));
|
|
3142
|
+
return validateFirstCloud(value, getValues(fieldNames.visibility), getValues(fieldNames.weather1), getValues(fieldNames.weather2), getValues(fieldNames.weather3));
|
|
2986
3143
|
}
|
|
2987
3144
|
}
|
|
2988
3145
|
},
|
|
@@ -3032,21 +3189,33 @@
|
|
|
3032
3189
|
}
|
|
3033
3190
|
}
|
|
3034
3191
|
}
|
|
3035
|
-
}), (!isChangeGroup || disabled) && /*#__PURE__*/React__default["default"].createElement(
|
|
3036
|
-
|
|
3037
|
-
xs: true
|
|
3038
|
-
}), isChangeGroup && !disabled && /*#__PURE__*/React__default["default"].createElement(core.Grid, {
|
|
3192
|
+
}), (!isChangeGroup || disabled) && /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
3193
|
+
className: classes.emptyButtonContainer,
|
|
3039
3194
|
item: true,
|
|
3040
3195
|
xs: true
|
|
3041
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
|
3196
|
+
}, !disabled && /*#__PURE__*/React__default["default"].createElement(material.IconButton, {
|
|
3197
|
+
"aria-label": "add",
|
|
3198
|
+
"data-testid": "add-changeGroup",
|
|
3199
|
+
onClick: addChangeGroup,
|
|
3200
|
+
size: "large"
|
|
3201
|
+
}, /*#__PURE__*/React__default["default"].createElement(iconsMaterial.Add, null))), isChangeGroup && !disabled && /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
3202
|
+
item: true
|
|
3203
|
+
}, /*#__PURE__*/React__default["default"].createElement(material.IconButton, {
|
|
3204
|
+
"aria-label": "add",
|
|
3205
|
+
"data-testid": "add-changeGroup",
|
|
3206
|
+
onClick: addChangeGroup,
|
|
3207
|
+
size: "large"
|
|
3208
|
+
}, /*#__PURE__*/React__default["default"].createElement(iconsMaterial.Add, null)), /*#__PURE__*/React__default["default"].createElement(material.IconButton, __assign({
|
|
3042
3209
|
"aria-label": "delete",
|
|
3043
3210
|
"data-testid": "remove-changeGroup",
|
|
3044
3211
|
onClick: function onClick() {
|
|
3045
3212
|
return onRemoveChangeGroup(index);
|
|
3046
3213
|
}
|
|
3047
3214
|
}, lastRow ? {
|
|
3048
|
-
tabIndex:
|
|
3049
|
-
} : {}
|
|
3215
|
+
tabIndex: -1
|
|
3216
|
+
} : {}, {
|
|
3217
|
+
size: "large"
|
|
3218
|
+
}), /*#__PURE__*/React__default["default"].createElement(iconsMaterial.Delete, null))));
|
|
3050
3219
|
});
|
|
3051
3220
|
|
|
3052
3221
|
var getIssuesLabel = function getIssuesLabel(sumOfErrors) {
|
|
@@ -3086,9 +3255,9 @@
|
|
|
3086
3255
|
var togglePane = _a.togglePane,
|
|
3087
3256
|
sumOfErrors = _a.sumOfErrors;
|
|
3088
3257
|
var color = sumOfErrors > 0 ? 'red' : 'green';
|
|
3089
|
-
return /*#__PURE__*/React__namespace.createElement(
|
|
3258
|
+
return /*#__PURE__*/React__namespace.createElement(material.Tooltip, {
|
|
3090
3259
|
title: "View details"
|
|
3091
|
-
}, /*#__PURE__*/React__namespace.createElement(
|
|
3260
|
+
}, /*#__PURE__*/React__namespace.createElement(material.Chip, {
|
|
3092
3261
|
"data-testid": "issuesButton",
|
|
3093
3262
|
size: "small",
|
|
3094
3263
|
label: getIssuesLabel(sumOfErrors),
|
|
@@ -3098,7 +3267,7 @@
|
|
|
3098
3267
|
};
|
|
3099
3268
|
|
|
3100
3269
|
var ThumbsUp = function ThumbsUp(props) {
|
|
3101
|
-
return /*#__PURE__*/React__default["default"].createElement(
|
|
3270
|
+
return /*#__PURE__*/React__default["default"].createElement(material.SvgIcon, __assign({
|
|
3102
3271
|
fontSize: "inherit",
|
|
3103
3272
|
viewBox: "0 0 58 69"
|
|
3104
3273
|
}, props), /*#__PURE__*/React__default["default"].createElement("title", null, "Thumbs up"), /*#__PURE__*/React__default["default"].createElement("g", {
|
|
@@ -3134,7 +3303,7 @@
|
|
|
3134
3303
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3135
3304
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
3136
3305
|
* */
|
|
3137
|
-
var useStyles$8 =
|
|
3306
|
+
var useStyles$8 = makeStyles__default["default"]({
|
|
3138
3307
|
paneContent: {
|
|
3139
3308
|
marginTop: '16px',
|
|
3140
3309
|
marginLeft: '24px'
|
|
@@ -3237,7 +3406,7 @@
|
|
|
3237
3406
|
className: classes.image,
|
|
3238
3407
|
"data-testid": "zeroIssuesImage"
|
|
3239
3408
|
}, /*#__PURE__*/React__namespace.createElement(ThumbsUp, null)), errorList.length > 0 && errorList.map(function (error, index) {
|
|
3240
|
-
return /*#__PURE__*/React__namespace.createElement(
|
|
3409
|
+
return /*#__PURE__*/React__namespace.createElement(material.Typography // eslint-disable-next-line react/no-array-index-key
|
|
3241
3410
|
, {
|
|
3242
3411
|
// eslint-disable-next-line react/no-array-index-key
|
|
3243
3412
|
key: "message-" + index,
|
|
@@ -3323,19 +3492,19 @@
|
|
|
3323
3492
|
return setIsIssuesPaneOpen(!isIssuesPaneOpen);
|
|
3324
3493
|
};
|
|
3325
3494
|
|
|
3326
|
-
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(
|
|
3495
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
3327
3496
|
container: true,
|
|
3328
|
-
|
|
3497
|
+
justifyContent: "space-between",
|
|
3329
3498
|
alignItems: "center",
|
|
3330
3499
|
className: classes.lifecycleButtons
|
|
3331
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
|
3500
|
+
}, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
3332
3501
|
item: true
|
|
3333
3502
|
}, /*#__PURE__*/React__default["default"].createElement(IssuesButton, {
|
|
3334
3503
|
sumOfErrors: errorList.length,
|
|
3335
3504
|
togglePane: toggleIssuesPane
|
|
3336
|
-
})), /*#__PURE__*/React__default["default"].createElement(
|
|
3505
|
+
})), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
3337
3506
|
item: true
|
|
3338
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
|
3507
|
+
}, /*#__PURE__*/React__default["default"].createElement(material.Button, {
|
|
3339
3508
|
"data-testid": "discardtaf",
|
|
3340
3509
|
variant: "outlined",
|
|
3341
3510
|
color: "secondary",
|
|
@@ -3345,7 +3514,7 @@
|
|
|
3345
3514
|
// Simply discard the changes and close the dialog.
|
|
3346
3515
|
onTafFormButtonPress('DISCARD');
|
|
3347
3516
|
}
|
|
3348
|
-
}, "Discard"), /*#__PURE__*/React__default["default"].createElement(
|
|
3517
|
+
}, "Discard"), /*#__PURE__*/React__default["default"].createElement(material.Button, {
|
|
3349
3518
|
"data-testid": "savedrafttaf",
|
|
3350
3519
|
variant: "outlined",
|
|
3351
3520
|
color: "secondary",
|
|
@@ -3375,7 +3544,7 @@
|
|
|
3375
3544
|
break;
|
|
3376
3545
|
}
|
|
3377
3546
|
}
|
|
3378
|
-
}, "Save"), /*#__PURE__*/React__default["default"].createElement(
|
|
3547
|
+
}, "Save"), /*#__PURE__*/React__default["default"].createElement(material.Button, {
|
|
3379
3548
|
"data-testid": "publishtaf",
|
|
3380
3549
|
variant: "outlined",
|
|
3381
3550
|
color: "secondary",
|
|
@@ -3428,7 +3597,7 @@
|
|
|
3428
3597
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3429
3598
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
3430
3599
|
* */
|
|
3431
|
-
var useStyles$7 =
|
|
3600
|
+
var useStyles$7 = makeStyles__default["default"](function () {
|
|
3432
3601
|
return {
|
|
3433
3602
|
dragHandle: {
|
|
3434
3603
|
backgroundColor: 'transparent',
|
|
@@ -3449,12 +3618,13 @@
|
|
|
3449
3618
|
isDisabled = _c === void 0 ? false : _c,
|
|
3450
3619
|
index = _a.index;
|
|
3451
3620
|
var classes = useStyles$7(isSorting);
|
|
3452
|
-
return /*#__PURE__*/React__default["default"].createElement(
|
|
3621
|
+
return /*#__PURE__*/React__default["default"].createElement(material.IconButton, {
|
|
3453
3622
|
className: classes.dragHandle + " handle",
|
|
3454
3623
|
"data-testid": "dragHandle-" + index,
|
|
3455
3624
|
disableRipple: true,
|
|
3456
|
-
disabled: isDisabled
|
|
3457
|
-
|
|
3625
|
+
disabled: isDisabled,
|
|
3626
|
+
size: "large"
|
|
3627
|
+
}, /*#__PURE__*/React__default["default"].createElement(iconsMaterial.DragIndicator, null));
|
|
3458
3628
|
};
|
|
3459
3629
|
|
|
3460
3630
|
var noop = function noop() {};
|
|
@@ -3547,7 +3717,7 @@
|
|
|
3547
3717
|
var showConfirmDialog = function showConfirmDialog(action) {
|
|
3548
3718
|
return confirmDialog({
|
|
3549
3719
|
title: getConfirmationDialogTitle(action),
|
|
3550
|
-
description: getConfirmationDialogContent(action),
|
|
3720
|
+
description: getConfirmationDialogContent(action, isFormDirty),
|
|
3551
3721
|
confirmLabel: getConfirmationDialogButtonLabel(action)
|
|
3552
3722
|
});
|
|
3553
3723
|
};
|
|
@@ -3596,38 +3766,67 @@
|
|
|
3596
3766
|
name: 'changeGroups'
|
|
3597
3767
|
}),
|
|
3598
3768
|
fields = _h.fields,
|
|
3599
|
-
|
|
3769
|
+
insert = _h.insert,
|
|
3600
3770
|
remove = _h.remove,
|
|
3601
3771
|
move = _h.move;
|
|
3602
3772
|
|
|
3603
|
-
var lastTotalFields = shared.usePrevious(fields.length);
|
|
3604
|
-
|
|
3605
3773
|
var _j = useDragOrder(trigger, move, onFormBlur),
|
|
3606
3774
|
onChangeOrder = _j.onChangeOrder,
|
|
3607
3775
|
onStartDrag = _j.onStartDrag,
|
|
3608
3776
|
activeDraggingIndex = _j.activeDraggingIndex;
|
|
3609
3777
|
|
|
3610
3778
|
var onRemoverow = function onRemoverow(index) {
|
|
3611
|
-
|
|
3779
|
+
confirmDialog({
|
|
3780
|
+
title: 'Delete row',
|
|
3781
|
+
description: 'Are you sure you want to delete this row?',
|
|
3782
|
+
confirmLabel: 'Yes'
|
|
3783
|
+
}).then(function () {
|
|
3784
|
+
remove(index);
|
|
3785
|
+
trigger(); // trigger all fields validation
|
|
3786
|
+
|
|
3787
|
+
onFormBlur();
|
|
3788
|
+
});
|
|
3789
|
+
}; // TODO: https://gitlab.com/opengeoweb/opengeoweb/-/issues/726 insert (react-hook-form) does not work well with focus (only last row will get focus), so added this dirty solution. This can be fixed in a better way in react-hook-form v7
|
|
3790
|
+
|
|
3791
|
+
|
|
3792
|
+
var focusFirstInput = function focusFirstInput(rowIndex) {
|
|
3793
|
+
var nextRowFirstInput = document.querySelector("[name=\"changeGroups[" + rowIndex + "].probability\"]");
|
|
3794
|
+
|
|
3795
|
+
if (nextRowFirstInput) {
|
|
3796
|
+
nextRowFirstInput.focus();
|
|
3797
|
+
}
|
|
3612
3798
|
};
|
|
3613
3799
|
|
|
3614
|
-
var onAddRow = function onAddRow() {
|
|
3615
|
-
|
|
3800
|
+
var onAddRow = function onAddRow(rowIndex) {
|
|
3801
|
+
if (rowIndex === void 0) {
|
|
3802
|
+
rowIndex = -1;
|
|
3803
|
+
}
|
|
3804
|
+
|
|
3805
|
+
var newRowIndex = rowIndex + 1;
|
|
3806
|
+
insert(newRowIndex, emptyChangegroup, false); // 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
|
|
3807
|
+
|
|
3808
|
+
setTimeout(function () {
|
|
3809
|
+
focusFirstInput(newRowIndex);
|
|
3810
|
+
trigger(); // trigger all fields validation
|
|
3811
|
+
}, 0);
|
|
3616
3812
|
};
|
|
3617
3813
|
|
|
3618
3814
|
React__default["default"].useEffect(function () {
|
|
3619
|
-
if (
|
|
3620
|
-
|
|
3621
|
-
|
|
3815
|
+
if (!isDisabled) {
|
|
3816
|
+
// trigger validation on all changegroup validity times after initial load since they could be outside the new validity period
|
|
3817
|
+
var validFields = fields.map(function (_field, index) {
|
|
3818
|
+
return "changeGroups[" + index + "].valid";
|
|
3819
|
+
});
|
|
3820
|
+
trigger(validFields);
|
|
3622
3821
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3623
3822
|
|
|
3624
|
-
}, [
|
|
3823
|
+
}, []);
|
|
3625
3824
|
return /*#__PURE__*/React__default["default"].createElement("form", {
|
|
3626
3825
|
onSubmit: handleSubmit(onSubmit),
|
|
3627
3826
|
onBlur: onFormBlur
|
|
3628
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
|
3827
|
+
}, /*#__PURE__*/React__default["default"].createElement(material.Typography, {
|
|
3629
3828
|
className: classes.tacTitle
|
|
3630
|
-
}, "TAC"), /*#__PURE__*/React__default["default"].createElement(
|
|
3829
|
+
}, "TAC"), /*#__PURE__*/React__default["default"].createElement(material.Typography, {
|
|
3631
3830
|
"data-testid": "form-tac-message",
|
|
3632
3831
|
className: classes.tacText
|
|
3633
3832
|
}, TAC.split('\n').map(function (line) {
|
|
@@ -3637,7 +3836,8 @@
|
|
|
3637
3836
|
"data-testid": "tafform-tac-message-line"
|
|
3638
3837
|
}, line);
|
|
3639
3838
|
})), /*#__PURE__*/React__default["default"].createElement(TafFormRow, {
|
|
3640
|
-
disabled: isDisabled
|
|
3839
|
+
disabled: isDisabled,
|
|
3840
|
+
onAddChangeGroup: onAddRow
|
|
3641
3841
|
}), /*#__PURE__*/React__default["default"].createElement(reactSortablejs.ReactSortable, {
|
|
3642
3842
|
tag: "div",
|
|
3643
3843
|
list: fields,
|
|
@@ -3661,6 +3861,7 @@
|
|
|
3661
3861
|
lastRow: fields.length === index + 1,
|
|
3662
3862
|
disabled: isDisabled,
|
|
3663
3863
|
onRemoveChangeGroup: onRemoverow,
|
|
3864
|
+
onAddChangeGroup: onAddRow,
|
|
3664
3865
|
isChangeGroup: true,
|
|
3665
3866
|
dragHandle: /*#__PURE__*/React__default["default"].createElement(DragHandle, {
|
|
3666
3867
|
isDisabled: fields.length === 1 || isDisabled,
|
|
@@ -3668,20 +3869,10 @@
|
|
|
3668
3869
|
index: index
|
|
3669
3870
|
})
|
|
3670
3871
|
});
|
|
3671
|
-
})), !isDisabled && /*#__PURE__*/React__default["default"].createElement(
|
|
3672
|
-
container: true,
|
|
3673
|
-
item: true,
|
|
3674
|
-
xs: 12,
|
|
3675
|
-
justify: "flex-end"
|
|
3676
|
-
}, /*#__PURE__*/React__default["default"].createElement(core.IconButton, {
|
|
3677
|
-
"aria-label": "add",
|
|
3678
|
-
"data-testid": "add-changeGroup",
|
|
3679
|
-
onClick: onAddRow,
|
|
3680
|
-
className: classes.addButton
|
|
3681
|
-
}, /*#__PURE__*/React__default["default"].createElement(icons.Add, null))), /*#__PURE__*/React__default["default"].createElement(TafFormButtons, {
|
|
3872
|
+
})), !isDisabled && /*#__PURE__*/React__default["default"].createElement(TafFormButtons, {
|
|
3682
3873
|
tafAction: tafAction,
|
|
3683
3874
|
onTafFormButtonPress: onTafButtonPress
|
|
3684
|
-
})
|
|
3875
|
+
}), hiddenInputFields.map(function (field) {
|
|
3685
3876
|
return /*#__PURE__*/React__default["default"].createElement(formFields.ReactHookFormHiddenInput, {
|
|
3686
3877
|
name: field,
|
|
3687
3878
|
key: field
|
|
@@ -3771,7 +3962,7 @@
|
|
|
3771
3962
|
}));
|
|
3772
3963
|
};
|
|
3773
3964
|
|
|
3774
|
-
var useStyles$6 =
|
|
3965
|
+
var useStyles$6 = makeStyles__default["default"]({
|
|
3775
3966
|
dialogHeader: {
|
|
3776
3967
|
borderRadius: '3px',
|
|
3777
3968
|
border: 'solid 1px #f6f5f5',
|
|
@@ -3807,39 +3998,37 @@
|
|
|
3807
3998
|
other = __rest(_a, ["open", "toggleDialogStatus", "titleComponent", "children", "onClose", "alertBanner", "onFormAction"]);
|
|
3808
3999
|
|
|
3809
4000
|
var classes = useStyles$6();
|
|
3810
|
-
return /*#__PURE__*/React__namespace.createElement(
|
|
4001
|
+
return /*#__PURE__*/React__namespace.createElement(material.Dialog, __assign({
|
|
3811
4002
|
"data-testid": "contentDialog",
|
|
3812
4003
|
open: open,
|
|
3813
4004
|
onClose: function onClose() {
|
|
3814
4005
|
return onFormAction('CLOSE');
|
|
3815
4006
|
},
|
|
3816
4007
|
maxWidth: other.maxWidth ? other.maxWidth : 'lg',
|
|
3817
|
-
disableBackdropClick: true,
|
|
3818
4008
|
PaperProps: {
|
|
3819
4009
|
style: {
|
|
3820
4010
|
position: 'inherit'
|
|
3821
4011
|
}
|
|
3822
4012
|
}
|
|
3823
|
-
}, other), /*#__PURE__*/React__namespace.createElement(
|
|
3824
|
-
disableTypography: true,
|
|
4013
|
+
}, other), /*#__PURE__*/React__namespace.createElement(material.DialogTitle, {
|
|
3825
4014
|
className: classes.dialogHeader
|
|
3826
|
-
}, /*#__PURE__*/React__namespace.createElement(
|
|
4015
|
+
}, /*#__PURE__*/React__namespace.createElement(material.Grid, {
|
|
3827
4016
|
container: true
|
|
3828
|
-
}, /*#__PURE__*/React__namespace.createElement(
|
|
4017
|
+
}, /*#__PURE__*/React__namespace.createElement(material.Grid, {
|
|
3829
4018
|
item: true,
|
|
3830
4019
|
xs: 11,
|
|
3831
4020
|
className: classes.dialogTitle
|
|
3832
|
-
}, titleComponent), /*#__PURE__*/React__namespace.createElement(
|
|
4021
|
+
}, titleComponent), /*#__PURE__*/React__namespace.createElement(material.Grid, {
|
|
3833
4022
|
item: true,
|
|
3834
4023
|
xs: true,
|
|
3835
4024
|
className: classes.dialogCloseButton
|
|
3836
|
-
}, /*#__PURE__*/React__namespace.createElement(
|
|
4025
|
+
}, /*#__PURE__*/React__namespace.createElement(material.IconButton, {
|
|
3837
4026
|
"data-testid": "closeDialog",
|
|
3838
4027
|
size: "small",
|
|
3839
4028
|
onClick: function onClick() {
|
|
3840
4029
|
return onFormAction('CLOSE');
|
|
3841
4030
|
}
|
|
3842
|
-
}, /*#__PURE__*/React__namespace.createElement(
|
|
4031
|
+
}, /*#__PURE__*/React__namespace.createElement(iconsMaterial.Close, null))))), alertBanner !== null && alertBanner, /*#__PURE__*/React__namespace.createElement(material.DialogContent, {
|
|
3843
4032
|
className: classes.dialogChildren
|
|
3844
4033
|
}, children));
|
|
3845
4034
|
};
|
|
@@ -3862,11 +4051,11 @@
|
|
|
3862
4051
|
* */
|
|
3863
4052
|
|
|
3864
4053
|
var getActiveStatus = function getActiveStatus(listType, className) {
|
|
3865
|
-
return listType === 'ACTIVE' ? /*#__PURE__*/React__default["default"].createElement(
|
|
4054
|
+
return listType === 'ACTIVE' ? /*#__PURE__*/React__default["default"].createElement(iconsMaterial.CheckCircle, {
|
|
3866
4055
|
"data-testid": "status-active",
|
|
3867
4056
|
className: className,
|
|
3868
4057
|
fontSize: "small"
|
|
3869
|
-
}) : /*#__PURE__*/React__default["default"].createElement(
|
|
4058
|
+
}) : /*#__PURE__*/React__default["default"].createElement(iconsMaterial.Schedule, {
|
|
3870
4059
|
"data-testid": "status-upcoming",
|
|
3871
4060
|
className: className,
|
|
3872
4061
|
fontSize: "small"
|
|
@@ -3901,7 +4090,7 @@
|
|
|
3901
4090
|
|
|
3902
4091
|
return 'Draft';
|
|
3903
4092
|
};
|
|
3904
|
-
var useStyles$5 =
|
|
4093
|
+
var useStyles$5 = makeStyles__default["default"]({
|
|
3905
4094
|
cardWrapper: {
|
|
3906
4095
|
width: '100%'
|
|
3907
4096
|
},
|
|
@@ -3930,35 +4119,35 @@
|
|
|
3930
4119
|
var classes = useStyles$5();
|
|
3931
4120
|
var validTimeDate = moment__default["default"].utc(taf.validDateStart).format('DD MMM');
|
|
3932
4121
|
var baseTime = moment__default["default"].utc(taf.baseTime).format('HH:mm');
|
|
3933
|
-
return /*#__PURE__*/React__default["default"].createElement(
|
|
4122
|
+
return /*#__PURE__*/React__default["default"].createElement(material.Card, {
|
|
3934
4123
|
elevation: 0,
|
|
3935
4124
|
className: classes.cardWrapper
|
|
3936
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
|
4125
|
+
}, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
3937
4126
|
container: true,
|
|
3938
4127
|
alignItems: "center",
|
|
3939
4128
|
spacing: 1
|
|
3940
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
|
4129
|
+
}, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
3941
4130
|
item: true,
|
|
3942
4131
|
xs: 3,
|
|
3943
4132
|
sm: 2,
|
|
3944
4133
|
md: 1
|
|
3945
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
|
4134
|
+
}, /*#__PURE__*/React__default["default"].createElement(material.Typography, {
|
|
3946
4135
|
variant: "subtitle2",
|
|
3947
4136
|
noWrap: true,
|
|
3948
4137
|
className: classes.font
|
|
3949
|
-
}, taf.location)), /*#__PURE__*/React__default["default"].createElement(
|
|
4138
|
+
}, taf.location)), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
3950
4139
|
item: true,
|
|
3951
4140
|
xs: 3,
|
|
3952
4141
|
sm: 3,
|
|
3953
4142
|
md: 1,
|
|
3954
4143
|
container: true
|
|
3955
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
|
4144
|
+
}, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
3956
4145
|
item: true,
|
|
3957
4146
|
xs: 3,
|
|
3958
4147
|
sm: 3,
|
|
3959
4148
|
md: 3,
|
|
3960
4149
|
className: classes.alignIcon
|
|
3961
|
-
}, showTac && /*#__PURE__*/React__default["default"].createElement(
|
|
4150
|
+
}, showTac && /*#__PURE__*/React__default["default"].createElement(material.Tooltip, {
|
|
3962
4151
|
"data-testid": "taflistrow-tactooltip",
|
|
3963
4152
|
title: /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3964
4153
|
style: {
|
|
@@ -3966,63 +4155,63 @@
|
|
|
3966
4155
|
}
|
|
3967
4156
|
}, TAC),
|
|
3968
4157
|
placement: "bottom-start"
|
|
3969
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
|
4158
|
+
}, /*#__PURE__*/React__default["default"].createElement(iconsMaterial.InfoOutlined, {
|
|
3970
4159
|
"data-testid": "taflistrow-tacicon",
|
|
3971
4160
|
color: "secondary",
|
|
3972
4161
|
fontSize: "small"
|
|
3973
|
-
}))), /*#__PURE__*/React__default["default"].createElement(
|
|
4162
|
+
}))), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
3974
4163
|
item: true,
|
|
3975
4164
|
xs: 9,
|
|
3976
4165
|
sm: 9,
|
|
3977
4166
|
md: 9
|
|
3978
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
|
4167
|
+
}, /*#__PURE__*/React__default["default"].createElement(material.Typography, {
|
|
3979
4168
|
variant: "subtitle2",
|
|
3980
4169
|
className: classes.font,
|
|
3981
4170
|
"data-testid": "baseTime"
|
|
3982
|
-
}, baseTime))), /*#__PURE__*/React__default["default"].createElement(
|
|
4171
|
+
}, baseTime))), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
3983
4172
|
item: true,
|
|
3984
4173
|
xs: 3,
|
|
3985
4174
|
sm: 2,
|
|
3986
4175
|
md: 1
|
|
3987
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
|
4176
|
+
}, /*#__PURE__*/React__default["default"].createElement(material.Typography, {
|
|
3988
4177
|
variant: "subtitle2",
|
|
3989
4178
|
className: classes.font,
|
|
3990
4179
|
"data-testid": "validTimeDate"
|
|
3991
|
-
}, validTimeDate)), /*#__PURE__*/React__default["default"].createElement(
|
|
4180
|
+
}, validTimeDate)), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
3992
4181
|
item: true,
|
|
3993
4182
|
xs: 3,
|
|
3994
4183
|
sm: 3,
|
|
3995
4184
|
md: 6
|
|
3996
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
|
4185
|
+
}, /*#__PURE__*/React__default["default"].createElement(material.Typography, {
|
|
3997
4186
|
variant: "subtitle2",
|
|
3998
4187
|
className: classes.font,
|
|
3999
4188
|
"data-testid": "validTimeSlot"
|
|
4000
4189
|
}, formatValidToString({
|
|
4001
4190
|
start: taf.validDateStart,
|
|
4002
4191
|
end: taf.validDateEnd
|
|
4003
|
-
}))), /*#__PURE__*/React__default["default"].createElement(
|
|
4192
|
+
}))), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
4004
4193
|
item: true,
|
|
4005
4194
|
xs: 12,
|
|
4006
4195
|
sm: 4,
|
|
4007
4196
|
md: 3
|
|
4008
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
|
4197
|
+
}, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
4009
4198
|
container: true,
|
|
4010
|
-
|
|
4199
|
+
justifyContent: "flex-start",
|
|
4011
4200
|
spacing: 2
|
|
4012
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
|
4201
|
+
}, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
4013
4202
|
item: true,
|
|
4014
4203
|
xs: 8,
|
|
4015
4204
|
container: true,
|
|
4016
|
-
|
|
4017
|
-
}, taf.status === 'DRAFT' || taf.status === 'DRAFT_CORRECTED' || taf.status === 'DRAFT_AMENDED' ? /*#__PURE__*/React__default["default"].createElement(
|
|
4205
|
+
justifyContent: "flex-end"
|
|
4206
|
+
}, taf.status === 'DRAFT' || taf.status === 'DRAFT_CORRECTED' || taf.status === 'DRAFT_AMENDED' ? /*#__PURE__*/React__default["default"].createElement(material.Button, {
|
|
4018
4207
|
color: "secondary",
|
|
4019
4208
|
size: "small",
|
|
4020
4209
|
"data-testid": "tafRow-draft",
|
|
4021
|
-
startIcon: /*#__PURE__*/React__default["default"].createElement(
|
|
4210
|
+
startIcon: /*#__PURE__*/React__default["default"].createElement(iconsMaterial.Create, {
|
|
4022
4211
|
fontSize: "small",
|
|
4023
4212
|
color: "secondary"
|
|
4024
4213
|
})
|
|
4025
|
-
}, getDraftTitle(taf.status)) : getStatusTagList(taf)), /*#__PURE__*/React__default["default"].createElement(
|
|
4214
|
+
}, getDraftTitle(taf.status)) : getStatusTagList(taf)), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
4026
4215
|
item: true,
|
|
4027
4216
|
className: classes.alignIcon
|
|
4028
4217
|
}, taf.status !== 'NEW' && taf.status !== 'DRAFT' && taf.status !== 'DRAFT_CORRECTED' && taf.status !== 'DRAFT_AMENDED' && taf.status !== 'CANCELLED' && listType !== 'EXPIRED' && getActiveStatus(listType, classes.activeStatus))))));
|
|
@@ -4117,7 +4306,7 @@
|
|
|
4117
4306
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
4118
4307
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
4119
4308
|
* */
|
|
4120
|
-
var useStyles$4 =
|
|
4309
|
+
var useStyles$4 = makeStyles__default["default"]({
|
|
4121
4310
|
actionButtons: {
|
|
4122
4311
|
paddingRight: '98px',
|
|
4123
4312
|
paddingTop: '40px',
|
|
@@ -4130,34 +4319,34 @@
|
|
|
4130
4319
|
canBe = _a.canBe,
|
|
4131
4320
|
onClickTafActionButton = _a.onClickTafActionButton;
|
|
4132
4321
|
var classes = useStyles$4();
|
|
4133
|
-
return !canBe.includes('CANCELLED') && !canBe.includes('CORRECTED') && !canBe.includes('AMENDED') ? null : /*#__PURE__*/React__default["default"].createElement(
|
|
4322
|
+
return !canBe.includes('CANCELLED') && !canBe.includes('CORRECTED') && !canBe.includes('AMENDED') ? null : /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
4134
4323
|
container: true,
|
|
4135
4324
|
alignItems: "center",
|
|
4136
|
-
|
|
4325
|
+
justifyContent: "flex-end",
|
|
4137
4326
|
"data-testid": "taflist-canbebuttons",
|
|
4138
4327
|
spacing: 1,
|
|
4139
4328
|
className: classes.actionButtons
|
|
4140
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
|
4329
|
+
}, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
4141
4330
|
item: true
|
|
4142
|
-
}, canBe.includes('CANCELLED') && /*#__PURE__*/React__default["default"].createElement(
|
|
4331
|
+
}, canBe.includes('CANCELLED') && /*#__PURE__*/React__default["default"].createElement(material.Button, {
|
|
4143
4332
|
"data-testid": "canceltaf",
|
|
4144
4333
|
variant: "outlined",
|
|
4145
4334
|
color: "secondary",
|
|
4146
4335
|
onClick: function onClick() {
|
|
4147
4336
|
return onClickTafActionButton(uuid, 'CANCEL');
|
|
4148
4337
|
}
|
|
4149
|
-
}, "Cancel")), /*#__PURE__*/React__default["default"].createElement(
|
|
4338
|
+
}, "Cancel")), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
4150
4339
|
item: true
|
|
4151
|
-
}, canBe.includes('CORRECTED') && /*#__PURE__*/React__default["default"].createElement(
|
|
4340
|
+
}, canBe.includes('CORRECTED') && /*#__PURE__*/React__default["default"].createElement(material.Button, {
|
|
4152
4341
|
"data-testid": "correctaf",
|
|
4153
4342
|
variant: "outlined",
|
|
4154
4343
|
color: "secondary",
|
|
4155
4344
|
onClick: function onClick() {
|
|
4156
4345
|
return onClickTafActionButton(uuid, 'CORRECT');
|
|
4157
4346
|
}
|
|
4158
|
-
}, "Correct")), /*#__PURE__*/React__default["default"].createElement(
|
|
4347
|
+
}, "Correct")), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
4159
4348
|
item: true
|
|
4160
|
-
}, canBe.includes('AMENDED') && /*#__PURE__*/React__default["default"].createElement(
|
|
4349
|
+
}, canBe.includes('AMENDED') && /*#__PURE__*/React__default["default"].createElement(material.Button, {
|
|
4161
4350
|
"data-testid": "amendtaf",
|
|
4162
4351
|
variant: "outlined",
|
|
4163
4352
|
color: "secondary",
|
|
@@ -4167,12 +4356,15 @@
|
|
|
4167
4356
|
}, "Amend")));
|
|
4168
4357
|
};
|
|
4169
4358
|
|
|
4170
|
-
var useStyles$3 =
|
|
4359
|
+
var useStyles$3 = makeStyles__default["default"]({
|
|
4171
4360
|
accordion: {
|
|
4172
4361
|
marginBottom: '5px'
|
|
4173
4362
|
},
|
|
4174
4363
|
formPadding: {
|
|
4175
4364
|
padding: '8px'
|
|
4365
|
+
},
|
|
4366
|
+
expandIcon: {
|
|
4367
|
+
color: '#0075a9'
|
|
4176
4368
|
}
|
|
4177
4369
|
});
|
|
4178
4370
|
|
|
@@ -4214,7 +4406,7 @@
|
|
|
4214
4406
|
|
|
4215
4407
|
}, [tafListItem.taf]);
|
|
4216
4408
|
var popOut = status === 'NEW' || status === 'DRAFT' || status === 'DRAFT_AMENDED' || status === 'DRAFT_CORRECTED';
|
|
4217
|
-
return /*#__PURE__*/React__default["default"].createElement(
|
|
4409
|
+
return /*#__PURE__*/React__default["default"].createElement(material.Accordion, __assign({
|
|
4218
4410
|
"data-testid": "tafListItem",
|
|
4219
4411
|
className: classes.accordion
|
|
4220
4412
|
}, popOut ? {
|
|
@@ -4228,14 +4420,16 @@
|
|
|
4228
4420
|
TransitionProps: {
|
|
4229
4421
|
unmountOnExit: true
|
|
4230
4422
|
}
|
|
4231
|
-
}), /*#__PURE__*/React__default["default"].createElement(
|
|
4423
|
+
}), /*#__PURE__*/React__default["default"].createElement(material.AccordionSummary, {
|
|
4232
4424
|
"data-testid": "tafListSectionAccordionSummary",
|
|
4233
|
-
expandIcon: popOut ? /*#__PURE__*/React__default["default"].createElement(
|
|
4234
|
-
title: "Popout to edit"
|
|
4235
|
-
|
|
4425
|
+
expandIcon: popOut ? /*#__PURE__*/React__default["default"].createElement(material.Tooltip, {
|
|
4426
|
+
title: "Popout to edit",
|
|
4427
|
+
className: classes.expandIcon
|
|
4428
|
+
}, /*#__PURE__*/React__default["default"].createElement(iconsMaterial.OpenInNew, {
|
|
4236
4429
|
"data-testid": "popOutIcon",
|
|
4237
4430
|
fontSize: "small"
|
|
4238
|
-
})) : /*#__PURE__*/React__default["default"].createElement(
|
|
4431
|
+
})) : /*#__PURE__*/React__default["default"].createElement(iconsMaterial.ExpandMore, {
|
|
4432
|
+
className: classes.expandIcon,
|
|
4239
4433
|
"data-testid": "expandIcon"
|
|
4240
4434
|
})
|
|
4241
4435
|
}, /*#__PURE__*/React__default["default"].createElement(TafListRow, {
|
|
@@ -4243,7 +4437,7 @@
|
|
|
4243
4437
|
listType: listType,
|
|
4244
4438
|
TAC: TAC,
|
|
4245
4439
|
showTac: true
|
|
4246
|
-
})), /*#__PURE__*/React__default["default"].createElement(
|
|
4440
|
+
})), /*#__PURE__*/React__default["default"].createElement(material.AccordionDetails, null, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
4247
4441
|
container: true,
|
|
4248
4442
|
direction: "column"
|
|
4249
4443
|
}, errorCancelTaf.length > 0 && errorCancelTaf.find(function (uuid) {
|
|
@@ -4254,13 +4448,13 @@
|
|
|
4254
4448
|
dataTestId: "tafList-cancelAlert"
|
|
4255
4449
|
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
4256
4450
|
className: classes.formPadding
|
|
4257
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
|
4451
|
+
}, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
4258
4452
|
item: true
|
|
4259
4453
|
}, /*#__PURE__*/React__default["default"].createElement(TafFormWrapper, {
|
|
4260
4454
|
tafFromBackend: tafListItem,
|
|
4261
4455
|
mode: "view",
|
|
4262
4456
|
TAC: TAC
|
|
4263
|
-
})), /*#__PURE__*/React__default["default"].createElement(
|
|
4457
|
+
})), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
4264
4458
|
item: true
|
|
4265
4459
|
}, /*#__PURE__*/React__default["default"].createElement(TafListButtons, {
|
|
4266
4460
|
canBe: tafListItem.canbe,
|
|
@@ -4285,7 +4479,7 @@
|
|
|
4285
4479
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
4286
4480
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
4287
4481
|
* */
|
|
4288
|
-
var useStyles$2 =
|
|
4482
|
+
var useStyles$2 = makeStyles__default["default"]({
|
|
4289
4483
|
listHeaders: {
|
|
4290
4484
|
color: '#9d9d9d'
|
|
4291
4485
|
},
|
|
@@ -4305,7 +4499,7 @@
|
|
|
4305
4499
|
errorCancelTaf = _b === void 0 ? [] : _b,
|
|
4306
4500
|
onClickTafActionButton = _a.onClickTafActionButton;
|
|
4307
4501
|
var classes = useStyles$2();
|
|
4308
|
-
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(
|
|
4502
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(material.Typography, {
|
|
4309
4503
|
variant: "subtitle2",
|
|
4310
4504
|
className: classes.listHeaders
|
|
4311
4505
|
}, title), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -4321,7 +4515,7 @@
|
|
|
4321
4515
|
})));
|
|
4322
4516
|
};
|
|
4323
4517
|
|
|
4324
|
-
var useStyles$1 =
|
|
4518
|
+
var useStyles$1 = makeStyles__default["default"]({
|
|
4325
4519
|
accordion: {
|
|
4326
4520
|
marginBottom: '5px'
|
|
4327
4521
|
},
|
|
@@ -4379,11 +4573,11 @@
|
|
|
4379
4573
|
}
|
|
4380
4574
|
}
|
|
4381
4575
|
|
|
4382
|
-
return /*#__PURE__*/React__default["default"].createElement(
|
|
4576
|
+
return /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
4383
4577
|
container: true,
|
|
4384
4578
|
direction: "column",
|
|
4385
4579
|
alignItems: "stretch"
|
|
4386
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
|
4580
|
+
}, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
4387
4581
|
item: true,
|
|
4388
4582
|
className: classes.listBody
|
|
4389
4583
|
}, error && /*#__PURE__*/React__default["default"].createElement(shared.AlertBanner, {
|
|
@@ -4409,9 +4603,9 @@
|
|
|
4409
4603
|
tafList: expiredTafs,
|
|
4410
4604
|
errorCancelTaf: errorCancelTaf,
|
|
4411
4605
|
onClickTafActionButton: onClickTafActionButton
|
|
4412
|
-
})), isLoading && /*#__PURE__*/React__default["default"].createElement(
|
|
4606
|
+
})), isLoading && /*#__PURE__*/React__default["default"].createElement(material.Skeleton, {
|
|
4413
4607
|
"data-testid": "tafList-skeleton",
|
|
4414
|
-
variant: "
|
|
4608
|
+
variant: "rectangular",
|
|
4415
4609
|
height: "660px"
|
|
4416
4610
|
})));
|
|
4417
4611
|
};
|
|
@@ -4432,7 +4626,7 @@
|
|
|
4432
4626
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
4433
4627
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
4434
4628
|
* */
|
|
4435
|
-
var useStyles =
|
|
4629
|
+
var useStyles = makeStyles__default["default"]({
|
|
4436
4630
|
backdrop: {
|
|
4437
4631
|
zIndex: 1500,
|
|
4438
4632
|
color: '#fff'
|
|
@@ -4441,10 +4635,10 @@
|
|
|
4441
4635
|
|
|
4442
4636
|
var Spinner = function Spinner() {
|
|
4443
4637
|
var classes = useStyles();
|
|
4444
|
-
return /*#__PURE__*/React__default["default"].createElement(
|
|
4638
|
+
return /*#__PURE__*/React__default["default"].createElement(material.Backdrop, {
|
|
4445
4639
|
open: true,
|
|
4446
4640
|
className: classes.backdrop
|
|
4447
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
|
4641
|
+
}, /*#__PURE__*/React__default["default"].createElement(material.CircularProgress, {
|
|
4448
4642
|
"data-testid": "spinner",
|
|
4449
4643
|
color: "inherit"
|
|
4450
4644
|
}));
|