Skip to content

Commit aed77fd

Browse files
author
yulichun
committed
Merge branch 'main' into yulc_20240327
2 parents 4465843 + a2ce94d commit aed77fd

File tree

8 files changed

+29
-17
lines changed

8 files changed

+29
-17
lines changed

datav/frontend/src/i18n/locales/en.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ export const panelMsg = i18n('panel', {
464464
"Final interval is caculated based on the current time range, max data points and the min interval, it's sent to datasource, e.g final interval will be directly passed as the step option that Prometheus requires",
465465

466466
panelTitle: 'Panel Title',
467-
panelDesc: 'give a short description to this panel',
467+
panelDesc: 'give a short description to this panel, support markdown',
468468
panelType: 'Panel type',
469469
visualization: 'Built-in',
470470
externalPanels: 'External',

datav/frontend/src/i18n/locales/zh.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@
414414
"finalInterval": "最终间隔",
415415
"finalIntervalTips": "最终间隔是根据当前的时间范围、最大点数和最小间隔综合计算出的,它将被发送到数据源并用于最终渲染的图表点间隔,例如 Prometheus 需要的 step 参数就是使用该值",
416416
"panelTitle": "图表标题",
417-
"panelDesc": "给图表一个简单描述",
417+
"panelDesc": "给图表一个简单描述,支持 markdown",
418418
"panelType": "图表类型",
419419
"visualization": "内置图表",
420420
"externalPanels": "外部图表",

datav/frontend/src/views/dashboard/edit-panel/PanelSettings.tsx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import { initTimeRange } from 'components/DatePicker/TimePicker'
3939
import DatePicker from '../components/PanelDatePicker'
4040
import customColors from 'theme/colors'
4141
import { ExternalLinksEditor } from 'components/ExternalLinks'
42+
import CodeEditor from 'components/CodeEditor/CodeEditor'
4243

4344
// in edit mode, we need to cache all the plugins we have edited, until we save the dashboard
4445
let pluginsCachedInEdit = {}
@@ -116,16 +117,18 @@ const PanelSettings = memo(({ panel, onChange }: PanelEditorProps) => {
116117
/>
117118
</PanelEditItem>
118119
<PanelEditItem title={t.description} desc={t1.panelDesc}>
119-
<EditorInputItem
120-
type='textarea'
121-
size='sm'
122-
value={panel.desc}
123-
onChange={(v) =>
124-
onChange((tempPanel: Panel) => {
125-
tempPanel.desc = v
126-
})
127-
}
128-
/>
120+
<Box className='bordered'>
121+
<CodeEditor
122+
value={panel.desc}
123+
onChange={(v) =>
124+
onChange((tempPanel: Panel) => {
125+
tempPanel.desc = v
126+
})
127+
}
128+
height='150px'
129+
language='markdown'
130+
/>
131+
</Box>
129132
</PanelEditItem>
130133
<PanelEditItem title={t.transform} desc={t1.enableTransform}>
131134
<Switch

datav/frontend/src/views/dashboard/grid/PanelGrid/PanelGrid.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ const PanelHeader = ({
738738
pl='2'
739739
>
740740
{panel.styles.title.position != 'left' && <Box></Box>}
741-
{!isEmpty(title) ? (
741+
{!(isEmpty(title) && isEmpty(queryError)) ? (
742742
<HStack
743743
paddingTop={panel.styles.title.paddingTop}
744744
paddingBottom={panel.styles.title.paddingBottom}

datav/frontend/src/views/dashboard/plugins/built-in/panel/graph/Tooltip.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ const Tooltip = memo(({ props, options, data, inactiveSeries, defaultLegend }: P
145145
filterIdx={focusIdx}
146146
panelType={props.panel.type}
147147
inactiveSeries={inactiveSeries}
148+
defaultLegend={defaultLegend}
148149
/>
149150
</Box>
150151
</TooltipContainer>

datav/frontend/src/views/dashboard/plugins/built-in/panel/graph/Tooltip/SeriesTable.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,11 @@ const SeriesTable = memo(
163163
let inactive
164164
if (!isEmpty(inactiveSeries)) {
165165
inactive = inactiveSeries.includes(v.name)
166-
} else [
166+
} else {
167+
if (defaultLegend) {
167168
inactive = !v.name.match(defaultLegend)
168-
]
169+
}
170+
}
169171
if (inactive) {
170172
// hiding inactive tooltips
171173
return <></>

datav/frontend/src/views/dashboard/plugins/built-in/panel/graph/options.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,11 @@ export const parseOptions = (
238238
if (!isEmpty(inactiveSeries)) {
239239
showSeries = inactiveSeries.includes(d.name) ? false : true
240240
} else {
241-
showSeries = d.name.match(defaultLegend)
241+
if (defaultLegend) {
242+
showSeries = d.name.match(defaultLegend)
243+
} else {
244+
showSeries = true
245+
}
242246
}
243247
series.push({
244248
show: showSeries,

datav/frontend/src/views/dashboard/plugins/components/Legend.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,9 @@ const LegendTable = memo(
275275
if (!isEmpty(inactiveSeries)) {
276276
inactive = inactiveSeries.includes(v.name)
277277
} else {
278-
inactive = !v.name.match(defaultLegend)
278+
if (defaultLegend) {
279+
inactive = !v.name.match(defaultLegend)
280+
}
279281
}
280282
return (
281283
<Tr verticalAlign='top' width='100%'>

0 commit comments

Comments
 (0)