From 0cf64d23162013f0a625b3e6f51c19e01c3b9c26 Mon Sep 17 00:00:00 2001 From: "chen.zhang" <422734124@qq.com> Date: Wed, 4 Dec 2024 16:31:56 +0800 Subject: [PATCH 1/6] =?UTF-8?q?perf:=20=E8=AF=81=E4=B9=A6=E5=88=9B?= =?UTF-8?q?=E5=BB=BA-=E8=B4=A6=E5=8F=B7=E7=9A=84=E9=80=89=E6=8B=A9?= =?UTF-8?q?=EF=BC=8C=E6=9B=BF=E6=8D=A2=E4=B8=BA=E7=BB=84=E4=BB=B6=20--stor?= =?UTF-8?q?y=3D121038957?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/src/views/business/cert-manager/index.tsx | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/front/src/views/business/cert-manager/index.tsx b/front/src/views/business/cert-manager/index.tsx index e5d868d893..24af2b68cb 100644 --- a/front/src/views/business/cert-manager/index.tsx +++ b/front/src/views/business/cert-manager/index.tsx @@ -11,7 +11,7 @@ import { useResourceAccountStore } from '@/store/useResourceAccountStore'; import useColumns from '@/views/resource/resource-manage/hooks/use-columns'; import useSelection from '@/views/resource/resource-manage/hooks/use-selection'; import CommonSideslider from '@/components/common-sideslider'; -import AccountSelector from '@/components/account-selector/index.vue'; +import AccountSelector from '@/components/account-selector/index-new.vue'; import { BatchDistribution, DResourceType } from '@/views/resource/resource-manage/children/dialog/batch-distribution'; import Confirm from '@/components/confirm'; import { getTableNewRowClass } from '@/common/util'; @@ -173,14 +173,7 @@ export default defineComponent({ label: '云账号', property: 'account_id', required: true, - content: () => ( - - ), + content: () => , }, { label: '证书名称', From 68cf14d1be2db6c7ee51dce72495287f50fc5eab Mon Sep 17 00:00:00 2001 From: "chen.zhang" <422734124@qq.com> Date: Fri, 6 Dec 2024 19:17:05 +0800 Subject: [PATCH 2/6] =?UTF-8?q?feat:=20=E6=89=B9=E9=87=8F=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E8=B7=9F=E5=A4=8D=E5=88=B6=E5=88=86=E5=BC=80=E6=9D=A5?= =?UTF-8?q?=20--story=3D121039445?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/src/components/drop-down-menu/index.vue | 106 ++++++++++++++++++ front/src/typings/common.ts | 5 + .../host/children/host-operations/index.tsx | 71 +++++------- .../common/table/HostOperations.tsx | 59 ++++------ 4 files changed, 163 insertions(+), 78 deletions(-) create mode 100644 front/src/components/drop-down-menu/index.vue diff --git a/front/src/components/drop-down-menu/index.vue b/front/src/components/drop-down-menu/index.vue new file mode 100644 index 0000000000..6c71124a01 --- /dev/null +++ b/front/src/components/drop-down-menu/index.vue @@ -0,0 +1,106 @@ + + + diff --git a/front/src/typings/common.ts b/front/src/typings/common.ts index c0cd4dab1f..b0dac39cb8 100644 --- a/front/src/typings/common.ts +++ b/front/src/typings/common.ts @@ -93,3 +93,8 @@ export interface IBreadcrumb { title: string; display: boolean; } + +export interface DropDownPopover { + trigger: 'manual' | 'click' | 'hover'; + forceClickoutside: boolean; +} diff --git a/front/src/views/business/host/children/host-operations/index.tsx b/front/src/views/business/host/children/host-operations/index.tsx index 270f27ad32..4e6c18c432 100644 --- a/front/src/views/business/host/children/host-operations/index.tsx +++ b/front/src/views/business/host/children/host-operations/index.tsx @@ -1,12 +1,10 @@ import { PropType, defineComponent, reactive, ref, watch, computed, toRefs } from 'vue'; -import { Button, Dialog, Dropdown, Loading } from 'bkui-vue'; +import { Button, Dialog, Loading } from 'bkui-vue'; import cssModule from './index.module.scss'; -import { AngleDown } from 'bkui-vue/lib/icon'; -import { BkDropdownItem, BkDropdownMenu } from 'bkui-vue/lib/dropdown'; import CommonLocalTable from '@/components/LocalTable'; -import CopyToClipboard from '@/components/copy-to-clipboard/index.vue'; import { BkButtonGroup } from 'bkui-vue/lib/button'; import useBatchOperation from './use-batch-operation'; +import DropDownMenu from '@/components/drop-down-menu/index.vue'; export const HOST_SHUTDOWN_STATUS = [ 'TERMINATED', @@ -70,6 +68,14 @@ export const operationMap = { }, }; +const validOperationMap = Object.entries(operationMap) + .filter(([opType]) => opType !== OperationActions.NONE) + .reduce((prev: any, cur) => { + const [key, value] = cur; + prev[key] = value?.label ?? ''; + return prev; + }, {}); + export default defineComponent({ props: { selections: { @@ -148,42 +154,27 @@ export default defineComponent({ return () => ( <> -
- - {{ - default: () => ( - - ), - content: () => ( - - {Object.entries(operationMap) - .filter(([opType]) => opType !== OperationActions.NONE) - .map(([opType, opData]) => ( - { - operationType.value = opType as OperationActions; - }}> - {`批量${opData.label}`} - - ))} - - - - ), - }} - -
+ (operationType.value = value as OperationActions)}> + + ( <> -
- - {{ - default: () => ( - - ), - content: () => ( - - {Object.entries(OperationsMap).map(([opType, opName]) => ( - { - operationType.value = opType as Operations; - }}> - {`批量${opName}`} - - ))} - - - - ), - }} - -
+ (operationType.value = value as Operations)}> + + Date: Tue, 10 Dec 2024 17:10:07 +0800 Subject: [PATCH 3/6] =?UTF-8?q?perf:=20=E7=BB=84=E4=BB=B6=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/src/components/drop-down-menu/index.vue | 106 ------------------ front/src/components/dropdown-menu/index.vue | 74 ++++++++++++ front/src/typings/common.ts | 5 - .../host/children/host-operations/index.tsx | 84 +++++++++----- .../common/table/HostOperations.tsx | 71 ++++++++---- 5 files changed, 182 insertions(+), 158 deletions(-) delete mode 100644 front/src/components/drop-down-menu/index.vue create mode 100644 front/src/components/dropdown-menu/index.vue diff --git a/front/src/components/drop-down-menu/index.vue b/front/src/components/drop-down-menu/index.vue deleted file mode 100644 index 6c71124a01..0000000000 --- a/front/src/components/drop-down-menu/index.vue +++ /dev/null @@ -1,106 +0,0 @@ - - - diff --git a/front/src/components/dropdown-menu/index.vue b/front/src/components/dropdown-menu/index.vue new file mode 100644 index 0000000000..1917e5bd1a --- /dev/null +++ b/front/src/components/dropdown-menu/index.vue @@ -0,0 +1,74 @@ + + + diff --git a/front/src/typings/common.ts b/front/src/typings/common.ts index b0dac39cb8..c0cd4dab1f 100644 --- a/front/src/typings/common.ts +++ b/front/src/typings/common.ts @@ -93,8 +93,3 @@ export interface IBreadcrumb { title: string; display: boolean; } - -export interface DropDownPopover { - trigger: 'manual' | 'click' | 'hover'; - forceClickoutside: boolean; -} diff --git a/front/src/views/business/host/children/host-operations/index.tsx b/front/src/views/business/host/children/host-operations/index.tsx index 4e6c18c432..c4bef27259 100644 --- a/front/src/views/business/host/children/host-operations/index.tsx +++ b/front/src/views/business/host/children/host-operations/index.tsx @@ -1,10 +1,13 @@ import { PropType, defineComponent, reactive, ref, watch, computed, toRefs } from 'vue'; import { Button, Dialog, Loading } from 'bkui-vue'; import cssModule from './index.module.scss'; +import { AngleDown } from 'bkui-vue/lib/icon'; +import { BkDropdownItem } from 'bkui-vue/lib/dropdown'; import CommonLocalTable from '@/components/LocalTable'; +import CopyToClipboard from '@/components/copy-to-clipboard/index.vue'; import { BkButtonGroup } from 'bkui-vue/lib/button'; import useBatchOperation from './use-batch-operation'; -import DropDownMenu from '@/components/drop-down-menu/index.vue'; +import DropDownMenu from '@/components/dropdown-menu/index.vue'; export const HOST_SHUTDOWN_STATUS = [ 'TERMINATED', @@ -68,14 +71,6 @@ export const operationMap = { }, }; -const validOperationMap = Object.entries(operationMap) - .filter(([opType]) => opType !== OperationActions.NONE) - .reduce((prev: any, cur) => { - const [key, value] = cur; - prev[key] = value?.label ?? ''; - return prev; - }, {}); - export default defineComponent({ props: { selections: { @@ -95,6 +90,7 @@ export default defineComponent({ }, setup(props) { const dialogRef = ref(null); + const operationRef = ref(null); const { selections } = toRefs(props); @@ -155,26 +151,58 @@ export default defineComponent({ return () => ( <> (operationType.value = value as OperationActions)}> + ref={operationRef} + class={cssModule.host_operations_container} + disabled={operationsDisabled.value}> + {{ + default: () => ( + <> + 批量操作 + + + ), + menuItem: () => ( + <> + {Object.entries(operationMap) + .filter(([opType]) => opType !== OperationActions.NONE) + .map(([opType, opData]) => ( + { + operationType.value = opType as OperationActions; + operationRef.value?.hidePopover(); + }}> + {`批量${opData.label}`} + + ))} + + ), + }} + - + + {{ + default: () => ( + <> + 复制 + + + ), + menuItem: () => ( + <> + + + + ), + }} + (Operations.None); const dialogRef = ref(null); + const operationRef = ref(null); const isConfirmDisabled = ref(true); const targetHost = ref([]); const unTargetHost = ref([]); @@ -385,25 +389,54 @@ export default defineComponent({ return () => ( <> - (operationType.value = value as Operations)}> + + {{ + default: () => ( + <> + 批量操作 + + + ), + menuItem: () => ( + <> + {Object.entries(OperationsMap).map(([opType, opName]) => ( + { + operationType.value = opType as Operations; + operationRef.value?.hidePopover(); + }}> + {`批量${opName}`} + + ))} + + ), + }} + - + + {{ + default: () => ( + <> + 复制 + + + ), + menuItem: () => ( + <> + + + + ), + }} + Date: Tue, 10 Dec 2024 17:57:33 +0800 Subject: [PATCH 4/6] =?UTF-8?q?perf:=20=E5=A4=8D=E5=88=B6=E6=88=90?= =?UTF-8?q?=E5=8A=9F=E5=90=8E=E4=B8=8B=E6=8B=89=E5=B1=82=E6=B6=88=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{dropdown-menu => hcm-dropdown}/index.vue | 10 ++++------ .../host/children/host-operations/index.tsx | 11 +++++++---- .../common/table/HostOperations.tsx | 17 ++++++++++------- 3 files changed, 21 insertions(+), 17 deletions(-) rename front/src/components/{dropdown-menu => hcm-dropdown}/index.vue (82%) diff --git a/front/src/components/dropdown-menu/index.vue b/front/src/components/hcm-dropdown/index.vue similarity index 82% rename from front/src/components/dropdown-menu/index.vue rename to front/src/components/hcm-dropdown/index.vue index 1917e5bd1a..2e3d1db2bb 100644 --- a/front/src/components/dropdown-menu/index.vue +++ b/front/src/components/hcm-dropdown/index.vue @@ -3,7 +3,6 @@ import { ref } from 'vue'; export interface DropDownPopover { trigger: 'manual' | 'click' | 'hover'; - forceClickoutside: boolean; } export interface DropDownMenuProps { isShow: boolean; @@ -11,13 +10,12 @@ export interface DropDownMenuProps { popoverOptions: DropDownPopover; } -defineOptions({ name: 'DropDownMenu' }); +defineOptions({ name: 'hcm-dropdown' }); const props = withDefaults(defineProps(), { isShow: false, popoverOptions: () => ({ trigger: 'manual', - forceClickoutside: true, }), }); @@ -60,13 +58,13 @@ defineExpose({ hidePopover });