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