Skip to content

Commit 1ecdbb3

Browse files
yaojp123yaojiping
and
yaojiping
authored
chore: adjust the description when no data in monitor logs (#153)
* chore: adjust the description when no data in monitor logs * chore: adjust discover's histogram --------- Co-authored-by: yaojiping <[email protected]>
1 parent 78cdd44 commit 1ecdbb3

File tree

8 files changed

+92
-64
lines changed

8 files changed

+92
-64
lines changed

web/src/components/Overview/Monitor/index.jsx

+43-41
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ const Monitor = (props) => {
158158
return monitor_configs?.node_stats?.enabled === false && monitor_configs?.index_stats?.enabled === false
159159
}
160160
return metric_collection_mode === 'agent'
161-
}, [JSON.stringify(selectedCluster?.monitor_configs)])
161+
}, [JSON.stringify(selectedCluster)])
162162

163163
return (
164164
<div>
@@ -170,46 +170,48 @@ const Monitor = (props) => {
170170
<>
171171
<div style={{ marginBottom: 5 }}>
172172
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
173-
<DatePicker
174-
locale={getLocale()}
175-
start={state.timeRange.min}
176-
end={state.timeRange.max}
177-
onRangeChange={({ start, end }) => {
178-
handleTimeChange({ start, end })
179-
}}
180-
{...refresh}
181-
onRefreshChange={(newRefresh) => {
182-
onTimeSettingsChange(newRefresh)
183-
setRefresh(newRefresh)
184-
}}
185-
onRefresh={(value) => handleTimeChange({ ...(value || {}), refresh: new Date().valueOf()})}
186-
showTimeSetting={true}
187-
showTimeInterval={true}
188-
timeInterval={state.timeInterval}
189-
timeIntervalDisabled={state.timeIntervalDisabled}
190-
showTimeout={true}
191-
timeout={state.timeout}
192-
onTimeSettingChange={(timeSetting) => {
193-
onTimeSettingsChange({
194-
timeInterval: timeSetting.timeInterval,
195-
timeout: timeSetting.timeout
196-
})
197-
setState({
198-
...state,
199-
param,
200-
timeInterval: timeSetting.timeInterval,
201-
timeout: timeSetting.timeout
202-
});
203-
}}
204-
timeZone={timeZone}
205-
onTimeZoneChange={(timeZone) => {
206-
onTimeSettingsChange({
207-
timeZone,
208-
})
209-
setTimeZone(timeZone)
210-
}}
211-
recentlyUsedRangesKey={'monitor'}
212-
/>
173+
<div style={{ maxWidth: 600 }}>
174+
<DatePicker
175+
locale={getLocale()}
176+
start={state.timeRange.min}
177+
end={state.timeRange.max}
178+
onRangeChange={({ start, end }) => {
179+
handleTimeChange({ start, end })
180+
}}
181+
{...refresh}
182+
onRefreshChange={(newRefresh) => {
183+
onTimeSettingsChange(newRefresh)
184+
setRefresh(newRefresh)
185+
}}
186+
onRefresh={(value) => handleTimeChange({ ...(value || {}), refresh: new Date().valueOf()})}
187+
showTimeSetting={true}
188+
showTimeInterval={true}
189+
timeInterval={state.timeInterval}
190+
timeIntervalDisabled={state.timeIntervalDisabled}
191+
showTimeout={true}
192+
timeout={state.timeout}
193+
onTimeSettingChange={(timeSetting) => {
194+
onTimeSettingsChange({
195+
timeInterval: timeSetting.timeInterval,
196+
timeout: timeSetting.timeout
197+
})
198+
setState({
199+
...state,
200+
param,
201+
timeInterval: timeSetting.timeInterval,
202+
timeout: timeSetting.timeout
203+
});
204+
}}
205+
timeZone={timeZone}
206+
onTimeZoneChange={(timeZone) => {
207+
onTimeSettingsChange({
208+
timeZone,
209+
})
210+
setTimeZone(timeZone)
211+
}}
212+
recentlyUsedRangesKey={'monitor'}
213+
/>
214+
</div>
213215
<CollectStatus fetchUrl={`${ESPrefix}/${selectedCluster?.id}/_collection_stats`}/>
214216
</div>
215217
</div>

web/src/components/vendor/discover/public/application/components/histogram/histogram.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export class DiscoverHistogram extends Component {
8888

8989
render() {
9090
const timeZone = getTimezone();
91-
const { chartData } = this.props;
91+
const { chartData, height = 100 } = this.props;
9292

9393
const { chartsTheme, chartsBaseTheme } = this.state;
9494

@@ -149,7 +149,7 @@ export class DiscoverHistogram extends Component {
149149
//console.log(data)
150150

151151
return (
152-
<Chart size={{ height: 40 }}>
152+
<Chart size={{ height }}>
153153
<Settings
154154
xDomain={xDomain}
155155
onBrushEnd={this.onBrushEnd}

web/src/locales/en-US/cluster.js

+2
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ export default {
130130
"cluster.monitor.logs.node": "Node",
131131
"cluster.monitor.logs.message": "Message",
132132
"cluster.monitor.logs.search.placeholder": "Search message",
133+
"cluster.monitor.logs.empty.agent": "No data, please change the time range or check if the Agent is working properly.",
134+
"cluster.monitor.logs.empty.agentless": "No data, please install the Agent and change the cluster collection mode to Agent.",
133135

134136
"cluster.monitor.tabs.overview": "Overview",
135137
"cluster.monitor.tabs.advanced": "Advanced",

web/src/locales/zh-CN/cluster.js

+2
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ export default {
121121
"cluster.monitor.logs.node": "节点",
122122
"cluster.monitor.logs.message": "日志",
123123
"cluster.monitor.logs.search.placeholder": "搜索日志",
124+
"cluster.monitor.logs.empty.agent": "没有数据,请更改时间范围或检查 Agent 是否正常工作。",
125+
"cluster.monitor.logs.empty.agentless": "没有数据,请安装 Agent 并更改集群采集模式为 Agent 。",
124126

125127
"cluster.monitor.tabs.overview": "概览",
126128
"cluster.monitor.tabs.advanced": "高级",

web/src/models/global.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,10 @@ export default {
355355
let idx = state.clusterList.findIndex((item) => item.id === payload.id);
356356
idx > -1 && (state.clusterList[idx].name = payload.name);
357357
if (state.selectedCluster?.id === payload.id) {
358-
state.selectedCluster.monitor_configs = payload.monitor_configs
358+
state.selectedCluster = {
359+
...(state.selectedCluster || {}),
360+
...(payload || {})
361+
}
359362
}
360363
state.clusterStatus[payload.id].config.monitored = payload.monitored;
361364
return state;

web/src/pages/DataManagement/Discover.jsx

+31-1
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ const Discover = (props) => {
178178
field: "",
179179
enabled: false,
180180
};
181+
182+
const [histogramVisible, setHistogramVisible] = useState(false)
183+
181184
const [distinctParams, setDistinctParams] = React.useState(
182185
distinctParamsDefault
183186
);
@@ -1162,7 +1165,9 @@ const Discover = (props) => {
11621165
showLayoutListIcon={false}
11631166
histogramProps={{
11641167
histogramData,
1165-
timefilterUpdateHandler
1168+
onHistogramToggle: () => {
1169+
setHistogramVisible(!histogramVisible)
1170+
},
11661171
}}
11671172
// viewLayout={viewLayout}
11681173
// onViewLayoutChange={(layout) => {
@@ -1310,6 +1315,31 @@ const Discover = (props) => {
13101315
responsive={false}
13111316
style={{ position: "relative" }}
13121317
>
1318+
{histogramVisible && opts.timefield && (
1319+
<EuiFlexItem>
1320+
<section
1321+
aria-label={"Histogram of found documents"}
1322+
className="dscTimechart"
1323+
>
1324+
{opts.chartAggConfigs &&
1325+
histogramData &&
1326+
records.length !== 0 && (
1327+
<div
1328+
className="dscHistogramGrid"
1329+
data-test-subj="discoverChart"
1330+
>
1331+
<DiscoverHistogram
1332+
chartData={histogramData}
1333+
timefilterUpdateHandler={
1334+
timefilterUpdateHandler
1335+
}
1336+
/>
1337+
</div>
1338+
)}
1339+
</section>
1340+
<EuiSpacer size="s" />
1341+
</EuiFlexItem>
1342+
)}
13131343
<EuiFlexItem className="eui-yScroll">
13141344
<section
13151345
className="dscTable eui-yScroll"

web/src/pages/DataManagement/Insight/Histogram/index.jsx

+4-18
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,11 @@ import styles from "./index.less";
55

66
export default (props) => {
77

8-
const { histogramData, timefilterUpdateHandler } = props
9-
10-
const [visible, setVisible] = useState(false)
8+
const { onHistogramToggle } = props
119

1210
return (
13-
<Popover
14-
visible={visible}
15-
placement="left"
16-
title={null}
17-
overlayClassName={styles.histogram}
18-
content={(
19-
<DiscoverHistogram
20-
chartData={histogramData}
21-
timefilterUpdateHandler={timefilterUpdateHandler}
22-
/>
23-
)}>
24-
<Icon type="bar-chart" style={{color: '#006BB4', cursor: 'pointer'}} onClick={() => {
25-
setVisible(!visible)
26-
}}/>
27-
</Popover>
11+
<Icon type="bar-chart" title="show histogram" style={{color: '#006BB4', cursor: 'pointer'}} onClick={() => {
12+
onHistogramToggle()
13+
}}/>
2814
)
2915
}

web/src/pages/Platform/Overview/components/Logs/index.jsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,10 @@ export default (props) => {
314314
</div>
315315
</>
316316
) : (
317-
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE}/>
317+
<Empty
318+
image={Empty.PRESENTED_IMAGE_SIMPLE}
319+
description={formatMessage({ id: `cluster.monitor.logs.empty.${isAgent ? 'agent' : 'agentless'}` })}
320+
/>
318321
)
319322
}
320323
</div>

0 commit comments

Comments
 (0)