XYChart: Improve base options setup (#67878)

This commit is contained in:
Ryan McKinley
2023-07-10 17:54:01 -07:00
committed by GitHub
parent 4206a4d16a
commit 09cc63329f
21 changed files with 433 additions and 510 deletions

View File

@@ -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;