diff --git a/api/init.go b/api/init.go index 7ad9bf25..b86b1ddb 100644 --- a/api/init.go +++ b/api/init.go @@ -4,7 +4,6 @@ import ( log "github.com/cihub/seelog" "infini.sh/framework/core/api" "infini.sh/framework/core/task" - "infini.sh/framework/core/ui" "infini.sh/search-center/api/index_management" "infini.sh/search-center/config" "infini.sh/search-center/service/alerting" @@ -17,66 +16,66 @@ func Init(cfg *config.AppConfig) { } var pathPrefix = "/_search-center/" var esPrefix = "/elasticsearch/:id/" - //ui.HandleUIMethod(api.POST, "/api/get_indices",index_management.API1) - ui.HandleUIMethod(api.GET, path.Join(pathPrefix, "elasticsearch/overview"), handler.ElasticsearchOverviewAction) + api.HandleAPIMethod(api.GET, path.Join(pathPrefix, "elasticsearch/overview"), handler.ElasticsearchOverviewAction) + //api.HandleAPIMethod(api.POST, "/api/get_indices",index_management.API1) - ui.HandleUIMethod(api.GET, path.Join(pathPrefix, "dict/_search"), handler.GetDictListAction) - ui.HandleUIMethod(api.POST, path.Join(pathPrefix, "dict/*id"), handler.CreateDictItemAction) - //ui.HandleUIMethod(api.GET, "/api/dict/:id",handler.GetDictItemAction) - ui.HandleUIMethod(api.DELETE, path.Join(pathPrefix, "dict/:id"), handler.DeleteDictItemAction) - ui.HandleUIMethod(api.PUT, path.Join(pathPrefix, "dict/:id"), handler.UpdateDictItemAction) - ui.HandleUIMethod(api.POST, path.Join(esPrefix, "doc/:index/_search"), handler.HandleSearchDocumentAction) - ui.HandleUIMethod(api.POST, path.Join(esPrefix, "doc/:index"), handler.HandleAddDocumentAction) - ui.HandleUIMethod(api.PUT, path.Join(esPrefix, "doc/:index/:docId"), handler.HandleUpdateDocumentAction) - ui.HandleUIMethod(api.DELETE, path.Join(esPrefix, "doc/:index/:docId"), handler.HandleDeleteDocumentAction) - ui.HandleUIMethod(api.GET, path.Join(esPrefix, "doc/_validate"), handler.ValidateDocIDAction) + api.HandleAPIMethod(api.GET, path.Join(pathPrefix, "dict/_search"), handler.GetDictListAction) + api.HandleAPIMethod(api.POST, path.Join(pathPrefix, "dict/*id"), handler.CreateDictItemAction) + //api.HandleAPIMethod(api.GET, "/api/dict/:id",handler.GetDictItemAction) + api.HandleAPIMethod(api.DELETE, path.Join(pathPrefix, "dict/:id"), handler.DeleteDictItemAction) + api.HandleAPIMethod(api.PUT, path.Join(pathPrefix, "dict/:id"), handler.UpdateDictItemAction) + api.HandleAPIMethod(api.POST, path.Join(esPrefix, "doc/:index/_search"), handler.HandleSearchDocumentAction) + api.HandleAPIMethod(api.POST, path.Join(esPrefix, "doc/:index"), handler.HandleAddDocumentAction) + api.HandleAPIMethod(api.PUT, path.Join(esPrefix, "doc/:index/:docId"), handler.HandleUpdateDocumentAction) + api.HandleAPIMethod(api.DELETE, path.Join(esPrefix, "doc/:index/:docId"), handler.HandleDeleteDocumentAction) + api.HandleAPIMethod(api.GET, path.Join(esPrefix, "doc/_validate"), handler.ValidateDocIDAction) - ui.HandleUIMethod(api.POST, path.Join(pathPrefix, "rebuild/*id"), handler.HandleReindexAction) - ui.HandleUIMethod(api.GET, path.Join(pathPrefix, "rebuild/_search"), handler.HandleGetRebuildListAction) - ui.HandleUIMethod(api.DELETE, path.Join(pathPrefix, "rebuild/:id"), handler.HandleDeleteRebuildAction) + api.HandleAPIMethod(api.POST, path.Join(pathPrefix, "rebuild/*id"), handler.HandleReindexAction) + api.HandleAPIMethod(api.GET, path.Join(pathPrefix, "rebuild/_search"), handler.HandleGetRebuildListAction) + api.HandleAPIMethod(api.DELETE, path.Join(pathPrefix, "rebuild/:id"), handler.HandleDeleteRebuildAction) - ui.HandleUIMethod(api.GET, path.Join(esPrefix, "_cat/indices"), handler.HandleGetIndicesAction) - ui.HandleUIMethod(api.GET, path.Join(esPrefix, "index/:index/_mappings"), handler.HandleGetMappingsAction) - ui.HandleUIMethod(api.GET, path.Join(esPrefix, "index/:index/_settings"), handler.HandleGetSettingsAction) - ui.HandleUIMethod(api.PUT, path.Join(esPrefix, "index/:index/_settings"), handler.HandleUpdateSettingsAction) - ui.HandleUIMethod(api.DELETE, path.Join(esPrefix, "index/:index"), handler.HandleDeleteIndexAction) - ui.HandleUIMethod(api.POST, path.Join(esPrefix, "index/:index"), handler.HandleCreateIndexAction) + api.HandleAPIMethod(api.GET, path.Join(esPrefix, "_cat/indices"), handler.HandleGetIndicesAction) + api.HandleAPIMethod(api.GET, path.Join(esPrefix, "index/:index/_mappings"), handler.HandleGetMappingsAction) + api.HandleAPIMethod(api.GET, path.Join(esPrefix, "index/:index/_settings"), handler.HandleGetSettingsAction) + api.HandleAPIMethod(api.PUT, path.Join(esPrefix, "index/:index/_settings"), handler.HandleUpdateSettingsAction) + api.HandleAPIMethod(api.DELETE, path.Join(esPrefix, "index/:index"), handler.HandleDeleteIndexAction) + api.HandleAPIMethod(api.POST, path.Join(esPrefix, "index/:index"), handler.HandleCreateIndexAction) - ui.HandleUIMethod(api.POST, path.Join(pathPrefix, "elasticsearch/command"), handler.HandleSaveCommonCommandAction) - ui.HandleUIMethod(api.GET, path.Join(pathPrefix, "elasticsearch/command"), handler.HandleQueryCommonCommandAction) - ui.HandleUIMethod(api.DELETE, path.Join(pathPrefix, "elasticsearch/command/:cid"), handler.HandleDeleteCommonCommandAction) + api.HandleAPIMethod(api.POST, path.Join(pathPrefix, "elasticsearch/command"), handler.HandleSaveCommonCommandAction) + api.HandleAPIMethod(api.GET, path.Join(pathPrefix, "elasticsearch/command"), handler.HandleQueryCommonCommandAction) + api.HandleAPIMethod(api.DELETE, path.Join(pathPrefix, "elasticsearch/command/:cid"), handler.HandleDeleteCommonCommandAction) //new api - ui.HandleUIMethod(api.GET, path.Join(pathPrefix, "alerting/overview"), alerting.GetAlertOverview) - ui.HandleUIMethod(api.GET, path.Join(pathPrefix, "alerting/overview/alerts"), alerting.GetAlerts) - ui.HandleUIMethod(api.POST, path.Join(pathPrefix,"alerting/destinations/email_accounts"), alerting.CreateEmailAccount) - ui.HandleUIMethod(api.PUT, path.Join(pathPrefix, "alerting/email_accounts/:emailAccountId"), alerting.UpdateEmailAccount) - ui.HandleUIMethod(api.DELETE, path.Join(pathPrefix,"alerting/email_accounts/:emailAccountId"), alerting.DeleteEmailAccount) - ui.HandleUIMethod(api.GET, path.Join(pathPrefix,"alerting/destinations/email_accounts"), alerting.GetEmailAccounts) - ui.HandleUIMethod(api.GET, path.Join(pathPrefix,"alerting/email_accounts/:emailAccountId"), alerting.GetEmailAccount) - ui.HandleUIMethod(api.POST, path.Join(pathPrefix,"alerting/destinations/email_groups"), alerting.CreateEmailGroup) - ui.HandleUIMethod(api.GET, path.Join(pathPrefix,"alerting/destinations/email_groups"), alerting.GetEmailGroups) - ui.HandleUIMethod(api.DELETE, path.Join(pathPrefix,"alerting/email_groups/:emailGroupId"), alerting.DeleteEmailGroup) - ui.HandleUIMethod(api.PUT, path.Join(pathPrefix,"alerting/email_groups/:emailGroupId"), alerting.UpdateEmailGroup) - ui.HandleUIMethod(api.GET, path.Join(pathPrefix,"alerting/email_groups/:emailGroupId"), alerting.GetEmailGroup) - ui.HandleUIMethod(api.GET, path.Join(pathPrefix, "alerting/destinations"), alerting.GetDestinations) - ui.HandleUIMethod(api.POST, path.Join(pathPrefix,"alerting/destinations"), alerting.CreateDestination) - ui.HandleUIMethod(api.PUT, path.Join(pathPrefix,"alerting/destinations/:destinationId"), alerting.UpdateDestination) - ui.HandleUIMethod(api.DELETE, path.Join(pathPrefix, "alerting/destinations/:destinationId"), alerting.DeleteDestination) - ui.HandleUIMethod(api.GET, "/elasticsearch/:id/alerting/monitors/:monitorID", alerting.GetMonitor) - ui.HandleUIMethod(api.PUT, "/elasticsearch/:id/alerting/monitors/:monitorID", alerting.UpdateMonitor) - ui.HandleUIMethod(api.GET, "/elasticsearch/:id/alerting/monitors", alerting.GetMonitors) - ui.HandleUIMethod(api.POST, "/elasticsearch/:id/alerting/monitors", alerting.CreateMonitor) - ui.HandleUIMethod(api.POST, "/elasticsearch/:id/alerting/monitors/_execute", alerting.ExecuteMonitor) - ui.HandleUIMethod(api.DELETE, "/elasticsearch/:id/alerting/monitors/:monitorID", alerting.DeleteMonitor) + api.HandleAPIMethod(api.GET, path.Join(pathPrefix, "alerting/overview"), alerting.GetAlertOverview) + api.HandleAPIMethod(api.GET, path.Join(pathPrefix, "alerting/overview/alerts"), alerting.GetAlerts) + api.HandleAPIMethod(api.POST, path.Join(pathPrefix,"alerting/destinations/email_accounts"), alerting.CreateEmailAccount) + api.HandleAPIMethod(api.PUT, path.Join(pathPrefix, "alerting/email_accounts/:emailAccountId"), alerting.UpdateEmailAccount) + api.HandleAPIMethod(api.DELETE, path.Join(pathPrefix,"alerting/email_accounts/:emailAccountId"), alerting.DeleteEmailAccount) + api.HandleAPIMethod(api.GET, path.Join(pathPrefix,"alerting/destinations/email_accounts"), alerting.GetEmailAccounts) + api.HandleAPIMethod(api.GET, path.Join(pathPrefix,"alerting/email_accounts/:emailAccountId"), alerting.GetEmailAccount) + api.HandleAPIMethod(api.POST, path.Join(pathPrefix,"alerting/destinations/email_groups"), alerting.CreateEmailGroup) + api.HandleAPIMethod(api.GET, path.Join(pathPrefix,"alerting/destinations/email_groups"), alerting.GetEmailGroups) + api.HandleAPIMethod(api.DELETE, path.Join(pathPrefix,"alerting/email_groups/:emailGroupId"), alerting.DeleteEmailGroup) + api.HandleAPIMethod(api.PUT, path.Join(pathPrefix,"alerting/email_groups/:emailGroupId"), alerting.UpdateEmailGroup) + api.HandleAPIMethod(api.GET, path.Join(pathPrefix,"alerting/email_groups/:emailGroupId"), alerting.GetEmailGroup) + api.HandleAPIMethod(api.GET, path.Join(pathPrefix, "alerting/destinations"), alerting.GetDestinations) + api.HandleAPIMethod(api.POST, path.Join(pathPrefix,"alerting/destinations"), alerting.CreateDestination) + api.HandleAPIMethod(api.PUT, path.Join(pathPrefix,"alerting/destinations/:destinationId"), alerting.UpdateDestination) + api.HandleAPIMethod(api.DELETE, path.Join(pathPrefix, "alerting/destinations/:destinationId"), alerting.DeleteDestination) + api.HandleAPIMethod(api.GET, "/elasticsearch/:id/alerting/monitors/:monitorID", alerting.GetMonitor) + api.HandleAPIMethod(api.PUT, "/elasticsearch/:id/alerting/monitors/:monitorID", alerting.UpdateMonitor) + api.HandleAPIMethod(api.GET, "/elasticsearch/:id/alerting/monitors", alerting.GetMonitors) + api.HandleAPIMethod(api.POST, "/elasticsearch/:id/alerting/monitors", alerting.CreateMonitor) + api.HandleAPIMethod(api.POST, "/elasticsearch/:id/alerting/monitors/_execute", alerting.ExecuteMonitor) + api.HandleAPIMethod(api.DELETE, "/elasticsearch/:id/alerting/monitors/:monitorID", alerting.DeleteMonitor) - ui.HandleUIMethod(api.GET, path.Join(pathPrefix,"alerting/_settings"), alerting.GetSettings) - ui.HandleUIMethod(api.POST, "/elasticsearch/:id/alerting/_indices", alerting.GetIndices) - ui.HandleUIMethod(api.POST, "/elasticsearch/:id/alerting/_aliases", alerting.GetAliases) - ui.HandleUIMethod(api.POST, "/elasticsearch/:id/alerting/_mappings", alerting.GetMappings) - ui.HandleUIMethod(api.POST, path.Join(pathPrefix, "alerting/_search"), alerting.Search) - ui.HandleUIMethod(api.GET, "/elasticsearch/:id/alerting/alerts", alerting.GetAlerts) - ui.HandleUIMethod(api.POST, "/elasticsearch/:id/alerting/_monitors/:monitorID/_acknowledge/alerts", alerting.AcknowledgeAlerts) + api.HandleAPIMethod(api.GET, path.Join(pathPrefix,"alerting/_settings"), alerting.GetSettings) + api.HandleAPIMethod(api.POST, "/elasticsearch/:id/alerting/_indices", alerting.GetIndices) + api.HandleAPIMethod(api.POST, "/elasticsearch/:id/alerting/_aliases", alerting.GetAliases) + api.HandleAPIMethod(api.POST, "/elasticsearch/:id/alerting/_mappings", alerting.GetMappings) + api.HandleAPIMethod(api.POST, path.Join(pathPrefix, "alerting/_search"), alerting.Search) + api.HandleAPIMethod(api.GET, "/elasticsearch/:id/alerting/alerts", alerting.GetAlerts) + api.HandleAPIMethod(api.POST, "/elasticsearch/:id/alerting/_monitors/:monitorID/_acknowledge/alerts", alerting.AcknowledgeAlerts) task.RegisterScheduleTask(task.ScheduleTask{ diff --git a/main.go b/main.go index 6bf8eeed..eb8033fa 100644 --- a/main.go +++ b/main.go @@ -67,6 +67,14 @@ func main() { appUI = &UI{Config: appConfig} appUI.InitUI() + //uiConfig := ui.UIConfig{} + //env.ParseConfig("web", &uiConfig) + // + //if len(global.Env().SystemConfig.APIConfig.CrossDomain.AllowedOrigins)==0{ + // global.Env().SystemConfig.APIConfig.CrossDomain.AllowedOrigins= + // append(global.Env().SystemConfig.APIConfig.CrossDomain.AllowedOrigins,uiConfig.NetworkConfig.GetBindingAddr()) + //} + //start each module, with enabled provider module.Start() diff --git a/web/config/config.js b/web/config/config.js index 0ac2a6e7..1f1ea155 100644 --- a/web/config/config.js +++ b/web/config/config.js @@ -49,6 +49,8 @@ export default { }, define: { APP_TYPE: process.env.APP_TYPE || '', + ENV: process.env.NODE_ENV, + API_ENDPOINT: 'http://localhost:2900', }, // 路由配置 routes: pageRoutes, diff --git a/web/config/router.config.js b/web/config/router.config.js index b33bbbb5..bfcdee98 100644 --- a/web/config/router.config.js +++ b/web/config/router.config.js @@ -482,7 +482,7 @@ export default [ }, { path: '/system/command', - name: 'command', + name: 'commonCommand', component: './System/Command/Index', hideInMenu: true }, diff --git a/web/src/components/GlobalHeader/index.less b/web/src/components/GlobalHeader/index.less index 5ed7fbaf..23e61c18 100644 --- a/web/src/components/GlobalHeader/index.less +++ b/web/src/components/GlobalHeader/index.less @@ -127,3 +127,7 @@ i.trigger { } } } + +[tabindex]{ + outline: none !important; +} \ No newline at end of file diff --git a/web/src/components/kibana/console/components/Console.tsx b/web/src/components/kibana/console/components/Console.tsx index 89a314d1..ce0ed644 100644 --- a/web/src/components/kibana/console/components/Console.tsx +++ b/web/src/components/kibana/console/components/Console.tsx @@ -1,5 +1,5 @@ // @ts-ignore -import React, { useRef, useMemo,useEffect, useLayoutEffect } from 'react'; +import React, { useRef, useMemo,useEffect, useLayoutEffect, useState } from 'react'; import ConsoleInput from './ConsoleInput'; import ConsoleOutput from './ConsoleOutput'; import { Panel } from './Panel'; @@ -40,61 +40,68 @@ const ConsoleWrapper = ({ } = useRequestReadContext(); const lastDatum = requestData?.[requestData.length - 1] ?? requestError; - const getElementTop = (elem: any)=>{ -   var elemTop=elem.offsetTop; -   elem=elem.offsetParent; - -   while(elem!=null){ -     elemTop+=elem.offsetTop; -     elem=elem.offsetParent; -   } - -   return elemTop; - - } - const statusBarRef = useRef(null); - const consoleRef = useRef(null); - // useEffect(()=>{ - // const winScroll = ()=>{ - // const wsTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop; - // if(wsTop>getElementTop(consoleRef.current)) { - // statusBarRef.current && (statusBarRef.current.style.position='relative'); - // }else{ - // statusBarRef.current && (statusBarRef.current.style.position='fixed'); - // } - // } - // window.addEventListener('scroll', winScroll, {passive:true}) - // return ()=>{ - // window.removeEventListener('scroll', winScroll) - // } - // },[]) - - useEventListener('resize', ()=>{ - statusBarRef.current && consoleRef.current && (statusBarRef.current.style.width=consoleRef.current.offsetWidth+'px'); - }) - - useLayoutEffect(()=>{ - // console.log(consoleRef.current?.offsetWidth) - if(consoleRef.current.offsetWidth>0) - statusBarRef.current && consoleRef.current && (statusBarRef.current.style.width=consoleRef.current.offsetWidth+'px'); - }, [consoleRef.current?.offsetWidth]) - - const calcHeight = height > 0 ? (height-35)+'px' : '100%'; + const calcHeight = height > 0 ? (height)+'px' : '100%'; + // const leftBarRef = useRef(null) + // const rightBarRef = useRef(null) + // const [widths, setWidths] = useState(['calc(50% - 7px)', 'calc(50% - 7px)']) + // const onPanelWidthChange = (widths:any)=>{ + // const [lp, rp] = widths; + // setWidths([lp+'%', rp+'%']); + // } return (
-
+
- + +
+ +
- + +
+ +
-
+ {/*
-
+
*/}
); }; diff --git a/web/src/components/kibana/console/components/request_status_bar/request_status_bar.scss b/web/src/components/kibana/console/components/request_status_bar/request_status_bar.scss index 28841945..8432be8e 100644 --- a/web/src/components/kibana/console/components/request_status_bar/request_status_bar.scss +++ b/web/src/components/kibana/console/components/request_status_bar/request_status_bar.scss @@ -1,15 +1,14 @@ .request-status-bar{ - display: flex; - justify-content: center; - align-items: center; height: 100%; .bar-item{ - flex: 0 0 50%; + height: 100%; .base-info{ display: flex; - font-size: 12px; + font-size: 12px; + align-items: center; + margin-top: 2px; .info-item{ - margin: 12px; + margin: 0 12px; position: relative; &.health{ padding-right: 14px; @@ -21,7 +20,7 @@ font-size: 12px; align-items: center; .info-item{ - margin: 12px; + margin: 0 12px; } } } diff --git a/web/src/components/kibana/console/components/request_status_bar/request_status_bar.tsx b/web/src/components/kibana/console/components/request_status_bar/request_status_bar.tsx index a50080ed..01ef6939 100644 --- a/web/src/components/kibana/console/components/request_status_bar/request_status_bar.tsx +++ b/web/src/components/kibana/console/components/request_status_bar/request_status_bar.tsx @@ -22,6 +22,7 @@ import { EuiFlexGroup, EuiFlexItem, EuiBadge, EuiText, EuiToolTip,EuiCodeBlock } import {HealthStatusCircle} from '@/components/infini/health_status_circle'; import './request_status_bar.scss'; import {Drawer, Tabs, Button} from 'antd'; +import { FormattedMessage, formatMessage } from 'umi/locale'; export interface Props { requestInProgress: boolean; @@ -65,101 +66,27 @@ const mapStatusCodeToBadgeColor = (statusCode: number) => { return 'danger'; }; -// export const RequestStatusBar: FunctionComponent = ({ -// requestInProgress, -// requestResult, -// selectedCluster, -// }) => { -// let content: React.ReactNode = null; -// const clusterContent = ( -// -// {selectedCluster.host} - {selectedCluster.version} -// -// ); - -// if (requestInProgress) { -// content = ( -// -// -// Request in progress -// -// -// ); -// } else if (requestResult) { -// const { endpoint, method, statusCode, statusText, timeElapsedMs } = requestResult; - -// content = ( -// <> -// -// {`${method} ${ -// endpoint.startsWith('/') ? endpoint : '/' + endpoint -// }`} -// } -// > -// -// {/* Use   to ensure that no matter the width we don't allow line breaks */} -// {statusCode} - {statusText} -// -// -// -// -// -// Time Elapsed -// -// } -// > -// -// -// {timeElapsedMs} {'ms'} -// -// -// -// -// -// ); -// } - -// return ( -// -// {clusterContent} -// {content} -// -// ); -// }; - export const RequestStatusBar = ({ requestInProgress, requestResult, selectedCluster, - container, + left, }:Props) => { let content: React.ReactNode = null; const clusterContent = (
- 健康状态: +
- 集群地址: - {selectedCluster.host} + + {selectedCluster.host}
- 版本: - {selectedCluster.version} + + {selectedCluster.version}
); const [headerInfoVisible, setHeaderInfoVisible] = React.useState(false) @@ -179,7 +106,7 @@ const [headerInfoVisible, setHeaderInfoVisible] = React.useState(false) <>
- 响应状态: + } > - - {/* Use   to ensure that no matter the width we don't allow line breaks */} - {statusCode} - {statusText} - + + + {/* Use   to ensure that no matter the width we don't allow line breaks */} + {statusCode} - {statusText} + +
- 时延: +
- - - + {/* */}
@@ -225,8 +153,8 @@ const [headerInfoVisible, setHeaderInfoVisible] = React.useState(false) return (
-
{clusterContent}
-
{content}
+ {left?
{clusterContent}
: + [
{content}
, - + ] + }
); diff --git a/web/src/components/kibana/console/modules/es/index.ts b/web/src/components/kibana/console/modules/es/index.ts index 8bbec3fc..90c4c02d 100644 --- a/web/src/components/kibana/console/modules/es/index.ts +++ b/web/src/components/kibana/console/modules/es/index.ts @@ -34,7 +34,7 @@ import $ from 'jquery'; // @ts-ignore import { stringify } from 'query-string'; -import {pathPrefix} from '@/services/common'; +import {pathPrefix, ESPrefix} from '@/services/common'; interface SendOptions { asSystemRequest?: boolean; @@ -48,7 +48,7 @@ export function getVersion() { } export function getContentType(body: unknown) { - if (!body) return; + if (!body) return 'text/plain'; return 'application/json'; } @@ -75,11 +75,12 @@ export function send( // } // @ts-ignore const options: JQuery.AjaxSettings = { - url: `/elasticsearch/${clusterID}/_proxy?` + stringify({ path, method }), - headers: { - 'infini-xsrf': 'search-center', - ...(asSystemRequest && { 'infini-request': 'true' }), - }, + url: `${ESPrefix}/${clusterID}/_proxy?` + stringify({ path, method }), + // headers: { + // 'infini-xsrf': 'search-center', + // 'origin': location.origin, + // ...(asSystemRequest && { 'infini-request': 'true' }), + // }, data, contentType: getContentType(data), cache: false, diff --git a/web/src/locales/en-US.js b/web/src/locales/en-US.js index 4480aea0..ab955f21 100644 --- a/web/src/locales/en-US.js +++ b/web/src/locales/en-US.js @@ -1,4 +1,5 @@ import alert from './en-US/alert'; +import console from './en-US/console'; export default { 'navBar.lang': 'Languages', @@ -152,6 +153,7 @@ export default { 'menu.system.logs.audit': 'AUDIT', 'menu.system.logs.query': 'QUERY', 'menu.system.logs.slow': 'SLOW', + 'menu.system.commonCommand': 'COMMON COMMAND', 'menu.form': 'Form', @@ -405,4 +407,5 @@ export default { 'Setting panel shows in development environment only, please manually modify', ...alert, + ...console, }; diff --git a/web/src/locales/en-US/console.js b/web/src/locales/en-US/console.js new file mode 100644 index 00000000..7cc9e809 --- /dev/null +++ b/web/src/locales/en-US/console.js @@ -0,0 +1,9 @@ +export default { + 'console.cluster.status': 'Health', + 'console.cluster.endpoint': 'Endpoint', + 'console.cluster.version': 'Version', + 'console.response.status': 'Response status', + 'console.response.time_elapsed': 'Time elapsed', + 'console.request.headers': 'Headers', + 'console.request.headers.title': 'Request header info', +} \ No newline at end of file diff --git a/web/src/locales/zh-CN.js b/web/src/locales/zh-CN.js index b5ada7b8..d58d79b5 100644 --- a/web/src/locales/zh-CN.js +++ b/web/src/locales/zh-CN.js @@ -1,4 +1,5 @@ import alert from './zh-CN/alert'; +import console from './zh-CN/console'; export default { 'navBar.lang': '语言', @@ -158,6 +159,7 @@ export default { 'menu.system.logs.audit': '审计日志', 'menu.system.logs.query': '查询日志', 'menu.system.logs.slow': '慢日志', + 'menu.system.commonCommand': '常用命令', 'menu.form': '表单页', @@ -406,4 +408,5 @@ export default { '配置栏只在开发环境用于预览,生产环境不会展现,请拷贝后手动修改配置文件', ...alert, + ...console, }; diff --git a/web/src/locales/zh-CN/console.js b/web/src/locales/zh-CN/console.js new file mode 100644 index 00000000..fadd5d02 --- /dev/null +++ b/web/src/locales/zh-CN/console.js @@ -0,0 +1,9 @@ +export default { + 'console.cluster.status': '健康状态', + 'console.cluster.endpoint': '集群地址', + 'console.cluster.version': '版本', + 'console.response.status': '响应状态', + 'console.response.time_elapsed': '时延', + 'console.request.headers': '请求头', + 'console.request.headers.title': '请求头信息', +} \ No newline at end of file diff --git a/web/src/pages/Alerting/index.js b/web/src/pages/Alerting/index.js index cad400b3..ed0e1a44 100644 --- a/web/src/pages/Alerting/index.js +++ b/web/src/pages/Alerting/index.js @@ -7,6 +7,7 @@ import {ScopedHistory} from '../../components/kibana/core/public/application/sco import {notification} from 'antd'; import {connect} from 'dva' import PageHeaderWrapper from '@/components/PageHeaderWrapper'; +import {ESPrefix} from '@/services/common' const httpClient = new Fetch({ basePath:{ @@ -41,7 +42,7 @@ const AlertingUI = (props)=>{ } useMemo(()=>{ httpClient.params.basePath.prepend = (url)=>{ - return '/elasticsearch/'+ props.selectedCluster.id +"/" + url; + return `${ESPrefix}/${props.selectedCluster.id}/${url}`; } }, [props.selectedCluster]); const isDarkMode = false; diff --git a/web/src/pages/Cluster/NewOverview.js b/web/src/pages/Cluster/NewOverview.js index 6c895ffd..9de2664e 100644 --- a/web/src/pages/Cluster/NewOverview.js +++ b/web/src/pages/Cluster/NewOverview.js @@ -19,6 +19,7 @@ const NewOverview = ()=>{ onChange={()=>{}} type="card" tabBarGutter={10} + tabindex="-1" > {panes.map(pane => ( diff --git a/web/src/pages/Cluster/components/clusters.scss b/web/src/pages/Cluster/components/clusters.scss index 189f2c27..bbbdbb26 100644 --- a/web/src/pages/Cluster/components/clusters.scss +++ b/web/src/pages/Cluster/components/clusters.scss @@ -9,6 +9,7 @@ &.left{ border-right: 1px solid rgb(232, 232, 232); padding-right: 15px; + min-width: 642px; .card-cnt{ margin-top: 10px; .ant-list-item{ diff --git a/web/src/pages/Cluster/components/tag.scss b/web/src/pages/Cluster/components/tag.scss index e82b8767..f3aa5708 100644 --- a/web/src/pages/Cluster/components/tag.scss +++ b/web/src/pages/Cluster/components/tag.scss @@ -9,6 +9,7 @@ &.checked{ background: #1890ff; color: #fff; + border-color: #1890ff; } >.wrapper{ font-size: 12px; diff --git a/web/src/pages/DataManagement/Discover.jsx b/web/src/pages/DataManagement/Discover.jsx index 7e8ab807..48a61c16 100644 --- a/web/src/pages/DataManagement/Discover.jsx +++ b/web/src/pages/DataManagement/Discover.jsx @@ -49,7 +49,8 @@ import {generateFilters} from '../../components/kibana/data/public/query/filter_ import Table from '../../components/kibana/discover/public/application/components/discover_table/table'; import {useQueryParam, StringParam, QueryParamProvider, ArrayParam} from 'use-query-params'; -import {Route} from 'umi' +import {Route} from 'umi'; +import {ESPrefix} from '@/services/common'; const SidebarMemoized = React.memo(DiscoverSidebar); @@ -550,7 +551,7 @@ const DiscoverUI = (props)=>{ useMemo(()=>{ const {http} = getContext(); http.getServerBasePath = ()=>{ - return '/elasticsearch/'+ props.selectedCluster.id; + return `${ESPrefix}/`+ props.selectedCluster.id; } }, [props.selectedCluster]) useEffect(()=>{ diff --git a/web/src/pages/DataManagement/IndexPatterns.jsx b/web/src/pages/DataManagement/IndexPatterns.jsx index 3e99661a..1b4b5d4d 100644 --- a/web/src/pages/DataManagement/IndexPatterns.jsx +++ b/web/src/pages/DataManagement/IndexPatterns.jsx @@ -15,6 +15,7 @@ import styles from '../System/Cluster/step.less'; import clusterBg from '@/assets/cluster_bg.png'; import { connect } from 'dva'; +import {ESPrefix} from '@/services/common'; const createContent = ( @@ -42,7 +43,7 @@ const IndexPatterns = (props)=> { const createComponentKey = useMemo(()=>{ const {http, uiSettings} = useGlobalContext(); http.getServerBasePath = ()=>{ - return '/elasticsearch/'+ props.selectedCluster.id; + return `${ESPrefix}/`+ props.selectedCluster.id; } return 'CreateIndexPatternWizard_'+Math.random(); },[props.selectedCluster]); diff --git a/web/src/pages/DataManagement/context.js b/web/src/pages/DataManagement/context.js index 9922cd42..04871132 100644 --- a/web/src/pages/DataManagement/context.js +++ b/web/src/pages/DataManagement/context.js @@ -23,6 +23,7 @@ import { import {FieldFormatsRegistry,} from '../../components/kibana/data/common/field_formats'; import {baseFormattersPublic} from '../../components/kibana/data/public/field_formats'; import { deserializeFieldFormat } from '../../components/kibana/data/public/field_formats/utils/deserialize'; +import {ESPrefix} from '@/services/common' const timeBucketConfig = { 'histogram:maxBars': 100, @@ -304,7 +305,7 @@ const getSearchParams = (indexPattern, internal, sort) =>{ } const fetchESRequest = (params, clusterID) => { - return fetch(`/elasticsearch/${clusterID}/search/ese`, { + return fetch(`${ESPrefix}/${clusterID}/search/ese`, { headers:{ 'Content-Type': 'application/json', }, diff --git a/web/src/pages/DevTool/Console.tsx b/web/src/pages/DevTool/Console.tsx index be144617..777c8f21 100644 --- a/web/src/pages/DevTool/Console.tsx +++ b/web/src/pages/DevTool/Console.tsx @@ -1,6 +1,7 @@ import Console from '../../components/kibana/console/components/Console'; import {connect} from 'dva'; -import {Tabs, Button, Icon, Menu, Dropdown} from 'antd'; +import {Button, Icon, Menu, Dropdown, Tabs} from 'antd'; +// import Tabs from '@/components/infini/tabs'; import {useState, useReducer, useCallback, useEffect, useMemo, useRef, useLayoutEffect} from 'react'; import {useLocalStorage} from '@/lib/hooks/storage'; import {setClusterID} from '../../components/kibana/console/modules/mappings/mappings'; diff --git a/web/src/services/alias.js b/web/src/services/alias.js index 859335b0..4e1f9d72 100644 --- a/web/src/services/alias.js +++ b/web/src/services/alias.js @@ -1,15 +1,15 @@ import request from '@/utils/request'; -//import {pathPrefix} from './common'; +import {ESPrefix} from './common'; export async function getAliasList(params){ - let url = `/elasticsearch/${params.clusterID}/alias`; + let url = `${ESPrefix}/${params.clusterID}/alias`; return request(url,{ method: 'GET', }); } export async function doAlias(params){ - let url = `/elasticsearch/${params.clusterID}/alias`; + let url = `${ESPrefix}/${params.clusterID}/alias`; return request(url,{ method: 'POST', body: params.data, diff --git a/web/src/services/cluster.js b/web/src/services/cluster.js index 5c13c0b5..6a6e1170 100644 --- a/web/src/services/cluster.js +++ b/web/src/services/cluster.js @@ -1,8 +1,8 @@ import request from '@/utils/request'; -import {buildQueryArgs, pathPrefix} from './common'; +import {buildQueryArgs, ESPrefix} from './common'; export async function getClusterVersion(params) { - return request(`/elasticsearch/${params.cluster}/version`, { + return request(`${ESPrefix}/${params.cluster}/version`, { method: 'GET' }); } @@ -10,13 +10,13 @@ export async function getClusterVersion(params) { export async function getClusterMetrics(params) { let id = params.cluster_id; delete(params['cluster_id']); - return request(`/elasticsearch/${id}/metrics?min=${params.timeRange.min}&max=${params.timeRange.max}`, { + return request(`${ESPrefix}/${id}/metrics?min=${params.timeRange.min}&max=${params.timeRange.max}`, { method: 'GET' }); } export async function createClusterConfig(params) { - return request(`/elasticsearch/`, { + return request(`${ESPrefix}/`, { method: 'POST', body: params, }); @@ -25,21 +25,21 @@ export async function createClusterConfig(params) { export async function updateClusterConfig(params) { let id = params.id; delete(params['id']); - return request(`/elasticsearch/${id}`, { + return request(`${ESPrefix}/${id}`, { method: 'PUT', body: params, }); } export async function deleteClusterConfig(params) { - return request(`/elasticsearch/${params.id}`, { + return request(`${ESPrefix}/${params.id}`, { method: 'DELETE', body: params, }); } export async function searchClusterConfig(params) { - let url = `/elasticsearch/_search`; + let url = `${ESPrefix}/_search`; let args = buildQueryArgs({ name: params.name, enabled: params.enabled, @@ -55,14 +55,14 @@ export async function searchClusterConfig(params) { } export async function getClusterStatus(params) { - let url = `/elasticsearch/status`; + let url = `${ESPrefix}/status`; return request(url, { method: 'GET', }); } export async function tryConnect(params) { - let url = `/elasticsearch/try_connect`; + let url = `${ESPrefix}/try_connect`; return request(url, { method: 'POST', body: params, diff --git a/web/src/services/common.js b/web/src/services/common.js index fa492476..16d80725 100644 --- a/web/src/services/common.js +++ b/web/src/services/common.js @@ -1,4 +1,4 @@ -export const pathPrefix = '/_search-center'; +export const pathPrefix = (API_ENDPOINT || '') + '/_search-center'; export function buildQueryArgs(params){ let argsStr = ''; @@ -14,4 +14,4 @@ export function buildQueryArgs(params){ return argsStr; } -export const ESPrefix = '/elasticsearch'; \ No newline at end of file +export const ESPrefix = (API_ENDPOINT || '') + '/elasticsearch'; \ No newline at end of file