diff --git a/src/api/one-class-page/virtualMachine.js b/src/api/one-class-page/virtualMachine.js index 6dcaa9c..9bd89b2 100644 --- a/src/api/one-class-page/virtualMachine.js +++ b/src/api/one-class-page/virtualMachine.js @@ -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' }) } diff --git a/src/api/operations/actions.js b/src/api/operations/actions.js index bb73878..b3bf99d 100644 --- a/src/api/operations/actions.js +++ b/src/api/operations/actions.js @@ -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' }) - }, - - - - + } } diff --git a/src/api/user.js b/src/api/user.js index 8605833..1c5d4c5 100644 --- a/src/api/user.js +++ b/src/api/user.js @@ -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' } }) } diff --git a/src/components/list.vue b/src/components/list.vue index 9db757a..dbc1f54 100644 --- a/src/components/list.vue +++ b/src/components/list.vue @@ -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 } - }); + }) } - } } } diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 1b94fae..2753593 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -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) diff --git a/src/utils/request.js b/src/utils/request.js index 034d6df..eaac1b7 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -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' diff --git a/src/views/blockChain/blockChainBrowser.vue b/src/views/blockChain/blockChainBrowser.vue index f18ace7..1250450 100644 --- a/src/views/blockChain/blockChainBrowser.vue +++ b/src/views/blockChain/blockChainBrowser.vue @@ -7,45 +7,45 @@ 区块链浏览器
{{status.txCount}}
-{{status.userCount}}
-{{status.tradeCount}}
-{{status.latestBlock}}
-{{status.chaincodeCount}}
-{{status.peerCount}}
-{{ status.txCount }}
+{{ status.userCount }}
+{{ status.tradeCount }}
+{{ status.latestBlock }}
+{{ status.chaincodeCount }}
+{{ status.peerCount }}
+