Skip to content

Commit

Permalink
feat(frontend): mysql工具箱支持格子内选择集群/实例/IP TencentBlueKing#6997
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 19172
  • Loading branch information
jinquantianxia committed Sep 24, 2024
1 parent 41172f2 commit d9ee2a9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,14 @@
@change="handleInstancesChange" />
</template>
<script lang="ts">
type InstanceInfo = ServiceReturnType<typeof checkMysqlInstances>[number];

const instanceWithSelectorMemo: { [key: string]: Record<string, boolean> } = {};
</script>
<script setup lang="ts">
import _ from 'lodash';
import { useI18n } from 'vue-i18n';

import { checkMysqlInstances } from '@services/source/instances';
import { checkInstance } from '@services/source/dbbase';
import type { InstanceInfos } from '@services/types/clusters';

import { ClusterTypes } from '@common/const';
import { ipPort, ipv4 } from '@common/regex';
Expand All @@ -83,7 +82,7 @@
db_module_name?: string;
master_domain?: string;
cluster_type?: string;
related_clusters?: InstanceInfo['related_clusters'];
related_clusters?: InstanceInfos['related_clusters'];
related_instances?: {
cluster_id: number;
instance_address: string;
Expand Down Expand Up @@ -151,8 +150,8 @@
},
{
validator: (value: string) =>
checkMysqlInstances({
bizId: window.PROJECT_CONFIG.BIZ_ID,
checkInstance<InstanceInfos>({
bk_biz_id: window.PROJECT_CONFIG.BIZ_ID,
instance_addresses: [value],
}).then((data) => {
if (data.length < 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';

import { checkMysqlInstances } from '@services/source/instances';
import { checkInstance } from '@services/source/dbbase';
import type { HostDetails } from '@services/types';

import { OSTypes } from '@common/const';
Expand Down Expand Up @@ -150,8 +150,8 @@
if (props.type === 'cloud-ip') {
ip = value.split(':')[1];
}
return checkMysqlInstances({
bizId: window.PROJECT_CONFIG.BIZ_ID,
return checkInstance<Required<IpBasicInfo>>({
bk_biz_id: window.PROJECT_CONFIG.BIZ_ID,
instance_addresses: [ip],
}).then((data) => {
if (data.length < 1) {
Expand Down

0 comments on commit d9ee2a9

Please sign in to comment.