@prorobotech/openapi-k8s-toolkit 0.0.1-alpha.77 → 0.0.1-alpha.79

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.
@@ -8405,7 +8405,7 @@ const ResumeCircleIcon = () => {
8405
8405
  return /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { width: "35", height: "35", viewBox: "0 0 35 35", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
8406
8406
  "path",
8407
8407
  {
8408
- d: "M18 0.5C8.33594 0.5 0.5 8.33594 0.5 18C0.5 27.6641 8.33594 35.5 18 35.5C27.6641 35.5 35.5 27.6641 35.5 18C35.5 8.33594 27.6641 0.5 18 0.5ZM23.6289 18.2695L15.0977 24.4766C15.0509 24.5102 14.9958 24.5302 14.9383 24.5346C14.8809 24.5389 14.8234 24.5273 14.7721 24.501C14.7208 24.4748 14.6778 24.4349 14.6477 24.3858C14.6176 24.3367 14.6017 24.2803 14.6016 24.2227V11.8164C14.6014 11.7587 14.6172 11.7021 14.6472 11.6528C14.6772 11.6035 14.7203 11.5635 14.7717 11.5372C14.8231 11.5109 14.8807 11.4994 14.9382 11.5038C14.9958 11.5083 15.051 11.5286 15.0977 11.5625L23.6289 17.7656C23.6692 17.7941 23.7021 17.8319 23.7248 17.8757C23.7475 17.9196 23.7593 17.9682 23.7593 18.0176C23.7593 18.0669 23.7475 18.1156 23.7248 18.1594C23.7021 18.2033 23.6692 18.241 23.6289 18.2695Z",
8408
+ d: "M17.5 0C7.83594 0 0 7.83594 0 17.5C0 27.1641 7.83594 35 17.5 35C27.1641 35 35 27.1641 35 17.5C35 7.83594 27.1641 0 17.5 0ZM23.1289 17.7695L14.5977 23.9766C14.5509 24.0102 14.4958 24.0302 14.4383 24.0346C14.3809 24.0389 14.3234 24.0273 14.2721 24.001C14.2208 23.9748 14.1778 23.9349 14.1477 23.8858C14.1176 23.8367 14.1017 23.7803 14.1016 23.7227V11.3164C14.1014 11.2587 14.1172 11.2021 14.1472 11.1528C14.1772 11.1035 14.2203 11.0635 14.2717 11.0372C14.3231 11.0109 14.3807 10.9994 14.4382 11.0038C14.4958 11.0083 14.551 11.0286 14.5977 11.0625L23.1289 17.2656C23.1692 17.2941 23.2021 17.3319 23.2248 17.3757C23.2475 17.4196 23.2593 17.4682 23.2593 17.5176C23.2593 17.5669 23.2475 17.6156 23.2248 17.6594C23.2021 17.7033 23.1692 17.741 23.1289 17.7695Z",
8409
8409
  fill: token.colorText,
8410
8410
  fillOpacity: "0.88"
8411
8411
  }
@@ -45496,6 +45496,7 @@ const VisibilityContainer = st.div`
45496
45496
  `;
45497
45497
  const CursorPointerDiv = st.div`
45498
45498
  cursor: pointer;
45499
+ user-select: none;
45499
45500
  `;
45500
45501
  const Styled$1 = {
45501
45502
  FullWidthDiv,
@@ -45619,7 +45620,6 @@ const MonacoEditor = ({
45619
45620
  };
45620
45621
 
45621
45622
  const TopRowContent = st.div`
45622
- width: 100%;
45623
45623
  height: 35px;
45624
45624
  margin-left: 202px;
45625
45625
  display: flex;
@@ -45640,6 +45640,7 @@ const PodLogsMonaco = ({
45640
45640
  namespace,
45641
45641
  podName,
45642
45642
  containers,
45643
+ initContainers,
45643
45644
  theme,
45644
45645
  substractHeight,
45645
45646
  rawPodInfo
@@ -45656,13 +45657,31 @@ const PodLogsMonaco = ({
45656
45657
  { value: "current", label: "Current log" },
45657
45658
  { value: "previous", label: "Previous log" }
45658
45659
  ] : [{ value: "current", label: "Current log" }];
45660
+ const options = initContainers.length > 0 ? [
45661
+ {
45662
+ label: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Containers" }),
45663
+ title: "Containers",
45664
+ options: containers.map((container) => ({ value: container, label: container }))
45665
+ },
45666
+ {
45667
+ label: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Init Containers" }),
45668
+ title: "Init Containers",
45669
+ options: initContainers.map((container) => ({ value: container, label: container }))
45670
+ }
45671
+ ] : [
45672
+ {
45673
+ label: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Containers" }),
45674
+ title: "Containers",
45675
+ options: containers.map((container) => ({ value: container, label: container }))
45676
+ }
45677
+ ];
45659
45678
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
45660
45679
  /* @__PURE__ */ jsxRuntimeExports.jsx(Styled.TopRowContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Flex, { gap: 16, children: [
45661
45680
  /* @__PURE__ */ jsxRuntimeExports.jsx(Styled.CustomSelect, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
45662
45681
  Select,
45663
45682
  {
45664
45683
  placeholder: "Select container",
45665
- options: containers.map((container) => ({ value: container, label: container })),
45684
+ options,
45666
45685
  filterOption: filterSelectOptions,
45667
45686
  disabled: containers.length === 0,
45668
45687
  showSearch: true,
@@ -45751,6 +45770,111 @@ const AntdText = ({
45751
45770
  ] });
45752
45771
  };
45753
45772
 
45773
+ const MultiQueryContext = createContext(void 0);
45774
+ const MultiQueryProvider = ({ urls, children }) => {
45775
+ const queries = useQueries({
45776
+ queries: urls.map((url, index) => ({
45777
+ queryKey: ["multi", index, url],
45778
+ queryFn: async () => {
45779
+ const response = await axios.get(url);
45780
+ return response.data;
45781
+ }
45782
+ }))
45783
+ });
45784
+ const data = {};
45785
+ const errors = [];
45786
+ queries.forEach((q, i) => {
45787
+ data[`req${i}`] = q.data;
45788
+ errors[i] = q.error ?? null;
45789
+ });
45790
+ const isLoading = queries.some((q) => q.isLoading);
45791
+ const isError = queries.some((q) => q.isError);
45792
+ const value = useMemo(
45793
+ () => ({ data, isLoading, isError, errors }),
45794
+ /*
45795
+ We use JSON.stringify(data) and JSON.stringify(errors) as dependencies to safely memoize when values deeply change (since data is a new object every render).
45796
+ Alternatively, you could use a deep comparison hook or lodash.isEqual if needed.
45797
+ */
45798
+ // eslint-disable-next-line react-hooks/exhaustive-deps
45799
+ [JSON.stringify(data), isLoading, isError, JSON.stringify(errors)]
45800
+ );
45801
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(MultiQueryContext.Provider, { value, children });
45802
+ };
45803
+ const useMultiQuery = () => {
45804
+ const context = useContext(MultiQueryContext);
45805
+ if (!context) {
45806
+ throw new Error("useMultiQuery must be used within a MultiQueryProvider");
45807
+ }
45808
+ return context;
45809
+ };
45810
+
45811
+ const createContextFactory = () => {
45812
+ const Context = createContext(null);
45813
+ const useTypedContext = () => {
45814
+ const context = useContext(Context);
45815
+ if (!context) {
45816
+ throw new Error("useTypedContext must be used within a Provider");
45817
+ }
45818
+ return context;
45819
+ };
45820
+ const Provider = ({ children, value }) => {
45821
+ const memoizedValue = useMemo(() => value, Object.values(value));
45822
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Context.Provider, { value: memoizedValue, children });
45823
+ };
45824
+ return {
45825
+ Provider,
45826
+ useTypedContext
45827
+ };
45828
+ };
45829
+
45830
+ const partsOfUrlContext = createContextFactory();
45831
+ const PartsOfUrlProvider = partsOfUrlContext.Provider;
45832
+ const usePartsOfUrl = partsOfUrlContext.useTypedContext;
45833
+
45834
+ const parseMutliqueryText$5 = ({ text, multiQueryData }) => {
45835
+ if (!text) return "";
45836
+ return text.replace(/\{reqs\[(\d+)\]\[((?:\s*['"][^'"]+['"]\s*,?)+)\]\}/g, (match, reqIndexStr, rawPath) => {
45837
+ try {
45838
+ const reqIndex = parseInt(reqIndexStr, 10);
45839
+ const path = Array.from(rawPath.matchAll(/['"]([^'"]+)['"]/g)).map(
45840
+ (m) => m[1]
45841
+ );
45842
+ const value = _$1.get(multiQueryData[`req${reqIndex}`], path);
45843
+ return value != null ? String(value) : "";
45844
+ } catch {
45845
+ return match;
45846
+ }
45847
+ });
45848
+ };
45849
+
45850
+ const AntdLink = ({
45851
+ data,
45852
+ children
45853
+ }) => {
45854
+ const { data: multiQueryData, isLoading: isMultiqueryLoading } = useMultiQuery();
45855
+ const partsOfUrl = usePartsOfUrl();
45856
+ const { id, text, href, ...linkProps } = data;
45857
+ const replaceValues = partsOfUrl.partsOfUrl.reduce((acc, value, index) => {
45858
+ acc[index.toString()] = value;
45859
+ return acc;
45860
+ }, {});
45861
+ const textPrepared = prepareTemplate({
45862
+ template: parseMutliqueryText$5({ text, multiQueryData }),
45863
+ replaceValues
45864
+ });
45865
+ const hrefPrepared = prepareTemplate({
45866
+ template: parseMutliqueryText$5({ text: href, multiQueryData }),
45867
+ replaceValues
45868
+ });
45869
+ if (isMultiqueryLoading) {
45870
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading multiquery" });
45871
+ }
45872
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(Typography.Link, { href: hrefPrepared, ...linkProps, children: [
45873
+ textPrepared,
45874
+ children
45875
+ ] });
45876
+ };
45877
+
45754
45878
  const AntdCard = ({
45755
45879
  data,
45756
45880
  children
@@ -45796,29 +45920,6 @@ const AntdButton = ({
45796
45920
  ] });
45797
45921
  };
45798
45922
 
45799
- const createContextFactory = () => {
45800
- const Context = createContext(null);
45801
- const useTypedContext = () => {
45802
- const context = useContext(Context);
45803
- if (!context) {
45804
- throw new Error("useTypedContext must be used within a Provider");
45805
- }
45806
- return context;
45807
- };
45808
- const Provider = ({ children, value }) => {
45809
- const memoizedValue = useMemo(() => value, Object.values(value));
45810
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Context.Provider, { value: memoizedValue, children });
45811
- };
45812
- return {
45813
- Provider,
45814
- useTypedContext
45815
- };
45816
- };
45817
-
45818
- const partsOfUrlContext = createContextFactory();
45819
- const PartsOfUrlProvider = partsOfUrlContext.Provider;
45820
- const usePartsOfUrl = partsOfUrlContext.useTypedContext;
45821
-
45822
45923
  const PartsOfUrl = ({ data }) => {
45823
45924
  const partsOfUrl = usePartsOfUrl();
45824
45925
  const replaceValues = partsOfUrl.partsOfUrl.reduce((acc, value, index) => {
@@ -45832,44 +45933,6 @@ const PartsOfUrl = ({ data }) => {
45832
45933
  return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: preparedText });
45833
45934
  };
45834
45935
 
45835
- const MultiQueryContext = createContext(void 0);
45836
- const MultiQueryProvider = ({ urls, children }) => {
45837
- const queries = useQueries({
45838
- queries: urls.map((url, index) => ({
45839
- queryKey: ["multi", index, url],
45840
- queryFn: async () => {
45841
- const response = await axios.get(url);
45842
- return response.data;
45843
- }
45844
- }))
45845
- });
45846
- const data = {};
45847
- const errors = [];
45848
- queries.forEach((q, i) => {
45849
- data[`req${i}`] = q.data;
45850
- errors[i] = q.error ?? null;
45851
- });
45852
- const isLoading = queries.some((q) => q.isLoading);
45853
- const isError = queries.some((q) => q.isError);
45854
- const value = useMemo(
45855
- () => ({ data, isLoading, isError, errors }),
45856
- /*
45857
- We use JSON.stringify(data) and JSON.stringify(errors) as dependencies to safely memoize when values deeply change (since data is a new object every render).
45858
- Alternatively, you could use a deep comparison hook or lodash.isEqual if needed.
45859
- */
45860
- // eslint-disable-next-line react-hooks/exhaustive-deps
45861
- [JSON.stringify(data), isLoading, isError, JSON.stringify(errors)]
45862
- );
45863
- return /* @__PURE__ */ jsxRuntimeExports.jsx(MultiQueryContext.Provider, { value, children });
45864
- };
45865
- const useMultiQuery = () => {
45866
- const context = useContext(MultiQueryContext);
45867
- if (!context) {
45868
- throw new Error("useMultiQuery must be used within a MultiQueryProvider");
45869
- }
45870
- return context;
45871
- };
45872
-
45873
45936
  const MultiQuery = ({ data }) => {
45874
45937
  const { data: multiQueryData, isLoading, isError, errors } = useMultiQuery();
45875
45938
  const preparedText = useMemo(() => {
@@ -45934,7 +45997,7 @@ const ParsedText = ({ data }) => {
45934
45997
  template: preparedText,
45935
45998
  replaceValues
45936
45999
  });
45937
- return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: preparedTextWithPartsOfUrl });
46000
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: data.style, children: preparedTextWithPartsOfUrl });
45938
46001
  };
45939
46002
 
45940
46003
  const ProjectInfoCard = ({
@@ -46392,7 +46455,11 @@ const parseMutliqueryText$1 = ({ text, multiQueryData }) => {
46392
46455
  }
46393
46456
  });
46394
46457
  };
46395
- const getRunningContainerNames = (pod) => (pod.status?.containerStatuses ?? []).filter((st) => Boolean(st.state?.running)).map((st) => st.name);
46458
+ const getRunningContainerNames = (pod) => {
46459
+ const containers = (pod.status?.containerStatuses ?? []).filter((st) => Boolean(st.state?.running)).map((st) => st.name);
46460
+ const initContainers = (pod.status?.initContainerStatuses ?? []).map((st) => st.name);
46461
+ return { containers, initContainers };
46462
+ };
46396
46463
 
46397
46464
  const PodLogs = ({
46398
46465
  data,
@@ -46452,7 +46519,7 @@ const PodLogs = ({
46452
46519
  if (!podInfo) {
46453
46520
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: "No Pod Info" });
46454
46521
  }
46455
- const containers = getRunningContainerNames(podInfo);
46522
+ const { containers, initContainers } = getRunningContainerNames(podInfo);
46456
46523
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
46457
46524
  /* @__PURE__ */ jsxRuntimeExports.jsx(
46458
46525
  PodLogsMonaco,
@@ -46461,6 +46528,7 @@ const PodLogs = ({
46461
46528
  namespace: namespacePrepared,
46462
46529
  podName: podNamePrepared,
46463
46530
  containers,
46531
+ initContainers,
46464
46532
  theme,
46465
46533
  substractHeight: substractHeight || 340 + 35 + 8,
46466
46534
  rawPodInfo: podInfo,
@@ -46569,6 +46637,7 @@ const YamlEditorSingleton = ({
46569
46637
  const DynamicComponents = {
46570
46638
  DefaultDiv,
46571
46639
  antdText: AntdText,
46640
+ antdLink: AntdLink,
46572
46641
  antdCard: AntdCard,
46573
46642
  antdFlex: AntdFlex,
46574
46643
  antdRow: AntdRow,