This commit is contained in:
ann 2021-08-03 17:36:24 +08:00
parent 7d4ab2ef6b
commit ff22e55b1a
7 changed files with 190 additions and 61 deletions

View File

@ -3,21 +3,21 @@ import request from '@/utils/request'
// 虚拟机管理-主机列表
export function getVirtualHosts() {
return request({
url: '/v1/nodes',
url: '/virtual/v1/nodes',
method: 'get'
})
}
export function getHostYaml(name) {
return request({
url: '/v1/nodes/' + name,
url: '/virtual/v1/nodes/' + name,
method: 'get'
})
}
export function putHostYaml(name, yaml) {
return request({
url: '/v1/nodes/' + name,
url: '/virtual/v1/nodes/' + name,
method: 'put',
data: yaml
})
@ -26,21 +26,21 @@ export function putHostYaml(name, yaml) {
// 虚拟机管理-虚拟机列表
export function getVirtualMachines() {
return request({
url: '/v1/kubevirt.io.virtualmachines',
url: '/virtual/v1/kubevirt.io.virtualmachines',
method: 'get'
})
}
export function getNodeNetworks() {
return request({
url: '/v1/network.harvesterhci.io.nodenetworks',
url: '/virtual/v1/network.harvesterhci.io.nodenetworks',
method: 'get'
})
}
export function getVirtualMachineImage() {
return request({
url: '/v1/harvesterhci.io.virtualmachineimages',
url: '/virtual/v1/harvesterhci.io.virtualmachineimages',
method: 'get'
})
}
@ -48,21 +48,24 @@ export function getVirtualMachineImage() {
// 虚拟机管理-卷列表
export function getDataVolume() {
return request({
url: '/v1/cdi.kubevirt.io.datavolume',
url: '/virtual/v1/cdi.kubevirt.io.datavolume',
method: 'get'
})
}
export function getDataVolumeYaml(name) {
return request({
url: '/proxy/apis/cdi.kubevirt.io/v1beta1/namespaces/default/datavolumes/' + name,
method: 'get'
url: '/virtual/apis/cdi.kubevirt.io/v1beta1/namespaces/default/datavolumes/' + name,
method: 'get',
headers: {
'Accept': 'application/yaml'
}
})
}
export function putDataVolumeYaml(name, yaml) {
return request({
url: '/proxy/apis/cdi.kubevirt.io/v1beta1/namespaces/default/datavolumes/' + name,
url: '/virtual/apis/cdi.kubevirt.io/v1beta1/namespaces/default/datavolumes/' + name,
method: 'put',
data: yaml
})
@ -70,14 +73,14 @@ export function putDataVolumeYaml(name, yaml) {
export function getVirtualMachineYaml(name) {
return request({
url: '/apis/kubevirt.io/v1/namespaces/default/virtualmachines/' + name,
url: '/virtual/apis/kubevirt.io/v1/namespaces/default/virtualmachines/' + name,
method: 'get'
})
}
export function putVirtualMachineYaml(name, yaml) {
return request({
url: '/kubevirt.io/v1/namespaces/default/virtualmachines/' + name,
url: '/virtual/kubevirt.io/v1/namespaces/default/virtualmachines/' + name,
method: 'put',
data: yaml
})
@ -85,14 +88,14 @@ export function putVirtualMachineYaml(name, yaml) {
export function getHostNetwork(name) {
return request({
url: '/v1/network.harvesterhci.io.nodenetworks/harvester-system/' + name + '-vlan',
url: '/virtual/v1/network.harvesterhci.io.nodenetworks/harvester-system/' + name + '-vlan',
method: 'get'
})
}
export function putHostNetwork(name, data) {
return request({
url: '/v1/network.harvesterhci.io.nodenetworks/harvester-system/' + name + '-vlan',
url: '/virtual/v1/network.harvesterhci.io.nodenetworks/harvester-system/' + name + '-vlan',
method: 'put',
data: data
})
@ -100,7 +103,7 @@ export function putHostNetwork(name, data) {
export function postSSHKey(data) {
return request({
url: '/v1/harvesterhci.io.keypairs',
url: '/virtual/v1/harvesterhci.io.keypairs',
method: 'post',
data: data
})

View File

@ -153,21 +153,21 @@ export default {
// 通道hash查询接口
getCurrentChannel() {
return request({
url: `/apiLedger/curChannel`,
url: `/blockChain/apiLedger/curChannel`,
method: 'get'
})
},
// 通道指标统计查询接口 4个数据 还差2个
getStatisticsCount(hash) {
return request({
url: `/apiLedger/status/${hash}`,
url: `/blockChain/apiLedger/status/${hash}`,
method: 'get'
})
},
// 块链列表
getBlockList(hash, query) {
return request({
url: `/apiLedger/blockAndTxList/${hash}/0`,
url: `/blockChain/apiLedger/blockAndTxList/${hash}/0`,
method: 'get',
params: query
})
@ -175,17 +175,64 @@ export default {
// 交易列表
getTradeList(hash) {
return request({
url: `/apiLedger/txList/${hash}/0/0`,
url: `/blockChain/apiLedger/txList/${hash}/0/0`,
method: 'get'
})
},
// 交易详情
getTradeDetail(hash, tradeHash) {
return request({
url: `/apiLedger/transaction/${hash}/${tradeHash}`,
url: `/blockChain/apiLedger/transaction/${hash}/${tradeHash}`,
method: 'get'
})
}
},
// 函数
createFunction(query) {
return request({
url: '/function/createFunction',
method: 'post',
data: query,
});
},
deleteFunctionByName() {
return request({
url: '/function/delete/functionByName',
method: 'delete',
});
},
deleteFunction(functionId) {
return request({
url: `/function/deleteFunction/${functionId}`,
method: 'delete',
});
},
getFunctionByFunctionName() {
return request({
url: '/function/delete/functionByName',
method: 'get',
});
},
invokeFunction(query) {
return request({
url: '/function/invokeFunction',
method: 'post',
data: query,
});
},
listFunctions(query) {
return request({
url: '/function/lists',
method: 'get',
params: query || { page: 1, size: 10 },
});
},
updateFunction() {
return request({
url: '/function/updateFunction',
method: 'put',
});
},
}

View File

@ -11,7 +11,7 @@ export function login(data) {
export function harvesterLogin(data) {
return request({
url: '/v3-public/localProviders/local?action=login',
url: '/virtual/v3-public/localProviders/local?action=login',
method: 'post',
// params: { action: 'login'},
data: data,
@ -23,7 +23,7 @@ export function harvesterLogin(data) {
export function blockChainLogin(query) {
return request({
url: `/authLedger/login`,
url: `/blockChain/authLedger/login`,
method: 'post',
data: query,
headers: {

View File

@ -18,13 +18,13 @@ const service = axios.create({
service.interceptors.request.use(
config => {
// do something before request is sent
if (store.getters.token && config.url.indexOf('/v1/') !== 0 && config.url.indexOf('apiLedger') === -1) {
if (store.getters.token && config.url.indexOf('/virtual/v1/') !== 0 && config.url.indexOf('blockChain/apiLedger') === -1) {
config.headers['Authorization'] = 'Bearer ' + getToken()
}
if (config.url.indexOf('apiLedger') !== -1) {
if (config.url.indexOf('blockChain/apiLedger') !== -1) {
config.headers['Authorization'] = 'bearer ' + Cookies.get('htoken')
}
if (config.url.indexOf('v3-public') !== -1) {
if (config.url.indexOf('/virtual/v3-public') !== -1) {
const csrf = Cookies.get('CSRF')
if (csrf) {
config.headers['x-api-csrf'] = csrf
@ -35,7 +35,7 @@ service.interceptors.request.use(
'Content-Type': 'application/x-www-form-urlencoded'
}
}
if (config.url.indexOf('/v1/') === 0) {
if (config.url.indexOf('/virtual/v1/') === 0) {
config.headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'

View File

@ -79,11 +79,11 @@
<span>交易</span>
</div>
<div v-if="tradeList.length>0" class="">
<div v-for="i in 5" :key="i" class="blockInfo" @click="getTradeDetail(tradeList[i])">
<div v-for="i in tradeListLength" :key="i" class="blockInfo" @click="getTradeDetail(tradeList[i-1])">
<div class="blockInfoIcon"><svg-icon icon-class="money" /></div>
<span class="time">{{ tradeList[i].createdt }}</span>
<span class="time">{{ tradeList[i-1].createdt}}</span>
<span class="title">交易ID</span>
<span class="info">{{ tradeList[i].txhash }}</span>
<span class="info">{{ tradeList[i-1].txhash}}</span>
</div>
</div>
</el-card>
@ -105,6 +105,11 @@ export default {
TradeLineChart,
FormData
},
computed: {
tradeListLength() {
return this.tradeList.length >= 5 ? 5 : this.tradeList.length
}
},
data() {
return {
status: {

View File

@ -1,12 +1,12 @@
<template>
<div>
<div class="cloudComputation">
<el-card class="basicInfo" shadow="never">
<img src="@/assets/img/pod.png" class="sidebar-logo" alt="容器组">
<h4>函数</h4>
<span class="tips" />
</el-card>
<el-card shadow="never">
<el-button style="margin-top:30px" @click="dialogCreateVisible=true">创建函数</el-button>
<el-button style="margin-top:30px" type="primary" @click="dialogCreateVisible=true">创建函数</el-button>
<el-row :gutter="30">
<el-col v-for="(item,index) in functionList" :key="index" :span="6">
<el-card class="functionCard">
@ -202,7 +202,7 @@ export default {
}
},
mounted() {
// this.getList()
this.getList()
},
methods: {
currentChange(e) {
@ -239,17 +239,17 @@ export default {
})
},
getList() {
// const query = {
// page: this.page,
// size: this.size
// }
// this.$Api.cloudComputation.listFunctions(query).then((res) => {
// this.functionList = res.rows;
// this.total = res.total;
// });
const query = {
page: this.page,
size: this.size
}
this.$Api.listFunctions(query).then((res) => {
this.functionList = res.data.rows;
this.total = res.data.total;
});
},
deleteFunc(id) {
this.$Api.cloudComputation.deleteFunction(id).then((res) => {
this.$Api.deleteFunction(id).then((res) => {
if (res) {
this.$message.success('操作成功')
this.getList()
@ -264,11 +264,13 @@ export default {
goDetail(val) {
// this.form = val;
// this.activeName = '2';
this.form = val;
this.dialogExecuteVisible = true;
},
createFunc() {
//
const funcForm = { code: { zipFile: this.form.runEnv === 'java8' ? this.fileList[0].code : this.transBase64(this.code) }, ...this.form }
this.$Api.cloudComputation.createFunction(funcForm).then((res) => {
this.$Api.createFunction(funcForm).then((res) => {
if (res) {
this.$message.success('创建函数成功')
this.goDetail(this.form)
@ -279,7 +281,7 @@ export default {
return Buffer.from(code).toString('base64')
},
invoke() {
this.$Api.cloudComputation.invokeFunction({ functionName: this.form.functionName, jsonObject: this.jsonObject }).then((res) => {
this.$Api.invokeFunction({ functionName: this.form.functionName, jsonObject: this.jsonObject }).then((res) => {
if (res) {
console.log(res)
this.result = 'hello world'
@ -293,6 +295,73 @@ export default {
}
</script>
<style lang="scss" scoped>
<style lang="scss">
.cloudComputation{
.el-tabs__header{
margin-bottom: 0;
}
.bg-gray{
padding: 20px;
}
.codemirror {
width: 100%;
height: 100%;
margin: 0;
overflow: auto;
}
.funcTable{
margin-bottom: 30px;
border-spacing: 0;
tr{
border-top: 1px solid #ebeef5;
}
tr:last-child(){
border-bottom: 1px solid #ebeef5;
}
td{
width: 16.6%;
padding-left:10px;
border-left: 1px solid #ebeef5;
}
td:last-child(){
border-right: 1px solid #ebeef5;
}
}
.progress{
width: 300px;
margin: 30px auto;
}
.invokeBtn{
margin: 40px auto;
}
}
.functionCard{
margin: 30px auto;
.el-card__body{
padding:0;
padding-bottom: 20px;
text-align: center;
}
.title{
margin:20px;
margin-bottom: 10px;
}
.el-button--text{
line-height: 1.1rem;
}
p{
margin: 10px 20px;
// margin-bottom: 10px;
}
.el-button{
margin:10px;
}
.insideFloatRight {
margin: 0;
padding:0;
float: right;
}
}
</style>

View File

@ -41,18 +41,18 @@ module.exports = {
ws: false,
target: 'http://119.45.100.73:30881/', /* Host */
},
'^/v1': {
ws: false,
secure: false,
changeOrigin: true,
target: 'https://103.116.78.162:30443/'
},
'/v3-public': {
ws: false,
secure: false,
changeOrigin: true,
target: 'https://103.116.78.162:30443/'
},
// '^/v1': {
// ws: false,
// secure: false,
// changeOrigin: true,
// target: 'https://103.116.78.162:30443/'
// },
// '/v3-public': {
// ws: false,
// secure: false,
// changeOrigin: true,
// target: 'https://103.116.78.162:30443/'
// },
'/kapis': {
// ws: true,
// target: 'http://124.71.196.205:30881/' /* EduCoder */
@ -68,9 +68,9 @@ module.exports = {
'^/prom': ''
}
},
'^/apiLedger': {
'^/blockChain': {
ws: false,
target: 'http://124.71.195.158:8080/',
target: 'http://106.53.150.192/',
changeOrigin: true,
},
'^/api/': {
@ -83,11 +83,16 @@ module.exports = {
target: 'http://119.45.100.73:30881/', /* Host */
// changeOrigin: true,
},
'^/authLedger': {
'^/virtual': {
ws: false,
target: 'http://124.71.195.158:8080/',
target: 'http://106.53.150.192/',
changeOrigin: true,
},
'^/function': {
ws: false,
target: 'http://106.53.150.192:8004/',
// changeOrigin: true,
},
'/kapis/terminal.kubesphere.io': {
ws: true,
changeOrigin: true,