Skip to content

Commit adc8124

Browse files
committed
Use the new custom select to render chart point modes cause the enum select
component that comes with Eui messes up with the chart dimensions which causes the chart legends to compact
1 parent 5da5a7e commit adc8124

File tree

2 files changed

+82
-6
lines changed

2 files changed

+82
-6
lines changed

redisinsight/ui/src/packages/redistimeseries-app/src/components/Chart/ChartConfigForm.tsx

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,22 @@ import {
1010
import { AxisScale, GraphMode, ChartConfigFormProps } from './interfaces'
1111
import { X_LABEL_MAX_LENGTH, Y_LABEL_MAX_LENGTH, TITLE_MAX_LENGTH } from './constants'
1212

13+
const NewEnumSelect = ({selected, values, onClick}: {select: string, values: string[], onClick: (v: string) => void}) => (
14+
<div className="new-button">
15+
{
16+
values.map(v => (
17+
<div
18+
title={v.charAt(0).toUpperCase() + v.slice(1)}
19+
onClick={() => onClick(v)}
20+
className={`button-point ${selected === v ? 'button-selected' : null}`}
21+
>
22+
{v}
23+
</div>
24+
))
25+
}
26+
</div>
27+
)
28+
1329
export default function ChartConfigForm(props: ChartConfigFormProps) {
1430
const [moreOptions, setMoreOptions] = useState(false)
1531

@@ -18,12 +34,7 @@ export default function ChartConfigForm(props: ChartConfigFormProps) {
1834
return (
1935
<form className="chart-config-form">
2036
<div className="chart-top-form">
21-
<EnumSelect
22-
inputLabel="mode"
23-
onChange={(e: React.ChangeEvent<{ value: unknown }>) => onChange('mode', e.target.value)}
24-
value={value.mode}
25-
enumType={GraphMode}
26-
/>
37+
<NewEnumSelect values={Object.keys(GraphMode)} selected={value.mode} onClick={v => onChange('mode', v)} />
2738
<EuiSwitch
2839
compressed
2940
label={<span className="switch-staircase-label">Staircase</span>}

redisinsight/ui/src/packages/redistimeseries-app/src/styles/styles.less

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,3 +406,68 @@ body {
406406
.switch-staircase-label {
407407
padding-right: 10px !important;
408408
}
409+
410+
411+
.theme_DARK {
412+
.button-point {
413+
background-color: black;
414+
border: 1px solid #465282;
415+
}
416+
417+
.button-selected {
418+
color: #8BA2FF;
419+
background-color: #292F47;
420+
}
421+
}
422+
423+
.theme_LIGHT {
424+
.new-button {
425+
color: #343741;
426+
}
427+
428+
.button-point {
429+
border: 1px solid #243DAC;
430+
}
431+
432+
.button-selected {
433+
color: #3163D8;
434+
background-color: #D7E3FA;
435+
}
436+
}
437+
438+
.new-button {
439+
box-shadow: none!important;
440+
border-radius: 2px;
441+
cursor: pointer;
442+
height: 32px;
443+
border: 1px solid hsla(0, 0%, 100%, 0.1);
444+
overflow: visible;
445+
display: flex;
446+
447+
div {
448+
font-size: 13px;
449+
padding: 0px;
450+
font-weight: normal;
451+
height: 30px;
452+
width: 68px;
453+
}
454+
455+
div:first-child {
456+
border-radius: 4px;
457+
border-right: 0px;
458+
border-top-right-radius: 0px;
459+
border-bottom-right-radius: 0px;
460+
}
461+
462+
div:last-child {
463+
border-radius: 4px;
464+
border-top-left-radius: 0px;
465+
border-bottom-left-radius: 0px;
466+
}
467+
468+
.button-point {
469+
text-transform: capitalize;
470+
text-align: center;
471+
padding: 6px;
472+
}
473+
}

0 commit comments

Comments
 (0)