@prorobotech/openapi-k8s-toolkit 1.1.0-alpha.10 → 1.1.0-alpha.11

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.
@@ -9511,9 +9511,10 @@
9511
9511
  replaceValues,
9512
9512
  pathname,
9513
9513
  idToCompare,
9514
+ fallbackIdToCompare,
9514
9515
  currentTags
9515
9516
  }) => {
9516
- const foundData = data.find((el) => el.id === idToCompare);
9517
+ const foundData = data.find((el) => el.id === idToCompare) || (fallbackIdToCompare ? data.find((el) => el.id === fallbackIdToCompare) : void 0);
9517
9518
  if (!foundData) {
9518
9519
  return void 0;
9519
9520
  }
@@ -9543,6 +9544,7 @@
9543
9544
  replaceValues,
9544
9545
  pathname,
9545
9546
  idToCompare,
9547
+ fallbackIdToCompare,
9546
9548
  currentTags,
9547
9549
  hidden,
9548
9550
  noMarginTop
@@ -9579,6 +9581,7 @@
9579
9581
  replaceValues,
9580
9582
  pathname,
9581
9583
  idToCompare,
9584
+ fallbackIdToCompare,
9582
9585
  currentTags
9583
9586
  });
9584
9587
  if (!result) {
@@ -47427,6 +47430,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
47427
47430
  BigText: BigText$1
47428
47431
  };
47429
47432
 
47433
+ const NOTIFICATION_KEY = "yaml-data-changed";
47430
47434
  const YamlEditorSingleton = ({
47431
47435
  theme,
47432
47436
  cluster,
@@ -47451,14 +47455,14 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
47451
47455
  const initialPrefillYamlRef = K.useRef(null);
47452
47456
  const latestPrefillYamlRef = K.useRef(null);
47453
47457
  const firstLoadRef = K.useRef(true);
47454
- const handleReload = () => {
47458
+ const handleReload = K.useCallback(() => {
47459
+ api.destroy(NOTIFICATION_KEY);
47455
47460
  const nextYaml = latestPrefillYamlRef.current ?? initialPrefillYamlRef.current;
47456
47461
  if (nextYaml !== null) {
47457
47462
  setYamlData(nextYaml);
47458
47463
  }
47459
- };
47464
+ }, [api]);
47460
47465
  const openNotificationYamlChanged = K.useCallback(() => {
47461
- const key = `open${Date.now()}`;
47462
47466
  const btn = /* @__PURE__ */ jsxRuntimeExports.jsx(
47463
47467
  antd.Button,
47464
47468
  {
@@ -47466,25 +47470,21 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
47466
47470
  size: "small",
47467
47471
  onClick: () => {
47468
47472
  handleReload();
47469
- api.destroy(key);
47470
47473
  },
47471
47474
  children: "Reload"
47472
47475
  }
47473
47476
  );
47474
47477
  api.info({
47478
+ key: NOTIFICATION_KEY,
47475
47479
  message: "Data changed",
47476
- description: "Reload will flush changes and reload data to latest",
47480
+ description: "The source data has been updated. Reload to apply the latest changes (will discard your edits).",
47477
47481
  btn,
47478
- key,
47479
- onClose: () => console.log("Notification closed"),
47480
47482
  placement: "bottomRight",
47481
47483
  duration: 30
47482
- // keep it open until user closes
47483
47484
  });
47484
- }, [api]);
47485
+ }, [api, handleReload]);
47485
47486
  K.useEffect(() => {
47486
47487
  if (prefillValuesSchema === void 0) return;
47487
- console.log(prefillValuesSchema);
47488
47488
  const nextYaml = stringify(prefillValuesSchema);
47489
47489
  if (firstLoadRef.current) {
47490
47490
  initialPrefillYamlRef.current = nextYaml;