@dovetail-v2/refine 0.3.11-alpha.3 → 0.3.12-alpha.1

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 {};
@@ -36,6 +36,7 @@ export interface ShowConfig<Model extends ResourceModel = ResourceModel> {
36
36
  basicGroup?: ShowGroup<Model>;
37
37
  tabs?: ShowTab<Model>[];
38
38
  renderExtraButton?: (record: Model) => React.ReactNode;
39
+ renderCustomBackButton?: (record: Model) => React.ReactNode;
39
40
  resourceStateMap?: {
40
41
  color: Record<string, StatusCapsuleColor | 'loading'>;
41
42
  text: Record<string, string>;
package/dist/refine.cjs CHANGED
@@ -10647,7 +10647,7 @@ function validateNodePort(nodePort, allNodePorts, i18n2) {
10647
10647
  }
10648
10648
  function K8sDropdown(props) {
10649
10649
  var _a;
10650
- const { record, size = "normal" } = props;
10650
+ const { record, size = "normal", customButton } = props;
10651
10651
  const globalStore = useGlobalStore();
10652
10652
  const useResourceResult = core.useResource();
10653
10653
  const configs = React.useContext(ConfigsContext);
@@ -10707,7 +10707,7 @@ function K8sDropdown(props) {
10707
10707
  ) : null
10708
10708
  ] }),
10709
10709
  trigger: ["click"],
10710
- children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(
10710
+ children: customButton || /* @__PURE__ */ common.jsxRuntimeExports.jsx(
10711
10711
  eagle.Button,
10712
10712
  {
10713
10713
  type: "quiet",
@@ -11117,7 +11117,7 @@ const ResourceLink = (props) => {
11117
11117
  resourceName,
11118
11118
  namespace: namespace2,
11119
11119
  name: name2,
11120
- uid,
11120
+ query,
11121
11121
  displayName
11122
11122
  } = props;
11123
11123
  const navigation = core.useNavigation();
@@ -11142,7 +11142,9 @@ const ResourceLink = (props) => {
11142
11142
  to: navigation.showUrl(resourceName, ""),
11143
11143
  query: {
11144
11144
  id: namespace2 ? `${namespace2}/${name2}` : name2,
11145
- uid
11145
+ // from is current resource by default
11146
+ from: resourceName,
11147
+ ...query
11146
11148
  },
11147
11149
  options: {
11148
11150
  keepQuery: true
@@ -12735,7 +12737,7 @@ const PVCRefField = (i18n2) => {
12735
12737
  resourceName: "persistentvolumeclaims",
12736
12738
  namespace: pv2.pvcNamespace || "default",
12737
12739
  name: value2,
12738
- uid: pv2.pvcUid
12740
+ query: { uid: pv2.pvcUid }
12739
12741
  }
12740
12742
  );
12741
12743
  }
@@ -13479,7 +13481,7 @@ function BasicShowGroupComponent(props) {
13479
13481
  });
13480
13482
  }
13481
13483
  const ShowContentView = (props) => {
13482
- var _a, _b, _c, _d;
13484
+ var _a, _b, _c, _d, _e;
13483
13485
  const {
13484
13486
  id,
13485
13487
  resourceName,
@@ -13604,7 +13606,7 @@ const ShowContentView = (props) => {
13604
13606
  const stateDisplay = lodashEs.get(record, "stateDisplay");
13605
13607
  const topBar = /* @__PURE__ */ common.jsxRuntimeExports.jsxs("div", {
13606
13608
  className: ToolBarWrapper,
13607
- children: [!hideBackButton && /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", {
13609
+ children: [!hideBackButton && !showConfig.renderCustomBackButton && /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", {
13608
13610
  className: common.cx_default(eagle.Typo.Label.l4_bold, BackButton),
13609
13611
  onClick: () => {
13610
13612
  go({
@@ -13622,7 +13624,7 @@ const ShowContentView = (props) => {
13622
13624
  children: (config == null ? void 0 : config.displayName) || resourceName
13623
13625
  })
13624
13626
  })
13625
- }), /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.Space, {
13627
+ }), (_a = showConfig.renderCustomBackButton) == null ? void 0 : _a.call(showConfig, record), /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.Space, {
13626
13628
  className: TopBarStyle,
13627
13629
  children: [/* @__PURE__ */ common.jsxRuntimeExports.jsxs("div", {
13628
13630
  style: {
@@ -13633,13 +13635,13 @@ const ShowContentView = (props) => {
13633
13635
  children: config.kind
13634
13636
  }), /* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
13635
13637
  className: common.cx_default(eagle.Typo.Display.d2_regular_title, NameStyle),
13636
- children: ((_a = showConfig.displayName) == null ? void 0 : _a.call(showConfig, record)) || ((_b = record == null ? void 0 : record.metadata) == null ? void 0 : _b.name)
13638
+ children: ((_b = showConfig.displayName) == null ? void 0 : _b.call(showConfig, record)) || ((_c = record == null ? void 0 : record.metadata) == null ? void 0 : _c.name)
13637
13639
  }), stateDisplay ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(StateTag, {
13638
13640
  state: stateDisplay,
13639
13641
  customResourceStateMap: showConfig.resourceStateMap
13640
13642
  }) : void 0]
13641
13643
  }), /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.Space, {
13642
- children: [(_c = showConfig.renderExtraButton) == null ? void 0 : _c.call(showConfig, record), !config.hideEdit ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(core.CanAccess, {
13644
+ children: [(_d = showConfig.renderExtraButton) == null ? void 0 : _d.call(showConfig, record), !config.hideEdit ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(core.CanAccess, {
13643
13645
  resource: resourceName,
13644
13646
  action: AccessControlAuth.Edit,
13645
13647
  params: {
@@ -13652,7 +13654,7 @@ const ShowContentView = (props) => {
13652
13654
  onClick: () => openForm({
13653
13655
  id
13654
13656
  }),
13655
- 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")
13657
+ 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")
13656
13658
  })
13657
13659
  }) : null, /* @__PURE__ */ common.jsxRuntimeExports.jsx(Dropdown, {
13658
13660
  record,
@@ -19178,7 +19180,9 @@ const PVCRefColumnRenderer = (i18n2) => {
19178
19180
  resourceName: "persistentvolumeclaims",
19179
19181
  namespace: pv2.pvcNamespace || "default",
19180
19182
  name: value2,
19181
- uid: pv2.pvcUid
19183
+ query: {
19184
+ uid: pv2.pvcUid
19185
+ }
19182
19186
  });
19183
19187
  }
19184
19188
  };
package/dist/refine.js CHANGED
@@ -10628,7 +10628,7 @@ function validateNodePort(nodePort, allNodePorts, i18n2) {
10628
10628
  }
10629
10629
  function K8sDropdown(props) {
10630
10630
  var _a;
10631
- const { record, size = "normal" } = props;
10631
+ const { record, size = "normal", customButton } = props;
10632
10632
  const globalStore = useGlobalStore();
10633
10633
  const useResourceResult = useResource();
10634
10634
  const configs = useContext(ConfigsContext);
@@ -10688,7 +10688,7 @@ function K8sDropdown(props) {
10688
10688
  ) : null
10689
10689
  ] }),
10690
10690
  trigger: ["click"],
10691
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
10691
+ children: customButton || /* @__PURE__ */ jsxRuntimeExports.jsx(
10692
10692
  Button,
10693
10693
  {
10694
10694
  type: "quiet",
@@ -11098,7 +11098,7 @@ const ResourceLink = (props) => {
11098
11098
  resourceName,
11099
11099
  namespace: namespace2,
11100
11100
  name: name2,
11101
- uid,
11101
+ query,
11102
11102
  displayName
11103
11103
  } = props;
11104
11104
  const navigation = useNavigation();
@@ -11123,7 +11123,9 @@ const ResourceLink = (props) => {
11123
11123
  to: navigation.showUrl(resourceName, ""),
11124
11124
  query: {
11125
11125
  id: namespace2 ? `${namespace2}/${name2}` : name2,
11126
- uid
11126
+ // from is current resource by default
11127
+ from: resourceName,
11128
+ ...query
11127
11129
  },
11128
11130
  options: {
11129
11131
  keepQuery: true
@@ -12716,7 +12718,7 @@ const PVCRefField = (i18n2) => {
12716
12718
  resourceName: "persistentvolumeclaims",
12717
12719
  namespace: pv2.pvcNamespace || "default",
12718
12720
  name: value2,
12719
- uid: pv2.pvcUid
12721
+ query: { uid: pv2.pvcUid }
12720
12722
  }
12721
12723
  );
12722
12724
  }
@@ -13460,7 +13462,7 @@ function BasicShowGroupComponent(props) {
13460
13462
  });
13461
13463
  }
13462
13464
  const ShowContentView = (props) => {
13463
- var _a, _b, _c, _d;
13465
+ var _a, _b, _c, _d, _e;
13464
13466
  const {
13465
13467
  id,
13466
13468
  resourceName,
@@ -13585,7 +13587,7 @@ const ShowContentView = (props) => {
13585
13587
  const stateDisplay = get$2(record, "stateDisplay");
13586
13588
  const topBar = /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
13587
13589
  className: ToolBarWrapper,
13588
- children: [!hideBackButton && /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
13590
+ children: [!hideBackButton && !showConfig.renderCustomBackButton && /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
13589
13591
  className: cx_default(Typo.Label.l4_bold, BackButton),
13590
13592
  onClick: () => {
13591
13593
  go({
@@ -13603,7 +13605,7 @@ const ShowContentView = (props) => {
13603
13605
  children: (config == null ? void 0 : config.displayName) || resourceName
13604
13606
  })
13605
13607
  })
13606
- }), /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, {
13608
+ }), (_a = showConfig.renderCustomBackButton) == null ? void 0 : _a.call(showConfig, record), /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, {
13607
13609
  className: TopBarStyle,
13608
13610
  children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
13609
13611
  style: {
@@ -13614,13 +13616,13 @@ const ShowContentView = (props) => {
13614
13616
  children: config.kind
13615
13617
  }), /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
13616
13618
  className: cx_default(Typo.Display.d2_regular_title, NameStyle),
13617
- children: ((_a = showConfig.displayName) == null ? void 0 : _a.call(showConfig, record)) || ((_b = record == null ? void 0 : record.metadata) == null ? void 0 : _b.name)
13619
+ children: ((_b = showConfig.displayName) == null ? void 0 : _b.call(showConfig, record)) || ((_c = record == null ? void 0 : record.metadata) == null ? void 0 : _c.name)
13618
13620
  }), stateDisplay ? /* @__PURE__ */ jsxRuntimeExports.jsx(StateTag, {
13619
13621
  state: stateDisplay,
13620
13622
  customResourceStateMap: showConfig.resourceStateMap
13621
13623
  }) : void 0]
13622
13624
  }), /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, {
13623
- children: [(_c = showConfig.renderExtraButton) == null ? void 0 : _c.call(showConfig, record), !config.hideEdit ? /* @__PURE__ */ jsxRuntimeExports.jsx(CanAccess, {
13625
+ children: [(_d = showConfig.renderExtraButton) == null ? void 0 : _d.call(showConfig, record), !config.hideEdit ? /* @__PURE__ */ jsxRuntimeExports.jsx(CanAccess, {
13624
13626
  resource: resourceName,
13625
13627
  action: AccessControlAuth.Edit,
13626
13628
  params: {
@@ -13633,7 +13635,7 @@ const ShowContentView = (props) => {
13633
13635
  onClick: () => openForm({
13634
13636
  id
13635
13637
  }),
13636
- 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")
13638
+ 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")
13637
13639
  })
13638
13640
  }) : null, /* @__PURE__ */ jsxRuntimeExports.jsx(Dropdown2, {
13639
13641
  record,
@@ -19159,7 +19161,9 @@ const PVCRefColumnRenderer = (i18n2) => {
19159
19161
  resourceName: "persistentvolumeclaims",
19160
19162
  namespace: pv2.pvcNamespace || "default",
19161
19163
  name: value2,
19162
- uid: pv2.pvcUid
19164
+ query: {
19165
+ uid: pv2.pvcUid
19166
+ }
19163
19167
  });
19164
19168
  }
19165
19169
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dovetail-v2/refine",
3
- "version": "0.3.11-alpha.3",
3
+ "version": "0.3.12-alpha.1",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",