@dovetail-v2/refine 0.3.12-alpha.0 → 0.3.12-alpha.2

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.
@@ -4,6 +4,7 @@ export type DropdownSize = 'normal' | 'large';
4
4
  interface K8sDropdownProps {
5
5
  record: ResourceModel;
6
6
  size?: DropdownSize;
7
+ customButton?: React.ReactNode;
7
8
  }
8
9
  export declare function K8sDropdown(props: React.PropsWithChildren<K8sDropdownProps>): JSX.Element;
9
10
  export default K8sDropdown;
@@ -4,7 +4,7 @@ type Props = {
4
4
  namespace: string;
5
5
  name: string;
6
6
  displayName?: string;
7
- uid?: string;
7
+ query?: Record<string, unknown>;
8
8
  };
9
9
  export declare const ResourceLink: React.FC<Props>;
10
10
  export {};
@@ -37,6 +37,7 @@ export interface ShowConfig<Model extends ResourceModel = ResourceModel> {
37
37
  basicGroup?: ShowGroup<Model>;
38
38
  tabs?: ShowTab<Model>[];
39
39
  renderExtraButton?: (record: Model) => React.ReactNode;
40
+ renderCustomBackButton?: (record: Model) => React.ReactNode;
40
41
  resourceStateMap?: {
41
42
  color: Record<string, StatusCapsuleColor | 'loading'>;
42
43
  text: Record<string, string>;
package/dist/refine.cjs CHANGED
@@ -10659,7 +10659,7 @@ function validateNodePort(nodePort, allNodePorts, i18n2) {
10659
10659
  }
10660
10660
  function K8sDropdown(props) {
10661
10661
  var _a;
10662
- const { record, size = "normal" } = props;
10662
+ const { record, size = "normal", customButton } = props;
10663
10663
  const globalStore = useGlobalStore();
10664
10664
  const useResourceResult = core.useResource();
10665
10665
  const configs = React.useContext(ConfigsContext);
@@ -10719,7 +10719,7 @@ function K8sDropdown(props) {
10719
10719
  ) : null
10720
10720
  ] }),
10721
10721
  trigger: ["click"],
10722
- children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(
10722
+ children: customButton || /* @__PURE__ */ common.jsxRuntimeExports.jsx(
10723
10723
  eagle.Button,
10724
10724
  {
10725
10725
  type: "quiet",
@@ -11129,7 +11129,7 @@ const ResourceLink = (props) => {
11129
11129
  resourceName,
11130
11130
  namespace: namespace2,
11131
11131
  name: name2,
11132
- uid,
11132
+ query,
11133
11133
  displayName
11134
11134
  } = props;
11135
11135
  const navigation = core.useNavigation();
@@ -11154,7 +11154,9 @@ const ResourceLink = (props) => {
11154
11154
  to: navigation.showUrl(resourceName, ""),
11155
11155
  query: {
11156
11156
  id: namespace2 ? `${namespace2}/${name2}` : name2,
11157
- uid
11157
+ // from is current resource by default
11158
+ from: resourceName,
11159
+ ...query
11158
11160
  },
11159
11161
  options: {
11160
11162
  keepQuery: true
@@ -12749,7 +12751,7 @@ const PVCRefField = (i18n2) => {
12749
12751
  resourceName: "persistentvolumeclaims",
12750
12752
  namespace: pv2.pvcNamespace || "default",
12751
12753
  name: value2,
12752
- uid: pv2.pvcUid
12754
+ query: { uid: pv2.pvcUid }
12753
12755
  }
12754
12756
  );
12755
12757
  }
@@ -13547,7 +13549,7 @@ function BasicShowGroupComponent(props) {
13547
13549
  });
13548
13550
  }
13549
13551
  const ShowContentView = (props) => {
13550
- var _a, _b, _c, _d;
13552
+ var _a, _b, _c, _d, _e;
13551
13553
  const {
13552
13554
  id,
13553
13555
  resourceName,
@@ -13679,7 +13681,7 @@ const ShowContentView = (props) => {
13679
13681
  style: {
13680
13682
  padding: size === "small" ? "8px 16px" : void 0
13681
13683
  },
13682
- children: [!hideBackButton && /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", {
13684
+ children: [!hideBackButton && !showConfig.renderCustomBackButton && /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", {
13683
13685
  className: common.cx_default(eagle.Typo.Label.l4_bold, BackButton),
13684
13686
  onClick: () => {
13685
13687
  go({
@@ -13697,7 +13699,7 @@ const ShowContentView = (props) => {
13697
13699
  children: (config == null ? void 0 : config.displayName) || resourceName
13698
13700
  })
13699
13701
  })
13700
- }), /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.Space, {
13702
+ }), (_a = showConfig.renderCustomBackButton) == null ? void 0 : _a.call(showConfig, record), /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.Space, {
13701
13703
  className: TopBarStyle,
13702
13704
  children: [/* @__PURE__ */ common.jsxRuntimeExports.jsxs("div", {
13703
13705
  style: {
@@ -13708,13 +13710,13 @@ const ShowContentView = (props) => {
13708
13710
  children: config.kind
13709
13711
  }), /* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
13710
13712
  className: common.cx_default(eagle.Typo.Display.d2_regular_title, NameStyle),
13711
- children: ((_a = showConfig.displayName) == null ? void 0 : _a.call(showConfig, record)) || ((_b = record == null ? void 0 : record.metadata) == null ? void 0 : _b.name)
13713
+ children: ((_b = showConfig.displayName) == null ? void 0 : _b.call(showConfig, record)) || ((_c = record == null ? void 0 : record.metadata) == null ? void 0 : _c.name)
13712
13714
  }), stateDisplay ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(StateTag, {
13713
13715
  state: stateDisplay,
13714
13716
  customResourceStateMap: showConfig.resourceStateMap
13715
13717
  }) : void 0]
13716
13718
  }), /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.Space, {
13717
- children: [(_c = showConfig.renderExtraButton) == null ? void 0 : _c.call(showConfig, record), !config.hideEdit ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(core.CanAccess, {
13719
+ children: [(_d = showConfig.renderExtraButton) == null ? void 0 : _d.call(showConfig, record), !config.hideEdit ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(core.CanAccess, {
13718
13720
  resource: resourceName,
13719
13721
  action: AccessControlAuth.Edit,
13720
13722
  params: {
@@ -13727,7 +13729,7 @@ const ShowContentView = (props) => {
13727
13729
  onClick: () => openForm({
13728
13730
  id
13729
13731
  }),
13730
- children: ((_d = config.formConfig) == null ? void 0 : _d.formType) === FormType.FORM ? `${t2("dovetail.edit")}${transformResourceKindInSentence(config.displayName || config.kind, i18n2.language)}` : t2("dovetail.edit_yaml")
13732
+ children: ((_e = config.formConfig) == null ? void 0 : _e.formType) === FormType.FORM ? `${t2("dovetail.edit")}${transformResourceKindInSentence(config.displayName || config.kind, i18n2.language)}` : t2("dovetail.edit_yaml")
13731
13733
  })
13732
13734
  }) : null, /* @__PURE__ */ common.jsxRuntimeExports.jsx(Dropdown, {
13733
13735
  record,
@@ -19258,7 +19260,9 @@ const PVCRefColumnRenderer = (i18n2) => {
19258
19260
  resourceName: "persistentvolumeclaims",
19259
19261
  namespace: pv2.pvcNamespace || "default",
19260
19262
  name: value2,
19261
- uid: pv2.pvcUid
19263
+ query: {
19264
+ uid: pv2.pvcUid
19265
+ }
19262
19266
  });
19263
19267
  }
19264
19268
  };
package/dist/refine.js CHANGED
@@ -10640,7 +10640,7 @@ function validateNodePort(nodePort, allNodePorts, i18n2) {
10640
10640
  }
10641
10641
  function K8sDropdown(props) {
10642
10642
  var _a;
10643
- const { record, size = "normal" } = props;
10643
+ const { record, size = "normal", customButton } = props;
10644
10644
  const globalStore = useGlobalStore();
10645
10645
  const useResourceResult = useResource();
10646
10646
  const configs = useContext(ConfigsContext);
@@ -10700,7 +10700,7 @@ function K8sDropdown(props) {
10700
10700
  ) : null
10701
10701
  ] }),
10702
10702
  trigger: ["click"],
10703
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
10703
+ children: customButton || /* @__PURE__ */ jsxRuntimeExports.jsx(
10704
10704
  Button,
10705
10705
  {
10706
10706
  type: "quiet",
@@ -11110,7 +11110,7 @@ const ResourceLink = (props) => {
11110
11110
  resourceName,
11111
11111
  namespace: namespace2,
11112
11112
  name: name2,
11113
- uid,
11113
+ query,
11114
11114
  displayName
11115
11115
  } = props;
11116
11116
  const navigation = useNavigation();
@@ -11135,7 +11135,9 @@ const ResourceLink = (props) => {
11135
11135
  to: navigation.showUrl(resourceName, ""),
11136
11136
  query: {
11137
11137
  id: namespace2 ? `${namespace2}/${name2}` : name2,
11138
- uid
11138
+ // from is current resource by default
11139
+ from: resourceName,
11140
+ ...query
11139
11141
  },
11140
11142
  options: {
11141
11143
  keepQuery: true
@@ -12730,7 +12732,7 @@ const PVCRefField = (i18n2) => {
12730
12732
  resourceName: "persistentvolumeclaims",
12731
12733
  namespace: pv2.pvcNamespace || "default",
12732
12734
  name: value2,
12733
- uid: pv2.pvcUid
12735
+ query: { uid: pv2.pvcUid }
12734
12736
  }
12735
12737
  );
12736
12738
  }
@@ -13528,7 +13530,7 @@ function BasicShowGroupComponent(props) {
13528
13530
  });
13529
13531
  }
13530
13532
  const ShowContentView = (props) => {
13531
- var _a, _b, _c, _d;
13533
+ var _a, _b, _c, _d, _e;
13532
13534
  const {
13533
13535
  id,
13534
13536
  resourceName,
@@ -13660,7 +13662,7 @@ const ShowContentView = (props) => {
13660
13662
  style: {
13661
13663
  padding: size === "small" ? "8px 16px" : void 0
13662
13664
  },
13663
- children: [!hideBackButton && /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
13665
+ children: [!hideBackButton && !showConfig.renderCustomBackButton && /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
13664
13666
  className: cx_default(Typo.Label.l4_bold, BackButton),
13665
13667
  onClick: () => {
13666
13668
  go({
@@ -13678,7 +13680,7 @@ const ShowContentView = (props) => {
13678
13680
  children: (config == null ? void 0 : config.displayName) || resourceName
13679
13681
  })
13680
13682
  })
13681
- }), /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, {
13683
+ }), (_a = showConfig.renderCustomBackButton) == null ? void 0 : _a.call(showConfig, record), /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, {
13682
13684
  className: TopBarStyle,
13683
13685
  children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
13684
13686
  style: {
@@ -13689,13 +13691,13 @@ const ShowContentView = (props) => {
13689
13691
  children: config.kind
13690
13692
  }), /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
13691
13693
  className: cx_default(Typo.Display.d2_regular_title, NameStyle),
13692
- children: ((_a = showConfig.displayName) == null ? void 0 : _a.call(showConfig, record)) || ((_b = record == null ? void 0 : record.metadata) == null ? void 0 : _b.name)
13694
+ children: ((_b = showConfig.displayName) == null ? void 0 : _b.call(showConfig, record)) || ((_c = record == null ? void 0 : record.metadata) == null ? void 0 : _c.name)
13693
13695
  }), stateDisplay ? /* @__PURE__ */ jsxRuntimeExports.jsx(StateTag, {
13694
13696
  state: stateDisplay,
13695
13697
  customResourceStateMap: showConfig.resourceStateMap
13696
13698
  }) : void 0]
13697
13699
  }), /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, {
13698
- children: [(_c = showConfig.renderExtraButton) == null ? void 0 : _c.call(showConfig, record), !config.hideEdit ? /* @__PURE__ */ jsxRuntimeExports.jsx(CanAccess, {
13700
+ children: [(_d = showConfig.renderExtraButton) == null ? void 0 : _d.call(showConfig, record), !config.hideEdit ? /* @__PURE__ */ jsxRuntimeExports.jsx(CanAccess, {
13699
13701
  resource: resourceName,
13700
13702
  action: AccessControlAuth.Edit,
13701
13703
  params: {
@@ -13708,7 +13710,7 @@ const ShowContentView = (props) => {
13708
13710
  onClick: () => openForm({
13709
13711
  id
13710
13712
  }),
13711
- children: ((_d = config.formConfig) == null ? void 0 : _d.formType) === FormType.FORM ? `${t2("dovetail.edit")}${transformResourceKindInSentence(config.displayName || config.kind, i18n2.language)}` : t2("dovetail.edit_yaml")
13713
+ children: ((_e = config.formConfig) == null ? void 0 : _e.formType) === FormType.FORM ? `${t2("dovetail.edit")}${transformResourceKindInSentence(config.displayName || config.kind, i18n2.language)}` : t2("dovetail.edit_yaml")
13712
13714
  })
13713
13715
  }) : null, /* @__PURE__ */ jsxRuntimeExports.jsx(Dropdown2, {
13714
13716
  record,
@@ -19239,7 +19241,9 @@ const PVCRefColumnRenderer = (i18n2) => {
19239
19241
  resourceName: "persistentvolumeclaims",
19240
19242
  namespace: pv2.pvcNamespace || "default",
19241
19243
  name: value2,
19242
- uid: pv2.pvcUid
19244
+ query: {
19245
+ uid: pv2.pvcUid
19246
+ }
19243
19247
  });
19244
19248
  }
19245
19249
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dovetail-v2/refine",
3
- "version": "0.3.12-alpha.0",
3
+ "version": "0.3.12-alpha.2",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",