@blueking/ai-ui-sdk 0.1.2-beta.10 → 0.1.2-beta.13

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 (90) hide show
  1. package/dist/components/render-aside/index.vue.css +9 -9
  2. package/dist/components/render-aside/index.vue.js +1 -1
  3. package/dist/components/render-auth/auth-dialog-fn.d.ts +1 -1
  4. package/dist/components/render-auth/auth-dialog-fn.ts.js +2 -2
  5. package/dist/components/render-auth/auth-dialog.script.vue.js.js +7 -4
  6. package/dist/components/render-auth/auth-dialog.vue.d.ts +1 -1
  7. package/dist/components/render-auto-height-textarea/index.vue.css +11 -11
  8. package/dist/components/render-auto-height-textarea/index.vue.js +1 -1
  9. package/dist/components/render-choose-tag/index.vue.css +8 -8
  10. package/dist/components/render-choose-tag/index.vue.js +1 -1
  11. package/dist/components/render-collapse/index.vue.css +2 -2
  12. package/dist/components/render-collapse/index.vue.js +1 -1
  13. package/dist/components/render-dataset/components/edit-dataset-data/index.script.vue.js.js +159 -168
  14. package/dist/components/render-dataset/components/edit-dataset-data/index.vue.css +3 -3
  15. package/dist/components/render-dataset/components/edit-dataset-data/index.vue.d.ts +3 -0
  16. package/dist/components/render-dataset/components/edit-dataset-data/index.vue.js +1 -1
  17. package/dist/components/render-dataset/components/operation-record/index.script.vue.js.js +85 -89
  18. package/dist/components/render-dataset/components/operation-record/index.vue.css +4 -4
  19. package/dist/components/render-dataset/components/operation-record/index.vue.d.ts +6 -1
  20. package/dist/components/render-dataset/components/operation-record/index.vue.js +1 -1
  21. package/dist/components/render-dataset/components/operation-record/table/index.vue.css +1 -1
  22. package/dist/components/render-dataset/components/operation-record/table/index.vue.js +1 -1
  23. package/dist/components/render-dataset/components/operation-record/view-op-result/index.vue.css +2 -2
  24. package/dist/components/render-dataset/components/operation-record/view-op-result/index.vue.js +1 -1
  25. package/dist/components/render-dataset/components/plus-dataset/index.script.vue.js.js +54 -65
  26. package/dist/components/render-dataset/components/plus-dataset/index.vue.css +2 -2
  27. package/dist/components/render-dataset/components/plus-dataset/index.vue.d.ts +3 -0
  28. package/dist/components/render-dataset/components/plus-dataset/index.vue.js +1 -1
  29. package/dist/components/render-dataset/components/plus-dataset-data/form/dataset.script.vue.js.js +8 -2
  30. package/dist/components/render-dataset/components/plus-dataset-data/form/dataset.vue.d.ts +1 -0
  31. package/dist/components/render-dataset/components/plus-dataset-data/form/footer.vue.css +1 -1
  32. package/dist/components/render-dataset/components/plus-dataset-data/form/footer.vue.js +1 -1
  33. package/dist/components/render-dataset/components/plus-dataset-data/form/index.script.vue.js.js +11 -4
  34. package/dist/components/render-dataset/components/plus-dataset-data/form/index.vue.css +2 -2
  35. package/dist/components/render-dataset/components/plus-dataset-data/form/index.vue.d.ts +1 -0
  36. package/dist/components/render-dataset/components/plus-dataset-data/form/index.vue.js +1 -1
  37. package/dist/components/render-dataset/components/plus-dataset-data/index.script.vue.js.js +43 -7
  38. package/dist/components/render-dataset/components/plus-dataset-data/index.vue.d.ts +2 -0
  39. package/dist/components/render-dataset/components/source-type-icon/index.script.vue.js.js +2 -2
  40. package/dist/components/render-dataset/components/source-type-icon/index.vue.js +0 -2
  41. package/dist/components/render-dataset/index.script.vue.js.js +28 -5
  42. package/dist/components/render-dataset/index.vue.css +1 -1
  43. package/dist/components/render-dataset/index.vue.d.ts +1 -0
  44. package/dist/components/render-dataset/index.vue.js +1 -1
  45. package/dist/components/render-dataset-detail/components/header.script.vue.js.js +10 -36
  46. package/dist/components/render-dataset-detail/components/header.vue.d.ts +1 -3
  47. package/dist/components/render-dataset-detail/index.script.vue.js.js +85 -15
  48. package/dist/components/render-dataset-detail/index.vue.d.ts +1 -0
  49. package/dist/components/render-dataset-detail-origin-data/components/batch-operation/index.script.vue.js.js +40 -15
  50. package/dist/components/render-dataset-detail-origin-data/components/batch-operation/index.vue.d.ts +2 -0
  51. package/dist/components/render-dataset-detail-origin-data/components/table/index.script.vue.js +254 -172
  52. package/dist/components/render-dataset-detail-origin-data/components/table/index.vue.css +1 -1
  53. package/dist/components/render-dataset-detail-origin-data/components/table/index.vue.d.ts +1 -0
  54. package/dist/components/render-dataset-detail-origin-data/components/table/index.vue.js +1 -1
  55. package/dist/components/render-dataset-detail-origin-data/index.script.vue.js.js +20 -4
  56. package/dist/components/render-dataset-detail-origin-data/index.vue.css +3 -3
  57. package/dist/components/render-dataset-detail-origin-data/index.vue.d.ts +2 -0
  58. package/dist/components/render-dataset-detail-origin-data/index.vue.js +1 -1
  59. package/dist/components/render-dataset-list/components/main.script.vue.js.js +40 -14
  60. package/dist/components/render-dataset-list/components/main.vue.css +3 -3
  61. package/dist/components/render-dataset-list/components/main.vue.d.ts +2 -0
  62. package/dist/components/render-dataset-list/components/main.vue.js +1 -1
  63. package/dist/components/render-dataset-list/components/table.script.vue.js.js +405 -266
  64. package/dist/components/render-dataset-list/components/table.vue.d.ts +2 -0
  65. package/dist/components/render-dataset-list/index.script.vue.js.js +5 -2
  66. package/dist/components/render-dataset-list/index.vue.d.ts +2 -0
  67. package/dist/components/render-expand-collapse/index.vue.css +3 -3
  68. package/dist/components/render-expand-collapse/index.vue.js +1 -1
  69. package/dist/components/render-file-card/index.vue.css +11 -11
  70. package/dist/components/render-file-card/index.vue.js +1 -1
  71. package/dist/components/render-file-type-icon/index.vue.css +5 -5
  72. package/dist/components/render-file-type-icon/index.vue.js +1 -1
  73. package/dist/components/render-header/index.vue.css +5 -5
  74. package/dist/components/render-header/index.vue.js +1 -1
  75. package/dist/components/render-router-tab/index.vue.css +3 -3
  76. package/dist/components/render-router-tab/index.vue.js +1 -1
  77. package/dist/hooks/use-chat.d.ts +16 -0
  78. package/dist/hooks/use-chat.ts.js +1 -1
  79. package/dist/hooks/use-dataset-http.d.ts +1 -1
  80. package/dist/hooks/use-dataset-http.ts.js +6 -3
  81. package/dist/hooks/use-permission-http.ts.js +2 -2
  82. package/dist/http/fetch/error-interceptor.ts.js +1 -6
  83. package/dist/http/helper/dataset.ts.js +7 -2
  84. package/dist/http/helper/permission.ts.js +3 -1
  85. package/dist/types/dataset.d.ts +7 -1
  86. package/dist/types/enum.d.ts +5 -2
  87. package/dist/types/enum.ts.js +3 -0
  88. package/dist/types/permission.d.ts +4 -1
  89. package/package.json +1 -1
  90. package/dist/components/render-dataset/components/source-type-icon/index.vue.css +0 -10
@@ -1,7 +1,9 @@
1
1
  import { defineComponent as _defineComponent } from 'vue';
2
2
  import { createTextVNode as _createTextVNode, resolveComponent as _resolveComponent, mergeProps as _mergeProps, withCtx as _withCtx, createVNode as _createVNode, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
3
- import { ref } from 'vue';
3
+ import { ref, toRef } from 'vue';
4
4
  import RenderForm from './form/index.vue.js';
5
+ import { ResourcePermissionAction } from '../../../../enums.ts.js';
6
+ import { usePermission } from '../../../../hooks/use-permission.ts.js';
5
7
  export default /*@__PURE__*/ _defineComponent({
6
8
  props: {
7
9
  datasetData: {},
@@ -9,14 +11,38 @@ export default /*@__PURE__*/ _defineComponent({
9
11
  type: Boolean
10
12
  },
11
13
  apiPrefix: {},
12
- spaceId: {}
14
+ spaceId: {},
15
+ manageDataset: {
16
+ type: Boolean
17
+ },
18
+ isInternal: {
19
+ type: Boolean
20
+ }
13
21
  },
14
22
  emits: [
15
23
  "success-plus"
16
24
  ],
17
25
  setup (__props, { emit: __emit }) {
26
+ const props = __props;
18
27
  const emits = __emit;
28
+ const { handleMouseEnter, handleMouseMove, handleMouseLeave, handleMouseClick } = usePermission(props.apiPrefix, toRef(props, 'spaceId'), '#4d4f56');
19
29
  const isShow = ref(false);
30
+ const handlePermissionMouseEnter = ()=>{
31
+ handleMouseEnter(props.manageDataset);
32
+ };
33
+ const handlePermissionMouseMove = (event)=>{
34
+ handleMouseMove(event, props.manageDataset);
35
+ };
36
+ const handlePermissionMouseLeave = ()=>{
37
+ handleMouseLeave();
38
+ };
39
+ const handlePermissionMouseClick = (callback)=>{
40
+ var _props_datasetData;
41
+ handleMouseClick(callback, props.manageDataset, [
42
+ ResourcePermissionAction.ManageDataset,
43
+ ResourcePermissionAction.ViewDataset
44
+ ], (_props_datasetData = props.datasetData) === null || _props_datasetData === void 0 ? void 0 : _props_datasetData.datasetId);
45
+ };
20
46
  const handleShowForm = ()=>{
21
47
  isShow.value = true;
22
48
  };
@@ -27,23 +53,32 @@ export default /*@__PURE__*/ _defineComponent({
27
53
  const _component_bk_button = _resolveComponent("bk-button");
28
54
  return _openBlock(), _createElementBlock(_Fragment, null, [
29
55
  _createVNode(_component_bk_button, _mergeProps(_ctx.$attrs, {
56
+ class: {
57
+ 'g-disabled': !_ctx.manageDataset
58
+ },
30
59
  theme: "primary",
31
- onClick: handleShowForm
60
+ onMouseenter: handlePermissionMouseEnter,
61
+ onMousemove: handlePermissionMouseMove,
62
+ onMouseleave: handlePermissionMouseLeave,
63
+ onClick: _cache[0] || (_cache[0] = ($event)=>handlePermissionMouseClick(handleShowForm))
32
64
  }), {
33
- default: _withCtx(()=>_cache[1] || (_cache[1] = [
65
+ default: _withCtx(()=>_cache[2] || (_cache[2] = [
34
66
  _createTextVNode(" 添加数据 ")
35
67
  ])),
36
68
  _: 1 /* STABLE */ ,
37
69
  __: [
38
- 1
70
+ 2
39
71
  ]
40
- }, 16 /* FULL_PROPS */ ),
72
+ }, 16 /* FULL_PROPS */ , [
73
+ "class"
74
+ ]),
41
75
  _createVNode(RenderForm, {
42
76
  "is-show": isShow.value,
43
- "onUpdate:isShow": _cache[0] || (_cache[0] = ($event)=>isShow.value = $event),
77
+ "onUpdate:isShow": _cache[1] || (_cache[1] = ($event)=>isShow.value = $event),
44
78
  "dataset-data": _ctx.datasetData,
45
79
  "api-prefix": _ctx.apiPrefix,
46
80
  "space-id": _ctx.spaceId,
81
+ "is-internal": _ctx.isInternal,
47
82
  "disabled-choose-dataset": _ctx.disabledChooseDataset,
48
83
  onSuccessConfirm: handleSuccessPlus
49
84
  }, null, 8 /* PROPS */ , [
@@ -51,6 +86,7 @@ export default /*@__PURE__*/ _defineComponent({
51
86
  "dataset-data",
52
87
  "api-prefix",
53
88
  "space-id",
89
+ "is-internal",
54
90
  "disabled-choose-dataset"
55
91
  ])
56
92
  ], 64 /* STABLE_FRAGMENT */ );
@@ -4,6 +4,8 @@ interface IProps {
4
4
  disabledChooseDataset?: boolean;
5
5
  apiPrefix: string;
6
6
  spaceId?: string;
7
+ manageDataset: boolean;
8
+ isInternal?: boolean;
7
9
  }
8
10
  declare const _default: import("vue").DefineComponent<IProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
9
11
  "success-plus": () => any;
@@ -12,10 +12,10 @@ export default /*@__PURE__*/ _defineComponent({
12
12
  let icon = '';
13
13
  switch(props.sourceType){
14
14
  case DatasetDataSourceType.UploadFile:
15
- icon = 'ai-ui-sdk-icon ai-ui-sdk-wenben';
15
+ icon = 'ai-ui-sdk-icon ai-ui-sdk-wenben g-text-14 g-mr-2 g-text-gray';
16
16
  break;
17
17
  case DatasetDataSourceType.ManualImport:
18
- icon = 'ai-ui-sdk-icon ai-ui-sdk-markdown';
18
+ icon = 'ai-ui-sdk-icon ai-ui-sdk-markdown g-text-14 g-mr-2 g-text-gray';
19
19
  break;
20
20
  }
21
21
  return icon;
@@ -1,5 +1,3 @@
1
1
  import script from './index.script.vue.js.js';
2
- script.__scopeId = "data-v-qvtfc8ig";
3
2
  script.__file = "./src/components/render-dataset/components/source-type-icon/index.vue";
4
- import './index.vue.css';
5
3
  export default script;
@@ -7,17 +7,22 @@ const _hoisted_2 = {
7
7
  class: "dataset-main"
8
8
  };
9
9
  import { ref, toRef, watch } from 'vue';
10
- import { useRouter } from 'vue-router';
10
+ import { useRoute, useRouter } from 'vue-router';
11
11
  import RenderAside from '../render-aside/index.vue.js';
12
12
  import RenderExpandCollapse from '../render-expand-collapse/index.vue.js';
13
13
  import { useDatasetHttp } from '../../hooks/use-dataset-http.ts.js';
14
+ import { EnumCharacter } from '../../types/enum.ts.js';
14
15
  export default /*@__PURE__*/ _defineComponent({
15
16
  props: {
16
17
  apiPrefix: {},
17
- spaceId: {}
18
+ spaceId: {},
19
+ isInternal: {
20
+ type: Boolean
21
+ }
18
22
  },
19
23
  setup (__props) {
20
24
  const props = __props;
25
+ const route = useRoute();
21
26
  const router = useRouter();
22
27
  const { getDatasetMineInfo } = useDatasetHttp(props.apiPrefix, toRef(props, 'spaceId'));
23
28
  const tabs = ref([
@@ -25,20 +30,30 @@ export default /*@__PURE__*/ _defineComponent({
25
30
  name: '数据集',
26
31
  children: [
27
32
  {
28
- id: 'all',
33
+ id: EnumCharacter.All,
29
34
  name: '全部数据集',
30
35
  number: 0
31
- }
36
+ },
37
+ ...props.isInternal ? [
38
+ {
39
+ id: EnumCharacter.User,
40
+ name: '我的数据集',
41
+ number: 0
42
+ }
43
+ ] : []
32
44
  ]
33
45
  }
34
46
  ]);
35
- const tabId = ref('all');
47
+ const tabId = ref(EnumCharacter.All);
36
48
  const isOpen = ref(true);
37
49
  const loading = ref(false);
38
50
  const handleGetDatasetMineInfo = ()=>{
39
51
  loading.value = true;
40
52
  getDatasetMineInfo().then((data)=>{
41
53
  tabs.value[0].children[0].number = data.all;
54
+ if (props.isInternal) {
55
+ tabs.value[0].children[1].number = data.user;
56
+ }
42
57
  }).finally(()=>{
43
58
  loading.value = false;
44
59
  });
@@ -58,6 +73,14 @@ export default /*@__PURE__*/ _defineComponent({
58
73
  watch(()=>props.spaceId, handleGetDatasetMineInfo, {
59
74
  immediate: true
60
75
  });
76
+ const handleTabChange = ()=>{
77
+ if (route.name !== 'dataset-list') {
78
+ router.push({
79
+ name: 'dataset-list'
80
+ });
81
+ }
82
+ };
83
+ watch(()=>tabId.value, handleTabChange);
61
84
  return (_ctx, _cache)=>{
62
85
  const _component_router_view = _resolveComponent("router-view");
63
86
  const _directive_bkloading = _resolveDirective("bkloading");
@@ -1,5 +1,5 @@
1
1
 
2
- .dataset-main[data-v-6oehxwas] {
2
+ .dataset-main[data-v-ie4hcnqc] {
3
3
  flex: 1;
4
4
  width: calc(100vw - 300px);
5
5
  height: 100%;
@@ -1,6 +1,7 @@
1
1
  interface IProps {
2
2
  apiPrefix: string;
3
3
  spaceId?: string;
4
+ isInternal?: boolean;
4
5
  }
5
6
  declare const _default: import("vue").DefineComponent<IProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<IProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
7
  export default _default;
@@ -1,5 +1,5 @@
1
1
  import script from './index.script.vue.js.js';
2
- script.__scopeId = "data-v-6oehxwas";
2
+ script.__scopeId = "data-v-ie4hcnqc";
3
3
  script.__file = "./src/components/render-dataset/index.vue";
4
4
  import './index.vue.css';
5
5
  export default script;
@@ -1,61 +1,35 @@
1
1
  import { defineComponent as _defineComponent } from 'vue';
2
- import { createElementVNode as _createElementVNode, toDisplayString as _toDisplayString, resolveComponent as _resolveComponent, withCtx as _withCtx, createVNode as _createVNode, openBlock as _openBlock, createBlock as _createBlock } from "vue";
2
+ import { createElementVNode as _createElementVNode, toDisplayString as _toDisplayString, withCtx as _withCtx, openBlock as _openBlock, createBlock as _createBlock } from "vue";
3
3
  const _hoisted_1 = {
4
+ class: "g-flex-row g-height-full g-ml-24"
5
+ };
6
+ const _hoisted_2 = {
4
7
  class: "g-text-16 g-text-black"
5
8
  };
6
- import { onBeforeMount, ref, toRef } from 'vue';
7
9
  import { useRouter } from 'vue-router';
8
10
  import RenderHeader from '../../render-header/index.vue.js';
9
- import { useDatasetHttp } from '../../../hooks/use-dataset-http.ts.js';
10
11
  export default /*@__PURE__*/ _defineComponent({
11
12
  props: {
12
- apiPrefix: {},
13
- datasetId: {},
14
- spaceId: {}
13
+ datasetName: {}
15
14
  },
16
15
  setup (__props) {
17
- const props = __props;
18
- const { getDataset } = useDatasetHttp(props.apiPrefix, toRef(props, 'spaceId'));
19
16
  const router = useRouter();
20
- const loading = ref(false);
21
- const dataset = ref();
22
17
  const handleGoToList = ()=>{
23
18
  router.push({
24
19
  name: 'dataset-list'
25
20
  });
26
21
  };
27
- const handleInit = ()=>{
28
- loading.value = true;
29
- getDataset(props.datasetId).then((data)=>{
30
- dataset.value = data;
31
- }).finally(()=>{
32
- loading.value = false;
33
- });
34
- };
35
- onBeforeMount(handleInit);
36
22
  return (_ctx, _cache)=>{
37
- const _component_bk_loading = _resolveComponent("bk-loading");
38
23
  return _openBlock(), _createBlock(RenderHeader, {
39
24
  "show-search": false
40
25
  }, {
41
26
  title: _withCtx(()=>[
42
- _createVNode(_component_bk_loading, {
43
- class: "g-flex-row g-height-full g-ml-24",
44
- loading: loading.value
45
- }, {
46
- default: _withCtx(()=>{
47
- var _dataset_value;
48
- return [
49
- _createElementVNode("i", {
50
- class: "ai-ui-sdk-icon ai-ui-sdk-arrow-left g-text-20 g-text-blue g-cursor-pointer g-mr-8",
51
- onClick: handleGoToList
52
- }),
53
- _createElementVNode("span", _hoisted_1, _toDisplayString((_dataset_value = dataset.value) === null || _dataset_value === void 0 ? void 0 : _dataset_value.datasetName), 1 /* TEXT */ )
54
- ];
27
+ _createElementVNode("section", _hoisted_1, [
28
+ _createElementVNode("i", {
29
+ class: "ai-ui-sdk-icon ai-ui-sdk-arrow-left g-text-20 g-text-blue g-cursor-pointer g-mr-8",
30
+ onClick: handleGoToList
55
31
  }),
56
- _: 1 /* STABLE */
57
- }, 8 /* PROPS */ , [
58
- "loading"
32
+ _createElementVNode("span", _hoisted_2, _toDisplayString(_ctx.datasetName), 1 /* TEXT */ )
59
33
  ])
60
34
  ]),
61
35
  _: 1 /* STABLE */
@@ -1,7 +1,5 @@
1
1
  interface IProps {
2
- apiPrefix: string;
3
- datasetId: number;
4
- spaceId?: string;
2
+ datasetName: string;
5
3
  }
6
4
  declare const _default: import("vue").DefineComponent<IProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<IProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
7
5
  export default _default;
@@ -1,29 +1,99 @@
1
1
  import { defineComponent as _defineComponent } from 'vue';
2
- import { createVNode as _createVNode, resolveComponent as _resolveComponent, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
2
+ import { createVNode as _createVNode, resolveDynamicComponent as _resolveDynamicComponent, openBlock as _openBlock, createBlock as _createBlock, resolveComponent as _resolveComponent, withCtx as _withCtx, Fragment as _Fragment, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode } from "vue";
3
+ import { Message } from 'bkui-vue';
4
+ import { onBeforeMount, ref, toRef } from 'vue';
5
+ import { useRouter } from 'vue-router';
3
6
  import RenderHeader from './components/header.vue.js';
4
7
  import RenderTab from './components/tab.vue.js';
8
+ import { useDatasetHttp } from '../../hooks/use-dataset-http.ts.js';
9
+ import { HttpErrorCode } from '../../types/enum.ts.js';
5
10
  export default /*@__PURE__*/ _defineComponent({
6
11
  props: {
7
12
  apiPrefix: {},
8
13
  datasetId: {},
9
- spaceId: {}
14
+ spaceId: {},
15
+ isInternal: {
16
+ type: Boolean
17
+ }
10
18
  },
11
19
  setup (__props) {
20
+ const props = __props;
21
+ const router = useRouter();
22
+ const loading = ref(false);
23
+ const dataset = ref();
24
+ const { getDataset } = useDatasetHttp(props.apiPrefix, toRef(props, 'spaceId'));
25
+ const handleGoToNotFound = ()=>{
26
+ router.push({
27
+ name: 'dataset-detail-not-found'
28
+ });
29
+ };
30
+ const handleNoPermission = (data)=>{
31
+ const cancelCallback = ()=>{
32
+ router.push({
33
+ name: 'dataset-list'
34
+ });
35
+ };
36
+ import('../render-auth/auth-dialog-fn.ts.js').then(({ renderAuthDialog })=>{
37
+ renderAuthDialog(data, cancelCallback);
38
+ });
39
+ };
40
+ const handleInit = ()=>{
41
+ loading.value = true;
42
+ getDataset(props.datasetId).then((data)=>{
43
+ dataset.value = data;
44
+ }).catch((error)=>{
45
+ if (error.code === HttpErrorCode.NotFound) {
46
+ handleGoToNotFound();
47
+ } else if (error.code === HttpErrorCode.IamNoPermission) {
48
+ handleNoPermission(error.response);
49
+ } else {
50
+ Message({
51
+ theme: 'error',
52
+ message: error.message,
53
+ width: 'auto'
54
+ });
55
+ }
56
+ }).finally(()=>{
57
+ loading.value = false;
58
+ });
59
+ };
60
+ onBeforeMount(handleInit);
12
61
  return (_ctx, _cache)=>{
13
62
  const _component_router_view = _resolveComponent("router-view");
14
- return _openBlock(), _createElementBlock(_Fragment, null, [
15
- _createVNode(RenderHeader, {
16
- "api-prefix": _ctx.apiPrefix,
17
- "dataset-id": _ctx.datasetId,
18
- "space-id": _ctx.spaceId
19
- }, null, 8 /* PROPS */ , [
20
- "api-prefix",
21
- "dataset-id",
22
- "space-id"
23
- ]),
24
- _createVNode(RenderTab),
25
- _createVNode(_component_router_view)
26
- ], 64 /* STABLE_FRAGMENT */ );
63
+ const _component_bk_loading = _resolveComponent("bk-loading");
64
+ return _openBlock(), _createBlock(_component_bk_loading, {
65
+ class: "g-height-full",
66
+ loading: loading.value
67
+ }, {
68
+ default: _withCtx(()=>[
69
+ dataset.value ? (_openBlock(), _createElementBlock(_Fragment, {
70
+ key: 0
71
+ }, [
72
+ _createVNode(RenderHeader, {
73
+ "dataset-name": dataset.value.datasetName
74
+ }, null, 8 /* PROPS */ , [
75
+ "dataset-name"
76
+ ]),
77
+ _createVNode(RenderTab),
78
+ _createVNode(_component_router_view, null, {
79
+ default: _withCtx(({ Component })=>{
80
+ var _dataset_value_permission;
81
+ return [
82
+ (_openBlock(), _createBlock(_resolveDynamicComponent(Component), {
83
+ "manage-dataset": ((_dataset_value_permission = dataset.value.permission) === null || _dataset_value_permission === void 0 ? void 0 : _dataset_value_permission.manageDataset) || !_ctx.isInternal
84
+ }, null, 8 /* PROPS */ , [
85
+ "manage-dataset"
86
+ ]))
87
+ ];
88
+ }),
89
+ _: 1 /* STABLE */
90
+ })
91
+ ], 64 /* STABLE_FRAGMENT */ )) : _createCommentVNode("v-if", true)
92
+ ]),
93
+ _: 1 /* STABLE */
94
+ }, 8 /* PROPS */ , [
95
+ "loading"
96
+ ]);
27
97
  };
28
98
  }
29
99
  });
@@ -2,6 +2,7 @@ interface IProps {
2
2
  apiPrefix: string;
3
3
  datasetId: number;
4
4
  spaceId?: string;
5
+ isInternal?: boolean;
5
6
  }
6
7
  declare const _default: import("vue").DefineComponent<IProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<IProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
7
8
  export default _default;
@@ -1,13 +1,19 @@
1
1
  import { defineComponent as _defineComponent } from 'vue';
2
- import { unref as _unref, createVNode as _createVNode, createTextVNode as _createTextVNode, resolveComponent as _resolveComponent, withCtx as _withCtx, createElementVNode as _createElementVNode, normalizeClass as _normalizeClass, resolveDirective as _resolveDirective, openBlock as _openBlock, createElementBlock as _createElementBlock, withDirectives as _withDirectives, createBlock as _createBlock } from "vue";
2
+ import { unref as _unref, createVNode as _createVNode, createTextVNode as _createTextVNode, resolveComponent as _resolveComponent, withCtx as _withCtx, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, resolveDirective as _resolveDirective, openBlock as _openBlock, createElementBlock as _createElementBlock, withDirectives as _withDirectives, createBlock as _createBlock } from "vue";
3
3
  import { AngleDown } from 'bkui-vue/lib/icon';
4
4
  import { ref, toRef } from 'vue';
5
5
  import { useDatasetHttp } from '../../../../hooks/use-dataset-http.ts.js';
6
+ import { usePermission } from '../../../../hooks/use-permission.ts.js';
7
+ import { ResourcePermissionAction } from '../../../../types/enum.ts.js';
6
8
  export default /*@__PURE__*/ _defineComponent({
7
9
  props: {
8
10
  selectedDatasetDatas: {},
9
11
  apiPrefix: {},
10
- spaceId: {}
12
+ spaceId: {},
13
+ datasetId: {},
14
+ manageDataset: {
15
+ type: Boolean
16
+ }
11
17
  },
12
18
  emits: [
13
19
  "update:selectedDatasetDatas",
@@ -17,7 +23,18 @@ export default /*@__PURE__*/ _defineComponent({
17
23
  const props = __props;
18
24
  const emits = __emit;
19
25
  const { batchDeleteDatasetData } = useDatasetHttp(props.apiPrefix, toRef(props, 'spaceId'));
26
+ const { handleMouseEnter, handleMouseMove, handleMouseLeave, handleMouseClick } = usePermission(props.apiPrefix, toRef(props, 'spaceId'), '#4d4f56');
20
27
  const showMore = ref(false);
28
+ const deleteRef = ref();
29
+ const handlePermissionMouseClick = ()=>{
30
+ handleMouseClick(handleShowDelete, props.manageDataset, [
31
+ ResourcePermissionAction.ManageDataset,
32
+ ResourcePermissionAction.ViewDataset
33
+ ], props.datasetId);
34
+ };
35
+ const handleShowDelete = ()=>{
36
+ deleteRef.value.popoverRef.show();
37
+ };
21
38
  const handleShowMore = ()=>{
22
39
  showMore.value = true;
23
40
  };
@@ -25,7 +42,7 @@ export default /*@__PURE__*/ _defineComponent({
25
42
  showMore.value = false;
26
43
  };
27
44
  const handleDeleteDatasetDatas = ()=>{
28
- batchDeleteDatasetData(props.selectedDatasetDatas.map((item)=>item.id)).then(()=>{
45
+ batchDeleteDatasetData(props.selectedDatasetDatas.map((item)=>item.id), props.datasetId).then(()=>{
29
46
  emits('update:selectedDatasetDatas', []);
30
47
  emits('success-delete');
31
48
  });
@@ -52,21 +69,29 @@ export default /*@__PURE__*/ _defineComponent({
52
69
  })
53
70
  }, [
54
71
  _createVNode(_component_bk_pop_confirm, {
55
- trigger: "click",
72
+ trigger: "manual",
56
73
  title: "确认删除?",
57
74
  content: "删除操作无法撤回,请谨慎操作!",
58
- "ext-cls": "g-confirm-delete",
59
75
  placement: "right",
76
+ "ext-cls": "g-confirm-delete",
77
+ ref_key: "deleteRef",
78
+ ref: deleteRef,
60
79
  onConfirm: handleDeleteDatasetDatas
61
80
  }, {
62
- default: _withCtx(()=>_cache[1] || (_cache[1] = [
63
- _createElementVNode("li", null, " 删除数据 ", -1 /* HOISTED */ )
64
- ])),
65
- _: 1 /* STABLE */ ,
66
- __: [
67
- 1
68
- ]
69
- })
81
+ default: _withCtx(()=>[
82
+ _createElementVNode("li", {
83
+ class: _normalizeClass({
84
+ 'g-disabled': !_ctx.manageDataset
85
+ }),
86
+ onMouseenter: _cache[0] || (_cache[0] = ($event)=>_unref(handleMouseEnter)(_ctx.manageDataset)),
87
+ onMousemove: _cache[1] || (_cache[1] = (event)=>_unref(handleMouseMove)(event, _ctx.manageDataset)),
88
+ onMouseleave: _cache[2] || (_cache[2] = //@ts-ignore
89
+ (...args)=>_unref(handleMouseLeave) && _unref(handleMouseLeave)(...args)),
90
+ onClick: handlePermissionMouseClick
91
+ }, " 删除 ", 34 /* CLASS, NEED_HYDRATION */ )
92
+ ]),
93
+ _: 1 /* STABLE */
94
+ }, 512 /* NEED_PATCH */ )
70
95
  ], 2 /* CLASS */ )), [
71
96
  [
72
97
  _directive_clickoutside,
@@ -80,14 +105,14 @@ export default /*@__PURE__*/ _defineComponent({
80
105
  onClick: handleShowMore
81
106
  }, {
82
107
  default: _withCtx(()=>[
83
- _cache[0] || (_cache[0] = _createTextVNode(" 批量操作 ")),
108
+ _cache[3] || (_cache[3] = _createTextVNode(" 批量操作 ")),
84
109
  _createVNode(_unref(AngleDown), {
85
110
  class: "g-text-22"
86
111
  })
87
112
  ]),
88
113
  _: 1 /* STABLE */ ,
89
114
  __: [
90
- 0
115
+ 3
91
116
  ]
92
117
  }, 8 /* PROPS */ , [
93
118
  "disabled"
@@ -3,6 +3,8 @@ interface IProps {
3
3
  selectedDatasetDatas: IDatasetData[];
4
4
  apiPrefix: string;
5
5
  spaceId?: string;
6
+ datasetId: number;
7
+ manageDataset: boolean;
6
8
  }
7
9
  declare const _default: import("vue").DefineComponent<IProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
8
10
  "update:selectedDatasetDatas": (selectedDatasetDatas: IDatasetData[]) => any;