@dovetail-v2/refine 0.2.0-alpha.1 → 0.2.0
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.
- package/dist/{MonacoYamlDiffEditor-97cade84.js → MonacoYamlDiffEditor-c33773fc.js} +1 -1
- package/dist/{index-50a21e99.js → index-0acc32c8.js} +14 -16
- package/dist/refine.js +1 -1
- package/dist/refine.umd.cjs +13 -15
- package/lib/Dovetail.d.ts +4 -8
- package/lib/contexts/global-store.d.ts +3 -4
- package/lib/hooks/useGlobalStore.d.ts +1 -3
- package/lib/types/globalStore.d.ts +25 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/resource.d.ts +2 -0
- package/package.json +3 -3
|
@@ -11496,7 +11496,7 @@ function useOpenForm(options) {
|
|
|
11496
11496
|
function K8sDropdown(props) {
|
|
11497
11497
|
var _a;
|
|
11498
11498
|
const { record, size = "normal" } = props;
|
|
11499
|
-
const
|
|
11499
|
+
const globalStore = useGlobalStore();
|
|
11500
11500
|
const useResourceResult = useResource();
|
|
11501
11501
|
const resource = useResourceResult.resource;
|
|
11502
11502
|
const configs = useContext(ConfigsContext);
|
|
@@ -35859,7 +35859,7 @@ function PodShellModal(props) {
|
|
|
35859
35859
|
const { pod: pod2 } = props;
|
|
35860
35860
|
const { t: t2 } = useTranslation();
|
|
35861
35861
|
const popModal = usePopModal();
|
|
35862
|
-
const
|
|
35862
|
+
const globalStore = useGlobalStore();
|
|
35863
35863
|
const [socketStatus, setSocketStatus] = useState(SocketStatus.Opening);
|
|
35864
35864
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
35865
35865
|
Modal,
|
|
@@ -38845,7 +38845,7 @@ const Separator = () => {
|
|
|
38845
38845
|
});
|
|
38846
38846
|
};
|
|
38847
38847
|
const MonacoYamlEditor = React__default.lazy(() => Promise.resolve().then(() => MonacoYamlEditor$2));
|
|
38848
|
-
const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-
|
|
38848
|
+
const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-c33773fc.js"));
|
|
38849
38849
|
const YamlEditorComponent = forwardRef(
|
|
38850
38850
|
function YamlEditorComponent2(props, ref) {
|
|
38851
38851
|
const {
|
|
@@ -39180,8 +39180,9 @@ function generateYamlBySchema(defaultValue, schema) {
|
|
|
39180
39180
|
const content = yaml$2.dump(merged);
|
|
39181
39181
|
return content.replace(/(')(#.+?)(')/g, "$2").replace(/( +)(#)/g, "$2$1");
|
|
39182
39182
|
}
|
|
39183
|
-
const useGlobalStore = () => {
|
|
39184
|
-
|
|
39183
|
+
const useGlobalStore = (name2 = "default") => {
|
|
39184
|
+
const globalStores = useContext(GlobalStoreContext);
|
|
39185
|
+
return globalStores[name2];
|
|
39185
39186
|
};
|
|
39186
39187
|
const useYamlForm = ({
|
|
39187
39188
|
action: actionFromProps,
|
|
@@ -39225,7 +39226,7 @@ const useYamlForm = ({
|
|
|
39225
39226
|
const [rulesErrors, setRulesErrors] = useState([]);
|
|
39226
39227
|
const [errorResponseBody, setErrorResponseBody] = useState(null);
|
|
39227
39228
|
const useResourceResult = useResource();
|
|
39228
|
-
const
|
|
39229
|
+
const globalStore = useGlobalStore();
|
|
39229
39230
|
const {
|
|
39230
39231
|
schema,
|
|
39231
39232
|
loading: isLoadingSchema,
|
|
@@ -41223,11 +41224,8 @@ const Dovetail = (props) => {
|
|
|
41223
41224
|
schemaUrlPrefix,
|
|
41224
41225
|
Layout: Layout2,
|
|
41225
41226
|
history,
|
|
41226
|
-
|
|
41227
|
+
globalStoreMap,
|
|
41227
41228
|
accessControlProvider,
|
|
41228
|
-
routerProvider: customRouterProvider,
|
|
41229
|
-
dataProvider: customDataProvider,
|
|
41230
|
-
liveProvider: customLiveProvider,
|
|
41231
41229
|
antdGetPopupContainer
|
|
41232
41230
|
} = props;
|
|
41233
41231
|
const msg = useMessage();
|
|
@@ -41274,14 +41272,12 @@ const Dovetail = (props) => {
|
|
|
41274
41272
|
antd4Configs: {
|
|
41275
41273
|
getPopupContainer: antdGetPopupContainer || (() => document.body)
|
|
41276
41274
|
},
|
|
41277
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalStoreContext.Provider, { value:
|
|
41275
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalStoreContext.Provider, { value: globalStoreMap, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
41278
41276
|
Refine,
|
|
41279
41277
|
{
|
|
41280
|
-
dataProvider:
|
|
41281
|
-
|
|
41282
|
-
|
|
41283
|
-
routerProvider: customRouterProvider || routerProvider,
|
|
41284
|
-
liveProvider: customLiveProvider || liveProvider(globalStore),
|
|
41278
|
+
dataProvider: dataProvider(globalStoreMap.default),
|
|
41279
|
+
liveProvider: liveProvider(globalStoreMap.default),
|
|
41280
|
+
routerProvider,
|
|
41285
41281
|
notificationProvider,
|
|
41286
41282
|
options: {
|
|
41287
41283
|
warnWhenUnsavedChanges: true,
|
|
@@ -41293,6 +41289,7 @@ const Dovetail = (props) => {
|
|
|
41293
41289
|
return {
|
|
41294
41290
|
name: c2.name,
|
|
41295
41291
|
meta: {
|
|
41292
|
+
dataProviderName: c2.dataProviderName,
|
|
41296
41293
|
resourceBasePath: c2.basePath,
|
|
41297
41294
|
kind: c2.kind,
|
|
41298
41295
|
parent: c2.parent,
|
|
@@ -41304,6 +41301,7 @@ const Dovetail = (props) => {
|
|
|
41304
41301
|
edit: `${urlPrefix}/${c2.name}/edit`
|
|
41305
41302
|
};
|
|
41306
41303
|
}),
|
|
41304
|
+
...props,
|
|
41307
41305
|
children: content
|
|
41308
41306
|
}
|
|
41309
41307
|
) })
|
package/dist/refine.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { bO, cE, A, aX, aZ, aG, cc, bl, a2, cq, ce, aR, U, C, k, cK, aJ, bq, ad, cM, aj, aq, cV, ay, cf, cd, cY, aN, bx, x, aE, bE, cX, cF, bH, D, b2, at, bK, as, au, a1, cb, ca, cW, bj, aV, cH, ae, bR, cJ, cI, cL, co, aH, ak, t, s, cN, I, bu, aU, v, O, bf, bh, cg, cP, aM, bt, ar, az, aA, a9, aB, aY, aF, bF, bI, aa, d6, cp, cz, bN, N, a3, f, aW, a7, bQ, bz, by, cO, c1, d1, h, d0, aK, br, ci, M, bb, bc, bp, J, bd, K, be, E, b6, cC, B, b5, H, b9, F, b7, G, b8, L, c2, ba, cB, ab, d4, d3, P, bn, w, af, ai, c0, bk, cT, cS, b0, bv, c8, c7, q, aL, bm, y, bw, b1, d5, z, cs, cG, bL, bT, bU, d8, aI, R, ah, ao, an, bM, al, cU, c4, am, cD, c9, bi, bB, av, i, T, Q, bg, cv, cy, cu, ct, cw, cx, cr, cj, cm, cn, cl, ck, ch, cA, bV, aO, bs, aC, n, bY, m, a_, c$, p, bZ, a$, o, aT, bo, l, c_, aQ, aS, c6, bD, bC, c5, aP, S, bG, cZ, d2, b3, b4, bA, bJ, c3, b_, b$, ac, a0, cR, ag, W, cQ, ap, ax, aw, g, aD, bW, V, a4, d, db, da, dd, d7, a8, de, d9, bS, dc, a6, a5, r, a, c, Y, X, Z, e, _, u, bP, $, bX, b } from "./index-
|
|
1
|
+
import { bO, cE, A, aX, aZ, aG, cc, bl, a2, cq, ce, aR, U, C, k, cK, aJ, bq, ad, cM, aj, aq, cV, ay, cf, cd, cY, aN, bx, x, aE, bE, cX, cF, bH, D, b2, at, bK, as, au, a1, cb, ca, cW, bj, aV, cH, ae, bR, cJ, cI, cL, co, aH, ak, t, s, cN, I, bu, aU, v, O, bf, bh, cg, cP, aM, bt, ar, az, aA, a9, aB, aY, aF, bF, bI, aa, d6, cp, cz, bN, N, a3, f, aW, a7, bQ, bz, by, cO, c1, d1, h, d0, aK, br, ci, M, bb, bc, bp, J, bd, K, be, E, b6, cC, B, b5, H, b9, F, b7, G, b8, L, c2, ba, cB, ab, d4, d3, P, bn, w, af, ai, c0, bk, cT, cS, b0, bv, c8, c7, q, aL, bm, y, bw, b1, d5, z, cs, cG, bL, bT, bU, d8, aI, R, ah, ao, an, bM, al, cU, c4, am, cD, c9, bi, bB, av, i, T, Q, bg, cv, cy, cu, ct, cw, cx, cr, cj, cm, cn, cl, ck, ch, cA, bV, aO, bs, aC, n, bY, m, a_, c$, p, bZ, a$, o, aT, bo, l, c_, aQ, aS, c6, bD, bC, c5, aP, S, bG, cZ, d2, b3, b4, bA, bJ, c3, b_, b$, ac, a0, cR, ag, W, cQ, ap, ax, aw, g, aD, bW, V, a4, d, db, da, dd, d7, a8, de, d9, bS, dc, a6, a5, r, a, c, Y, X, Z, e, _, u, bP, $, bX, b } from "./index-0acc32c8.js";
|
|
2
2
|
import "@cloudtower/eagle";
|
|
3
3
|
import "@refinedev/core";
|
|
4
4
|
import "react";
|
package/dist/refine.umd.cjs
CHANGED
|
@@ -11502,7 +11502,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11502
11502
|
function K8sDropdown(props) {
|
|
11503
11503
|
var _a;
|
|
11504
11504
|
const { record, size = "normal" } = props;
|
|
11505
|
-
const
|
|
11505
|
+
const globalStore = useGlobalStore();
|
|
11506
11506
|
const useResourceResult = core.useResource();
|
|
11507
11507
|
const resource = useResourceResult.resource;
|
|
11508
11508
|
const configs = React.useContext(ConfigsContext);
|
|
@@ -35865,7 +35865,7 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
35865
35865
|
const { pod: pod2 } = props;
|
|
35866
35866
|
const { t: t2 } = useTranslation();
|
|
35867
35867
|
const popModal = eagle.usePopModal();
|
|
35868
|
-
const
|
|
35868
|
+
const globalStore = useGlobalStore();
|
|
35869
35869
|
const [socketStatus, setSocketStatus] = React.useState(SocketStatus.Opening);
|
|
35870
35870
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
35871
35871
|
eagle.Modal,
|
|
@@ -39186,8 +39186,9 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
39186
39186
|
const content = yaml$2.dump(merged);
|
|
39187
39187
|
return content.replace(/(')(#.+?)(')/g, "$2").replace(/( +)(#)/g, "$2$1");
|
|
39188
39188
|
}
|
|
39189
|
-
const useGlobalStore = () => {
|
|
39190
|
-
|
|
39189
|
+
const useGlobalStore = (name2 = "default") => {
|
|
39190
|
+
const globalStores = React.useContext(GlobalStoreContext);
|
|
39191
|
+
return globalStores[name2];
|
|
39191
39192
|
};
|
|
39192
39193
|
const useYamlForm = ({
|
|
39193
39194
|
action: actionFromProps,
|
|
@@ -39231,7 +39232,7 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
39231
39232
|
const [rulesErrors, setRulesErrors] = React.useState([]);
|
|
39232
39233
|
const [errorResponseBody, setErrorResponseBody] = React.useState(null);
|
|
39233
39234
|
const useResourceResult = core.useResource();
|
|
39234
|
-
const
|
|
39235
|
+
const globalStore = useGlobalStore();
|
|
39235
39236
|
const {
|
|
39236
39237
|
schema,
|
|
39237
39238
|
loading: isLoadingSchema,
|
|
@@ -41229,11 +41230,8 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
41229
41230
|
schemaUrlPrefix,
|
|
41230
41231
|
Layout: Layout2,
|
|
41231
41232
|
history,
|
|
41232
|
-
|
|
41233
|
+
globalStoreMap,
|
|
41233
41234
|
accessControlProvider,
|
|
41234
|
-
routerProvider: customRouterProvider,
|
|
41235
|
-
dataProvider: customDataProvider,
|
|
41236
|
-
liveProvider: customLiveProvider,
|
|
41237
41235
|
antdGetPopupContainer
|
|
41238
41236
|
} = props;
|
|
41239
41237
|
const msg = eagle.useMessage();
|
|
@@ -41280,14 +41278,12 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
41280
41278
|
antd4Configs: {
|
|
41281
41279
|
getPopupContainer: antdGetPopupContainer || (() => document.body)
|
|
41282
41280
|
},
|
|
41283
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalStoreContext.Provider, { value:
|
|
41281
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalStoreContext.Provider, { value: globalStoreMap, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
41284
41282
|
core.Refine,
|
|
41285
41283
|
{
|
|
41286
|
-
dataProvider:
|
|
41287
|
-
|
|
41288
|
-
|
|
41289
|
-
routerProvider: customRouterProvider || routerProvider,
|
|
41290
|
-
liveProvider: customLiveProvider || k8sApiProvider.liveProvider(globalStore),
|
|
41284
|
+
dataProvider: k8sApiProvider.dataProvider(globalStoreMap.default),
|
|
41285
|
+
liveProvider: k8sApiProvider.liveProvider(globalStoreMap.default),
|
|
41286
|
+
routerProvider,
|
|
41291
41287
|
notificationProvider,
|
|
41292
41288
|
options: {
|
|
41293
41289
|
warnWhenUnsavedChanges: true,
|
|
@@ -41299,6 +41295,7 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
41299
41295
|
return {
|
|
41300
41296
|
name: c2.name,
|
|
41301
41297
|
meta: {
|
|
41298
|
+
dataProviderName: c2.dataProviderName,
|
|
41302
41299
|
resourceBasePath: c2.basePath,
|
|
41303
41300
|
kind: c2.kind,
|
|
41304
41301
|
parent: c2.parent,
|
|
@@ -41310,6 +41307,7 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
41310
41307
|
edit: `${urlPrefix}/${c2.name}/edit`
|
|
41311
41308
|
};
|
|
41312
41309
|
}),
|
|
41310
|
+
...props,
|
|
41313
41311
|
children: content
|
|
41314
41312
|
}
|
|
41315
41313
|
) })
|
package/lib/Dovetail.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RefineProps } from '@refinedev/core';
|
|
2
2
|
import { History } from 'history';
|
|
3
|
-
import { GlobalStore } from 'k8s-api-provider';
|
|
4
3
|
import React from 'react';
|
|
5
4
|
import { ResourceConfig } from './types';
|
|
6
5
|
import './styles.css';
|
|
6
|
+
import { IGlobalStore } from './types/globalStore';
|
|
7
7
|
type Props = {
|
|
8
8
|
resourcesConfig: ResourceConfig[];
|
|
9
9
|
schemaUrlPrefix: string;
|
|
@@ -11,12 +11,8 @@ type Props = {
|
|
|
11
11
|
urlPrefix?: string;
|
|
12
12
|
Layout?: React.FC<unknown>;
|
|
13
13
|
history: History;
|
|
14
|
-
|
|
15
|
-
accessControlProvider?: AccessControlProvider;
|
|
16
|
-
routerProvider?: any;
|
|
17
|
-
dataProvider?: DataProvider;
|
|
18
|
-
liveProvider?: LiveProvider;
|
|
14
|
+
globalStoreMap: Record<string, IGlobalStore<unknown>>;
|
|
19
15
|
antdGetPopupContainer?: (triggerNode?: HTMLElement) => HTMLElement;
|
|
20
|
-
}
|
|
16
|
+
} & Partial<RefineProps>;
|
|
21
17
|
export declare const Dovetail: React.FC<Props>;
|
|
22
18
|
export {};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}>;
|
|
2
|
+
import { WatchEvent } from 'k8s-api-provider';
|
|
3
|
+
import { IGlobalStore } from 'src/types/globalStore';
|
|
4
|
+
declare const GlobalStoreContext: import("react").Context<Record<string, IGlobalStore<WatchEvent>>>;
|
|
6
5
|
export default GlobalStoreContext;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { MetaQuery } from '@refinedev/core';
|
|
2
|
+
import { CancelQueriesParams, IProviderPlugin, Unstructured, UnstructuredList } from 'k8s-api-provider';
|
|
3
|
+
interface GlobalStoreInitParams {
|
|
4
|
+
apiUrl: string;
|
|
5
|
+
fieldManager?: string;
|
|
6
|
+
kubeApiTimeout?: false | number;
|
|
7
|
+
}
|
|
8
|
+
export interface IGlobalStore<TWatchEvent> {
|
|
9
|
+
plugins: IProviderPlugin[];
|
|
10
|
+
prefix?: string;
|
|
11
|
+
fieldManager?: string;
|
|
12
|
+
apiUrl: string;
|
|
13
|
+
kubeApiTimeout: number | false | undefined;
|
|
14
|
+
get<T = UnstructuredList>(resource: string, meta?: MetaQuery): Promise<T>;
|
|
15
|
+
subscribe(resource: string, onEvent: (event: TWatchEvent) => void): () => void;
|
|
16
|
+
publish(resource: string, event: TWatchEvent): void;
|
|
17
|
+
init(params: GlobalStoreInitParams): void;
|
|
18
|
+
loadPlugins(plugins?: IProviderPlugin[]): void;
|
|
19
|
+
restoreItem(item: Unstructured): Unstructured;
|
|
20
|
+
restoreData(list: UnstructuredList): UnstructuredList;
|
|
21
|
+
destroy(): void;
|
|
22
|
+
cancelQueries(params?: CancelQueriesParams): void;
|
|
23
|
+
refreshList?(resource: string): void;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
package/lib/types/index.d.ts
CHANGED
package/lib/types/resource.d.ts
CHANGED
|
@@ -151,6 +151,8 @@ export type ResourceConfig<Model extends ResourceModel = ResourceModel> = {
|
|
|
151
151
|
* 实际效果为:{apiUrl}{basePath}{apiVersion}{name}
|
|
152
152
|
*/
|
|
153
153
|
apiVersion: string;
|
|
154
|
+
/** 资源使用的 DataProvider 的名称 */
|
|
155
|
+
dataProviderName?: string;
|
|
154
156
|
/** 资源在界面上显示的名称 */
|
|
155
157
|
displayName?: string;
|
|
156
158
|
/** 是否隐藏列表页的工具栏。会连标题和描述一起去掉 */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dovetail-v2/refine",
|
|
3
|
-
"version": "0.2.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"module": "./dist/refine.js",
|
|
11
11
|
"types": "./lib/index.d.ts",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@cloudtower/eagle": "^0.
|
|
14
|
-
"@cloudtower/icons-react": "^0.
|
|
13
|
+
"@cloudtower/eagle": "^0.32.46",
|
|
14
|
+
"@cloudtower/icons-react": "^0.32.46",
|
|
15
15
|
"@patternfly/react-core": "^5.1.1",
|
|
16
16
|
"@patternfly/react-log-viewer": "^5.0.0",
|
|
17
17
|
"@refinedev/core": "^4.47.2",
|