创建跨域项目联调

This commit is contained in:
jhnine 2022-11-24 17:33:00 +08:00
parent 0f46eed86a
commit 1280329de3
2 changed files with 58 additions and 11 deletions

View File

@ -1,6 +1,20 @@
<template>
<el-dialog v-if="createFormVisible" :close-on-click-modal="false" title="创建项目" :visible.sync="createFormVisible">
<el-form ref="editInfoForm" :rules="rules" :model="editInfoForm">
<el-form-item
required
prop="clusterName"
label="集群"
>
<el-select v-model="editInfoForm.clusterName" multiple style="width:100%" placeholder="请选择">
<el-option
v-for="item in clusterOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item
prop="ns_name"
label="名称"
@ -31,7 +45,7 @@
</template>
<script>
import { postNamespace } from '@/api/dispatching-center/dispatchingCenter'
import { postNamespace, getClusterList } from '@/api/dispatching-center/dispatchingCenter'
export default {
props: {
@ -50,12 +64,17 @@ export default {
},
data() {
return {
clusterOptions: [],
editInfoForm: {
ns_name: '',
alias: '',
describe: ''
describe: '',
clusterName: ''
},
rules: {
clusterName: [
{ required: true, message: '请选择', trigger: 'change' }
],
ns_name: [
{ required: true, message: '请输入名称' },
{
@ -76,9 +95,37 @@ export default {
}
}
},
mounted() {
//
getClusterList({ pageNum: 1, pageSize: 999 }).then(res => {
this.clusterList = res.data.list
this.clusterOptions = res.data.list.map(n => (
{
value: n.cluster_name,
label: n.cluster_name
}
)) || []
})
},
methods: {
submitInfoEdit() {
postNamespace(this.editInfoForm).then(res => {
const data = {
'templateId': '1',
'clusterName': this.editInfoForm.clusterName,
'namespace': {
'apiVersion': 'v1',
'kind': 'Namespace',
'metadata': {
'name': this.editInfoForm.ns_name,
'annotations': {
'kubesphere.io/creator': 'admin',
'kubesphere.io/description': this.editInfoForm.describe,
'kubesphere.io/alias-name': this.editInfoForm.alias
}
}
}
}
postNamespace(data).then(res => {
this.$message.success('创建成功')
this.createFormVisible = false
this.$emit('getList')

View File

@ -117,7 +117,7 @@ export default {
icon: 'xunijiguanli-juan',
description: '以广域异构分布式存储服务,提供用户快捷、安全的数据管理。',
path: '/disk'
},
}
// {
// id: 'functions',
// title: '',
@ -132,13 +132,13 @@ export default {
// description: '',
// path: '/blockChain/blockChainBrowser'
// },
{
id: 'hpc',
title: '超算管理',
icon: 'fuwu',
description: '1111111111111',
path: '/hpc/hpcOverview'
}
// {
// id: 'hpc',
// title: '',
// icon: 'fuwu',
// description: '1111111111111',
// path: '/hpc/hpcOverview'
// }
]
}
},