Merge branch 'master' of ssh://git.infini.ltd:64221/infini/search-center

This commit is contained in:
medcl 2021-11-23 10:12:42 +08:00
commit 23a086d233
4 changed files with 52 additions and 30 deletions

View File

@ -1,12 +1,13 @@
#配置应用存储数据的 Elasticsearch 集群信息
elasticsearch: elasticsearch:
- name: default - name: default
enabled: true enabled: true
monitored: true monitored: true
endpoint: http://192.168.3.188:9299 endpoint: http://localhost:9200
basic_auth: basic_auth:
username: elastic username: elastic
password: ZBdkVQUUdF1Sir4X4BGB password: ZBdkVQUUdF1Sir4X4BGB
#前端 UI HTTP 配置
web: web:
enabled: true enabled: true
ui: ui:
@ -14,9 +15,19 @@ web:
path: .public path: .public
vfs: true vfs: true
local: true local: true
#api_endpoint: 10.0.2.5:9000 #配置 api_endpoint 可覆盖默认 api 访问地址
network: network:
binding: 0.0.0.0:9000 binding: 0.0.0.0:9000
skip_occupied_port: true skip_occupied_port: true
#API IP 地址需要在前端可连通(虚拟机环境安装,宿主机访问)
api:
enabled: true
network:
binding: 0.0.0.0:2900
skip_occupied_port: true
cors:
allowed_origins:
- "*"
elastic: elastic:
elasticsearch: default elasticsearch: default
@ -56,4 +67,4 @@ pipeline:
elasticsearch: "default" elasticsearch: "default"
input_queue: "metrics" input_queue: "metrics"
worker_size: 1 worker_size: 1
bulk_size_in_mb: 10 bulk_size_in_mb: 10

14
main.go
View File

@ -3,11 +3,9 @@ package main
import ( import (
"errors" "errors"
_ "expvar" _ "expvar"
"fmt"
"infini.sh/framework" "infini.sh/framework"
"infini.sh/framework/core/elastic" "infini.sh/framework/core/elastic"
"infini.sh/framework/core/env" "infini.sh/framework/core/env"
"infini.sh/framework/core/global"
"infini.sh/framework/core/module" "infini.sh/framework/core/module"
"infini.sh/framework/core/orm" "infini.sh/framework/core/orm"
pipe "infini.sh/framework/core/pipeline" pipe "infini.sh/framework/core/pipeline"
@ -74,12 +72,12 @@ func main() {
// global.Env().SystemConfig.APIConfig.CrossDomain.AllowedOrigins= // global.Env().SystemConfig.APIConfig.CrossDomain.AllowedOrigins=
// append(global.Env().SystemConfig.APIConfig.CrossDomain.AllowedOrigins,uiConfig.NetworkConfig.GetBindingAddr()) // append(global.Env().SystemConfig.APIConfig.CrossDomain.AllowedOrigins,uiConfig.NetworkConfig.GetBindingAddr())
//} //}
apiConfig := global.Env().SystemConfig.APIConfig //apiConfig := global.Env().SystemConfig.APIConfig
if len(apiConfig.CrossDomain.AllowedOrigins) == 0 { //if len(apiConfig.CrossDomain.AllowedOrigins) == 0 {
apiConfig.CrossDomain.AllowedOrigins = []string{ // apiConfig.CrossDomain.AllowedOrigins = []string{
fmt.Sprintf("%s://%s", appConfig.GetSchema(), apiConfig.NetworkConfig.GetPublishAddr()), // fmt.Sprintf("%s://%s", appConfig.GetSchema(), appConfig.Network.GetPublishAddr()),
} // }
} //}
//start each module, with enabled provider //start each module, with enabled provider
module.Start() module.Start()

View File

@ -1,4 +1,4 @@
@import '~antd/lib/style/themes/default.less'; @import "~antd/lib/style/themes/default.less";
.menu { .menu {
:global(.anticon) { :global(.anticon) {
@ -16,6 +16,5 @@
line-height: 64px; line-height: 64px;
> svg { > svg {
position: relative; position: relative;
top: 2px;
} }
} }

View File

@ -38,19 +38,25 @@ export default ({ clusterID, timezone, timeRange, handleTimeChange }) => {
node_name: undefined, node_name: undefined,
}); });
const topChange = (e) => { const topChange = React.useCallback(
setFilter({ (e) => {
node_name: undefined, setFilter({
top: e.target.value, node_name: undefined,
}); top: e.target.value,
}; });
},
[setFilter]
);
const nodeValueChange = (value) => { const nodeValueChange = React.useCallback(
setFilter({ (value) => {
top: undefined, setFilter({
node_name: value, top: undefined,
}); node_name: value,
}; });
},
[setFilter]
);
const queryParams = React.useMemo(() => { const queryParams = React.useMemo(() => {
const bounds = calculateBounds({ const bounds = calculateBounds({
from: timeRange.min, from: timeRange.min,
@ -127,10 +133,18 @@ export default ({ clusterID, timezone, timeRange, handleTimeChange }) => {
<div className="selector"> <div className="selector">
<div className="top_radio"> <div className="top_radio">
<Radio.Group onChange={topChange} value={filter.top}> <Radio.Group onChange={topChange} value={filter.top}>
<Radio.Button value="5">Top5</Radio.Button> <Radio.Button key="5" value="5">
<Radio.Button value="10">Top10</Radio.Button> Top5
<Radio.Button value="15">Top15</Radio.Button> </Radio.Button>
<Radio.Button value="20">Top20</Radio.Button> <Radio.Button key="10" value="10">
Top10
</Radio.Button>
<Radio.Button key="15" value="15">
Top15
</Radio.Button>
<Radio.Button key="20" value="20">
Top20
</Radio.Button>
</Radio.Group> </Radio.Group>
</div> </div>
<div className="value-selector"> <div className="value-selector">
@ -154,7 +168,7 @@ export default ({ clusterID, timezone, timeRange, handleTimeChange }) => {
{//Object.keys(metrics) {//Object.keys(metrics)
gorupOrder.map((e, i) => { gorupOrder.map((e, i) => {
return ( return (
<div style={{ margin: "8px 0" }}> <div key={e} style={{ margin: "8px 0" }}>
<MetricContainer <MetricContainer
title={formatMessage({ id: `cluster.metrics.group.${e}` })} title={formatMessage({ id: `cluster.metrics.group.${e}` })}
collapsed={false} collapsed={false}