@prorobotech/openapi-k8s-toolkit 1.4.0-alpha.7 → 1.4.0-alpha.9

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.
Files changed (26) hide show
  1. package/dist/{index-BOKNPmwt.mjs → index-85og70S2.mjs} +2 -2
  2. package/dist/{index-BOKNPmwt.mjs.map → index-85og70S2.mjs.map} +1 -1
  3. package/dist/{index-bpfCtuwB.mjs → index-BwCZPalv.mjs} +1284 -536
  4. package/dist/index-BwCZPalv.mjs.map +1 -0
  5. package/dist/openapi-k8s-toolkit.es.js +1 -1
  6. package/dist/openapi-k8s-toolkit.umd.js +1280 -532
  7. package/dist/openapi-k8s-toolkit.umd.js.map +1 -1
  8. package/dist/types/components/molecules/ManageableSidebar/organisms/ManageableSidebarProvider/ManageableSidebarProvider.d.ts +1 -0
  9. package/dist/types/components/molecules/ManageableSidebar/organisms/ManageableSidebarProvider/types.d.ts +10 -0
  10. package/dist/types/components/molecules/ManageableSidebar/organisms/ManageableSidebarProvider/utils.d.ts +23 -1
  11. package/dist/types/components/molecules/YamlEditorSingleton/utils.d.ts +3 -0
  12. package/dist/types/components/molecules/YamlEditorSingleton/utils.test.d.ts +1 -0
  13. package/dist/types/components/organisms/DynamicComponents/molecules/ActionsDropdown/hooks/useActionsDropdownHandlers.d.ts +34 -2
  14. package/dist/types/components/organisms/DynamicComponents/molecules/ActionsDropdown/hooks/useActionsDropdownPermissions.d.ts +2 -3
  15. package/dist/types/components/organisms/DynamicComponents/molecules/ActionsDropdown/modals/ScaleModal.d.ts +10 -0
  16. package/dist/types/components/organisms/DynamicComponents/molecules/ActionsDropdown/permissionsMap.d.ts +7 -0
  17. package/dist/types/components/organisms/DynamicComponents/molecules/ActionsDropdown/utils.d.ts +9 -7
  18. package/dist/types/components/organisms/DynamicComponents/molecules/LabelsToSearchParams/utils.d.ts +6 -0
  19. package/dist/types/components/organisms/DynamicComponents/molecules/SecretBase64Plain/styled.d.ts +1 -0
  20. package/dist/types/components/organisms/DynamicComponents/molecules/SecretBase64Plain/utils.d.ts +2 -0
  21. package/dist/types/components/organisms/DynamicComponents/molecules/SecretBase64Plain/utils.test.d.ts +1 -0
  22. package/dist/types/components/organisms/DynamicComponents/types/ActionsDropdown.d.ts +59 -17
  23. package/dist/types/components/organisms/DynamicComponents/types/LabelsToSearchParams.d.ts +1 -0
  24. package/dist/types/components/organisms/DynamicComponents/types/SecretBase64Plain.d.ts +10 -0
  25. package/package.json +5 -5
  26. package/dist/index-bpfCtuwB.mjs.map +0 -1
@@ -6,6 +6,7 @@ export type TManageableSidebarProviderProps = {
6
6
  plural: string;
7
7
  isEnabled?: boolean;
8
8
  replaceValues: Record<string, string | undefined>;
9
+ multiQueryData?: Record<string, unknown>;
9
10
  pathname: string;
10
11
  searchParams?: string;
11
12
  idToCompare: string;
@@ -1,7 +1,17 @@
1
+ export type TResourcesList = {
2
+ cluster: string;
3
+ apiGroup?: string;
4
+ apiVersion: string;
5
+ plural: string;
6
+ namespace?: string;
7
+ linkToResource: string;
8
+ jsonPathToName: string;
9
+ };
1
10
  export type TLink = {
2
11
  key: string;
3
12
  label: string;
4
13
  link?: string;
14
+ resourcesList?: TResourcesList;
5
15
  children?: TLink[];
6
16
  };
7
17
  export type TCrdResource = {
@@ -1,6 +1,24 @@
1
1
  import { ItemType } from 'antd/es/menu/interface';
2
2
  import { TLink } from './types';
3
- export declare const prepareDataForManageableSidebar: ({ data, replaceValues, pathname, searchParams, idToCompare, fallbackIdToCompare, currentTags, }: {
3
+ export type TResourcesListFetchEntry = {
4
+ nodePath: string;
5
+ k8sParams: {
6
+ cluster: string;
7
+ apiGroup?: string;
8
+ apiVersion: string;
9
+ plural: string;
10
+ namespace?: string;
11
+ isEnabled: boolean;
12
+ };
13
+ };
14
+ export declare const collectLinksWithResourcesList: ({ items, parentPath, replaceValues, multiQueryData, isEnabled, }: {
15
+ items: TLink[];
16
+ parentPath?: string | undefined;
17
+ replaceValues: Record<string, string | undefined>;
18
+ multiQueryData: Record<string, unknown>;
19
+ isEnabled?: boolean | undefined;
20
+ }) => TResourcesListFetchEntry[];
21
+ export declare const prepareDataForManageableSidebar: ({ data, replaceValues, multiQueryData, pathname, searchParams, idToCompare, fallbackIdToCompare, currentTags, resourcesListData, }: {
4
22
  data: {
5
23
  id: string;
6
24
  menuItems: TLink[];
@@ -8,11 +26,15 @@ export declare const prepareDataForManageableSidebar: ({ data, replaceValues, pa
8
26
  externalKeys?: string[];
9
27
  }[];
10
28
  replaceValues: Record<string, string | undefined>;
29
+ multiQueryData?: Record<string, unknown> | undefined;
11
30
  pathname: string;
12
31
  searchParams?: string | undefined;
13
32
  idToCompare: string;
14
33
  fallbackIdToCompare?: string | undefined;
15
34
  currentTags?: string[] | undefined;
35
+ resourcesListData?: Record<string, {
36
+ items?: Record<string, unknown>[] | undefined;
37
+ }> | undefined;
16
38
  }) => {
17
39
  menuItems: ItemType[];
18
40
  selectedKeys: string[];
@@ -0,0 +1,3 @@
1
+ import type * as monaco from 'monaco-editor';
2
+ export declare const findManagedFieldsLine: (model: monaco.editor.ITextModel) => number | null;
3
+ export declare const collapseManagedFieldsInEditor: (editor: monaco.editor.IStandaloneCodeEditor) => void;
@@ -13,11 +13,29 @@ export type TEvictModalData = {
13
13
  gracePeriodSeconds?: number;
14
14
  dryRun?: string[];
15
15
  };
16
+ export type TScaleModalData = {
17
+ endpoint: string;
18
+ currentReplicas: number;
19
+ name: string;
20
+ namespace?: string;
21
+ apiVersion: string;
22
+ };
23
+ export type TDeleteChildrenModalData = {
24
+ children: {
25
+ name: string;
26
+ endpoint: string;
27
+ }[];
28
+ childResourceName: string;
29
+ };
30
+ export type TRerunModalData = {
31
+ createEndpoint: string;
32
+ sourceName: string;
33
+ sourceSpec: Record<string, unknown>;
34
+ };
16
35
  export type TParseContext = {
17
36
  replaceValues: Record<string, string | undefined>;
18
37
  multiQueryData: Record<string, unknown>;
19
38
  };
20
- type TUseActionsDropdownHandlersParams = TParseContext;
21
39
  export declare const parseValueIfString: (value: unknown, ctx: TParseContext) => unknown;
22
40
  export declare const buildEvictModalData: (props: TEvictActionProps, ctx: TParseContext) => TEvictModalData;
23
41
  export declare const buildEvictBody: (data: TEvictModalData) => {
@@ -29,17 +47,31 @@ export declare const buildEvictBody: (data: TEvictModalData) => {
29
47
  name: string;
30
48
  };
31
49
  };
32
- export declare const useActionsDropdownHandlers: ({ replaceValues, multiQueryData }: TUseActionsDropdownHandlersParams) => {
50
+ export declare const buildDeleteChildrenData: (action: Extract<TActionUnion, {
51
+ type: 'deleteChildren';
52
+ }>, ctx: TParseContext) => TDeleteChildrenModalData;
53
+ export declare const stripMetadataForRerun: (sourceObj: Record<string, unknown>, sourceJobName: string) => Record<string, unknown>;
54
+ export declare const useActionsDropdownHandlers: ({ replaceValues, multiQueryData }: TParseContext) => {
33
55
  notificationContextHolder: import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
34
56
  activeAction: TActionUnion | null;
35
57
  modalOpen: boolean;
36
58
  deleteModalData: TDeleteModalData | null;
37
59
  evictModalData: TEvictModalData | null;
38
60
  isEvictLoading: boolean;
61
+ scaleModalData: TScaleModalData | null;
62
+ isScaleLoading: boolean;
63
+ deleteChildrenModalData: TDeleteChildrenModalData | null;
64
+ rerunModalData: TRerunModalData | null;
65
+ isRerunLoading: boolean;
39
66
  handleActionClick: (action: TActionUnion) => void;
40
67
  handleCloseModal: () => void;
41
68
  handleDeleteModalClose: () => void;
42
69
  handleEvictConfirm: () => void;
43
70
  handleEvictCancel: () => void;
71
+ handleScaleConfirm: (newReplicas: number) => void;
72
+ handleScaleCancel: () => void;
73
+ handleDeleteChildrenClose: () => void;
74
+ handleRerunConfirm: () => void;
75
+ handleRerunCancel: () => void;
44
76
  };
45
77
  export {};
@@ -1,11 +1,10 @@
1
- import type { TActionUnion, TActionsPermissions, TPermissionContext } from '../../../types/ActionsDropdown';
1
+ import type { TActionUnion, TActionsPermissions } from '../../../types/ActionsDropdown';
2
2
  type TUseActionsDropdownPermissionsParams = {
3
3
  actions: TActionUnion[];
4
4
  permissions?: TActionsPermissions;
5
- permissionContext?: TPermissionContext;
6
5
  replaceValues: Record<string, string | undefined>;
7
6
  multiQueryData: Record<string, unknown>;
8
7
  isMultiQueryLoading: boolean;
9
8
  };
10
- export declare const useActionsDropdownPermissions: ({ actions, permissions, permissionContext, replaceValues, multiQueryData, isMultiQueryLoading, }: TUseActionsDropdownPermissionsParams) => TActionsPermissions;
9
+ export declare const useActionsDropdownPermissions: ({ actions, permissions, replaceValues, multiQueryData, isMultiQueryLoading, }: TUseActionsDropdownPermissionsParams) => TActionsPermissions;
11
10
  export {};
@@ -0,0 +1,10 @@
1
+ import { FC } from 'react';
2
+ export type TScaleModalProps = {
3
+ open: boolean;
4
+ onClose: () => void;
5
+ onConfirm: (replicas: number) => void;
6
+ currentReplicas: number;
7
+ name: string;
8
+ isLoading: boolean;
9
+ };
10
+ export declare const ScaleModal: FC<TScaleModalProps>;
@@ -0,0 +1,7 @@
1
+ import type { TPermissionVerb } from '../../../../../localTypes/permissions';
2
+ import type { TActionUnion } from '../../types/ActionsDropdown';
3
+ export type TRequiredPermission = {
4
+ verb: TPermissionVerb;
5
+ subresource?: string;
6
+ };
7
+ export declare const ACTION_REQUIRED_PERMISSIONS: Record<TActionUnion['type'], TRequiredPermission>;
@@ -1,18 +1,20 @@
1
1
  import React from 'react';
2
- import type { TPermissionVerb } from '../../../../../localTypes/permissions';
3
2
  import { TActionUnion, TEditActionProps, TActionsPermissions } from '../../types/ActionsDropdown';
3
+ import { TRequiredPermission } from './permissionsMap';
4
4
  type TVisibilityContext = {
5
5
  replaceValues: Record<string, string | undefined>;
6
6
  multiQueryData: Record<string, unknown>;
7
7
  };
8
- export type TRequiredPermission = {
9
- verb: TPermissionVerb;
10
- subresource?: string;
11
- };
12
8
  export declare const getRequiredPermissions: (actions: TActionUnion[]) => TRequiredPermission[];
13
- export declare const getVisibleActions: (actions: TActionUnion[], { replaceValues, multiQueryData }: TVisibilityContext) => TActionUnion[];
9
+ export declare const getVisibleActions: (actions: TActionUnion[], { replaceValues, multiQueryData }: TVisibilityContext) => {
10
+ action: TActionUnion;
11
+ actionKey: string;
12
+ }[];
14
13
  export declare const buildEditUrl: (props: TEditActionProps, fullPath: string) => string;
15
- export declare const getMenuItems: (actions: TActionUnion[], onActionClick: (action: TActionUnion) => void, permissions: TActionsPermissions) => {
14
+ export declare const getMenuItems: (visibleActions: {
15
+ action: TActionUnion;
16
+ actionKey: string;
17
+ }[], onActionClick: (action: TActionUnion) => void, permissions: TActionsPermissions) => {
16
18
  key: string;
17
19
  label: string | import("react/jsx-runtime").JSX.Element;
18
20
  icon: React.ReactNode;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export declare const handleLabelsToSearchParamsLinkClick: ({ e, hrefPrepared, navigate, }: {
3
+ e: React.MouseEvent<HTMLElement>;
4
+ hrefPrepared: string;
5
+ navigate: (to: string) => void;
6
+ }) => void;
@@ -277,6 +277,7 @@ export declare const Styled: {
277
277
  onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
278
278
  }>;
279
279
  DisabledInput: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("antd").InputProps & import("react").RefAttributes<import("antd").InputRef>, TDisabledInputProps>>;
280
+ DisabledTextArea: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("antd/es/input").TextAreaProps & import("react").RefAttributes<import("antd/es/input/TextArea").TextAreaRef>, TDisabledInputProps>>;
280
281
  NotificationOverrides: import("react").NamedExoticComponent<import("styled-components").ExecutionProps & object>;
281
282
  };
282
283
  export {};
@@ -0,0 +1,2 @@
1
+ export declare const decodeIfBase64: (value: string, shouldDecode: boolean) => string;
2
+ export declare const resolveMultilineRows: (value: string, multilineRows?: number) => number;
@@ -11,6 +11,13 @@ export type TActionVisibility = {
11
11
  criteria: TActionVisibilityCriteria;
12
12
  valueToCompare?: string | string[];
13
13
  };
14
+ export type TPermissionContext = {
15
+ cluster: string;
16
+ namespace?: string;
17
+ apiGroup?: string;
18
+ plural: string;
19
+ subresource?: string;
20
+ };
14
21
  export type TActionBaseProps = {
15
22
  icon?: TAntIconName;
16
23
  iconBase64Encoded?: string;
@@ -19,6 +26,7 @@ export type TActionBaseProps = {
19
26
  tooltip?: string;
20
27
  danger?: boolean;
21
28
  visibleWhen?: TActionVisibility;
29
+ permissionContext?: TPermissionContext;
22
30
  };
23
31
  export type TEditActionProps = TActionBaseProps & {
24
32
  cluster: string;
@@ -63,6 +71,36 @@ export type TOpenKubeletConfigActionProps = TActionBaseProps & {
63
71
  modalDescriptionText?: string;
64
72
  editModalWidth?: number | string;
65
73
  };
74
+ export type TScaleActionProps = TActionBaseProps & {
75
+ endpoint: string;
76
+ currentReplicas: string;
77
+ name: string;
78
+ namespace?: string;
79
+ apiVersion?: string;
80
+ };
81
+ export type TTriggerRunActionProps = TActionBaseProps & {
82
+ createEndpoint: string;
83
+ cronJobName: string;
84
+ jobTemplate: string;
85
+ };
86
+ export type TDeleteChildrenActionProps = TActionBaseProps & {
87
+ children: string;
88
+ childResourceName: string;
89
+ };
90
+ export type TRerunLastActionProps = TActionBaseProps & {
91
+ createEndpoint: string;
92
+ sourceJobSpec: string;
93
+ sourceJobName: string;
94
+ };
95
+ export type TDrainActionProps = TActionBaseProps & {
96
+ bffEndpoint: string;
97
+ nodeName: string;
98
+ };
99
+ export type TRollbackActionProps = TActionBaseProps & {
100
+ bffEndpoint: string;
101
+ resourceName: string;
102
+ resourceEndpoint: string;
103
+ };
66
104
  export type TActionUnion = {
67
105
  type: 'edit';
68
106
  props: TEditActionProps;
@@ -102,30 +140,34 @@ export type TActionUnion = {
102
140
  } | {
103
141
  type: 'openKubeletConfig';
104
142
  props: TOpenKubeletConfigActionProps;
143
+ } | {
144
+ type: 'scale';
145
+ props: TScaleActionProps;
146
+ } | {
147
+ type: 'triggerRun';
148
+ props: TTriggerRunActionProps;
149
+ } | {
150
+ type: 'deleteChildren';
151
+ props: TDeleteChildrenActionProps;
152
+ } | {
153
+ type: 'rerunLast';
154
+ props: TRerunLastActionProps;
155
+ } | {
156
+ type: 'drain';
157
+ props: TDrainActionProps;
158
+ } | {
159
+ type: 'rollback';
160
+ props: TRollbackActionProps;
105
161
  };
106
- export type TActionsPermissions = {
107
- canUpdate?: boolean;
108
- canPatch?: boolean;
109
- canDelete?: boolean;
110
- canGet?: boolean;
111
- canCreate?: boolean;
112
- };
113
- export type TPermissionContext = {
114
- cluster: string;
115
- namespace?: string;
116
- apiGroup?: string;
117
- plural: string;
118
- subresource?: string;
119
- };
162
+ /** Per-action permission map. Key = "${actionType}-${index}", value = whether action is allowed. */
163
+ export type TActionsPermissions = Record<string, boolean | undefined>;
120
164
  export type TActionsDropdownProps = {
121
165
  id: number | string;
122
166
  buttonText?: string;
123
167
  buttonVariant?: 'default' | 'icon';
124
168
  containerStyle?: CSSProperties;
125
169
  actions: TActionUnion[];
126
- /** Manual permission override. Takes priority over permissionContext. */
170
+ /** Manual permission override. Takes priority over per-action permissionContext. */
127
171
  permissions?: TActionsPermissions;
128
- /** Resource context for automatic permission checking. */
129
- permissionContext?: TPermissionContext;
130
172
  };
131
173
  export {};
@@ -6,6 +6,7 @@ export type TLabelsToSearchParamsProps = {
6
6
  linkPrefix: string;
7
7
  textLink?: string;
8
8
  errorText: string;
9
+ errorMode?: 'errorText' | 'default';
9
10
  maxTextLength?: number;
10
11
  renderLabelsAsRows?: boolean;
11
12
  } & Omit<LinkProps, 'id' | 'children' | 'href'>;
@@ -2,8 +2,18 @@ import { CSSProperties } from 'react';
2
2
  import { FlexProps } from 'antd';
3
3
  export type TSecretBase64PlainProps = {
4
4
  id: number | string;
5
+ type?: 'base64' | 'plain';
6
+ value?: string;
7
+ reqIndex?: string;
8
+ jsonPathToSecrets?: string;
5
9
  base64Value?: string;
6
10
  plainTextValue?: string;
11
+ multiline?: boolean;
12
+ multilineRows?: number;
13
+ shownByDefault?: boolean;
14
+ hideEye?: boolean;
15
+ textStyle?: CSSProperties;
16
+ emptyText?: string;
7
17
  containerStyle?: CSSProperties;
8
18
  inputContainerStyle?: CSSProperties;
9
19
  flexProps?: Omit<FlexProps, 'children'>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prorobotech/openapi-k8s-toolkit",
3
- "version": "1.4.0-alpha.7",
3
+ "version": "1.4.0-alpha.9",
4
4
  "description": "ProRobotech OpenAPI k8s tools",
5
5
  "main": "dist/openapi-k8s-toolkit.cjs.js",
6
6
  "module": "dist/openapi-k8s-toolkit.es.js",
@@ -72,7 +72,7 @@
72
72
  "@tanstack/react-query-devtools": "5.62.2",
73
73
  "@testing-library/jest-dom": "6.6.3",
74
74
  "@testing-library/react": "16.3.0",
75
- "@types/jest": "29.5.14",
75
+ "@types/jest": "30.0.0",
76
76
  "@types/jsonpath": "0.2.4",
77
77
  "@types/lodash": "4.17.13",
78
78
  "@types/node": "20.5.4",
@@ -93,8 +93,8 @@
93
93
  "eslint-plugin-prettier": "5.0.0",
94
94
  "eslint-plugin-react": "7.33.2",
95
95
  "eslint-plugin-react-hooks": "4.6.0",
96
- "jest": "29.7.0",
97
- "jest-environment-jsdom": "29.7.0",
96
+ "jest": "30.2.0",
97
+ "jest-environment-jsdom": "30.2.0",
98
98
  "jest-styled-components": "^7.2.0",
99
99
  "msw": "2.12.4",
100
100
  "msw-storybook-addon": "2.0.6",
@@ -108,7 +108,7 @@
108
108
  "storybook": "9.1.2",
109
109
  "stylelint": "16.14.1",
110
110
  "stylelint-config-standard": "37.0.0",
111
- "ts-jest": "29.3.2",
111
+ "ts-jest": "29.4.6",
112
112
  "ts-node": "10.9.2",
113
113
  "tsc-alias": "1.8.16",
114
114
  "vite": "5.4.6",