Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

Commit 82114b4

Browse files
authored
Merge pull request #1260 from BlueBrain/3937/show-better-names-in-my-data
3937 // Display name or label of resource in my-data if present other…
2 parents 60e9ca3 + 2b749d9 commit 82114b4

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/shared/molecules/MyDataTable/MyDataTable.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
removeLocalStorageRows,
2222
toLocalStorageResources,
2323
} from '../../../shared/utils/datapanel';
24+
import { getResourceLabel } from '../../../shared/utils';
2425

2526
export const MAX_DATA_SELECTED_SIZE__IN_BYTES = 1_073_741_824;
2627
export const MAX_LOCAL_STORAGE_ALLOWED_SIZE = 4.5;
@@ -188,22 +189,22 @@ const MyDataTable: React.FC<TProps> = ({
188189
width: 250,
189190
ellipsis: true,
190191
render: (text, record) => {
191-
const showedText = isValidUrl(text) ? text.split('/').pop() : text;
192+
const resourceId = record['@id'] ?? record._self;
192193
if (text && record._project) {
193194
const { org, project } = makeOrgProjectTuple(record._project);
194195
return (
195-
<Tooltip title={text}>
196+
<Tooltip title={resourceId}>
196197
<Button
197198
style={{ padding: 0 }}
198199
type="link"
199-
onClick={() => goToResource(org, project, text)}
200+
onClick={() => goToResource(org, project, resourceId)}
200201
>
201-
{showedText}
202+
{text}
202203
</Button>
203204
</Tooltip>
204205
);
205206
}
206-
return <Tooltip title={text}>{showedText}</Tooltip>;
207+
return <Tooltip title={resourceId}>{text}</Tooltip>;
207208
},
208209
},
209210
{
@@ -281,7 +282,7 @@ const MyDataTable: React.FC<TProps> = ({
281282
resources?._results?.map(resource => {
282283
return {
283284
...resource,
284-
name: resource['@id'] ?? resource._self,
285+
name: getResourceLabel(resource),
285286
description: resource.discription ?? '',
286287
};
287288
}) || [];

0 commit comments

Comments
 (0)