Skip to content

Commit 73b4aff

Browse files
committed
frontend: NamespacesAutocomplete: Show list of selected namespaces while hovering
1 parent 0bb3bbb commit 73b4aff

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

frontend/src/components/common/NamespacesAutocomplete.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
import { Icon } from '@iconify/react';
18+
import { Tooltip } from '@mui/material';
1819
import Autocomplete from '@mui/material/Autocomplete';
1920
import Box from '@mui/material/Box';
2021
import Checkbox from '@mui/material/Checkbox';
@@ -137,6 +138,7 @@ export function PureNamespacesAutocomplete({
137138
const joiner = ', ';
138139
const joinerLength = joiner.length;
139140
let joinnedNamespaces = 1;
141+
const remainingTags = tags.slice(1);
140142

141143
tags.slice(1).forEach(tag => {
142144
if (namespacesToShow.length + tag.length + joinerLength <= maxNamespacesChars) {
@@ -153,7 +155,19 @@ export function PureNamespacesAutocomplete({
153155
{tags.length > joinnedNamespaces && (
154156
<>
155157
<span>,&nbsp;</span>
156-
<b>{`+${tags.length - joinnedNamespaces}`}</b>
158+
<Tooltip
159+
title={
160+
<ul style={{ margin: 0, padding: 10, listStyle: 'none' }}>
161+
{remainingTags.map((tag, key) => (
162+
<li key={key}>{tag}</li>
163+
))}
164+
</ul>
165+
}
166+
arrow
167+
placement="top"
168+
>
169+
<b style={{ cursor: 'pointer' }}>{`+${tags.length - joinnedNamespaces}`}</b>
170+
</Tooltip>
157171
</>
158172
)}
159173
</Typography>

frontend/src/components/common/Table/__snapshots__/Table.NamespaceSelect.stories.storyshot

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@
5757
<span>
5858
5959
</span>
60-
<b>
60+
<b
61+
class=""
62+
data-mui-internal-clone-element="true"
63+
style="cursor: pointer;"
64+
>
6165
+1
6266
</b>
6367
</p>

frontend/src/components/common/__snapshots__/SimpleTable.NamespaceSelect.stories.storyshot

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@
5757
<span>
5858
5959
</span>
60-
<b>
60+
<b
61+
class=""
62+
data-mui-internal-clone-element="true"
63+
style="cursor: pointer;"
64+
>
6165
+1
6266
</b>
6367
</p>

0 commit comments

Comments
 (0)