mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
XYChart: Improve base options setup (#67878)
This commit is contained in:
@@ -70,7 +70,7 @@ export const ResourcePicker = (props: Props) => {
|
||||
<InlineFieldRow>
|
||||
<InlineField label={null} grow>
|
||||
<Input
|
||||
value={name}
|
||||
value={getDisplayName(src, name)}
|
||||
placeholder={placeholder}
|
||||
readOnly={true}
|
||||
prefix={sanitizedSrc && <SanitizedSVG src={sanitizedSrc} className={styles.icon} style={{ ...colorStyle }} />}
|
||||
@@ -109,6 +109,17 @@ export const ResourcePicker = (props: Props) => {
|
||||
);
|
||||
};
|
||||
|
||||
// strip the SVG off icons in the icons folder
|
||||
function getDisplayName(src?: string, name?: string): string | undefined {
|
||||
if (src?.startsWith('public/img/icons')) {
|
||||
const idx = name?.lastIndexOf('.svg') ?? 0;
|
||||
if (idx > 0) {
|
||||
return name!.substring(0, idx);
|
||||
}
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
const getStyles = (theme: GrafanaTheme2) => ({
|
||||
pointer: css`
|
||||
cursor: pointer;
|
||||
|
||||
Reference in New Issue
Block a user