mirror of
https://github.com/grafana/grafana.git
synced 2025-02-12 00:25:46 -06:00
Dashboard: Fixes setting long links overflow (#72428)
This commit is contained in:
parent
0fa20b7152
commit
c4731efb62
@ -1,7 +1,8 @@
|
|||||||
|
import { css } from '@emotion/css';
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
|
|
||||||
import { arrayUtils } from '@grafana/data';
|
import { arrayUtils } from '@grafana/data';
|
||||||
import { DeleteButton, HorizontalGroup, Icon, IconButton, TagList } from '@grafana/ui';
|
import { DeleteButton, HorizontalGroup, Icon, IconButton, TagList, useStyles2 } from '@grafana/ui';
|
||||||
import EmptyListCTA from 'app/core/components/EmptyListCTA/EmptyListCTA';
|
import EmptyListCTA from 'app/core/components/EmptyListCTA/EmptyListCTA';
|
||||||
|
|
||||||
import { DashboardModel, DashboardLink } from '../../state/DashboardModel';
|
import { DashboardModel, DashboardLink } from '../../state/DashboardModel';
|
||||||
@ -14,6 +15,8 @@ type LinkSettingsListProps = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const LinkSettingsList = ({ dashboard, onNew, onEdit }: LinkSettingsListProps) => {
|
export const LinkSettingsList = ({ dashboard, onNew, onEdit }: LinkSettingsListProps) => {
|
||||||
|
const styles = useStyles2(getStyles);
|
||||||
|
|
||||||
const [links, setLinks] = useState(dashboard.links);
|
const [links, setLinks] = useState(dashboard.links);
|
||||||
|
|
||||||
const moveLink = (idx: number, direction: number) => {
|
const moveLink = (idx: number, direction: number) => {
|
||||||
@ -69,8 +72,8 @@ export const LinkSettingsList = ({ dashboard, onNew, onEdit }: LinkSettingsListP
|
|||||||
</td>
|
</td>
|
||||||
<td role="gridcell">
|
<td role="gridcell">
|
||||||
<HorizontalGroup>
|
<HorizontalGroup>
|
||||||
{link.title && <span>{link.title}</span>}
|
{link.title && <span className={styles.titleWrapper}>{link.title}</span>}
|
||||||
{link.type === 'link' && <span>{link.url}</span>}
|
{link.type === 'link' && <span className={styles.urlWrapper}>{link.url}</span>}
|
||||||
{link.type === 'dashboards' && <TagList tags={link.tags ?? []} />}
|
{link.type === 'dashboards' && <TagList tags={link.tags ?? []} />}
|
||||||
</HorizontalGroup>
|
</HorizontalGroup>
|
||||||
</td>
|
</td>
|
||||||
@ -100,3 +103,16 @@ export const LinkSettingsList = ({ dashboard, onNew, onEdit }: LinkSettingsListP
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getStyles = () => ({
|
||||||
|
titleWrapper: css`
|
||||||
|
width: 20vw;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow: hidden;
|
||||||
|
`,
|
||||||
|
urlWrapper: css`
|
||||||
|
width: 40vw;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow: hidden;
|
||||||
|
`,
|
||||||
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user