@prorobotech/openapi-k8s-toolkit 1.4.0-alpha.13 → 1.4.0-alpha.15

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 (27) hide show
  1. package/dist/{index-D_swkE1M.mjs → index-_-34pI9_.mjs} +2 -2
  2. package/dist/{index-D_swkE1M.mjs.map → index-_-34pI9_.mjs.map} +1 -1
  3. package/dist/{index-C5QXAXXJ.mjs → index-mwV-HNIP.mjs} +695 -168
  4. package/dist/index-mwV-HNIP.mjs.map +1 -0
  5. package/dist/openapi-k8s-toolkit.es.js +1 -1
  6. package/dist/openapi-k8s-toolkit.umd.js +691 -164
  7. package/dist/openapi-k8s-toolkit.umd.js.map +1 -1
  8. package/dist/types/components/organisms/DynamicComponents/molecules/ActionsDropdown/hooks/useActionsDropdownHandlers/actionHandlers.d.ts +23 -0
  9. package/dist/types/components/organisms/DynamicComponents/molecules/ActionsDropdown/hooks/useActionsDropdownHandlers/handlers/index.d.ts +6 -0
  10. package/dist/types/components/organisms/DynamicComponents/molecules/ActionsDropdown/hooks/useActionsDropdownHandlers/handlers/useCreateFromFilesHandlers.d.ts +11 -0
  11. package/dist/types/components/organisms/DynamicComponents/molecules/ActionsDropdown/hooks/useActionsDropdownHandlers/handlers/useDrainHandlers.d.ts +12 -0
  12. package/dist/types/components/organisms/DynamicComponents/molecules/ActionsDropdown/hooks/useActionsDropdownHandlers/handlers/useEvictHandlers.d.ts +9 -0
  13. package/dist/types/components/organisms/DynamicComponents/molecules/ActionsDropdown/hooks/useActionsDropdownHandlers/handlers/useRerunHandlers.d.ts +11 -0
  14. package/dist/types/components/organisms/DynamicComponents/molecules/ActionsDropdown/hooks/useActionsDropdownHandlers/handlers/useRollbackHandlers.d.ts +11 -0
  15. package/dist/types/components/organisms/DynamicComponents/molecules/ActionsDropdown/hooks/useActionsDropdownHandlers/handlers/useScaleHandlers.d.ts +11 -0
  16. package/dist/types/components/organisms/DynamicComponents/molecules/ActionsDropdown/hooks/useActionsDropdownHandlers/helpers.d.ts +25 -0
  17. package/dist/types/components/organisms/DynamicComponents/molecules/ActionsDropdown/hooks/useActionsDropdownHandlers/index.d.ts +3 -0
  18. package/dist/types/components/organisms/DynamicComponents/molecules/ActionsDropdown/hooks/useActionsDropdownHandlers/types.d.ts +65 -0
  19. package/dist/types/components/organisms/DynamicComponents/molecules/ActionsDropdown/hooks/useActionsDropdownHandlers/useActionsDropdownHandlers.d.ts +38 -0
  20. package/dist/types/components/organisms/DynamicComponents/molecules/ActionsDropdown/modals/CreateFromFilesModal.d.ts +12 -0
  21. package/dist/types/components/organisms/DynamicComponents/molecules/ActionsDropdown/modals/CreateFromFilesModal.test.d.ts +1 -0
  22. package/dist/types/components/organisms/DynamicComponents/molecules/ActionsDropdown/modals/DownloadAsFilesModal.d.ts +11 -0
  23. package/dist/types/components/organisms/DynamicComponents/molecules/ActionsDropdown/modals/DownloadAsFilesModal.test.d.ts +1 -0
  24. package/dist/types/components/organisms/DynamicComponents/types/ActionsDropdown.d.ts +22 -2
  25. package/package.json +1 -1
  26. package/dist/index-C5QXAXXJ.mjs.map +0 -1
  27. package/dist/types/components/organisms/DynamicComponents/molecules/ActionsDropdown/hooks/useActionsDropdownHandlers.d.ts +0 -103
@@ -0,0 +1,23 @@
1
+ import type { TActionUnion } from '../../../../types/ActionsDropdown';
2
+ import type { TDeleteModalData, TNotificationCallbacks, TParseContext } from './types';
3
+ export declare const handleEditAction: (action: Extract<TActionUnion, {
4
+ type: 'edit';
5
+ }>, ctx: TParseContext, fullPath: string, navigate: (url: string) => void) => void;
6
+ export declare const handleDeleteAction: (action: Extract<TActionUnion, {
7
+ type: 'delete';
8
+ }>, ctx: TParseContext, setDeleteModalData: (data: TDeleteModalData) => void) => void;
9
+ export declare const handlePatchActions: (action: Extract<TActionUnion, {
10
+ type: 'cordon' | 'uncordon' | 'suspend' | 'resume';
11
+ }>, ctx: TParseContext, onSuccess: (label: string) => void, onError: (label: string, error: unknown) => void) => void;
12
+ export declare const handleRolloutRestartAction: (action: Extract<TActionUnion, {
13
+ type: 'rolloutRestart';
14
+ }>, ctx: TParseContext, onSuccess: (label: string) => void, onError: (label: string, error: unknown) => void) => void;
15
+ export declare const handleOpenKubeletConfigAction: (action: Extract<TActionUnion, {
16
+ type: 'openKubeletConfig';
17
+ }>, ctx: TParseContext, setActiveAction: (action: TActionUnion) => void, setModalOpen: (open: boolean) => void) => void;
18
+ export declare const fireTriggerRunAction: (action: Extract<TActionUnion, {
19
+ type: 'triggerRun';
20
+ }>, ctx: TParseContext, multiQueryData: Record<string, unknown>, { showSuccess, showError }: TNotificationCallbacks) => void;
21
+ export declare const handleDownloadAsFilesAction: (action: Extract<TActionUnion, {
22
+ type: 'downloadAsFiles';
23
+ }>, ctx: TParseContext, setActiveAction: (action: TActionUnion) => void, setModalOpen: (open: boolean) => void) => void;
@@ -0,0 +1,6 @@
1
+ export { useScaleHandlers } from './useScaleHandlers';
2
+ export { useEvictHandlers } from './useEvictHandlers';
3
+ export { useRerunHandlers } from './useRerunHandlers';
4
+ export { useDrainHandlers } from './useDrainHandlers';
5
+ export { useRollbackHandlers } from './useRollbackHandlers';
6
+ export { useCreateFromFilesHandlers } from './useCreateFromFilesHandlers';
@@ -0,0 +1,11 @@
1
+ import type { TActionUnion } from '../../../../../types/ActionsDropdown';
2
+ import type { TCreateFromFilesModalData, TNotificationCallbacks, TParseContext } from '../types';
3
+ export declare const useCreateFromFilesHandlers: (ctx: TParseContext, { showSuccess, showError }: TNotificationCallbacks) => {
4
+ createFromFilesModalData: TCreateFromFilesModalData | null;
5
+ isCreateFromFilesLoading: boolean;
6
+ handleCreateFromFilesAction: (action: Extract<TActionUnion, {
7
+ type: 'createFromFiles';
8
+ }>) => void;
9
+ handleCreateFromFilesConfirm: (name: string, data: Record<string, string>, binaryData: Record<string, string>) => void;
10
+ handleCreateFromFilesCancel: () => void;
11
+ };
@@ -0,0 +1,12 @@
1
+ import type { NotificationInstance } from 'antd/es/notification/interface';
2
+ import type { TActionUnion } from '../../../../../types/ActionsDropdown';
3
+ import type { TDrainModalData, TNotificationCallbacks, TParseContext } from '../types';
4
+ export declare const useDrainHandlers: (ctx: TParseContext, { showError }: Pick<TNotificationCallbacks, 'showError'>, notificationApi: NotificationInstance, invalidateMultiQuery: () => void) => {
5
+ drainModalData: TDrainModalData | null;
6
+ isDrainLoading: boolean;
7
+ handleDrainAction: (action: Extract<TActionUnion, {
8
+ type: 'drain';
9
+ }>) => void;
10
+ handleDrainConfirm: () => void;
11
+ handleDrainCancel: () => void;
12
+ };
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import type { TEvictModalData, TNotificationCallbacks } from '../types';
3
+ export declare const useEvictHandlers: ({ showSuccess, showError }: TNotificationCallbacks) => {
4
+ evictModalData: TEvictModalData | null;
5
+ isEvictLoading: boolean;
6
+ setEvictModalData: import("react").Dispatch<import("react").SetStateAction<TEvictModalData | null>>;
7
+ handleEvictConfirm: () => void;
8
+ handleEvictCancel: () => void;
9
+ };
@@ -0,0 +1,11 @@
1
+ import type { TActionUnion } from '../../../../../types/ActionsDropdown';
2
+ import type { TNotificationCallbacks, TParseContext, TRerunModalData } from '../types';
3
+ export declare const useRerunHandlers: (ctx: TParseContext, multiQueryData: Record<string, unknown>, { showSuccess, showError }: TNotificationCallbacks) => {
4
+ rerunModalData: TRerunModalData | null;
5
+ isRerunLoading: boolean;
6
+ handleRerunLastAction: (action: Extract<TActionUnion, {
7
+ type: 'rerunLast';
8
+ }>) => void;
9
+ handleRerunConfirm: () => void;
10
+ handleRerunCancel: () => void;
11
+ };
@@ -0,0 +1,11 @@
1
+ import type { TActionUnion } from '../../../../../types/ActionsDropdown';
2
+ import type { TNotificationCallbacks, TParseContext, TRollbackModalData } from '../types';
3
+ export declare const useRollbackHandlers: (ctx: TParseContext, { showSuccess, showError }: TNotificationCallbacks) => {
4
+ rollbackModalData: TRollbackModalData | null;
5
+ isRollbackLoading: boolean;
6
+ handleRollbackAction: (action: Extract<TActionUnion, {
7
+ type: 'rollback';
8
+ }>) => void;
9
+ handleRollbackConfirm: () => void;
10
+ handleRollbackCancel: () => void;
11
+ };
@@ -0,0 +1,11 @@
1
+ import type { TActionUnion } from '../../../../../types/ActionsDropdown';
2
+ import type { TNotificationCallbacks, TParseContext, TScaleModalData } from '../types';
3
+ export declare const useScaleHandlers: (ctx: TParseContext, { showSuccess, showError }: TNotificationCallbacks) => {
4
+ scaleModalData: TScaleModalData | null;
5
+ isScaleLoading: boolean;
6
+ handleScaleAction: (action: Extract<TActionUnion, {
7
+ type: 'scale';
8
+ }>) => void;
9
+ handleScaleConfirm: (newReplicas: number) => void;
10
+ handleScaleCancel: () => void;
11
+ };
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import type { TActionUnion, TEvictActionProps } from '../../../../types/ActionsDropdown';
3
+ import type { TDeleteChildrenModalData, TDrainResponse, TEvictModalData, TParseContext } from './types';
4
+ export declare const parseValueIfString: (value: unknown, ctx: TParseContext) => unknown;
5
+ export declare const resolveObjectByReqIndexAndJsonPath: ({ reqIndex, jsonPathToObj, multiQueryData, }: {
6
+ reqIndex: string;
7
+ jsonPathToObj: string;
8
+ multiQueryData: Record<string, unknown>;
9
+ }) => Record<string, unknown> | undefined;
10
+ export declare const buildEvictModalData: (props: TEvictActionProps, ctx: TParseContext) => TEvictModalData;
11
+ export declare const buildEvictBody: (data: TEvictModalData) => {
12
+ deleteOptions?: Record<string, unknown> | undefined;
13
+ apiVersion: string;
14
+ kind: string;
15
+ metadata: {
16
+ namespace?: string | undefined;
17
+ name: string;
18
+ };
19
+ };
20
+ export declare const buildDeleteChildrenData: (action: Extract<TActionUnion, {
21
+ type: 'deleteChildren';
22
+ }>, ctx: TParseContext) => TDeleteChildrenModalData;
23
+ export declare const generateDnsCompliantName: (prefix: string, maxLength?: number) => string;
24
+ export declare const stripMetadataForRerun: (sourceObj: Record<string, unknown>, sourceJobName: string) => Record<string, unknown>;
25
+ export declare const buildDrainFailureDescription: ({ drained, failed, skipped }: TDrainResponse) => React.ReactNode;
@@ -0,0 +1,3 @@
1
+ export { useActionsDropdownHandlers } from './useActionsDropdownHandlers';
2
+ export type { TCreateFromFilesModalData, TDeleteChildrenModalData, TDrainModalData, TDrainResponse, TEvictModalData, TParseContext, TRerunModalData, TRollbackModalData, TScaleModalData, } from './types';
3
+ export { buildDeleteChildrenData, buildEvictBody, buildEvictModalData, parseValueIfString, resolveObjectByReqIndexAndJsonPath, stripMetadataForRerun, } from './helpers';
@@ -0,0 +1,65 @@
1
+ import type { TResourceKind } from '../../../../types/ActionsDropdown';
2
+ export type TDeleteModalData = {
3
+ name: string;
4
+ endpoint: string;
5
+ redirectTo?: string;
6
+ };
7
+ export type TEvictModalData = {
8
+ name: string;
9
+ endpoint: string;
10
+ namespace?: string;
11
+ apiVersion: string;
12
+ gracePeriodSeconds?: number;
13
+ dryRun?: string[];
14
+ };
15
+ export type TScaleModalData = {
16
+ endpoint: string;
17
+ currentReplicas: number;
18
+ name: string;
19
+ namespace?: string;
20
+ apiVersion: string;
21
+ };
22
+ export type TDeleteChildrenModalData = {
23
+ children: {
24
+ name: string;
25
+ endpoint: string;
26
+ }[];
27
+ childResourceName: string;
28
+ };
29
+ export type TRerunModalData = {
30
+ createEndpoint: string;
31
+ sourceName: string;
32
+ sourceSpec: Record<string, unknown>;
33
+ };
34
+ export type TDrainModalData = {
35
+ bffEndpoint: string;
36
+ nodeName: string;
37
+ };
38
+ export type TDrainResponse = {
39
+ drained: number;
40
+ failed: {
41
+ name: string;
42
+ namespace: string;
43
+ error: string;
44
+ }[];
45
+ skipped: number;
46
+ };
47
+ export type TRollbackModalData = {
48
+ bffEndpoint: string;
49
+ resourceName: string;
50
+ resourceEndpoint: string;
51
+ };
52
+ export type TParseContext = {
53
+ replaceValues: Record<string, string | undefined>;
54
+ multiQueryData: Record<string, unknown>;
55
+ };
56
+ export type TNotificationCallbacks = {
57
+ showSuccess: (label: string) => void;
58
+ showError: (label: string, error: unknown) => void;
59
+ };
60
+ export type TCreateFromFilesModalData = {
61
+ createEndpoint: string;
62
+ namespace: string;
63
+ resourceKind: TResourceKind;
64
+ apiVersion: string;
65
+ };
@@ -0,0 +1,38 @@
1
+ /// <reference types="react" />
2
+ import type { TActionUnion } from '../../../../types/ActionsDropdown';
3
+ import type { TDeleteChildrenModalData, TDeleteModalData, TParseContext } from './types';
4
+ export declare const useActionsDropdownHandlers: ({ replaceValues, multiQueryData }: TParseContext) => {
5
+ notificationContextHolder: import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
6
+ activeAction: TActionUnion | null;
7
+ modalOpen: boolean;
8
+ deleteModalData: TDeleteModalData | null;
9
+ evictModalData: import("./types").TEvictModalData | null;
10
+ isEvictLoading: boolean;
11
+ scaleModalData: import("./types").TScaleModalData | null;
12
+ isScaleLoading: boolean;
13
+ deleteChildrenModalData: TDeleteChildrenModalData | null;
14
+ rerunModalData: import("./types").TRerunModalData | null;
15
+ isRerunLoading: boolean;
16
+ drainModalData: import("./types").TDrainModalData | null;
17
+ isDrainLoading: boolean;
18
+ rollbackModalData: import("./types").TRollbackModalData | null;
19
+ isRollbackLoading: boolean;
20
+ handleActionClick: (action: TActionUnion) => void;
21
+ handleCloseModal: () => void;
22
+ handleDeleteModalClose: () => void;
23
+ handleEvictConfirm: () => void;
24
+ handleEvictCancel: () => void;
25
+ handleScaleConfirm: (newReplicas: number) => void;
26
+ handleScaleCancel: () => void;
27
+ handleDeleteChildrenClose: () => void;
28
+ handleRerunConfirm: () => void;
29
+ handleRerunCancel: () => void;
30
+ handleDrainConfirm: () => void;
31
+ handleDrainCancel: () => void;
32
+ handleRollbackConfirm: () => void;
33
+ handleRollbackCancel: () => void;
34
+ createFromFilesModalData: import("./types").TCreateFromFilesModalData | null;
35
+ isCreateFromFilesLoading: boolean;
36
+ handleCreateFromFilesConfirm: (name: string, data: Record<string, string>, binaryData: Record<string, string>) => void;
37
+ handleCreateFromFilesCancel: () => void;
38
+ };
@@ -0,0 +1,12 @@
1
+ import { FC } from 'react';
2
+ import type { TResourceKind } from '../../../types/ActionsDropdown';
3
+ type TCreateFromFilesModalProps = {
4
+ open: boolean;
5
+ onClose: () => void;
6
+ onConfirm: (name: string, data: Record<string, string>, binaryData: Record<string, string>) => void;
7
+ resourceKind: TResourceKind;
8
+ namespace: string;
9
+ isLoading: boolean;
10
+ };
11
+ export declare const CreateFromFilesModal: FC<TCreateFromFilesModalProps>;
12
+ export {};
@@ -0,0 +1,11 @@
1
+ import { FC } from 'react';
2
+ import type { TResourceKind } from '../../../types/ActionsDropdown';
3
+ type TDownloadAsFilesModalProps = {
4
+ open: boolean;
5
+ onClose: () => void;
6
+ endpoint: string;
7
+ resourceKind: TResourceKind;
8
+ name: string;
9
+ };
10
+ export declare const DownloadAsFilesModal: FC<TDownloadAsFilesModalProps>;
11
+ export {};
@@ -81,7 +81,8 @@ export type TScaleActionProps = TActionBaseProps & {
81
81
  export type TTriggerRunActionProps = TActionBaseProps & {
82
82
  createEndpoint: string;
83
83
  cronJobName: string;
84
- jobTemplate: string;
84
+ reqIndex: string;
85
+ jsonPathToObj: string;
85
86
  };
86
87
  export type TDeleteChildrenActionProps = TActionBaseProps & {
87
88
  children: string;
@@ -89,8 +90,9 @@ export type TDeleteChildrenActionProps = TActionBaseProps & {
89
90
  };
90
91
  export type TRerunLastActionProps = TActionBaseProps & {
91
92
  createEndpoint: string;
92
- sourceJobSpec: string;
93
93
  sourceJobName: string;
94
+ reqIndex: string;
95
+ jsonPathToObj: string;
94
96
  };
95
97
  export type TDrainActionProps = TActionBaseProps & {
96
98
  bffEndpoint: string;
@@ -101,6 +103,18 @@ export type TRollbackActionProps = TActionBaseProps & {
101
103
  resourceName: string;
102
104
  resourceEndpoint: string;
103
105
  };
106
+ export type TResourceKind = 'ConfigMap' | 'Secret';
107
+ export type TDownloadAsFilesActionProps = TActionBaseProps & {
108
+ endpoint: string;
109
+ resourceKind: TResourceKind;
110
+ name: string;
111
+ };
112
+ export type TCreateFromFilesActionProps = TActionBaseProps & {
113
+ createEndpoint: string;
114
+ namespace: string;
115
+ resourceKind: TResourceKind;
116
+ apiVersion?: string;
117
+ };
104
118
  export type TActionUnion = {
105
119
  type: 'edit';
106
120
  props: TEditActionProps;
@@ -158,6 +172,12 @@ export type TActionUnion = {
158
172
  } | {
159
173
  type: 'rollback';
160
174
  props: TRollbackActionProps;
175
+ } | {
176
+ type: 'downloadAsFiles';
177
+ props: TDownloadAsFilesActionProps;
178
+ } | {
179
+ type: 'createFromFiles';
180
+ props: TCreateFromFilesActionProps;
161
181
  };
162
182
  /** Per-action permission map. Key = "${actionType}-${index}", value = whether action is allowed. */
163
183
  export type TActionsPermissions = Record<string, boolean | undefined>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prorobotech/openapi-k8s-toolkit",
3
- "version": "1.4.0-alpha.13",
3
+ "version": "1.4.0-alpha.15",
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",