-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
--story=120477691 【集群管理】新增GKE集群创建 (merge request !2097)
Squash merge branch 'feat/cluster-add-GKE' into 'master' feat:--story=120477691 【集群管理】新增GKE集群创建 TAPD: --story=120477691
- Loading branch information
v_yfqnyang
authored and
hitozhang
committed
Nov 14, 2024
1 parent
46f44bc
commit a17aaef
Showing
22 changed files
with
3,482 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
bcs-ui/frontend/src/views/cluster-manage/add/components/subnet.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<template> | ||
<bk-select | ||
searchable | ||
:clearable="false" | ||
:loading="subnetLoading" | ||
:value="value" | ||
@change="handleSubnetChange"> | ||
<bk-option | ||
v-for="net in subnets" | ||
:key="net.subnetID" | ||
:id="net.subnetID" | ||
:name="`${net.subnetName}(${net.subnetID})`" | ||
:disabled="!net.availableIPAddressCount || !!Object.keys(net.cluster || {}).length"> | ||
<div | ||
class="flex items-center justify-between" | ||
v-bk-tooltips="{ | ||
content: Object.keys(net.cluster || {}).length | ||
? $t('tke.tips.subnetInUsed', [net.cluster ? net.cluster.clusterName : '']) | ||
: $t('tke.tips.noAvailableIp'), | ||
disabled: net.availableIPAddressCount && !Object.keys(net.cluster || {}).length, | ||
placement: 'left' | ||
}"> | ||
<span>{{ `${net.subnetName}(${net.subnetID})` }}</span> | ||
<span | ||
:class="(!net.availableIPAddressCount || Object.keys(net.cluster || {}).length) ? '':'text-[#979BA5]'"> | ||
{{ `${$t('tke.label.availableIpNum')}: ${net.availableIPAddressCount}` }} | ||
</span> | ||
</div> | ||
</bk-option> | ||
</bk-select> | ||
</template> | ||
<script setup lang="ts"> | ||
import { onBeforeMount, ref, watch } from 'vue'; | ||
import { ISubnet } from '../../types/types'; | ||
import { cloudSubnets } from '@/api/modules/cluster-manager'; | ||
const props = defineProps({ | ||
value: { | ||
type: String, | ||
}, | ||
region: { | ||
type: String, | ||
default: '', | ||
}, | ||
cloudAccountID: { | ||
type: String, | ||
default: '', | ||
}, | ||
cloudID: { | ||
type: String, | ||
default: '', | ||
}, | ||
vpcId: { | ||
type: String, | ||
default: '', | ||
}, | ||
}); | ||
const emits = defineEmits(['input', 'change']); | ||
// 子网 | ||
const subnets = ref<Array<ISubnet>>([]); | ||
const subnetLoading = ref(false); | ||
const handleGetSubnets = async () => { | ||
if (!props.cloudAccountID || !props.region || !props.vpcId) return; | ||
subnetLoading.value = true; | ||
subnets.value = await cloudSubnets({ | ||
$cloudId: props.cloudID, | ||
region: props.region, | ||
accountID: props.cloudAccountID, | ||
vpcID: props.vpcId, | ||
injectCluster: true, | ||
}).catch(() => []); | ||
subnetLoading.value = false; | ||
}; | ||
const handleSubnetChange = (subnetID: string) => { | ||
emits('change', subnetID); | ||
emits('input', subnetID); | ||
}; | ||
watch([ | ||
() => props.region, | ||
() => props.cloudAccountID, | ||
() => props.vpcId, | ||
], () => { | ||
handleGetSubnets(); | ||
}); | ||
onBeforeMount(() => { | ||
handleGetSubnets(); | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.