update cluster metrics

This commit is contained in:
medcl 2021-02-23 13:50:32 +08:00
parent 34d780973c
commit 7311274061
9 changed files with 2822 additions and 4176 deletions

2591
web/mock/cluster/metrics.js Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
import { queryNotices } from '@/services/api';
import {message} from "antd";
import {searchClusterConfig} from "@/services/clusterConfig";
import {searchClusterConfig} from "@/services/cluster";
import {formatESSearchResult} from '@/lib/elasticsearch/util';

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,5 @@
import {getClusterOverview, getClusterNodeStats, getClusterList} from "@/services/dashboard";
import {getClusterMetrics} from "@/services/cluster";
export default {
namespace: 'clusterMonitor',
@ -13,6 +14,13 @@ export default {
callback(clusterData);
}
},
*fetchClusterMetrics({payload, callback}, {call, put}){
let clusterMetrics = yield call(getClusterMetrics, payload);
yield put({type: 'saveData', payload: clusterMetrics})
if(callback && typeof callback == 'function'){
callback(clusterMetrics);
}
},
*fetchClusterNodeStats({callback}, {call, put}){
let nodesStats = yield call(getClusterNodeStats);
//yield put({type: 'saveData', payload: nodesStats})
@ -38,4 +46,4 @@ export default {
};
},
}
};
};

View File

@ -1,4 +1,4 @@
import {createClusterConfig,searchClusterConfig, updateClusterConfig,deleteClusterConfig} from "@/services/clusterConfig";
import {createClusterConfig, searchClusterConfig, updateClusterConfig,deleteClusterConfig} from "@/services/cluster";
import {message} from "antd";
import {formatESSearchResult} from '@/lib/elasticsearch/util';

View File

@ -1,8 +1,53 @@
import request from '@/utils/request';
import {pathPrefix} from './common';
import {buildQueryArgs, pathPrefix} from './common';
export async function getClusterVersion(params) {
return request(`${pathPrefix}/cluster/${params.cluster}/version`, {
method: 'GET'
});
}
}
export async function getClusterMetrics(params) {
let id = params.id;
delete(params['id']);
return request(`${pathPrefix}/cluster/${id}/metrics`, {
method: 'GET'
});
}
export async function createClusterConfig(params) {
return request(`${pathPrefix}/cluster`, {
method: 'POST',
body: params,
});
}
export async function updateClusterConfig(params) {
let id = params.id;
delete(params['id']);
return request(`${pathPrefix}/cluster/${id}`, {
method: 'PUT',
body: params,
});
}
export async function deleteClusterConfig(params) {
return request(`${pathPrefix}/cluster/${params.id}`, {
method: 'DELETE',
body: params,
});
}
export async function searchClusterConfig(params) {
let url = `${pathPrefix}/cluster/_search`;
let args = buildQueryArgs({
name: params.name,
enabled: params.enabled
});
if(args.length > 0){
url += args;
}
return request(url, {
method: 'GET',
});
}

View File

@ -1,39 +0,0 @@
import {pathPrefix, buildQueryArgs} from "./common";
import request from '@/utils/request';
export async function createClusterConfig(params) {
return request(`${pathPrefix}/system/cluster`, {
method: 'POST',
body: params,
});
}
export async function updateClusterConfig(params) {
let id = params.id;
delete(params['id']);
return request(`${pathPrefix}/cluster/${id}`, {
method: 'PUT',
body: params,
});
}
export async function deleteClusterConfig(params) {
return request(`${pathPrefix}/cluster/${params.id}`, {
method: 'DELETE',
body: params,
});
}
export async function searchClusterConfig(params) {
let url = `${pathPrefix}/cluster/_search`;
let args = buildQueryArgs({
name: params.name,
enabled: params.enabled
});
if(args.length > 0){
url += args;
}
return request(url, {
method: 'GET',
});
}

View File

@ -15,4 +15,4 @@ export async function getClusterNodeStats(){
export async function getClusterList(){
return request('/dashboard/cluster/list');
}
}