Geomap: use short name for marker selection (#40541)

This commit is contained in:
Ryan McKinley 2021-10-18 09:53:21 -07:00 committed by GitHub
parent e4297006f6
commit e7c3e54079
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -101,7 +101,7 @@ export const ResourceDimensionEditor: FC<
<InlineFieldRow>
<InlineField label={null} grow>
<Input
value={value?.fixed}
value={niceName(value?.fixed)}
placeholder="Resource URL"
readOnly={true}
onClick={openModal}
@ -122,6 +122,17 @@ export const ResourceDimensionEditor: FC<
);
};
export function niceName(value?: string): string | undefined {
if (!value) {
return undefined;
}
const idx = value.lastIndexOf('/');
if (idx > 0) {
return value.substring(idx + 1);
}
return value;
}
const getStyles = (theme: GrafanaTheme2) => ({
icon: css`
vertical-align: middle;