Skip to content

Commit

Permalink
[v9.3.x] Panel Edit: Fix data links edit icons being off screen when …
Browse files Browse the repository at this point in the history
…provided title is too long (grafana#60082)

* Panel Edit: Fix data links edit icons being off screen when provided title is too long (grafana#59829)

* Fix data links edit icons being off screen

* Remove unused imports

* Review

(cherry picked from commit 6f930f4)

* Fix backport
  • Loading branch information
dprokop authored and GuaYounesPW committed Feb 8, 2023
1 parent 68bd634 commit 07001b6
Showing 1 changed file with 24 additions and 14 deletions.
Expand Up @@ -5,7 +5,6 @@ import { DataFrame, DataLink, GrafanaTheme2 } from '@grafana/data';

import { stylesFactory, useTheme2 } from '../../../themes';
import { IconButton } from '../../IconButton/IconButton';
import { HorizontalGroup, VerticalGroup } from '../../Layout/Layout';

export interface DataLinksListItemProps {
index: number;
Expand All @@ -27,20 +26,18 @@ export const DataLinksListItem: FC<DataLinksListItemProps> = ({ link, onEdit, on

return (
<div className={styles.wrapper}>
<VerticalGroup spacing="xs">
<HorizontalGroup justify="space-between" align="flex-start" width="100%">
<div className={cx(styles.title, !hasTitle && styles.notConfigured)}>
{hasTitle ? title : 'Data link title not provided'}
</div>
<HorizontalGroup>
<IconButton name="pen" onClick={onEdit} />
<IconButton name="times" onClick={onRemove} />
</HorizontalGroup>
</HorizontalGroup>
<div className={cx(styles.url, !hasUrl && styles.notConfigured)} title={url}>
{hasUrl ? url : 'Data link url not provided'}
<div className={styles.titleWrapper}>
<div className={cx(styles.url, !hasUrl && styles.notConfigured)}>
{hasTitle ? title : 'Data link title not provided'}
</div>
</VerticalGroup>
<div className={styles.actionButtons}>
<IconButton name="pen" onClick={onEdit} />
<IconButton name="times" onClick={onRemove} />
</div>
</div>
<div className={cx(styles.url, !hasUrl && styles.notConfigured)} title={url}>
{hasUrl ? url : 'Data link url not provided'}
</div>
</div>
);
};
Expand All @@ -53,6 +50,19 @@ const getDataLinkListItemStyles = stylesFactory((theme: GrafanaTheme2) => {
&:last-child {
margin-bottom: 0;
}
display: flex;
flex-direction: column;
`,
titleWrapper: css`
label: data-links-list-item-title;
justify-content: space-between;
display: flex;
width: 100%;
align-items: center;
`,
actionButtons: css`
margin-left: ${theme.spacing(1)};
display: flex;
`,
notConfigured: css`
font-style: italic;
Expand Down

0 comments on commit 07001b6

Please sign in to comment.