@prorobotech/openapi-k8s-toolkit 0.0.1-alpha.72 → 0.0.1-alpha.73

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.
@@ -45464,7 +45464,8 @@ const MonacoEditor = ({
45464
45464
  podName,
45465
45465
  container,
45466
45466
  theme,
45467
- substractHeight
45467
+ substractHeight,
45468
+ previous
45468
45469
  }) => {
45469
45470
  const [isLoading, setIsLoading] = useState(true);
45470
45471
  const [error, setError] = useState();
@@ -45493,7 +45494,7 @@ const MonacoEditor = ({
45493
45494
  socket.send(
45494
45495
  JSON.stringify({
45495
45496
  type: "init",
45496
- payload: { namespace, podName, container }
45497
+ payload: { namespace, podName, container, previous }
45497
45498
  })
45498
45499
  );
45499
45500
  console.log(`[${namespace}/${podName}]: WebSocket Client Connected`);
@@ -45522,7 +45523,7 @@ const MonacoEditor = ({
45522
45523
  socket.close();
45523
45524
  }
45524
45525
  };
45525
- }, [endpoint, namespace, podName, container]);
45526
+ }, [endpoint, namespace, podName, container, previous]);
45526
45527
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
45527
45528
  /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$1.RightAboveContainer, { $isVisible: isTerminalVisible, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
45528
45529
  Button,
@@ -45583,28 +45584,57 @@ const PodLogsMonaco = ({
45583
45584
  podName,
45584
45585
  containers,
45585
45586
  theme,
45586
- substractHeight
45587
+ substractHeight,
45588
+ rawPodInfo
45587
45589
  }) => {
45588
45590
  const [currentContainer, setCurrentContainer] = useState(containers[0] || void 0);
45591
+ const [previous, setPrevious] = useState(false);
45589
45592
  const endpoint = `/api/clusters/${cluster}/openapi-bff-ws/terminal/podLogs/podLogsNonWs`;
45590
45593
  if (containers.length === 0) {
45591
45594
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: "No Running Containers" });
45592
45595
  }
45596
+ const restartCount = rawPodInfo.status.containerStatuses.find((s) => s.name === currentContainer)?.restartCount ?? 0;
45597
+ const withPrevious = restartCount > 0;
45598
+ const prevCurOptions = withPrevious ? [
45599
+ { value: "current", label: "Current log" },
45600
+ { value: "previous", label: "Previous log" }
45601
+ ] : [{ value: "current", label: "Current log" }];
45593
45602
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
45594
- /* @__PURE__ */ jsxRuntimeExports.jsx(Styled.CustomSelect, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
45595
- Select,
45596
- {
45597
- placeholder: "Select container",
45598
- options: containers.map((container) => ({ value: container, label: container })),
45599
- filterOption: filterSelectOptions,
45600
- disabled: containers.length === 0,
45601
- showSearch: true,
45602
- value: currentContainer,
45603
- onChange: (value) => {
45604
- setCurrentContainer(value);
45603
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Flex, { gap: 16, children: [
45604
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Styled.CustomSelect, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
45605
+ Select,
45606
+ {
45607
+ placeholder: "Select container",
45608
+ options: containers.map((container) => ({ value: container, label: container })),
45609
+ filterOption: filterSelectOptions,
45610
+ disabled: containers.length === 0,
45611
+ showSearch: true,
45612
+ value: currentContainer,
45613
+ onChange: (value) => {
45614
+ setCurrentContainer(value);
45615
+ setPrevious(false);
45616
+ }
45605
45617
  }
45606
- }
45607
- ) }),
45618
+ ) }),
45619
+ currentContainer && /* @__PURE__ */ jsxRuntimeExports.jsx(Styled.CustomSelect, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
45620
+ Select,
45621
+ {
45622
+ placeholder: "Select current/previous",
45623
+ options: prevCurOptions,
45624
+ filterOption: filterSelectOptions,
45625
+ disabled: !withPrevious,
45626
+ showSearch: true,
45627
+ value: previous ? "previous" : "current",
45628
+ onChange: (value) => {
45629
+ if (value === "previous") {
45630
+ setPrevious(true);
45631
+ } else {
45632
+ setPrevious(false);
45633
+ }
45634
+ }
45635
+ }
45636
+ ) })
45637
+ ] }),
45608
45638
  /* @__PURE__ */ jsxRuntimeExports.jsx(Spacer$1, { $space: 8, $samespace: true }),
45609
45639
  currentContainer && /* @__PURE__ */ jsxRuntimeExports.jsx(
45610
45640
  MonacoEditor,
@@ -45614,9 +45644,10 @@ const PodLogsMonaco = ({
45614
45644
  podName,
45615
45645
  container: currentContainer,
45616
45646
  theme,
45617
- substractHeight
45647
+ substractHeight,
45648
+ previous
45618
45649
  },
45619
- `${cluster}-${namespace}-${podName}-${currentContainer}`
45650
+ `${cluster}-${namespace}-${podName}-${currentContainer}-${previous}`
45620
45651
  )
45621
45652
  ] });
45622
45653
  };
@@ -46369,6 +46400,7 @@ const PodLogs = ({
46369
46400
  containers,
46370
46401
  theme,
46371
46402
  substractHeight: substractHeight || 332,
46403
+ rawPodInfo: podInfo,
46372
46404
  ...props
46373
46405
  }
46374
46406
  ),