Skip to content

Commit

Permalink
Add region to NewApplicationSpace.vue (#675)
Browse files Browse the repository at this point in the history
Co-authored-by: 朱鑫睿 <[email protected]>
  • Loading branch information
zzxr6 and 朱鑫睿 authored Sep 27, 2024
1 parent 6d6f42e commit 3d33f93
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,25 @@
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
:label="t('endpoints.new.cluster')"
class="w-full"
prop="space_cluster">
<el-select
v-model="dataForm.space_cluster"
:placeholder="
t('all.pleaseSelect', { value: t('application_spaces.new.cluster') })
"
size="large"
style="width: 100%"
@change="fetchSpaceResources">
<el-option
v-for="item in spaceClusters"
:key="item.cluster_id"
:label="item.region"
:value="item.cluster_id" />
</el-select>
</el-form-item>
<el-form-item
class="w-full !mb-0"
:label="$t('application_spaces.new.cloudResource')"
Expand Down Expand Up @@ -417,6 +436,19 @@
}
const spaceResources = ref([])
const spaceClusters = ref([])
const fetchClusters = async () => {
const { data, error } = await useFetchApi('/cluster').json()
if (error.value) {
ElMessage({ message: error.value.msg, type: 'warning' })
} else {
const body = data.value
dataForm.value.space_cluster = body.data[0]?.cluster_id || ''
spaceClusters.value = body.data
fetchSpaceResources()
}
}
const fetchSpaceResources = async () => {
const { data, error } = await useFetchApi('/space_resources').json()
Expand Down Expand Up @@ -481,6 +513,7 @@
cover_image_url: dataForm.value.cover_image,
hardware: dataForm.value.cloud_resource,
resource_id: dataForm.value.cloud_resource,
cluster_id: dataForm.value.space_cluster,
private: dataForm.value.visibility === 'private'
}
const options = {
Expand All @@ -504,7 +537,7 @@
}
onMounted(() => {
fetchSpaceResources()
fetchClusters()
})
</script>
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/locales/en_js/application_spaces.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ export const application_spaces = {
failedFetchResources: "Failed to fetch resources",
license: "License",
createFail: "Application Space creation failed",
spaceEnName: "Space name"
spaceEnName: "Space name",
cluster: "Region",
},
edit: {
cloudResource: 'Cloud resource',
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/locales/zh_js/application_spaces.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ export const application_spaces = {
failedFetchResources: "获取资源失败",
license: "许可证",
createFail: "应用空间创建失败",
spaceEnName: "应用空间英文名称"
spaceEnName: "应用空间英文名称",
cluster: "区域",
},
edit: {
cloudResource: '空间云资源',
Expand Down

0 comments on commit 3d33f93

Please sign in to comment.