Skip to content

Commit

Permalink
fix(format): f
Browse files Browse the repository at this point in the history
1. ormat the code with yarn format;
2. modify yarn build as "vite build"
  • Loading branch information
Helltab committed Jan 13, 2024
1 parent 746ed7d commit 8b82013
Show file tree
Hide file tree
Showing 48 changed files with 695 additions and 777 deletions.
2 changes: 1 addition & 1 deletion ui-vue3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"dev": "vite",
"check:i18n": "node --loader ts-node/esm src/base/i18n/sortI18n.ts",
"build": "run-p type-check \"build-only {@}\" --",
"build": "prettier --write src/ && vite build",
"preview": "vite preview",
"test:unit": "vitest",
"build-only": "vite build",
Expand Down
19 changes: 9 additions & 10 deletions ui-vue3/src/api/mock/mockCluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@

import Mock from 'mockjs'
Mock.mock('/mock/metrics/cluster', 'get', {
code: 200,
message: '成功',
data: {
all: Mock.mock('@integer(100, 500)'),
application: Mock.mock('@integer(80, 200)'),
consumers: Mock.mock('@integer(80, 200)'),
providers: Mock.mock('@integer(80, 200)'),
services: Mock.mock('@integer(80, 200)'),

}
code: 200,
message: '成功',
data: {
all: Mock.mock('@integer(100, 500)'),
application: Mock.mock('@integer(80, 200)'),
consumers: Mock.mock('@integer(80, 200)'),
providers: Mock.mock('@integer(80, 200)'),
services: Mock.mock('@integer(80, 200)')
}
})
15 changes: 7 additions & 8 deletions ui-vue3/src/api/mock/mockServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,18 @@

import Mock from 'mockjs'


Mock.mock('/mock/metrics/metadata', 'get', {
code: 200,
message: '成功',
data: {
versions: ["dubbo-golang-3.0.4"],
protocols: ["tri"],
rules:["DemoService:1.0.0:test.configurators","DemoService4:bb:aa.configurators"],
configCenter: "127.0.0.1:2181",
registry: "127.0.0.1:2181",
metadataCenter: "127.0.0.1:2181",
versions: ['dubbo-golang-3.0.4'],
protocols: ['tri'],
rules: ['DemoService:1.0.0:test.configurators', 'DemoService4:bb:aa.configurators'],
configCenter: '127.0.0.1:2181',
registry: '127.0.0.1:2181',
metadataCenter: '127.0.0.1:2181',
// make sure the X-Frame-Options is forbidden
grafana: `http://${window.location.host}/admin/home`,
prometheus: "127.0.0.1:9090"
prometheus: '127.0.0.1:9090'
}
})
12 changes: 6 additions & 6 deletions ui-vue3/src/api/service/clusterInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

import request from '@/base/http/request'

export const getClusterInfo = (params: any):Promise<any> => {
return request({
url: '/metrics/cluster',
method: 'get',
params
})
export const getClusterInfo = (params: any): Promise<any> => {
return request({
url: '/metrics/cluster',
method: 'get',
params
})
}
15 changes: 7 additions & 8 deletions ui-vue3/src/api/service/serverInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@
* limitations under the License.
*/

import request from '@/base/http/request'

import request from "@/base/http/request";

export const getMetricsMetadata = (params: any):Promise<any> => {
return request({
url: '/metrics/metadata',
method: 'get',
params
})
export const getMetricsMetadata = (params: any): Promise<any> => {
return request({
url: '/metrics/metadata',
method: 'get',
params
})
}
8 changes: 3 additions & 5 deletions ui-vue3/src/base/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@
* limitations under the License.
*/

import {ref} from 'vue'
import { ref } from 'vue'

export const PRIMARY_COLOR_DEFAULT = '#17b392'


export const LOCAL_STORAGE_LOCALE = 'LOCAL_STORAGE_LOCALE'
export const LOCAL_STORAGE_THEME = 'LOCAL_STORAGE_THEME'

let item = localStorage.getItem(LOCAL_STORAGE_THEME)

let item = localStorage.getItem(LOCAL_STORAGE_THEME);

export const PRIMARY_COLOR = ref(item || PRIMARY_COLOR_DEFAULT)
export const PRIMARY_COLOR = ref(item || PRIMARY_COLOR_DEFAULT)
5 changes: 1 addition & 4 deletions ui-vue3/src/base/enums/Storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
* limitations under the License.
*/



const KEY_PREFIX = '__DUBBO_KUBE_'

export const STORAGE_KEY = {
}
export const STORAGE_KEY = {}
60 changes: 30 additions & 30 deletions ui-vue3/src/base/http/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,51 +16,51 @@
*/

import type {
AxiosInstance,
AxiosInterceptorManager,
AxiosRequestHeaders,
AxiosResponse,
InternalAxiosRequestConfig
AxiosInstance,
AxiosInterceptorManager,
AxiosRequestHeaders,
AxiosResponse,
InternalAxiosRequestConfig
} from 'axios'
import axios from 'axios'
import {message} from 'ant-design-vue'
import { message } from 'ant-design-vue'
import NProgress from 'nprogress'

const service: AxiosInstance = axios.create({
// change this to decide where to go
baseURL: '/mock',
timeout: 30 * 1000
// change this to decide where to go
baseURL: '/mock',
timeout: 30 * 1000
})
const request: AxiosInterceptorManager<InternalAxiosRequestConfig> = service.interceptors.request
const response: AxiosInterceptorManager<AxiosResponse> = service.interceptors.response

request.use(
(config) => {
config.data = JSON.stringify(config.data) //数据转化,也可以使用qs转换
config.headers = <AxiosRequestHeaders>{
'Content-Type': 'application/json' //配置请求头
}
NProgress.start()
return config
},
(error) => {
Promise.reject(error)
(config) => {
config.data = JSON.stringify(config.data) //数据转化,也可以使用qs转换
config.headers = <AxiosRequestHeaders>{
'Content-Type': 'application/json' //配置请求头
}
NProgress.start()
return config
},
(error) => {
Promise.reject(error)
}
)

response.use(
(response) => {
NProgress.done()
(response) => {
NProgress.done()

if (response.status === 200) {
return Promise.resolve(response.data)
}
return Promise.reject(response)
},
(error) => {
NProgress.done()
message.error(error.message)
return Promise.resolve(error.response)
if (response.status === 200) {
return Promise.resolve(response.data)
}
return Promise.reject(response)
},
(error) => {
NProgress.done()
message.error(error.message)
return Promise.resolve(error.response)
}
)
export default service
Loading

0 comments on commit 8b82013

Please sign in to comment.