@opengeoweb/taf 15.1.0 → 15.2.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 CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import { Chip, Box, Typography, Grid, Button, TextField, MenuList, MenuItem, LinearProgress, Card, Tabs, Tab, Backdrop, CircularProgress } from '@mui/material';
2
+ import { Chip, Box, Typography, Grid, Button, TextField, LinearProgress, MenuList, MenuItem, Card, Tabs, Tab, Backdrop, CircularProgress } from '@mui/material';
3
3
  import React, { useState, useEffect } from 'react';
4
4
  import { useFormContext, useFieldArray, Controller } from 'react-hook-form';
5
5
  import { useDispatch } from 'react-redux';
@@ -7,7 +7,7 @@ import { ReactSortable } from 'react-sortablejs';
7
7
  import Sortable from 'sortablejs';
8
8
  import { useAuthenticationContext as useAuthenticationContext$1 } from '@opengeoweb/authentication';
9
9
  import { HIDDEN_INPUT_HELPER_IS_DRAFT, getDeepProperty, useDraftFormHelpers, ReactHookFormHiddenInput, ReactHookFormProvider } from '@opengeoweb/form-fields';
10
- import { SHARED_NAMESPACE, CustomTooltip, ToolContainerDraggable, Avatar, getInitials, CustomIconButton, dateUtils, sessionStorageProvider, getErrorMessage as getErrorMessage$1, getWarningMessage, ToggleMenu, useConfirmationDialog, usePreventBrowserClose, SwitchButton, AlertBanner, CustomDialog, ToolHeader, LastUpdateTime, ErrorBoundary } from '@opengeoweb/shared';
10
+ import { SHARED_NAMESPACE, CustomTooltip, ToolContainerDraggable, Avatar, getInitials, CustomIconButton, dateUtils, sessionStorageProvider, getErrorMessage as getErrorMessage$1, getWarningMessage, AlertBanner, ToggleMenu, useConfirmationDialog, usePreventBrowserClose, SwitchButton, CustomDialog, ToolHeader, LastUpdateTime, ErrorBoundary } from '@opengeoweb/shared';
11
11
  import { snackbarActions, snackbarTypes } from '@opengeoweb/snackbar';
12
12
  import 'i18next';
13
13
  import { useTranslation } from 'react-i18next';
@@ -104,6 +104,7 @@ var en = {
104
104
  "autotaf-no-data": "No autoTAFs available",
105
105
  "autotaf-no-location": "No data available for this location",
106
106
  "autotaf-no-config": "Missing config key: autoTAFlocations",
107
+ remark: "RMK",
107
108
  "no-locations-message": "No locations available for this timeslot"
108
109
  };
109
110
  var fi = {
@@ -2925,20 +2926,23 @@ var DATE_FORMAT_BASE_TIME = 'HH:mm dd MMM';
2925
2926
  var config = sessionStorageProvider.getConfig();
2926
2927
  var tafBaseUrl = config.GW_TAF_BASE_URL || '';
2927
2928
  var getTafList = /*#__PURE__*/function () {
2928
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(auth) {
2929
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(auth, type) {
2929
2930
  return _regeneratorRuntime().wrap(function _callee$(_context) {
2930
2931
  while (1) switch (_context.prev = _context.next) {
2931
2932
  case 0:
2932
- return _context.abrupt("return", fetch(tafBaseUrl + "/taflist", {
2933
+ if (type === void 0) {
2934
+ type = 'TAF';
2935
+ }
2936
+ return _context.abrupt("return", fetch(tafBaseUrl + "/taflist?type=" + type, {
2933
2937
  headers: getHeaders(auth)
2934
2938
  }).then(handleResponse));
2935
- case 1:
2939
+ case 2:
2936
2940
  case "end":
2937
2941
  return _context.stop();
2938
2942
  }
2939
2943
  }, _callee);
2940
2944
  }));
2941
- return function getTafList(_x) {
2945
+ return function getTafList(_x, _x2) {
2942
2946
  return _ref.apply(this, arguments);
2943
2947
  };
2944
2948
  }();
@@ -2958,7 +2962,7 @@ var postTaf = /*#__PURE__*/function () {
2958
2962
  }
2959
2963
  }, _callee2);
2960
2964
  }));
2961
- return function postTaf(_x2, _x3) {
2965
+ return function postTaf(_x3, _x4) {
2962
2966
  return _ref2.apply(this, arguments);
2963
2967
  };
2964
2968
  }();
@@ -2978,7 +2982,7 @@ var patchTaf = /*#__PURE__*/function () {
2978
2982
  }
2979
2983
  }, _callee3);
2980
2984
  }));
2981
- return function patchTaf(_x4, _x5, _x6) {
2985
+ return function patchTaf(_x5, _x6, _x7) {
2982
2986
  return _ref3.apply(this, arguments);
2983
2987
  };
2984
2988
  }();
@@ -2998,25 +3002,28 @@ var getTAC = /*#__PURE__*/function () {
2998
3002
  }
2999
3003
  }, _callee4);
3000
3004
  }));
3001
- return function getTAC(_x7, _x8) {
3005
+ return function getTAC(_x8, _x9) {
3002
3006
  return _ref4.apply(this, arguments);
3003
3007
  };
3004
3008
  }();
3005
3009
  var getTafConfig = /*#__PURE__*/function () {
3006
- var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(auth) {
3010
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(auth, type) {
3007
3011
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
3008
3012
  while (1) switch (_context5.prev = _context5.next) {
3009
3013
  case 0:
3010
- return _context5.abrupt("return", fetch(tafBaseUrl + "/taf-config", {
3014
+ if (type === void 0) {
3015
+ type = 'TAF';
3016
+ }
3017
+ return _context5.abrupt("return", fetch(tafBaseUrl + "/taf-config?type=" + type, {
3011
3018
  headers: getHeaders(auth)
3012
3019
  }).then(handleResponse));
3013
- case 1:
3020
+ case 2:
3014
3021
  case "end":
3015
3022
  return _context5.stop();
3016
3023
  }
3017
3024
  }, _callee5);
3018
3025
  }));
3019
- return function getTafConfig(_x9) {
3026
+ return function getTafConfig(_x0, _x1) {
3020
3027
  return _ref5.apply(this, arguments);
3021
3028
  };
3022
3029
  }();
@@ -3038,6 +3045,9 @@ var getTafConfig = /*#__PURE__*/function () {
3038
3045
  * Copyright 2022 - Finnish Meteorological Institute (FMI)
3039
3046
  * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
3040
3047
  * */
3048
+ var isTafConfigLocationFixedPeriod = function isTafConfigLocationFixedPeriod(location) {
3049
+ return location.activity_period !== undefined;
3050
+ };
3041
3051
  var getLocationSetting = function getLocationSetting(location, locationSettings) {
3042
3052
  return locationSettings[location];
3043
3053
  };
@@ -3068,11 +3078,54 @@ var sortTafsOnIssueDate = function sortTafsOnIssueDate(tafList) {
3068
3078
  });
3069
3079
  };
3070
3080
  var getBaseTime = function getBaseTime(baseTime, location, tafConfig) {
3071
- var currentBaseTime = dateUtils.utc(baseTime);
3072
- var activityPeriod = getLocationSetting(location, tafConfig.locations).activity_period;
3073
- var nextBaseTime = dateUtils.add(dateUtils.utc(baseTime), {
3074
- hours: activityPeriod
3075
- });
3081
+ var configLocation = getLocationSetting(location, tafConfig.locations);
3082
+ var currentBaseTime;
3083
+ var nextBaseTime;
3084
+ if (isTafConfigLocationFixedPeriod(configLocation)) {
3085
+ var activityPeriod = configLocation.activity_period;
3086
+ currentBaseTime = dateUtils.utc(baseTime);
3087
+ nextBaseTime = dateUtils.add(dateUtils.utc(baseTime), {
3088
+ hours: activityPeriod
3089
+ });
3090
+ } else {
3091
+ currentBaseTime = dateUtils.utc(baseTime);
3092
+ var startTimeIndex = configLocation.valid_start_times.findLastIndex(function (hour) {
3093
+ return currentBaseTime.getUTCHours() >= hour;
3094
+ });
3095
+ // when current hour is lower than then first item in valid_start_times. we need to move to the last hour of the previous day
3096
+ if (startTimeIndex === -1) {
3097
+ var lastStartTimeIndex = configLocation.valid_start_times.length - 1;
3098
+ currentBaseTime = dateUtils.sub(currentBaseTime, {
3099
+ days: 1
3100
+ });
3101
+ currentBaseTime = dateUtils.set(currentBaseTime, {
3102
+ hours: configLocation.valid_start_times[lastStartTimeIndex],
3103
+ minutes: 0,
3104
+ seconds: 0
3105
+ });
3106
+ } else {
3107
+ // We make sure that the hours match the value in valid_start_times
3108
+ // or should we just assume that the baseTime aligns with the config here?
3109
+ currentBaseTime = dateUtils.set(currentBaseTime, {
3110
+ hours: configLocation.valid_start_times[startTimeIndex],
3111
+ minutes: 0,
3112
+ seconds: 0
3113
+ });
3114
+ }
3115
+ var nextStartTimeIndex = (startTimeIndex + 1) % configLocation.valid_start_times.length;
3116
+ var nextStartTimeHour = configLocation.valid_start_times[nextStartTimeIndex];
3117
+ nextBaseTime = dateUtils.set(currentBaseTime, {
3118
+ hours: nextStartTimeHour,
3119
+ minutes: 0,
3120
+ seconds: 0
3121
+ });
3122
+ // If next start time is earlier than or equal to current start time, it means we've wrapped to the next day
3123
+ if (nextStartTimeHour <= configLocation.valid_start_times[startTimeIndex]) {
3124
+ nextBaseTime = dateUtils.add(nextBaseTime, {
3125
+ days: 1
3126
+ });
3127
+ }
3128
+ }
3076
3129
  return {
3077
3130
  currentBaseTime: currentBaseTime,
3078
3131
  nextBaseTime: nextBaseTime
@@ -3088,21 +3141,25 @@ var calculateBaseTime = function calculateBaseTime(tafConfig) {
3088
3141
  var currentHour = dateUtils.getHours(currentTime);
3089
3142
  // take the first location from config (via locationOrder)
3090
3143
  var firstLocation = tafConfig.locationOrder[0];
3091
- var activityPeriod = getLocationSetting(firstLocation, tafConfig.locations).activity_period;
3092
- var baseHour = Math.floor(currentHour / activityPeriod) * activityPeriod;
3093
- var currentBaseTime = dateUtils.set(currentTime, {
3094
- hours: baseHour,
3095
- minutes: 0,
3096
- seconds: 0,
3097
- milliseconds: 0
3098
- });
3099
- var nextBaseTime = dateUtils.add(currentBaseTime, {
3100
- hours: activityPeriod
3101
- });
3102
- return {
3103
- currentBaseTime: currentBaseTime,
3104
- nextBaseTime: nextBaseTime
3105
- };
3144
+ var configLocation = getLocationSetting(firstLocation, tafConfig.locations);
3145
+ if (isTafConfigLocationFixedPeriod(configLocation)) {
3146
+ var activityPeriod = configLocation.activity_period;
3147
+ var baseHour = Math.floor(currentHour / activityPeriod) * activityPeriod;
3148
+ var currentBaseTime = dateUtils.set(currentTime, {
3149
+ hours: baseHour,
3150
+ minutes: 0,
3151
+ seconds: 0,
3152
+ milliseconds: 0
3153
+ });
3154
+ var nextBaseTime = dateUtils.add(currentBaseTime, {
3155
+ hours: activityPeriod
3156
+ });
3157
+ return {
3158
+ currentBaseTime: currentBaseTime,
3159
+ nextBaseTime: nextBaseTime
3160
+ };
3161
+ }
3162
+ return getBaseTime(currentTime.toUTCString(), firstLocation, tafConfig);
3106
3163
  };
3107
3164
  var getTafTimeSlot = function getTafTimeSlot(baseTime, location, status, tafConfig) {
3108
3165
  var now = dateUtils.utc();
@@ -3247,17 +3304,53 @@ var parseErrorMessage = function parseErrorMessage(error, params, t) {
3247
3304
  };
3248
3305
  };
3249
3306
 
3250
- var useTafList = function useTafList(disabled) {
3307
+ var useTafList = function useTafList(type, disabled) {
3308
+ if (type === void 0) {
3309
+ type = 'TAF';
3310
+ }
3251
3311
  if (disabled === void 0) {
3252
3312
  disabled = false;
3253
3313
  }
3254
- return useAuthQuery(['taf-list'], getTafList, disabled, 1000 * 60 * 5);
3314
+ return useAuthQuery(['taf-list', type], /*#__PURE__*/function () {
3315
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(auth) {
3316
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
3317
+ while (1) switch (_context.prev = _context.next) {
3318
+ case 0:
3319
+ return _context.abrupt("return", getTafList(auth, type));
3320
+ case 1:
3321
+ case "end":
3322
+ return _context.stop();
3323
+ }
3324
+ }, _callee);
3325
+ }));
3326
+ return function (_x) {
3327
+ return _ref.apply(this, arguments);
3328
+ };
3329
+ }(), disabled, 1000 * 60 * 5);
3255
3330
  };
3256
- var useTafConfig = function useTafConfig(disabled) {
3331
+ var useTafConfig = function useTafConfig(type, disabled) {
3332
+ if (type === void 0) {
3333
+ type = 'TAF';
3334
+ }
3257
3335
  if (disabled === void 0) {
3258
3336
  disabled = false;
3259
3337
  }
3260
- return useAuthQuery(['taf-config'], getTafConfig, disabled, false);
3338
+ return useAuthQuery(['taf-config', type], /*#__PURE__*/function () {
3339
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(auth) {
3340
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
3341
+ while (1) switch (_context2.prev = _context2.next) {
3342
+ case 0:
3343
+ return _context2.abrupt("return", getTafConfig(auth, type));
3344
+ case 1:
3345
+ case "end":
3346
+ return _context2.stop();
3347
+ }
3348
+ }, _callee2);
3349
+ }));
3350
+ return function (_x2) {
3351
+ return _ref2.apply(this, arguments);
3352
+ };
3353
+ }(), disabled, false);
3261
3354
  };
3262
3355
  var usePostTaf = function usePostTaf() {
3263
3356
  var queryClient = useQueryClient();
@@ -3268,83 +3361,83 @@ var usePostTaf = function usePostTaf() {
3268
3361
  var dispatch = useDispatch();
3269
3362
  return useMutation({
3270
3363
  mutationFn: function () {
3271
- var _mutationFn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
3364
+ var _mutationFn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref3) {
3272
3365
  var tafData, setError;
3273
- return _regeneratorRuntime().wrap(function _callee$(_context) {
3274
- while (1) switch (_context.prev = _context.next) {
3366
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
3367
+ while (1) switch (_context3.prev = _context3.next) {
3275
3368
  case 0:
3276
- tafData = _ref.tafData, setError = _ref.setError;
3369
+ tafData = _ref3.tafData, setError = _ref3.setError;
3277
3370
  if (auth) {
3278
- _context.next = 3;
3371
+ _context3.next = 3;
3279
3372
  break;
3280
3373
  }
3281
3374
  throw new Error('Authentication context not found');
3282
3375
  case 3:
3283
3376
  setError(null);
3284
- return _context.abrupt("return", postTaf(auth, tafData));
3377
+ return _context3.abrupt("return", postTaf(auth, tafData));
3285
3378
  case 5:
3286
3379
  case "end":
3287
- return _context.stop();
3380
+ return _context3.stop();
3288
3381
  }
3289
- }, _callee);
3382
+ }, _callee3);
3290
3383
  }));
3291
- function mutationFn(_x) {
3384
+ function mutationFn(_x3) {
3292
3385
  return _mutationFn.apply(this, arguments);
3293
3386
  }
3294
3387
  return mutationFn;
3295
3388
  }(),
3296
3389
  onSuccess: function () {
3297
- var _onSuccess = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_data, _ref2) {
3390
+ var _onSuccess = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_data, _ref4) {
3298
3391
  var tafData, isAutoSaved, message;
3299
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
3300
- while (1) switch (_context2.prev = _context2.next) {
3392
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
3393
+ while (1) switch (_context4.prev = _context4.next) {
3301
3394
  case 0:
3302
- tafData = _ref2.tafData, isAutoSaved = _ref2.isAutoSaved;
3395
+ tafData = _ref4.tafData, isAutoSaved = _ref4.isAutoSaved;
3303
3396
  message = getSnackbarMessage(tafData, isAutoSaved, t);
3304
3397
  dispatch(snackbarActions.openSnackbar({
3305
3398
  type: snackbarTypes.SnackbarMessageType.VERBATIM_MESSAGE,
3306
3399
  message: message
3307
3400
  }));
3308
3401
  // trigger refetch for the list
3309
- _context2.next = 5;
3402
+ _context4.next = 5;
3310
3403
  return queryClient.invalidateQueries({
3311
3404
  queryKey: ['taf-list']
3312
3405
  });
3313
3406
  case 5:
3314
3407
  case "end":
3315
- return _context2.stop();
3408
+ return _context4.stop();
3316
3409
  }
3317
- }, _callee2);
3410
+ }, _callee4);
3318
3411
  }));
3319
- function onSuccess(_x2, _x3) {
3412
+ function onSuccess(_x4, _x5) {
3320
3413
  return _onSuccess.apply(this, arguments);
3321
3414
  }
3322
3415
  return onSuccess;
3323
3416
  }(),
3324
3417
  onError: function () {
3325
- var _onError = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(error, _ref3) {
3418
+ var _onError = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(error, _ref5) {
3326
3419
  var tafData, setError, tafError;
3327
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
3328
- while (1) switch (_context3.prev = _context3.next) {
3420
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
3421
+ while (1) switch (_context5.prev = _context5.next) {
3329
3422
  case 0:
3330
- tafData = _ref3.tafData, setError = _ref3.setError;
3423
+ tafData = _ref5.tafData, setError = _ref5.setError;
3331
3424
  tafError = parseErrorMessage(error, tafData, t);
3332
3425
  setError(tafError);
3333
3426
  if (!isWarning(tafError)) {
3334
- _context3.next = 6;
3427
+ _context5.next = 6;
3335
3428
  break;
3336
3429
  }
3337
- _context3.next = 6;
3430
+ _context5.next = 6;
3338
3431
  return queryClient.invalidateQueries({
3339
3432
  queryKey: ['taf-list']
3340
3433
  });
3341
3434
  case 6:
3342
3435
  case "end":
3343
- return _context3.stop();
3436
+ return _context5.stop();
3344
3437
  }
3345
- }, _callee3);
3438
+ }, _callee5);
3346
3439
  }));
3347
- function onError(_x4, _x5) {
3440
+ function onError(_x6, _x7) {
3348
3441
  return _onError.apply(this, arguments);
3349
3442
  }
3350
3443
  return onError;
@@ -3359,45 +3452,45 @@ var usePatchTaf = function usePatchTaf() {
3359
3452
  t = _useTafTranslation2.t;
3360
3453
  return useMutation({
3361
3454
  mutationFn: function () {
3362
- var _mutationFn2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref4) {
3455
+ var _mutationFn2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_ref6) {
3363
3456
  var tafData, setError, force;
3364
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
3365
- while (1) switch (_context4.prev = _context4.next) {
3457
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
3458
+ while (1) switch (_context6.prev = _context6.next) {
3366
3459
  case 0:
3367
- tafData = _ref4.tafData, setError = _ref4.setError, force = _ref4.force;
3460
+ tafData = _ref6.tafData, setError = _ref6.setError, force = _ref6.force;
3368
3461
  if (auth) {
3369
- _context4.next = 3;
3462
+ _context6.next = 3;
3370
3463
  break;
3371
3464
  }
3372
3465
  throw new Error('Authentication context not found');
3373
3466
  case 3:
3374
3467
  setError(null);
3375
- return _context4.abrupt("return", patchTaf(auth, tafData, force));
3468
+ return _context6.abrupt("return", patchTaf(auth, tafData, force));
3376
3469
  case 5:
3377
3470
  case "end":
3378
- return _context4.stop();
3471
+ return _context6.stop();
3379
3472
  }
3380
- }, _callee4);
3473
+ }, _callee6);
3381
3474
  }));
3382
- function mutationFn(_x6) {
3475
+ function mutationFn(_x8) {
3383
3476
  return _mutationFn2.apply(this, arguments);
3384
3477
  }
3385
3478
  return mutationFn;
3386
3479
  }(),
3387
3480
  onSuccess: function () {
3388
- var _onSuccess2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
3389
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
3390
- while (1) switch (_context5.prev = _context5.next) {
3481
+ var _onSuccess2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
3482
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
3483
+ while (1) switch (_context7.prev = _context7.next) {
3391
3484
  case 0:
3392
- _context5.next = 2;
3485
+ _context7.next = 2;
3393
3486
  return queryClient.invalidateQueries({
3394
3487
  queryKey: ['taf-list']
3395
3488
  });
3396
3489
  case 2:
3397
3490
  case "end":
3398
- return _context5.stop();
3491
+ return _context7.stop();
3399
3492
  }
3400
- }, _callee5);
3493
+ }, _callee7);
3401
3494
  }));
3402
3495
  function onSuccess() {
3403
3496
  return _onSuccess2.apply(this, arguments);
@@ -3405,22 +3498,22 @@ var usePatchTaf = function usePatchTaf() {
3405
3498
  return onSuccess;
3406
3499
  }(),
3407
3500
  onError: function () {
3408
- var _onError2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(error, _ref5) {
3501
+ var _onError2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(error, _ref7) {
3409
3502
  var tafData, setError, newError;
3410
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
3411
- while (1) switch (_context6.prev = _context6.next) {
3503
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
3504
+ while (1) switch (_context8.prev = _context8.next) {
3412
3505
  case 0:
3413
- tafData = _ref5.tafData, setError = _ref5.setError;
3506
+ tafData = _ref7.tafData, setError = _ref7.setError;
3414
3507
  if (!(error.cause === 409)) {
3415
- _context6.next = 6;
3508
+ _context8.next = 6;
3416
3509
  break;
3417
3510
  }
3418
- _context6.next = 4;
3511
+ _context8.next = 4;
3419
3512
  return queryClient.invalidateQueries({
3420
3513
  queryKey: ['taf-list']
3421
3514
  });
3422
3515
  case 4:
3423
- _context6.next = 8;
3516
+ _context8.next = 8;
3424
3517
  break;
3425
3518
  case 6:
3426
3519
  // no refetch, show error message
@@ -3428,11 +3521,11 @@ var usePatchTaf = function usePatchTaf() {
3428
3521
  setError(newError);
3429
3522
  case 8:
3430
3523
  case "end":
3431
- return _context6.stop();
3524
+ return _context8.stop();
3432
3525
  }
3433
- }, _callee6);
3526
+ }, _callee8);
3434
3527
  }));
3435
- function onError(_x7, _x8) {
3528
+ function onError(_x9, _x0) {
3436
3529
  return _onError2.apply(this, arguments);
3437
3530
  }
3438
3531
  return onError;
@@ -3444,26 +3537,26 @@ var useGetTAC = function useGetTAC() {
3444
3537
  auth = _useAuthenticationCon3.auth;
3445
3538
  return useMutation({
3446
3539
  mutationFn: function () {
3447
- var _mutationFn3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(_ref6) {
3540
+ var _mutationFn3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(_ref8) {
3448
3541
  var tafData;
3449
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
3450
- while (1) switch (_context7.prev = _context7.next) {
3542
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
3543
+ while (1) switch (_context9.prev = _context9.next) {
3451
3544
  case 0:
3452
- tafData = _ref6.tafData;
3545
+ tafData = _ref8.tafData;
3453
3546
  if (auth) {
3454
- _context7.next = 3;
3547
+ _context9.next = 3;
3455
3548
  break;
3456
3549
  }
3457
3550
  throw new Error('Authentication context not found');
3458
3551
  case 3:
3459
- return _context7.abrupt("return", getTAC(auth, tafData));
3552
+ return _context9.abrupt("return", getTAC(auth, tafData));
3460
3553
  case 4:
3461
3554
  case "end":
3462
- return _context7.stop();
3555
+ return _context9.stop();
3463
3556
  }
3464
- }, _callee7);
3557
+ }, _callee9);
3465
3558
  }));
3466
- function mutationFn(_x9) {
3559
+ function mutationFn(_x1) {
3467
3560
  return _mutationFn3.apply(this, arguments);
3468
3561
  }
3469
3562
  return mutationFn;
@@ -3975,11 +4068,14 @@ var createChangeGroup = function createChangeGroup(changeGroup) {
3975
4068
  cloud: Object.assign({}, emptyChangegroup.cloud, changeGroup.cloud)
3976
4069
  });
3977
4070
  };
3978
- var prepareTafValues = function prepareTafValues(_taf, tafAction, addEmptyChangeGroups) {
4071
+ var prepareTafValues = function prepareTafValues(_taf, tafAction, addEmptyChangeGroups, shouldEnableRemark) {
3979
4072
  var _taf$changeGroups, _Object$assign2;
3980
4073
  if (addEmptyChangeGroups === void 0) {
3981
4074
  addEmptyChangeGroups = false;
3982
4075
  }
4076
+ if (shouldEnableRemark === void 0) {
4077
+ shouldEnableRemark = false;
4078
+ }
3983
4079
  // If action is AMEND/CORRECT/DRAFT_AMEND/DRAFT_CORRECTION - add previous valid start and end
3984
4080
  // If action is AMEND/DRAFT_AMEND - update validity start time to current time
3985
4081
  var taf = tafAction === 'AMEND' || tafAction === 'DRAFT_AMEND' || tafAction === 'CORRECT' || tafAction === 'DRAFT_CORRECT' ? getAmendedCorrectedTafTimes(_taf, tafAction) : _taf;
@@ -4001,18 +4097,24 @@ var prepareTafValues = function prepareTafValues(_taf, tafAction, addEmptyChange
4001
4097
  }
4002
4098
  return Object.assign({
4003
4099
  issueDate: '',
4100
+ type: 'TAF',
4004
4101
  previousId: null,
4005
4102
  previousValidDateStart: null,
4006
4103
  previousValidDateEnd: null
4104
+ }, shouldEnableRemark && {
4105
+ remark: ''
4007
4106
  }, taf, (_Object$assign2 = {
4008
4107
  messageType: getMessageType(taf, tafAction),
4009
4108
  baseForecast: baseForecast,
4010
4109
  changeGroups: changeGroups
4011
4110
  }, _Object$assign2[HIDDEN_INPUT_HELPER_IS_DRAFT] = true, _Object$assign2));
4012
4111
  };
4013
- var prepareTafExportValues = function prepareTafExportValues(tafToCopy, currentTaf) {
4112
+ var prepareTafExportValues = function prepareTafExportValues(tafToCopy, currentTaf, shouldEnableRemark) {
4014
4113
  var _currentTaf$baseForec;
4015
- var convertedCopy = prepareTafValues(tafToCopy, undefined, false);
4114
+ if (shouldEnableRemark === void 0) {
4115
+ shouldEnableRemark = false;
4116
+ }
4117
+ var convertedCopy = prepareTafValues(tafToCopy, undefined, false, shouldEnableRemark);
4016
4118
  var baseForecast = convertedCopy.baseForecast,
4017
4119
  _convertedCopy$change = convertedCopy.changeGroups,
4018
4120
  changeGroups = _convertedCopy$change === void 0 ? [] : _convertedCopy$change;
@@ -4150,7 +4252,9 @@ var ResponsiveWrapper = function ResponsiveWrapper(_ref) {
4150
4252
  });
4151
4253
  };
4152
4254
 
4153
- var _excluded$4 = ["shouldPreventUppercase"];
4255
+ var _excluded$4 = ["shouldPreventUppercase", "textAlign", "sx"];
4256
+ var TEXTFIELD_WIDTH_PERCENTAGE = 100 / 13;
4257
+ var TEXTFIELD_MIN_WIDTH = '60px';
4154
4258
  var textFieldStyle = function textFieldStyle(theme, shouldPreventUppercase) {
4155
4259
  var _ref;
4156
4260
  return _ref = {
@@ -4173,6 +4277,10 @@ var textFieldStyle = function textFieldStyle(theme, shouldPreventUppercase) {
4173
4277
  WebkitTransitionDelay: '86400s' // 1 day delay
4174
4278
  }
4175
4279
  },
4280
+ '&[data-text-align="left"] input': {
4281
+ textAlign: 'left',
4282
+ paddingLeft: '12px'
4283
+ },
4176
4284
  label: {
4177
4285
  transformOrigin: 'center top',
4178
4286
  right: 0,
@@ -4185,12 +4293,20 @@ var textFieldStyle = function textFieldStyle(theme, shouldPreventUppercase) {
4185
4293
  maxWidth: '100%',
4186
4294
  transform: 'translate(0px, 16px) scale(1)'
4187
4295
  },
4296
+ '&[data-text-align="left"] label': {
4297
+ transformOrigin: 'left top',
4298
+ transform: 'translate(12px, 16px) scale(1)',
4299
+ textAlign: 'left'
4300
+ },
4188
4301
  // shrink
4189
4302
  ' .MuiInputLabel-shrink': {
4190
4303
  transform: 'translate(2px, 10px) scale(0.75) !important',
4191
4304
  letterSpacing: '0.33px',
4192
4305
  textAlign: 'left'
4193
4306
  },
4307
+ '&[data-text-align="left"] .MuiInputLabel-shrink': {
4308
+ transform: 'translate(12px, 10px) scale(0.75) !important'
4309
+ },
4194
4310
  // root
4195
4311
  '&': {
4196
4312
  '.Mui-disabled:before': {
@@ -4231,16 +4347,19 @@ var getDisplayValue = function getDisplayValue(value, disabled) {
4231
4347
  var BaseTextField = /*#__PURE__*/React.memo(function (_ref2) {
4232
4348
  var _ref2$shouldPreventUp = _ref2.shouldPreventUppercase,
4233
4349
  shouldPreventUppercase = _ref2$shouldPreventUp === void 0 ? false : _ref2$shouldPreventUp,
4350
+ textAlign = _ref2.textAlign,
4351
+ sx = _ref2.sx,
4234
4352
  props = _objectWithoutPropertiesLoose(_ref2, _excluded$4);
4235
4353
  var theme = useTheme();
4236
4354
  var styling = textFieldStyle(theme, shouldPreventUppercase);
4237
4355
  return jsx(TextField, Object.assign({
4238
- sx: styling,
4356
+ "data-text-align": textAlign,
4357
+ sx: [styling].concat(Array.isArray(sx) ? sx : [sx]),
4239
4358
  type: "text",
4240
4359
  variant: "filled"
4241
4360
  }, props));
4242
4361
  }, function (prevProps, nextProps) {
4243
- return prevProps.value === nextProps.value && prevProps.error === nextProps.error && prevProps.name === nextProps.name && prevProps.disabled === nextProps.disabled;
4362
+ return prevProps.value === nextProps.value && prevProps.error === nextProps.error && prevProps.name === nextProps.name && prevProps.disabled === nextProps.disabled && prevProps.textAlign === nextProps.textAlign;
4244
4363
  });
4245
4364
  var TafFormTextField = function TafFormTextField(_ref3) {
4246
4365
  var label = _ref3.label,
@@ -4319,8 +4438,8 @@ var TafFormTextField = function TafFormTextField(_ref3) {
4319
4438
  var hasError = !!fieldErrors;
4320
4439
  return jsx(Grid, {
4321
4440
  sx: {
4322
- width: 100 / 13 + "%",
4323
- minWidth: 60
4441
+ width: TEXTFIELD_WIDTH_PERCENTAGE + "%",
4442
+ minWidth: TEXTFIELD_MIN_WIDTH
4324
4443
  },
4325
4444
  children: jsx(Controller, {
4326
4445
  control: control,
@@ -4359,6 +4478,78 @@ var TafFormTextField = function TafFormTextField(_ref3) {
4359
4478
  });
4360
4479
  };
4361
4480
 
4481
+ var TafRemarkField = function TafRemarkField(_ref) {
4482
+ var disabled = _ref.disabled,
4483
+ isEditor = _ref.isEditor;
4484
+ var _useTafTranslation = useTafTranslation(),
4485
+ t = _useTafTranslation.t;
4486
+ var _useFormContext = useFormContext(),
4487
+ control = _useFormContext.control,
4488
+ setValue = _useFormContext.setValue,
4489
+ trigger = _useFormContext.trigger;
4490
+ return jsx(Box, {
4491
+ sx: {
4492
+ display: 'flex',
4493
+ flexDirection: 'row',
4494
+ justifyContent: 'flex-end',
4495
+ marginTop: '8px',
4496
+ marginRight: 'max(28px, 3.5%)',
4497
+ paddingLeft: {
4498
+ xs: '2px',
4499
+ lg: '10px'
4500
+ },
4501
+ paddingRight: {
4502
+ xs: '2px',
4503
+ lg: '10px'
4504
+ }
4505
+ },
4506
+ children: jsx(Controller, {
4507
+ control: control,
4508
+ name: "remark",
4509
+ render: function render(_ref2) {
4510
+ var field = _ref2.field;
4511
+ return jsx(BaseTextField, {
4512
+ disabled: disabled,
4513
+ inputRef: field.ref,
4514
+ label: t('remark'),
4515
+ name: "remark",
4516
+ onBlur: function onBlur() {
4517
+ void trigger();
4518
+ field.onBlur();
4519
+ },
4520
+ onChange: function onChange(event) {
4521
+ field.onChange(event.currentTarget.value.toUpperCase());
4522
+ },
4523
+ onKeyDown: function onKeyDown(event) {
4524
+ if (event.key.toUpperCase() === 'D' && !field.value) {
4525
+ event.preventDefault();
4526
+ setValue('remark', 'DUE TO LACK OF DATA NO ');
4527
+ }
4528
+ },
4529
+ size: "small",
4530
+ slotProps: {
4531
+ htmlInput: {
4532
+ 'aria-label': 'remark'
4533
+ }
4534
+ },
4535
+ sx: {
4536
+ // the size of a taf textfield
4537
+ '--taf-textfield-size': "max(" + TEXTFIELD_WIDTH_PERCENTAGE + "%, " + TEXTFIELD_MIN_WIDTH + ")",
4538
+ // the width of the row minus the drag thingie
4539
+ '--total-row-size': 'calc(100% - 62px)',
4540
+ // calculates the size of the taf remark field so that it nicely aligns with the taf textfield rows
4541
+ // even when these rows are wrapped.
4542
+ width: isEditor ? "round(down, var(--total-row-size), var(--taf-textfield-size))" : '100%',
4543
+ marginLeft: 'auto'
4544
+ },
4545
+ textAlign: "left",
4546
+ value: field.value || ''
4547
+ });
4548
+ }
4549
+ })
4550
+ });
4551
+ };
4552
+
4362
4553
  /* *
4363
4554
  * Licensed under the Apache License, Version 2.0 (the "License");
4364
4555
  * you may not use this file except in compliance with the License.
@@ -4420,6 +4611,96 @@ var validateProbabilityField = function validateProbabilityField(value) {
4420
4611
  return isValid ? true : invalidProbabilityMessage;
4421
4612
  };
4422
4613
 
4614
+ var TafConfigContext = /*#__PURE__*/React.createContext({
4615
+ tafConfig: null
4616
+ });
4617
+ var useTafConfigContext = function useTafConfigContext() {
4618
+ return React.useContext(TafConfigContext);
4619
+ };
4620
+ var TafConfigWrapper = function TafConfigWrapper(_ref) {
4621
+ var children = _ref.children,
4622
+ _ref$type = _ref.type,
4623
+ type = _ref$type === void 0 ? 'TAF' : _ref$type;
4624
+ var _useTafTranslation = useTafTranslation(),
4625
+ t = _useTafTranslation.t;
4626
+ var _React$useState = React.useState(null),
4627
+ errorMessage = _React$useState[0],
4628
+ setErrorMessage = _React$useState[1];
4629
+ var ERROR_CONFIG = t('error-config');
4630
+ var ERROR_CONFIG_MESSAGE = t('error-config-message');
4631
+ var _useAuthenticationCon = useAuthenticationContext$1(),
4632
+ isLoggedIn = _useAuthenticationCon.isLoggedIn;
4633
+ var ERROR_AUTH = t('error-auth');
4634
+ var ERROR_AUTH_MESSAGE = t('error-auth-message');
4635
+ var _useTafConfig = useTafConfig(type),
4636
+ isFetching = _useTafConfig.isFetching,
4637
+ tafConfigError = _useTafConfig.error,
4638
+ tafConfig = _useTafConfig.data,
4639
+ fetchConfig = _useTafConfig.refetch;
4640
+ var onFetchConfig = /*#__PURE__*/function () {
4641
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
4642
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
4643
+ while (1) switch (_context.prev = _context.next) {
4644
+ case 0:
4645
+ _context.next = 2;
4646
+ return fetchConfig();
4647
+ case 2:
4648
+ case "end":
4649
+ return _context.stop();
4650
+ }
4651
+ }, _callee);
4652
+ }));
4653
+ return function onFetchConfig() {
4654
+ return _ref2.apply(this, arguments);
4655
+ };
4656
+ }();
4657
+ React.useEffect(function () {
4658
+ if (!isLoggedIn) {
4659
+ setErrorMessage({
4660
+ title: ERROR_AUTH,
4661
+ info: ERROR_AUTH_MESSAGE
4662
+ });
4663
+ } else if (tafConfigError) {
4664
+ setErrorMessage({
4665
+ title: ERROR_CONFIG,
4666
+ info: tafConfigError.message
4667
+ });
4668
+ } else {
4669
+ setErrorMessage(null);
4670
+ }
4671
+ }, [t, isLoggedIn, tafConfigError, ERROR_CONFIG, ERROR_AUTH, ERROR_AUTH_MESSAGE]);
4672
+ var contextValue = React.useMemo(function () {
4673
+ return {
4674
+ tafConfig: tafConfig
4675
+ };
4676
+ }, [tafConfig]);
4677
+ if (isLoggedIn && isFetching) {
4678
+ return jsx(LinearProgress, {
4679
+ color: "secondary",
4680
+ "data-testid": "tafconfig-loading-bar",
4681
+ sx: {
4682
+ marginBottom: '-4px'
4683
+ }
4684
+ });
4685
+ }
4686
+ if (errorMessage || !tafConfig) {
4687
+ return jsx(AlertBanner, {
4688
+ actionButtonProps: !errorMessage || (errorMessage == null ? void 0 : errorMessage.title) !== ERROR_AUTH ? {
4689
+ title: t('error-title-retry'),
4690
+ onClick: onFetchConfig
4691
+ } : undefined,
4692
+ "data-testid": "error-message",
4693
+ info: errorMessage ? errorMessage.info : ERROR_CONFIG_MESSAGE,
4694
+ severity: "error",
4695
+ title: errorMessage ? errorMessage.title : ERROR_CONFIG
4696
+ });
4697
+ }
4698
+ return jsx(TafConfigContext.Provider, {
4699
+ value: contextValue,
4700
+ children: children
4701
+ });
4702
+ };
4703
+
4423
4704
  var TafFormOptionsButton = function TafFormOptionsButton(_ref) {
4424
4705
  var isChangeGroup = _ref.isChangeGroup,
4425
4706
  addChangeGroupBelow = _ref.addChangeGroupBelow,
@@ -4501,6 +4782,8 @@ var TafFormRow = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
4501
4782
  var _useFormContext = useFormContext(),
4502
4783
  getValues = _useFormContext.getValues,
4503
4784
  trigger = _useFormContext.trigger;
4785
+ var _useTafConfigContext = useTafConfigContext(),
4786
+ tafConfig = _useTafConfigContext.tafConfig;
4504
4787
  // cross-field required validation
4505
4788
  var _getRequiredCrossFiel = getRequiredCrossFields(fieldNames),
4506
4789
  mainFields = _getRequiredCrossFiel[0],
@@ -4527,8 +4810,13 @@ var TafFormRow = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
4527
4810
  var _validateRequiredMainFields = function validateRequiredMainFields(value, fieldName) {
4528
4811
  var changeField = getValues(namePrefix + ".change");
4529
4812
  var visibilityField = getValues(namePrefix + ".visibility");
4530
- var isFM = changeField && changeField.trim() === 'FM';
4531
- var isCAVOK = visibilityField && visibilityField.trim() === 'CAVOK';
4813
+ var isFM = (changeField == null ? void 0 : changeField.trim()) === 'FM';
4814
+ var isCAVOK = (visibilityField == null ? void 0 : visibilityField.trim()) === 'CAVOK';
4815
+ // it is possible to send a empty row when the remark field has "DUE TO LACK OF DATA NO NAF" in it
4816
+ var remark = getValues('remark');
4817
+ if ((tafConfig == null ? void 0 : tafConfig.type) === 'NAF' && (remark == null ? void 0 : remark.toUpperCase()) === 'DUE TO LACK OF DATA NO NAF') {
4818
+ return true;
4819
+ }
4532
4820
  if (isNotRequiredForAction(value) !== true && !value.length) {
4533
4821
  if (isChangeGroup && isFM || !isChangeGroup) {
4534
4822
  // exception for CavOK
@@ -5047,7 +5335,9 @@ var TafForm = /*#__PURE__*/React.memo(function (_ref) {
5047
5335
  }, _callee2);
5048
5336
  })) : _ref$onSwitchEditor,
5049
5337
  _ref$previousTaf = _ref.previousTaf,
5050
- previousTaf = _ref$previousTaf === void 0 ? null : _ref$previousTaf;
5338
+ previousTaf = _ref$previousTaf === void 0 ? null : _ref$previousTaf,
5339
+ _ref$shouldEnableRema = _ref.shouldEnableRemark,
5340
+ shouldEnableRemark = _ref$shouldEnableRema === void 0 ? false : _ref$shouldEnableRema;
5051
5341
  var _useTafTranslation = useTafTranslation(),
5052
5342
  t = _useTafTranslation.t;
5053
5343
  var formRef = React.useRef(null);
@@ -5094,7 +5384,7 @@ var TafForm = /*#__PURE__*/React.memo(function (_ref) {
5094
5384
  onPreventCloseView(isFormDirty);
5095
5385
  // eslint-disable-next-line react-hooks/exhaustive-deps
5096
5386
  }, [isFormDirty]);
5097
- var hiddenInputFields = ['baseTime', 'issueDate', 'uuid', 'validDateStart', 'validDateEnd', 'status', 'previousId', 'previousValidDateStart', 'previousValidDateEnd', HIDDEN_INPUT_HELPER_IS_DRAFT];
5387
+ var hiddenInputFields = ['baseTime', 'issueDate', 'uuid', 'validDateStart', 'validDateEnd', 'status', 'previousId', 'previousValidDateStart', 'previousValidDateEnd', 'type', HIDDEN_INPUT_HELPER_IS_DRAFT];
5098
5388
  var onSubmit = function onSubmit(data) {
5099
5389
  // eslint-disable-next-line no-console
5100
5390
  console.log('submit:', convertTafValuesToObject(data));
@@ -5148,7 +5438,7 @@ var TafForm = /*#__PURE__*/React.memo(function (_ref) {
5148
5438
  tafToReset = originalTaf;
5149
5439
  }
5150
5440
  var shouldAddEmptyChangGroup = !resetDisabled;
5151
- var newTaf = prepareTafValues(tafToReset, action, shouldAddEmptyChangGroup);
5441
+ var newTaf = prepareTafValues(tafToReset, action, shouldAddEmptyChangGroup, shouldEnableRemark);
5152
5442
  resetFormValues(newTaf);
5153
5443
  setIsDisabled(resetDisabled);
5154
5444
  setTafAction(action);
@@ -5301,7 +5591,7 @@ var TafForm = /*#__PURE__*/React.memo(function (_ref) {
5301
5591
  while (1) switch (_context7.prev = _context7.next) {
5302
5592
  case 0:
5303
5593
  _context7.next = 2;
5304
- return onFormAction(action, convertTafValuesToObject(prepareTafValues(originalTaf, action)));
5594
+ return onFormAction(action, convertTafValuesToObject(prepareTafValues(originalTaf, action, false, shouldEnableRemark)));
5305
5595
  case 2:
5306
5596
  case "end":
5307
5597
  return _context7.stop();
@@ -5432,7 +5722,9 @@ var TafForm = /*#__PURE__*/React.memo(function (_ref) {
5432
5722
  // eslint-disable-next-line react-hooks/exhaustive-deps
5433
5723
  }, []);
5434
5724
  React.useEffect(function () {
5435
- var newValues = prepareTafValues(originalTaf, undefined, !isDefaultDisabled);
5725
+ var newValues = prepareTafValues(originalTaf, undefined, !isDefaultDisabled,
5726
+ // Only add empty changegroup rows if not yet published
5727
+ shouldEnableRemark);
5436
5728
  // set new form values when taf values changed
5437
5729
  resetFormValues(newValues);
5438
5730
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -5529,7 +5821,10 @@ var TafForm = /*#__PURE__*/React.memo(function (_ref) {
5529
5821
  onRemoveChangeGroup: onRemoverow
5530
5822
  }, item.id);
5531
5823
  })
5532
- }), !isDisabled && isEditor ? jsx(Grid, {
5824
+ }), shouldEnableRemark ? jsx(TafRemarkField, {
5825
+ disabled: isDisabled,
5826
+ isEditor: isEditor
5827
+ }) : null, !isDisabled && isEditor ? jsx(Grid, {
5533
5828
  container: true,
5534
5829
  sx: {
5535
5830
  justifyContent: 'space-between',
@@ -5787,97 +6082,9 @@ var AdverseWeatherTACMessage = function AdverseWeatherTACMessage(_ref) {
5787
6082
  });
5788
6083
  };
5789
6084
 
5790
- var TafConfigContext = /*#__PURE__*/React.createContext({
5791
- tafConfig: null
5792
- });
5793
- var useTafConfigContext = function useTafConfigContext() {
5794
- return React.useContext(TafConfigContext);
5795
- };
5796
- var TafConfigWrapper = function TafConfigWrapper(_ref) {
5797
- var children = _ref.children;
5798
- var _useTafTranslation = useTafTranslation(),
5799
- t = _useTafTranslation.t;
5800
- var _React$useState = React.useState(null),
5801
- errorMessage = _React$useState[0],
5802
- setErrorMessage = _React$useState[1];
5803
- var ERROR_CONFIG = t('error-config');
5804
- var ERROR_CONFIG_MESSAGE = t('error-config-message');
5805
- var _useAuthenticationCon = useAuthenticationContext$1(),
5806
- isLoggedIn = _useAuthenticationCon.isLoggedIn;
5807
- var ERROR_AUTH = t('error-auth');
5808
- var ERROR_AUTH_MESSAGE = t('error-auth-message');
5809
- var _useTafConfig = useTafConfig(),
5810
- isFetching = _useTafConfig.isFetching,
5811
- tafConfigError = _useTafConfig.error,
5812
- tafConfig = _useTafConfig.data,
5813
- fetchConfig = _useTafConfig.refetch;
5814
- var onFetchConfig = /*#__PURE__*/function () {
5815
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
5816
- return _regeneratorRuntime().wrap(function _callee$(_context) {
5817
- while (1) switch (_context.prev = _context.next) {
5818
- case 0:
5819
- _context.next = 2;
5820
- return fetchConfig();
5821
- case 2:
5822
- case "end":
5823
- return _context.stop();
5824
- }
5825
- }, _callee);
5826
- }));
5827
- return function onFetchConfig() {
5828
- return _ref2.apply(this, arguments);
5829
- };
5830
- }();
5831
- React.useEffect(function () {
5832
- if (!isLoggedIn) {
5833
- setErrorMessage({
5834
- title: ERROR_AUTH,
5835
- info: ERROR_AUTH_MESSAGE
5836
- });
5837
- } else if (tafConfigError) {
5838
- setErrorMessage({
5839
- title: ERROR_CONFIG,
5840
- info: tafConfigError.message
5841
- });
5842
- } else {
5843
- setErrorMessage(null);
5844
- }
5845
- }, [t, isLoggedIn, tafConfigError, ERROR_CONFIG, ERROR_AUTH, ERROR_AUTH_MESSAGE]);
5846
- var contextValue = React.useMemo(function () {
5847
- return {
5848
- tafConfig: tafConfig
5849
- };
5850
- }, [tafConfig]);
5851
- if (isLoggedIn && isFetching) {
5852
- return jsx(LinearProgress, {
5853
- color: "secondary",
5854
- "data-testid": "tafconfig-loading-bar",
5855
- sx: {
5856
- marginBottom: '-4px'
5857
- }
5858
- });
5859
- }
5860
- if (errorMessage || !tafConfig) {
5861
- return jsx(AlertBanner, {
5862
- actionButtonProps: !errorMessage || errorMessage.title !== ERROR_AUTH ? {
5863
- title: t('error-title-retry'),
5864
- onClick: onFetchConfig
5865
- } : undefined,
5866
- "data-testid": "error-message",
5867
- info: errorMessage ? errorMessage.info : ERROR_CONFIG_MESSAGE,
5868
- severity: "error",
5869
- title: errorMessage ? errorMessage.title : ERROR_CONFIG
5870
- });
5871
- }
5872
- return jsx(TafConfigContext.Provider, {
5873
- value: contextValue,
5874
- children: children
5875
- });
5876
- };
5877
-
5878
- var ExportButton = function ExportButton(_ref) {
5879
- var onClick = _ref.onClick,
5880
- isHidden = _ref.isHidden;
6085
+ var ExportButton = function ExportButton(_ref) {
6086
+ var onClick = _ref.onClick,
6087
+ isHidden = _ref.isHidden;
5881
6088
  var _useTafTranslation = useTafTranslation(),
5882
6089
  t = _useTafTranslation.t;
5883
6090
  return isHidden ? null : jsx(CustomIconButton, {
@@ -5942,7 +6149,7 @@ var TacContainer = function TacContainer(_ref2) {
5942
6149
  }, [dispatch]);
5943
6150
  var handleExport = function handleExport() {
5944
6151
  var currentTaf = getValues();
5945
- var newTaf = prepareTafExportValues(taf, currentTaf);
6152
+ var newTaf = prepareTafExportValues(taf, currentTaf, tafConfig == null ? void 0 : tafConfig.shouldEnableRemark);
5946
6153
  reset(newTaf, {
5947
6154
  keepDefaultValues: true,
5948
6155
  keepValues: false,
@@ -6475,7 +6682,9 @@ var TafPanel = function TafPanel(_ref) {
6475
6682
  error = _ref.error,
6476
6683
  _ref$previousTaf = _ref.previousTaf,
6477
6684
  previousTaf = _ref$previousTaf === void 0 ? null : _ref$previousTaf,
6478
- tafAction = _ref.tafAction;
6685
+ tafAction = _ref.tafAction,
6686
+ _ref$shouldEnableRema = _ref.shouldEnableRemark,
6687
+ shouldEnableRemark = _ref$shouldEnableRema === void 0 ? false : _ref$shouldEnableRema;
6479
6688
  var _useTafTranslation = useTafTranslation(),
6480
6689
  t = _useTafTranslation.t;
6481
6690
  var severity = isWarning(error) ? 'warning' : 'error';
@@ -6553,6 +6762,7 @@ var TafPanel = function TafPanel(_ref) {
6553
6762
  previousTaf: previousTaf,
6554
6763
  setIsDisabled: setIsFormDisabled,
6555
6764
  setIsIssuesPaneOpen: setIsIssuesPaneOpen,
6765
+ shouldEnableRemark: shouldEnableRemark,
6556
6766
  tafFromBackend: tafFromBackend
6557
6767
  })
6558
6768
  })]
@@ -6842,7 +7052,7 @@ var TafLayout = function TafLayout(_ref) {
6842
7052
  // eslint-disable-next-line react-hooks/exhaustive-deps
6843
7053
  }, [tafList, setLocations]);
6844
7054
  React.useEffect(function () {
6845
- var cancelErrorTimeout = error && error.type === 'CANCELLED' ? setTimeout(function () {
7055
+ var cancelErrorTimeout = (error == null ? void 0 : error.type) === 'CANCELLED' ? setTimeout(function () {
6846
7056
  setError(null);
6847
7057
  }, 10000) : null;
6848
7058
  return function () {
@@ -6957,6 +7167,7 @@ var TafLayout = function TafLayout(_ref) {
6957
7167
  previousTaf: getPreviousTaf(tafList, tafFromBackend),
6958
7168
  setIsFormDisabled: setIsFormDisabled,
6959
7169
  setIsIssuesPaneOpen: onToggleIssuesPane,
7170
+ shouldEnableRemark: tafConfig == null ? void 0 : tafConfig.shouldEnableRemark,
6960
7171
  tafAction: tafAction,
6961
7172
  tafFromBackend: tafFromBackend
6962
7173
  }, tafFromBackend.taf.uuid);
@@ -7028,6 +7239,7 @@ var TafWrapper = function TafWrapper(_ref) {
7028
7239
  uuid: '',
7029
7240
  issueDate: '',
7030
7241
  status: '',
7242
+ type: 'TAF',
7031
7243
  IS_DRAFT: false
7032
7244
  }
7033
7245
  },
@@ -7037,15 +7249,16 @@ var TafWrapper = function TafWrapper(_ref) {
7037
7249
  });
7038
7250
  };
7039
7251
 
7040
- var _excluded = ["isAutoTafEnabled"];
7252
+ var _excluded = ["isAutoTafEnabled", "type"];
7041
7253
  var TafModule = function TafModule(_ref) {
7042
- var isAutoTafEnabled = _ref.isAutoTafEnabled;
7254
+ var isAutoTafEnabled = _ref.isAutoTafEnabled,
7255
+ type = _ref.type;
7043
7256
  var _useTafTranslation = useTafTranslation(),
7044
7257
  t = _useTafTranslation.t;
7045
7258
  var _useState = useState(null),
7046
7259
  errorMessage = _useState[0],
7047
7260
  setErrorMessage = _useState[1];
7048
- var _useTafList = useTafList(),
7261
+ var _useTafList = useTafList(type),
7049
7262
  isFetching = _useTafList.isFetching,
7050
7263
  tafListError = _useTafList.error,
7051
7264
  tafList = _useTafList.data,
@@ -7114,11 +7327,15 @@ var TafModule = function TafModule(_ref) {
7114
7327
  var Wrapper = function Wrapper(_ref3) {
7115
7328
  var _ref3$isAutoTafEnable = _ref3.isAutoTafEnabled,
7116
7329
  isAutoTafEnabled = _ref3$isAutoTafEnable === void 0 ? false : _ref3$isAutoTafEnable,
7330
+ _ref3$type = _ref3.type,
7331
+ type = _ref3$type === void 0 ? 'TAF' : _ref3$type,
7117
7332
  props = _objectWithoutPropertiesLoose(_ref3, _excluded);
7118
7333
  return jsx(TafWrapper, Object.assign({}, props, {
7119
7334
  children: jsx(TafConfigWrapper, {
7335
+ type: type,
7120
7336
  children: jsx(TafModule, {
7121
- isAutoTafEnabled: isAutoTafEnabled
7337
+ isAutoTafEnabled: isAutoTafEnabled,
7338
+ type: type
7122
7339
  })
7123
7340
  })
7124
7341
  }));
@@ -7147,7 +7364,8 @@ var TafApiWrapper = function TafApiWrapper(_ref) {
7147
7364
  return config ? jsx(ErrorBoundary, {
7148
7365
  children: jsx(Wrapper, {
7149
7366
  isAutoTafEnabled: initialProps == null ? void 0 : initialProps.isAutoTafEnabled,
7150
- onPreventCloseView: onPreventCloseView
7367
+ onPreventCloseView: onPreventCloseView,
7368
+ type: initialProps == null ? void 0 : initialProps.type
7151
7369
  })
7152
7370
  }) : null;
7153
7371
  };
@@ -7191,9 +7409,94 @@ ConnectedModuleWrapper) {
7191
7409
  }
7192
7410
  };
7193
7411
 
7412
+ var fakeTafConfig = {
7413
+ type: 'TAF',
7414
+ location_indicator_mwo: 'EHDB',
7415
+ locations: {
7416
+ EHAM: {
7417
+ validity_duration: 30,
7418
+ activity_period: 6,
7419
+ label: 'Schiphol'
7420
+ },
7421
+ EHRD: {
7422
+ validity_duration: 30,
7423
+ activity_period: 6,
7424
+ label: 'Rotterdam'
7425
+ },
7426
+ EHGG: {
7427
+ validity_duration: 30,
7428
+ activity_period: 6,
7429
+ label: 'Eelde'
7430
+ },
7431
+ EHBK: {
7432
+ validity_duration: 30,
7433
+ activity_period: 6,
7434
+ label: 'Maastricht'
7435
+ },
7436
+ EHLE: {
7437
+ validity_duration: 30,
7438
+ activity_period: 6,
7439
+ label: 'Lelystad'
7440
+ },
7441
+ TNCB: {
7442
+ validity_duration: 30,
7443
+ activity_period: 6,
7444
+ label: 'Bonaire'
7445
+ },
7446
+ EHAK: {
7447
+ validity_duration: 30,
7448
+ activity_period: 6,
7449
+ label: 'Akureyri'
7450
+ },
7451
+ EHFD: {
7452
+ validity_duration: 30,
7453
+ activity_period: 6,
7454
+ label: 'Farnborough'
7455
+ },
7456
+ EHDV: {
7457
+ validity_duration: 30,
7458
+ activity_period: 6,
7459
+ label: 'De Vries'
7460
+ },
7461
+ EHHW: {
7462
+ validity_duration: 30,
7463
+ activity_period: 6,
7464
+ label: 'Holland'
7465
+ },
7466
+ EHKV: {
7467
+ validity_duration: 30,
7468
+ activity_period: 6,
7469
+ label: 'Kavala'
7470
+ },
7471
+ EHMG: {
7472
+ validity_duration: 30,
7473
+ activity_period: 6,
7474
+ label: 'München'
7475
+ },
7476
+ EHMA: {
7477
+ validity_duration: 30,
7478
+ activity_period: 6,
7479
+ label: 'Maastricht'
7480
+ },
7481
+ EHPG: {
7482
+ validity_duration: 30,
7483
+ activity_period: 6,
7484
+ label: 'Petersburg'
7485
+ },
7486
+ EHQN: {
7487
+ validity_duration: 30,
7488
+ activity_period: 6,
7489
+ label: 'Queenstown'
7490
+ }
7491
+ },
7492
+ locationOrder: ['EHAM', 'EHRD', 'EHLE', 'EHGG', 'EHBK', 'TNCB', 'EHAK', 'EHFD', 'EHDV', 'EHHW', 'EHKV', 'EHMG', 'EHMA', 'EHPG', 'EHQN'],
7493
+ autoTAFlocations: ['EHAM', 'EHRD', 'EHLE', 'EHGG', 'EHBK'],
7494
+ shouldEnableRemark: false
7495
+ };
7496
+
7194
7497
  // Used to mimic an authenticated user
7195
- var MOCK_USERNAME = 'user.name';
7196
- var currentDate = dateUtils.dateToString(dateUtils.utc(), dateUtils.DATE_FORMAT_YEAR);
7498
+ var MOCK_USERNAME$1 = 'user.name';
7499
+ var currentDate$1 = dateUtils.dateToString(dateUtils.utc(), dateUtils.DATE_FORMAT_YEAR);
7197
7500
  var tomorrowDate = dateUtils.dateToString(dateUtils.add(dateUtils.utc(), {
7198
7501
  days: 1
7199
7502
  }), dateUtils.DATE_FORMAT_YEAR);
@@ -7212,7 +7515,7 @@ var validDateRange = function validDateRange(refHour, period) {
7212
7515
  });
7213
7516
  return [dateUtils.dateToString(start, dateUtils.DATE_FORMAT_UTC, false), dateUtils.dateToString(end, dateUtils.DATE_FORMAT_UTC, false)];
7214
7517
  };
7215
- var dateAdd = function dateAdd(refDateAsString, hours) {
7518
+ var dateAdd$1 = function dateAdd(refDateAsString, hours) {
7216
7519
  var newDate = dateUtils.add(dateUtils.utc(refDateAsString), {
7217
7520
  hours: hours
7218
7521
  });
@@ -7235,7 +7538,7 @@ var _validDateRange3 = validDateRange(dateUtils.sub(dateUtils.utc(), {
7235
7538
  var fakeTafList = [{
7236
7539
  creationDate: upcomingValidDateStart,
7237
7540
  canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
7238
- editor: MOCK_USERNAME,
7541
+ editor: MOCK_USERNAME$1,
7239
7542
  taf: {
7240
7543
  uuid: '5f9583fjdf0f337925',
7241
7544
  baseTime: upcomingValidDateStart,
@@ -7319,8 +7622,8 @@ var fakeTafList = [{
7319
7622
  change: 'TEMPO',
7320
7623
  probability: 'PROB30',
7321
7624
  valid: {
7322
- start: dateAdd(upcomingValidDateStart, 3),
7323
- end: dateAdd(upcomingValidDateStart, 4)
7625
+ start: dateAdd$1(upcomingValidDateStart, 3),
7626
+ end: dateAdd$1(upcomingValidDateStart, 4)
7324
7627
  },
7325
7628
  visibility: {
7326
7629
  range: 100,
@@ -7336,12 +7639,12 @@ var fakeTafList = [{
7336
7639
  }, {
7337
7640
  creationDate: upcomingValidDateStart,
7338
7641
  canbe: ['CANCELLED', 'AMENDED', 'CORRECTED'],
7339
- editor: MOCK_USERNAME,
7642
+ editor: MOCK_USERNAME$1,
7340
7643
  taf: {
7341
7644
  uuid: '43545345345',
7342
7645
  issueDate: upcomingValidDateStart,
7343
- baseTime: currentDate + "T18:00:00Z",
7344
- validDateStart: currentDate + "T18:00:00Z",
7646
+ baseTime: currentDate$1 + "T18:00:00Z",
7647
+ validDateStart: currentDate$1 + "T18:00:00Z",
7345
7648
  validDateEnd: upcomingValidDateEnd,
7346
7649
  previousId: 'jkdjkdfjkgdf',
7347
7650
  previousValidDateStart: upcomingValidDateStart,
@@ -7365,8 +7668,8 @@ var fakeTafList = [{
7365
7668
  changeGroups: [{
7366
7669
  change: 'BECMG',
7367
7670
  valid: {
7368
- start: dateAdd(upcomingValidDateStart, 1),
7369
- end: dateAdd(upcomingValidDateStart, 2)
7671
+ start: dateAdd$1(upcomingValidDateStart, 1),
7672
+ end: dateAdd$1(upcomingValidDateStart, 2)
7370
7673
  },
7371
7674
  visibility: {
7372
7675
  range: 1000,
@@ -7381,7 +7684,7 @@ var fakeTafList = [{
7381
7684
  }, {
7382
7685
  change: 'FM',
7383
7686
  valid: {
7384
- start: dateAdd(upcomingValidDateStart, 2)
7687
+ start: dateAdd$1(upcomingValidDateStart, 2)
7385
7688
  },
7386
7689
  visibility: {
7387
7690
  range: 6000,
@@ -7444,8 +7747,8 @@ var fakeTafList = [{
7444
7747
  change: 'TEMPO',
7445
7748
  probability: 'PROB30',
7446
7749
  valid: {
7447
- start: dateAdd(upcomingValidDateStart, 1),
7448
- end: dateAdd(upcomingValidDateStart, 2)
7750
+ start: dateAdd$1(upcomingValidDateStart, 1),
7751
+ end: dateAdd$1(upcomingValidDateStart, 2)
7449
7752
  },
7450
7753
  visibility: {
7451
7754
  range: 200,
@@ -7506,7 +7809,7 @@ var fakeTafList = [{
7506
7809
  taf: {
7507
7810
  uuid: 'gh56734fghfgh',
7508
7811
  previousId: '8574jnf93475',
7509
- issueDate: currentDate + "T16:16:00Z",
7812
+ issueDate: currentDate$1 + "T16:16:00Z",
7510
7813
  baseTime: upcomingValidDateStart,
7511
7814
  validDateStart: upcomingValidDateStart,
7512
7815
  validDateEnd: upcomingValidDateEnd,
@@ -7517,7 +7820,7 @@ var fakeTafList = [{
7517
7820
  messageType: 'AMD',
7518
7821
  baseForecast: {
7519
7822
  valid: {
7520
- start: currentDate + "T16:12:00Z",
7823
+ start: currentDate$1 + "T16:12:00Z",
7521
7824
  end: upcomingValidDateEnd
7522
7825
  },
7523
7826
  visibility: {
@@ -7619,7 +7922,7 @@ var fakeTafList = [{
7619
7922
  }
7620
7923
  }
7621
7924
  }, {
7622
- creationDate: currentDate + "T06:00:00Z",
7925
+ creationDate: currentDate$1 + "T06:00:00Z",
7623
7926
  canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
7624
7927
  editor: null,
7625
7928
  taf: {
@@ -7639,7 +7942,7 @@ var fakeTafList = [{
7639
7942
  }
7640
7943
  }
7641
7944
  }, {
7642
- creationDate: currentDate + "T06:00:00Z",
7945
+ creationDate: currentDate$1 + "T06:00:00Z",
7643
7946
  canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
7644
7947
  editor: null,
7645
7948
  taf: {
@@ -7659,7 +7962,7 @@ var fakeTafList = [{
7659
7962
  }
7660
7963
  }
7661
7964
  }, {
7662
- creationDate: currentDate + "T06:00:00Z",
7965
+ creationDate: currentDate$1 + "T06:00:00Z",
7663
7966
  canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
7664
7967
  editor: null,
7665
7968
  taf: {
@@ -7706,8 +8009,8 @@ var fakeTafList = [{
7706
8009
  changeGroups: [{
7707
8010
  change: 'BECMG',
7708
8011
  valid: {
7709
- start: dateAdd(expiredValidDateStart, 1),
7710
- end: dateAdd(expiredValidDateStart, 4)
8012
+ start: dateAdd$1(expiredValidDateStart, 1),
8013
+ end: dateAdd$1(expiredValidDateStart, 4)
7711
8014
  },
7712
8015
  visibility: {
7713
8016
  range: 1000,
@@ -7719,7 +8022,7 @@ var fakeTafList = [{
7719
8022
  }, {
7720
8023
  change: 'FM',
7721
8024
  valid: {
7722
- start: dateAdd(expiredValidDateStart, 5)
8025
+ start: dateAdd$1(expiredValidDateStart, 5)
7723
8026
  },
7724
8027
  visibility: {
7725
8028
  range: 6000,
@@ -7827,8 +8130,8 @@ var fakeTafList = [{
7827
8130
  change: 'TEMPO',
7828
8131
  probability: 'PROB30',
7829
8132
  valid: {
7830
- start: dateAdd(upcomingValidDateStart, 3),
7831
- end: dateAdd(upcomingValidDateStart, 4)
8133
+ start: dateAdd$1(upcomingValidDateStart, 3),
8134
+ end: dateAdd$1(upcomingValidDateStart, 4)
7832
8135
  },
7833
8136
  visibility: {
7834
8137
  range: 100,
@@ -7848,8 +8151,8 @@ var fakeTafList = [{
7848
8151
  taf: {
7849
8152
  uuid: '4354545345345',
7850
8153
  issueDate: upcomingValidDateStart,
7851
- baseTime: currentDate + "T18:00:00Z",
7852
- validDateStart: currentDate + "T18:00:00Z",
8154
+ baseTime: currentDate$1 + "T18:00:00Z",
8155
+ validDateStart: currentDate$1 + "T18:00:00Z",
7853
8156
  validDateEnd: upcomingValidDateEnd,
7854
8157
  location: 'EHLE',
7855
8158
  status: 'AUTO',
@@ -7870,8 +8173,8 @@ var fakeTafList = [{
7870
8173
  changeGroups: [{
7871
8174
  change: 'BECMG',
7872
8175
  valid: {
7873
- start: dateAdd(upcomingValidDateStart, 1),
7874
- end: dateAdd(upcomingValidDateStart, 2)
8176
+ start: dateAdd$1(upcomingValidDateStart, 1),
8177
+ end: dateAdd$1(upcomingValidDateStart, 2)
7875
8178
  },
7876
8179
  visibility: {
7877
8180
  range: 1000,
@@ -7886,7 +8189,7 @@ var fakeTafList = [{
7886
8189
  }, {
7887
8190
  change: 'FM',
7888
8191
  valid: {
7889
- start: dateAdd(upcomingValidDateStart, 2)
8192
+ start: dateAdd$1(upcomingValidDateStart, 2)
7890
8193
  },
7891
8194
  visibility: {
7892
8195
  range: 6000,
@@ -7949,8 +8252,8 @@ var fakeTafList = [{
7949
8252
  change: 'TEMPO',
7950
8253
  probability: 'PROB30',
7951
8254
  valid: {
7952
- start: dateAdd(upcomingValidDateStart, 1),
7953
- end: dateAdd(upcomingValidDateStart, 2)
8255
+ start: dateAdd$1(upcomingValidDateStart, 1),
8256
+ end: dateAdd$1(upcomingValidDateStart, 2)
7954
8257
  },
7955
8258
  visibility: {
7956
8259
  range: 200,
@@ -7969,13 +8272,13 @@ var fakeNewTaf = {
7969
8272
  messageType: 'ORG',
7970
8273
  status: 'NEW',
7971
8274
  uuid: '5f9583fjdf0445332f337925',
7972
- baseTime: currentDate + "T12:00:00Z",
7973
- validDateStart: currentDate + "T12:00:00Z",
8275
+ baseTime: currentDate$1 + "T12:00:00Z",
8276
+ validDateStart: currentDate$1 + "T12:00:00Z",
7974
8277
  validDateEnd: tomorrowDate + "T18:00:00Z",
7975
8278
  location: 'EHBK',
7976
8279
  baseForecast: {
7977
8280
  valid: {
7978
- start: currentDate + "T12:00:00Z",
8281
+ start: currentDate$1 + "T12:00:00Z",
7979
8282
  end: tomorrowDate + "T18:00:00Z"
7980
8283
  }
7981
8284
  }
@@ -7997,16 +8300,16 @@ var fakeNewTaf = {
7997
8300
  var fakePublishedTaf = {
7998
8301
  taf: {
7999
8302
  uuid: 'slsdkjg-023895',
8000
- issueDate: currentDate + "T12:00:00Z",
8001
- baseTime: currentDate + "T12:00:00Z",
8002
- validDateStart: currentDate + "T12:00:00Z",
8303
+ issueDate: currentDate$1 + "T12:00:00Z",
8304
+ baseTime: currentDate$1 + "T12:00:00Z",
8305
+ validDateStart: currentDate$1 + "T12:00:00Z",
8003
8306
  validDateEnd: tomorrowDate + "T18:00:00Z",
8004
8307
  location: 'EHLE',
8005
8308
  status: 'PUBLISHED',
8006
8309
  messageType: 'ORG',
8007
8310
  baseForecast: {
8008
8311
  valid: {
8009
- start: currentDate + "T12:00:00Z",
8312
+ start: currentDate$1 + "T12:00:00Z",
8010
8313
  end: tomorrowDate + "T18:00:00Z"
8011
8314
  },
8012
8315
  wind: {
@@ -8019,7 +8322,7 @@ var fakePublishedTaf = {
8019
8322
  changeGroups: [{
8020
8323
  change: 'FM',
8021
8324
  valid: {
8022
- start: currentDate + "T12:00:00Z"
8325
+ start: currentDate$1 + "T12:00:00Z"
8023
8326
  },
8024
8327
  visibility: {
8025
8328
  range: 6000,
@@ -8048,7 +8351,7 @@ var fakePublishedTaf = {
8048
8351
  }, {
8049
8352
  change: 'BECMG',
8050
8353
  valid: {
8051
- start: currentDate + "T23:00:00Z",
8354
+ start: currentDate$1 + "T23:00:00Z",
8052
8355
  end: tomorrowDate + "T01:00:00Z"
8053
8356
  },
8054
8357
  wind: {
@@ -8133,15 +8436,15 @@ var fakePublishedTaf = {
8133
8436
  var fakeDraftTaf = {
8134
8437
  taf: {
8135
8438
  uuid: '5f9583fjdf0f337925',
8136
- baseTime: currentDate + "T18:00:00Z",
8137
- validDateStart: currentDate + "T18:00:00Z",
8439
+ baseTime: currentDate$1 + "T18:00:00Z",
8440
+ validDateStart: currentDate$1 + "T18:00:00Z",
8138
8441
  validDateEnd: tomorrowDate + "T23:59:00Z",
8139
8442
  location: 'EHLE',
8140
8443
  status: 'DRAFT',
8141
8444
  messageType: 'ORG',
8142
8445
  baseForecast: {
8143
8446
  valid: {
8144
- start: currentDate + "T18:00:00Z",
8447
+ start: currentDate$1 + "T18:00:00Z",
8145
8448
  end: tomorrowDate + "T23:59:00Z"
8146
8449
  },
8147
8450
  wind: {
@@ -8182,17 +8485,17 @@ var fakeDraftAmendmentTaf = {
8182
8485
  taf: {
8183
8486
  uuid: '954905487',
8184
8487
  previousId: '5f9583fjdf45ff4330f337925',
8185
- baseTime: currentDate + "T12:00:00Z",
8186
- validDateStart: currentDate + "T14:00:00Z",
8488
+ baseTime: currentDate$1 + "T12:00:00Z",
8489
+ validDateStart: currentDate$1 + "T14:00:00Z",
8187
8490
  validDateEnd: tomorrowDate + "T18:00:00Z",
8188
- previousValidDateStart: currentDate + "T12:00:00Z",
8491
+ previousValidDateStart: currentDate$1 + "T12:00:00Z",
8189
8492
  previousValidDateEnd: tomorrowDate + "T18:00:00Z",
8190
8493
  location: 'EHAM',
8191
8494
  status: 'DRAFT_AMENDED',
8192
8495
  messageType: 'AMD',
8193
8496
  baseForecast: {
8194
8497
  valid: {
8195
- start: currentDate + "T14:00:00Z",
8498
+ start: currentDate$1 + "T14:00:00Z",
8196
8499
  end: tomorrowDate + "T18:00:00Z"
8197
8500
  },
8198
8501
  visibility: {
@@ -8218,8 +8521,8 @@ var fakeDraftAmendmentTaf = {
8218
8521
  change: 'TEMPO',
8219
8522
  probability: 'PROB30',
8220
8523
  valid: {
8221
- start: currentDate + "T15:00:00Z",
8222
- end: currentDate + "T16:00:00Z"
8524
+ start: currentDate$1 + "T15:00:00Z",
8525
+ end: currentDate$1 + "T16:00:00Z"
8223
8526
  },
8224
8527
  visibility: {
8225
8528
  range: 100,
@@ -8281,18 +8584,18 @@ var fakeAmendmentTaf = {
8281
8584
  taf: {
8282
8585
  uuid: '754905486',
8283
8586
  previousId: '5f9583fjdf45ff4330f337925',
8284
- issueDate: currentDate + "T14:00:00Z",
8285
- baseTime: currentDate + "T12:00:00Z",
8286
- validDateStart: currentDate + "T14:00:00Z",
8587
+ issueDate: currentDate$1 + "T14:00:00Z",
8588
+ baseTime: currentDate$1 + "T12:00:00Z",
8589
+ validDateStart: currentDate$1 + "T14:00:00Z",
8287
8590
  validDateEnd: tomorrowDate + "T18:00:00Z",
8288
- previousValidDateStart: currentDate + "T12:00:00Z",
8591
+ previousValidDateStart: currentDate$1 + "T12:00:00Z",
8289
8592
  previousValidDateEnd: tomorrowDate + "T18:00:00Z",
8290
8593
  location: 'EHAM',
8291
8594
  status: 'AMENDED',
8292
8595
  messageType: 'AMD',
8293
8596
  baseForecast: {
8294
8597
  valid: {
8295
- start: currentDate + "T14:00:00Z",
8598
+ start: currentDate$1 + "T14:00:00Z",
8296
8599
  end: tomorrowDate + "T18:00:00Z"
8297
8600
  },
8298
8601
  visibility: {
@@ -8335,13 +8638,630 @@ var fakeAmendmentTaf = {
8335
8638
  })
8336
8639
  });
8337
8640
 
8641
+ var fakeNafConfig = {
8642
+ type: 'NAF',
8643
+ location_indicator_mwo: 'EHAK',
8644
+ locations: {
8645
+ EHAK: {
8646
+ valid_durations: [9, 9, 9, 6],
8647
+ valid_start_times: [5, 8, 11, 14],
8648
+ label: 'A12-CPP'
8649
+ },
8650
+ EHFD: {
8651
+ valid_durations: [9, 9, 9, 6],
8652
+ valid_start_times: [5, 8, 11, 14],
8653
+ label: 'F3-FB-1'
8654
+ },
8655
+ EHDV: {
8656
+ valid_durations: [9, 9, 9, 6],
8657
+ valid_start_times: [5, 8, 11, 14],
8658
+ label: 'D15-FA-1'
8659
+ },
8660
+ EHHW: {
8661
+ valid_durations: [9, 9, 9, 6],
8662
+ valid_start_times: [5, 8, 11, 14],
8663
+ label: 'BG-OHVS2'
8664
+ },
8665
+ EHKV: {
8666
+ valid_durations: [9, 9, 9, 6],
8667
+ valid_start_times: [5, 8, 11, 14],
8668
+ label: 'K14-FA-1C'
8669
+ },
8670
+ EHMG: {
8671
+ valid_durations: [9, 9, 9, 6],
8672
+ valid_start_times: [5, 8, 11, 14],
8673
+ label: 'L9-FF-1'
8674
+ },
8675
+ EHMA: {
8676
+ valid_durations: [9, 9, 9, 6],
8677
+ valid_start_times: [5, 8, 11, 14],
8678
+ label: 'AWG-1'
8679
+ },
8680
+ EHQN: {
8681
+ valid_durations: [9, 9, 9, 6],
8682
+ valid_start_times: [5, 8, 11, 14],
8683
+ label: 'HKN'
8684
+ },
8685
+ EHPG: {
8686
+ valid_durations: [9, 9, 9, 6],
8687
+ valid_start_times: [5, 8, 11, 14],
8688
+ label: 'P11-B'
8689
+ }
8690
+ },
8691
+ locationOrder: ['EHAK', 'EHFD', 'EHDV', 'EHHW', 'EHKV', 'EHMG', 'EHMA', 'EHQN', 'EHPG'],
8692
+ autoTAFlocations: ['EHAK', 'EHFD', 'EHDV', 'EHHW', 'EHKV', 'EHMG', 'EHMA', 'EHQN', 'EHPG'],
8693
+ shouldEnableRemark: true
8694
+ };
8695
+
8696
+ /* *
8697
+ * Licensed under the Apache License, Version 2.0 (the "License");
8698
+ * you may not use this file except in compliance with the License.
8699
+ * You may obtain a copy of the License at
8700
+ *
8701
+ * http://www.apache.org/licenses/LICENSE-2.0
8702
+ *
8703
+ * Unless required by applicable law or agreed to in writing, software
8704
+ * distributed under the License is distributed on an "AS IS" BASIS,
8705
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8706
+ * See the License for the specific language governing permissions and
8707
+ * limitations under the License.
8708
+ *
8709
+ * Copyright 2026 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
8710
+ * Copyright 2026 - Finnish Meteorological Institute (FMI)
8711
+ * Copyright 2026 - The Norwegian Meteorological Institute (MET Norway)
8712
+ * */
8713
+ // Used to mimic an authenticated user
8714
+ var MOCK_USERNAME = 'user.name';
8715
+ var now = dateUtils.utc();
8716
+ var currentDate = dateUtils.dateToString(dateUtils.utc(), dateUtils.DATE_FORMAT_YEAR);
8717
+ var dateAdd = function dateAdd(refDateAsString, hours) {
8718
+ var newDate = dateUtils.add(dateUtils.utc(refDateAsString), {
8719
+ hours: hours
8720
+ });
8721
+ var formattedDate = dateUtils.dateToString(newDate, dateUtils.DATE_FORMAT_UTC);
8722
+ return formattedDate;
8723
+ };
8724
+ function getDateRange(locationConfig, index, addDays) {
8725
+ if (addDays === void 0) {
8726
+ addDays = 0;
8727
+ }
8728
+ var baseDate = dateUtils.add(now, {
8729
+ days: addDays
8730
+ });
8731
+ var start = dateUtils.set(baseDate, {
8732
+ hours: locationConfig.valid_start_times[index],
8733
+ minutes: 0,
8734
+ seconds: 0
8735
+ }, true);
8736
+ var end = dateUtils.add(start, {
8737
+ hours: locationConfig.valid_durations[index]
8738
+ });
8739
+ return [dateUtils.dateToString(start, dateUtils.DATE_FORMAT_UTC, false), dateUtils.dateToString(end, dateUtils.DATE_FORMAT_UTC, false)];
8740
+ }
8741
+ function withLocationDates(location, cb) {
8742
+ var locationConfig = fakeNafConfig.locations[location];
8743
+ var currentIndex = locationConfig.valid_start_times.findLastIndex(function (startTime) {
8744
+ return now.getUTCHours() >= startTime;
8745
+ });
8746
+ var currentIsYesterday = currentIndex === -1;
8747
+ if (currentIsYesterday) {
8748
+ currentIndex = locationConfig.valid_start_times.length - 1;
8749
+ }
8750
+ var upcomingIndex = (currentIndex + 1) % locationConfig.valid_start_times.length;
8751
+ // If upcoming start time is earlier than or equal to current start time, we've wrapped to the next day
8752
+ var upcomingWrapsToNextDay = locationConfig.valid_start_times[upcomingIndex] <= locationConfig.valid_start_times[currentIndex];
8753
+ var _getDateRange = getDateRange(locationConfig, currentIndex, currentIsYesterday ? -1 : 0),
8754
+ currentValidDateStart = _getDateRange[0],
8755
+ currentValidDateEnd = _getDateRange[1];
8756
+ var _getDateRange2 = getDateRange(locationConfig, upcomingIndex, upcomingWrapsToNextDay ? 1 : 0),
8757
+ upcomingValidDateStart = _getDateRange2[0],
8758
+ upcomingValidDateEnd = _getDateRange2[1];
8759
+ return cb({
8760
+ currentValidDateStart: currentValidDateStart,
8761
+ currentValidDateEnd: currentValidDateEnd,
8762
+ upcomingValidDateStart: upcomingValidDateStart,
8763
+ upcomingValidDateEnd: upcomingValidDateEnd
8764
+ });
8765
+ }
8766
+ var fakeNafList = [withLocationDates('EHAK', function (_ref) {
8767
+ var upcomingValidDateStart = _ref.upcomingValidDateStart,
8768
+ upcomingValidDateEnd = _ref.upcomingValidDateEnd;
8769
+ return {
8770
+ creationDate: upcomingValidDateStart,
8771
+ canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
8772
+ editor: MOCK_USERNAME,
8773
+ taf: {
8774
+ uuid: '5f9583fjdf0f337925',
8775
+ type: 'NAF',
8776
+ baseTime: upcomingValidDateStart,
8777
+ validDateStart: upcomingValidDateStart,
8778
+ validDateEnd: upcomingValidDateEnd,
8779
+ location: 'EHAK',
8780
+ status: 'NEW',
8781
+ messageType: 'ORG',
8782
+ baseForecast: {
8783
+ valid: {
8784
+ start: upcomingValidDateStart,
8785
+ end: upcomingValidDateEnd
8786
+ }
8787
+ },
8788
+ remark: 'THIS IS A REMARK'
8789
+ }
8790
+ };
8791
+ }), withLocationDates('EHFD', function (_ref2) {
8792
+ var upcomingValidDateStart = _ref2.upcomingValidDateStart,
8793
+ upcomingValidDateEnd = _ref2.upcomingValidDateEnd;
8794
+ return {
8795
+ creationDate: upcomingValidDateStart,
8796
+ canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
8797
+ editor: null,
8798
+ taf: {
8799
+ uuid: '5f9583fjd111137925',
8800
+ type: 'NAF',
8801
+ baseTime: upcomingValidDateStart,
8802
+ validDateStart: upcomingValidDateStart,
8803
+ validDateEnd: upcomingValidDateEnd,
8804
+ location: 'EHFD',
8805
+ status: 'DRAFT',
8806
+ messageType: 'ORG',
8807
+ baseForecast: {
8808
+ valid: {
8809
+ start: upcomingValidDateStart,
8810
+ end: upcomingValidDateEnd
8811
+ },
8812
+ wind: {
8813
+ direction: 180,
8814
+ speed: 10,
8815
+ unit: 'KT'
8816
+ },
8817
+ cavOK: true
8818
+ }
8819
+ }
8820
+ };
8821
+ }), withLocationDates('EHKV', function (_ref3) {
8822
+ var upcomingValidDateStart = _ref3.upcomingValidDateStart,
8823
+ upcomingValidDateEnd = _ref3.upcomingValidDateEnd;
8824
+ return {
8825
+ creationDate: upcomingValidDateStart,
8826
+ canbe: ['CANCELLED', 'AMENDED', 'DISCARDED'],
8827
+ editor: null,
8828
+ taf: {
8829
+ uuid: '754905485',
8830
+ type: 'NAF',
8831
+ baseTime: upcomingValidDateStart,
8832
+ previousId: '5f9583fjdf45ff4330f337925',
8833
+ validDateStart: upcomingValidDateStart,
8834
+ validDateEnd: upcomingValidDateEnd,
8835
+ previousValidDateStart: upcomingValidDateStart,
8836
+ previousValidDateEnd: upcomingValidDateEnd,
8837
+ location: 'EHKV',
8838
+ status: 'DRAFT_AMENDED',
8839
+ messageType: 'AMD',
8840
+ baseForecast: {
8841
+ valid: {
8842
+ start: upcomingValidDateStart,
8843
+ end: upcomingValidDateEnd
8844
+ },
8845
+ visibility: {
8846
+ range: 600,
8847
+ unit: 'M'
8848
+ },
8849
+ wind: {
8850
+ direction: 180,
8851
+ speed: 10,
8852
+ unit: 'KT'
8853
+ },
8854
+ weather: {
8855
+ weather1: 'SN'
8856
+ },
8857
+ cloud: {
8858
+ cloud1: {
8859
+ coverage: 'BKN',
8860
+ height: 35
8861
+ }
8862
+ }
8863
+ },
8864
+ changeGroups: [{
8865
+ change: 'TEMPO',
8866
+ probability: 'PROB30',
8867
+ valid: {
8868
+ start: dateAdd(upcomingValidDateStart, 3),
8869
+ end: dateAdd(upcomingValidDateStart, 4)
8870
+ },
8871
+ visibility: {
8872
+ range: 100,
8873
+ unit: 'M'
8874
+ },
8875
+ cloud: {
8876
+ cloud1: {
8877
+ verticalVisibility: 5
8878
+ }
8879
+ }
8880
+ }]
8881
+ }
8882
+ };
8883
+ }), withLocationDates('EHKV', function (_ref4) {
8884
+ var upcomingValidDateStart = _ref4.upcomingValidDateStart,
8885
+ upcomingValidDateEnd = _ref4.upcomingValidDateEnd;
8886
+ return {
8887
+ creationDate: upcomingValidDateStart,
8888
+ canbe: ['CANCELLED', 'AMENDED', 'CORRECTED'],
8889
+ editor: MOCK_USERNAME,
8890
+ taf: {
8891
+ uuid: '43545345345',
8892
+ type: 'NAF',
8893
+ issueDate: upcomingValidDateStart,
8894
+ baseTime: currentDate + "T18:00:00Z",
8895
+ validDateStart: currentDate + "T18:00:00Z",
8896
+ validDateEnd: upcomingValidDateEnd,
8897
+ previousId: 'jkdjkdfjkgdf',
8898
+ previousValidDateStart: upcomingValidDateStart,
8899
+ previousValidDateEnd: upcomingValidDateEnd,
8900
+ location: 'EHKV',
8901
+ status: 'CORRECTED',
8902
+ messageType: 'COR',
8903
+ baseForecast: {
8904
+ valid: {
8905
+ start: upcomingValidDateStart,
8906
+ end: upcomingValidDateEnd
8907
+ },
8908
+ wind: {
8909
+ direction: 350,
8910
+ speed: 46,
8911
+ gust: 67,
8912
+ unit: 'KT'
8913
+ },
8914
+ cavOK: true
8915
+ },
8916
+ changeGroups: [{
8917
+ change: 'BECMG',
8918
+ valid: {
8919
+ start: dateAdd(upcomingValidDateStart, 1),
8920
+ end: dateAdd(upcomingValidDateStart, 2)
8921
+ },
8922
+ visibility: {
8923
+ range: 1000,
8924
+ unit: 'M'
8925
+ },
8926
+ weather: {
8927
+ weather1: 'MIFG'
8928
+ },
8929
+ cloud: {
8930
+ cloud1: 'NSC'
8931
+ }
8932
+ }, {
8933
+ change: 'FM',
8934
+ valid: {
8935
+ start: dateAdd(upcomingValidDateStart, 2)
8936
+ },
8937
+ visibility: {
8938
+ range: 6000,
8939
+ unit: 'M'
8940
+ },
8941
+ weather: {
8942
+ weather1: '+SHRA'
8943
+ },
8944
+ cloud: {
8945
+ cloud1: {
8946
+ coverage: 'BKN',
8947
+ height: 40
8948
+ },
8949
+ cloud2: {
8950
+ coverage: 'OVC',
8951
+ height: 60,
8952
+ type: 'CB'
8953
+ }
8954
+ }
8955
+ }]
8956
+ }
8957
+ };
8958
+ }), withLocationDates('EHFD', function (_ref5) {
8959
+ var upcomingValidDateStart = _ref5.upcomingValidDateStart,
8960
+ upcomingValidDateEnd = _ref5.upcomingValidDateEnd;
8961
+ return {
8962
+ creationDate: upcomingValidDateStart,
8963
+ canbe: ['CANCELLED', 'AMENDED', 'CORRECTED'],
8964
+ editor: null,
8965
+ taf: {
8966
+ uuid: '5f9583fjdf45ff4330f337925',
8967
+ type: 'NAF',
8968
+ issueDate: upcomingValidDateStart,
8969
+ baseTime: upcomingValidDateStart,
8970
+ validDateStart: upcomingValidDateStart,
8971
+ validDateEnd: upcomingValidDateEnd,
8972
+ location: 'EHFD',
8973
+ status: 'PUBLISHED',
8974
+ messageType: 'ORG',
8975
+ baseForecast: {
8976
+ valid: {
8977
+ start: upcomingValidDateStart,
8978
+ end: upcomingValidDateEnd
8979
+ },
8980
+ visibility: {
8981
+ range: 600,
8982
+ unit: 'M'
8983
+ },
8984
+ wind: {
8985
+ direction: 180,
8986
+ speed: 10,
8987
+ unit: 'KT'
8988
+ },
8989
+ weather: {
8990
+ weather1: 'SN'
8991
+ },
8992
+ cloud: {
8993
+ cloud1: {
8994
+ coverage: 'BKN',
8995
+ height: 35
8996
+ }
8997
+ }
8998
+ },
8999
+ changeGroups: [{
9000
+ change: 'TEMPO',
9001
+ probability: 'PROB30',
9002
+ valid: {
9003
+ start: dateAdd(upcomingValidDateStart, 1),
9004
+ end: dateAdd(upcomingValidDateStart, 2)
9005
+ },
9006
+ visibility: {
9007
+ range: 200,
9008
+ unit: 'M'
9009
+ },
9010
+ cloud: {
9011
+ cloud1: {
9012
+ verticalVisibility: 5
9013
+ }
9014
+ }
9015
+ }]
9016
+ }
9017
+ };
9018
+ }), withLocationDates('EHHW', function (_ref6) {
9019
+ var upcomingValidDateStart = _ref6.upcomingValidDateStart,
9020
+ upcomingValidDateEnd = _ref6.upcomingValidDateEnd;
9021
+ return {
9022
+ creationDate: upcomingValidDateStart,
9023
+ canbe: ['AMENDED'],
9024
+ editor: null,
9025
+ taf: {
9026
+ uuid: '5464565464',
9027
+ type: 'NAF',
9028
+ previousId: '5445fghrfg3546456',
9029
+ issueDate: upcomingValidDateStart,
9030
+ baseTime: upcomingValidDateStart,
9031
+ validDateStart: upcomingValidDateStart,
9032
+ validDateEnd: upcomingValidDateEnd,
9033
+ previousValidDateStart: upcomingValidDateStart,
9034
+ previousValidDateEnd: upcomingValidDateEnd,
9035
+ location: 'EHHW',
9036
+ status: 'CANCELLED',
9037
+ messageType: 'CNL',
9038
+ baseForecast: {
9039
+ valid: {
9040
+ start: upcomingValidDateStart,
9041
+ end: upcomingValidDateEnd
9042
+ },
9043
+ visibility: {
9044
+ range: 600,
9045
+ unit: 'M'
9046
+ },
9047
+ wind: {
9048
+ direction: 180,
9049
+ speed: 10,
9050
+ unit: 'KT'
9051
+ },
9052
+ weather: {
9053
+ weather1: 'SN'
9054
+ },
9055
+ cloud: {
9056
+ cloud1: {
9057
+ coverage: 'BKN',
9058
+ height: 35
9059
+ }
9060
+ }
9061
+ }
9062
+ }
9063
+ };
9064
+ }), withLocationDates('EHMA', function (_ref7) {
9065
+ var upcomingValidDateStart = _ref7.upcomingValidDateStart,
9066
+ upcomingValidDateEnd = _ref7.upcomingValidDateEnd;
9067
+ return {
9068
+ creationDate: upcomingValidDateStart,
9069
+ canbe: ['CANCELLED', 'AMENDED', 'CORRECTED'],
9070
+ editor: 'max.jansen',
9071
+ taf: {
9072
+ uuid: 'gh56734fghfgh',
9073
+ type: 'NAF',
9074
+ previousId: '8574jnf93475',
9075
+ issueDate: currentDate + "T16:16:00Z",
9076
+ baseTime: upcomingValidDateStart,
9077
+ validDateStart: upcomingValidDateStart,
9078
+ validDateEnd: upcomingValidDateEnd,
9079
+ previousValidDateStart: upcomingValidDateStart,
9080
+ previousValidDateEnd: upcomingValidDateEnd,
9081
+ location: 'EHMA',
9082
+ status: 'AMENDED',
9083
+ messageType: 'AMD',
9084
+ baseForecast: {
9085
+ valid: {
9086
+ start: currentDate + "T16:12:00Z",
9087
+ end: upcomingValidDateEnd
9088
+ },
9089
+ visibility: {
9090
+ range: 600,
9091
+ unit: 'M'
9092
+ },
9093
+ wind: {
9094
+ direction: 180,
9095
+ speed: 10,
9096
+ unit: 'KT'
9097
+ },
9098
+ weather: {
9099
+ weather1: 'SN'
9100
+ },
9101
+ cloud: {
9102
+ cloud1: {
9103
+ coverage: 'BKN',
9104
+ height: 35
9105
+ }
9106
+ }
9107
+ }
9108
+ }
9109
+ };
9110
+ }), withLocationDates('EHQN', function (_ref8) {
9111
+ var currentValidDateStart = _ref8.currentValidDateStart,
9112
+ currentValidDateEnd = _ref8.currentValidDateEnd;
9113
+ return {
9114
+ creationDate: currentValidDateStart,
9115
+ canbe: ['CANCELLED', 'AMENDED', 'CORRECTED'],
9116
+ editor: null,
9117
+ taf: {
9118
+ uuid: 'giskdj09845872039',
9119
+ type: 'NAF',
9120
+ issueDate: currentValidDateStart,
9121
+ baseTime: currentValidDateStart,
9122
+ validDateStart: currentValidDateStart,
9123
+ validDateEnd: currentValidDateEnd,
9124
+ location: 'EHQN',
9125
+ status: 'PUBLISHED',
9126
+ messageType: 'ORG',
9127
+ baseForecast: {
9128
+ valid: {
9129
+ start: currentValidDateStart,
9130
+ end: currentValidDateEnd
9131
+ },
9132
+ visibility: {
9133
+ range: 500,
9134
+ unit: 'M'
9135
+ },
9136
+ wind: {
9137
+ direction: 200,
9138
+ speed: 20,
9139
+ gust: 35,
9140
+ unit: 'KT'
9141
+ },
9142
+ weather: {
9143
+ weather1: 'SN'
9144
+ },
9145
+ cloud: {
9146
+ cloud1: {
9147
+ coverage: 'BKN',
9148
+ height: 40
9149
+ }
9150
+ }
9151
+ }
9152
+ }
9153
+ };
9154
+ }), withLocationDates('EHPG', function (_ref9) {
9155
+ var currentValidDateStart = _ref9.currentValidDateStart,
9156
+ currentValidDateEnd = _ref9.currentValidDateEnd;
9157
+ return {
9158
+ creationDate: currentValidDateStart,
9159
+ canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
9160
+ editor: null,
9161
+ taf: {
9162
+ uuid: 'ghskdj09845872039',
9163
+ type: 'NAF',
9164
+ baseTime: currentValidDateStart,
9165
+ validDateStart: currentValidDateStart,
9166
+ validDateEnd: currentValidDateEnd,
9167
+ location: 'EHPG',
9168
+ status: 'NEW',
9169
+ messageType: 'ORG',
9170
+ baseForecast: {
9171
+ valid: {
9172
+ start: currentValidDateStart,
9173
+ end: currentValidDateEnd
9174
+ }
9175
+ }
9176
+ }
9177
+ };
9178
+ }), withLocationDates('EHDV', function (_ref0) {
9179
+ var currentValidDateStart = _ref0.currentValidDateStart,
9180
+ currentValidDateEnd = _ref0.currentValidDateEnd;
9181
+ return {
9182
+ creationDate: currentValidDateStart,
9183
+ canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
9184
+ editor: null,
9185
+ taf: {
9186
+ uuid: 'eHDV123456789',
9187
+ type: 'NAF',
9188
+ baseTime: currentValidDateStart,
9189
+ validDateStart: currentValidDateStart,
9190
+ validDateEnd: currentValidDateEnd,
9191
+ location: 'EHDV',
9192
+ status: 'NEW',
9193
+ messageType: 'ORG',
9194
+ baseForecast: {
9195
+ valid: {
9196
+ start: currentValidDateStart,
9197
+ end: currentValidDateEnd
9198
+ },
9199
+ wind: {
9200
+ direction: 270,
9201
+ speed: 15,
9202
+ unit: 'KT'
9203
+ },
9204
+ cavOK: true
9205
+ }
9206
+ }
9207
+ };
9208
+ }),
9209
+ // Added missing NafLocation: EHMG
9210
+ withLocationDates('EHMG', function (_ref1) {
9211
+ var currentValidDateStart = _ref1.currentValidDateStart,
9212
+ currentValidDateEnd = _ref1.currentValidDateEnd;
9213
+ return {
9214
+ creationDate: currentValidDateStart,
9215
+ canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
9216
+ editor: null,
9217
+ taf: {
9218
+ uuid: 'eHMG987654321',
9219
+ type: 'NAF',
9220
+ baseTime: currentValidDateStart,
9221
+ validDateStart: currentValidDateStart,
9222
+ validDateEnd: currentValidDateEnd,
9223
+ location: 'EHMG',
9224
+ status: 'NEW',
9225
+ messageType: 'ORG',
9226
+ baseForecast: {
9227
+ valid: {
9228
+ start: currentValidDateStart,
9229
+ end: currentValidDateEnd
9230
+ },
9231
+ visibility: {
9232
+ range: 8000,
9233
+ unit: 'M'
9234
+ },
9235
+ wind: {
9236
+ direction: 90,
9237
+ speed: 8,
9238
+ unit: 'KT'
9239
+ },
9240
+ cloud: {
9241
+ cloud1: {
9242
+ coverage: 'SCT',
9243
+ height: 25
9244
+ }
9245
+ }
9246
+ }
9247
+ }
9248
+ };
9249
+ })];
9250
+
8338
9251
  var fakeUpdatedTafList = [].concat(fakeTafList);
8339
- var setFakeUpdatedList = function setFakeUpdatedList(newList) {
9252
+ var setFakeUpdatedTafList = function setFakeUpdatedTafList(newList) {
8340
9253
  fakeUpdatedTafList = newList;
8341
9254
  };
8342
- var getFakeUpdatedList = function getFakeUpdatedList() {
9255
+ var getFakeUpdatedTafList = function getFakeUpdatedTafList() {
8343
9256
  return fakeUpdatedTafList;
8344
9257
  };
9258
+ var fakeUpdatedNafList = [].concat(fakeNafList);
9259
+ var setFakeUpdatedNafList = function setFakeUpdatedNafList(newList) {
9260
+ fakeUpdatedNafList = newList;
9261
+ };
9262
+ var getFakeUpdatedNafList = function getFakeUpdatedNafList() {
9263
+ return fakeUpdatedNafList;
9264
+ };
8345
9265
  var fakeTafTacJson = {
8346
9266
  tac: [[{
8347
9267
  text: 'TAF'
@@ -8374,45 +9294,13 @@ var fakeTafTacJson = {
8374
9294
  text: '='
8375
9295
  }]]
8376
9296
  };
8377
- var fakeTafConfig = {
8378
- location_indicator_mwo: 'EHDB',
8379
- locations: {
8380
- EHAM: {
8381
- validity_duration: 30,
8382
- activity_period: 6,
8383
- label: 'Schiphol'
8384
- },
8385
- EHRD: {
8386
- validity_duration: 30,
8387
- activity_period: 6,
8388
- label: 'Rotterdam'
8389
- },
8390
- EHGG: {
8391
- validity_duration: 30,
8392
- activity_period: 6,
8393
- label: 'Eelde'
8394
- },
8395
- EHBK: {
8396
- validity_duration: 30,
8397
- activity_period: 6,
8398
- label: 'Maastricht'
8399
- },
8400
- EHLE: {
8401
- validity_duration: 30,
8402
- activity_period: 6,
8403
- label: 'Lelystad'
8404
- },
8405
- TNCB: {
8406
- validity_duration: 30,
8407
- activity_period: 6,
8408
- label: 'Bonaire'
8409
- }
8410
- },
8411
- locationOrder: ['EHAM', 'EHRD', 'EHLE', 'EHGG', 'EHBK', 'TNCB'],
8412
- autoTAFlocations: ['EHAM', 'EHRD', 'EHLE', 'EHGG', 'EHBK']
8413
- };
8414
- var tafEndPoints = [http.get(/^.*\/taflist$/, function () {
8415
- return HttpResponse.json(getFakeUpdatedList());
9297
+ var tafEndPoints = [http.get(/^.*\/taflist$/, function (_ref) {
9298
+ var request = _ref.request;
9299
+ var url = new URL(request.url);
9300
+ if (url.searchParams.get('type') === 'NAF') {
9301
+ return HttpResponse.json(getFakeUpdatedNafList());
9302
+ }
9303
+ return HttpResponse.json(getFakeUpdatedTafList());
8416
9304
  }), http.post(/^.*\/taf$/, /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
8417
9305
  return _regeneratorRuntime().wrap(function _callee$(_context) {
8418
9306
  while (1) switch (_context.prev = _context.next) {
@@ -8427,17 +9315,18 @@ var tafEndPoints = [http.get(/^.*\/taflist$/, function () {
8427
9315
  }
8428
9316
  }, _callee);
8429
9317
  }))), http.patch(/^.*\/taf$/, /*#__PURE__*/function () {
8430
- var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref2) {
8431
- var request, patchTaf, updatedList;
9318
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref3) {
9319
+ var request, patchTaf, items, updatedList;
8432
9320
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
8433
9321
  while (1) switch (_context2.prev = _context2.next) {
8434
9322
  case 0:
8435
- request = _ref2.request;
9323
+ request = _ref3.request;
8436
9324
  _context2.next = 3;
8437
9325
  return request.json();
8438
9326
  case 3:
8439
9327
  patchTaf = _context2.sent;
8440
- updatedList = getFakeUpdatedList().map(function (tafFromBackend) {
9328
+ items = patchTaf.taf.type === 'NAF' ? getFakeUpdatedNafList() : getFakeUpdatedTafList();
9329
+ updatedList = items.map(function (tafFromBackend) {
8441
9330
  if (tafFromBackend.taf.uuid === patchTaf.taf.uuid) {
8442
9331
  return Object.assign({}, tafFromBackend, {
8443
9332
  editor: patchTaf.editor
@@ -8445,19 +9334,23 @@ var tafEndPoints = [http.get(/^.*\/taflist$/, function () {
8445
9334
  }
8446
9335
  return tafFromBackend;
8447
9336
  });
8448
- setFakeUpdatedList(updatedList);
8449
- _context2.next = 8;
9337
+ if (patchTaf.taf.type === 'NAF') {
9338
+ setFakeUpdatedNafList(updatedList);
9339
+ } else {
9340
+ setFakeUpdatedTafList(updatedList);
9341
+ }
9342
+ _context2.next = 9;
8450
9343
  return delay();
8451
- case 8:
8452
- return _context2.abrupt("return", HttpResponse.json(null));
8453
9344
  case 9:
9345
+ return _context2.abrupt("return", HttpResponse.json(null));
9346
+ case 10:
8454
9347
  case "end":
8455
9348
  return _context2.stop();
8456
9349
  }
8457
9350
  }, _callee2);
8458
9351
  }));
8459
9352
  return function (_x) {
8460
- return _ref3.apply(this, arguments);
9353
+ return _ref4.apply(this, arguments);
8461
9354
  };
8462
9355
  }()), http.post(/^.*\/taf2tac$/, /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
8463
9356
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
@@ -8472,7 +9365,12 @@ var tafEndPoints = [http.get(/^.*\/taflist$/, function () {
8472
9365
  return _context3.stop();
8473
9366
  }
8474
9367
  }, _callee3);
8475
- }))), http.get(/^.*\/taf-config$/, function () {
9368
+ }))), http.get(/^.*\/taf-config/, function (_ref6) {
9369
+ var request = _ref6.request;
9370
+ var url = new URL(request.url);
9371
+ if (url.searchParams.get('type') === 'NAF') {
9372
+ return HttpResponse.json(fakeNafConfig);
9373
+ }
8476
9374
  return HttpResponse.json(fakeTafConfig);
8477
9375
  })];
8478
9376