This commit is contained in:
ann 2021-07-29 17:04:03 +08:00
parent d9c4e8add4
commit 7e61570617
10 changed files with 83 additions and 77 deletions

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 虚拟机管理-主机列表
export function getVirtualHosts() {
return request({
url: '/proxy/v1/nodes',
url: '/v1/nodes',
method: 'get'
})
}
@ -11,21 +11,21 @@ export function getVirtualHosts() {
// 虚拟机管理-虚拟机列表
export function getVirtualMachines() {
return request({
url: '/proxy/v1/kubevirt.io.virtualmachines',
url: '/v1/kubevirt.io.virtualmachines',
method: 'get'
})
}
export function getNodeNetworks() {
return request({
url: '/proxy/v1/network.harvesterhci.io.nodenetworks',
url: '/v1/network.harvesterhci.io.nodenetworks',
method: 'get'
})
}
export function getVirtualMachineImage() {
return request({
url: '/proxy/v1/harvesterhci.io.virtualmachineimages',
url: '/v1/harvesterhci.io.virtualmachineimages',
method: 'get'
})
}
@ -33,7 +33,7 @@ export function getVirtualMachineImage() {
// 虚拟机管理-卷列表
export function getDataVolume() {
return request({
url: '/proxy/v1/cdi.kubevirt.io.datavolume',
url: '/v1/cdi.kubevirt.io.datavolume',
method: 'get'
})
}

View File

@ -147,7 +147,6 @@ export default {
// {"apiVersion":"v1","kind":"Namespace","metadata":{"name":"what","labels":{},"annotations":{"kubesphere.io/creator":"nudt"}}}
// 区块链
// 鉴权
@ -185,11 +184,7 @@ export default {
url: `/apiLedger/transaction/${hash}/${tradeHash}`,
method: 'get'
})
},
}
}

View File

@ -16,7 +16,7 @@ export function harvesterLogin(data) {
// params: { action: 'login'},
data: data,
headers: {
'Content-Type': 'application/json;charset=UTF-8',
'Content-Type': 'application/json;charset=UTF-8'
}
})
}

View File

@ -162,7 +162,7 @@ export default {
type: Array
},
clusterName: String,
hash: String,
hash: String
},
data() {
const filterData = { ...this.defaultFilterData }
@ -227,11 +227,10 @@ export default {
} else {
this.$Api[this.getListAction](this.hash).then((res) => {
if (res) {
this.tableData = res.row;
this.tableData = res.row
}
});
})
}
}
}
}

View File

@ -38,18 +38,19 @@ const actions = {
return Promise.all([
login({ 'grant_type': 'password', 'username': username.trim(), 'password': password }),
harvesterLogin({"username":"admin","password":"Nudt@112!","description":"UI Session","responseType":"cookie","ttl":57600000}),
harvesterLogin({ 'username': 'admin', 'password': 'Nudt@112!', 'description': 'UI Session', 'responseType': 'cookie', 'ttl': 57600000 }),
blockChainLogin({
"user": "exploreradmin",
"password": "exploreradminpw",
"network": "agridepart-network"
'user': 'exploreradmin',
'password': 'exploreradminpw',
'network': 'agridepart-network'
})]).then(response => {
// commit('SET_TOKEN', response[1].token)
// setToken(response[1].token)
commit('SET_TOKEN', response[0].access_token)
setToken(response[0].access_token)
Cookies.set('jweToken', response[1].jweToken)
console.log(response[1])
console.log(response[2])
// Cookies.set('jweToken', response[1].jweToken)
Promise.resolve()
}).catch(error => {
Promise.reject(error)

View File

@ -2,6 +2,7 @@ import axios from 'axios'
import { Message } from 'element-ui'
import store from '@/store'
import { getToken } from '@/utils/auth'
import Cookies from 'js-cookie'
// create an axios instance
const service = axios.create({
@ -17,15 +18,21 @@ const service = axios.create({
service.interceptors.request.use(
config => {
// do something before request is sent
if (store.getters.token && config.url.indexOf('proxy') === -1) {
if (store.getters.token && config.url.indexOf('/v1/') !== 0) {
config.headers['Authorization'] = 'Bearer ' + getToken()
}
if (config.url.indexOf('v3-public') !== -1){
const csrf = Cookies.get('CSRF');
if ( csrf ) {
config.headers['x-api-csrf'] = csrf;
}
}
if (config.url === '/oauth/token') {
config.headers = {
'Content-Type': 'application/x-www-form-urlencoded'
}
}
if (config.url.indexOf('proxy') !== -1) {
if (config.url.indexOf('/v1/') === 0) {
config.headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'

View File

@ -7,45 +7,45 @@
<span>区块链浏览器</span>
</div>
<div class="blockChain-overview">
<el-row :gutter="20">
<el-col :span="8">
<div>
<span>交易数量</span>
<p>{{status.txCount}}</p>
</div>
</el-col>
<el-col :span="8">
<div>
<span>参与交易用户数量</span>
<p>{{status.userCount}}</p>
</div>
</el-col>
<el-col :span="8">
<div>
<span>合同交易总金额</span>
<p>{{status.tradeCount}}</p>
</div>
</el-col>
<el-col :span="8">
<div>
<span>当前区块高度</span>
<p>{{status.latestBlock}}</p>
</div>
</el-col>
<el-col :span="8">
<div>
<span>排序服务总数</span>
<p>{{status.chaincodeCount}}</p>
</div>
</el-col>
<el-col :span="8">
<div>
<span>节点服务总数</span>
<p>{{status.peerCount}}</p>
</div>
</el-col>
</el-row>
</div>
<el-row :gutter="20">
<el-col :span="8">
<div>
<span>交易数量</span>
<p>{{ status.txCount }}</p>
</div>
</el-col>
<el-col :span="8">
<div>
<span>参与交易用户数量</span>
<p>{{ status.userCount }}</p>
</div>
</el-col>
<el-col :span="8">
<div>
<span>合同交易总金额</span>
<p>{{ status.tradeCount }}</p>
</div>
</el-col>
<el-col :span="8">
<div>
<span>当前区块高度</span>
<p>{{ status.latestBlock }}</p>
</div>
</el-col>
<el-col :span="8">
<div>
<span>排序服务总数</span>
<p>{{ status.chaincodeCount }}</p>
</div>
</el-col>
<el-col :span="8">
<div>
<span>节点服务总数</span>
<p>{{ status.peerCount }}</p>
</div>
</el-col>
</el-row>
</div>
</el-card>
</el-col>
<el-col :span="13">
@ -63,7 +63,7 @@
<el-button style="float: right; padding: 3px 0" type="text" @click="toBlockList">更多</el-button>
</div>
<div class="">
<div class="blockInfo" v-for="i in 5" :key="i">
<div v-for="i in 5" :key="i" class="blockInfo">
<div class="blockInfoIcon"><i class="el-icon-connection" /></div>
<span class="time">2021-07-23T08:36:03.777Z</span>
<span class="title">区块18</span>
@ -80,7 +80,7 @@
<span>交易</span>
</div>
<div class="">
<div class="blockInfo" v-for="i in 5" :key="i">
<div v-for="i in 5" :key="i" class="blockInfo">
<div class="blockInfoIcon"><svg-icon icon-class="money" /></div>
<span class="time">2021-07-23T08:36:03.777Z</span>
<span class="title">交易ID</span>
@ -105,12 +105,12 @@ export default {
data() {
return {
status: {
chaincodeCount: "1",
txCount: "40",
latestBlock: "40",
peerCount: "6",
userCount: "10",
tradeCount: "22"
chaincodeCount: '1',
txCount: '40',
latestBlock: '40',
peerCount: '6',
userCount: '10',
tradeCount: '22'
}
}

View File

@ -1,7 +1,5 @@
<template>
<div>
</div>
<div />
</template>
<script>

View File

@ -25,9 +25,9 @@ export default {
filterMap: {
},
columns: [
{ prop: 'blocknum', label: '区块高度'},
{ prop: 'blockhash', label: '区块哈希'},
{ prop: 'createdt', label: '创建时间'},
{ prop: 'blocknum', label: '区块高度' },
{ prop: 'blockhash', label: '区块哈希' },
{ prop: 'createdt', label: '创建时间' }
]
}
},

View File

@ -44,6 +44,12 @@ module.exports = {
target: 'http://119.45.100.73:30881/', /* Host */
// target: 'http://39.103.233.49:30881/', /* BJ-Member2 */
},
'^/v1': {
ws: false,
secure: false,
changeOrigin: true,
target: 'https://103.116.78.162:30443/'
},
'/v3-public': {
ws: false,
secure: false,