Skip to content

Commit

Permalink
Human-readable file storage locations GSI-1207 (#252)
Browse files Browse the repository at this point in the history
* Added human-readable file storage locations
Minor improvement to mock data

* Upped patch version number

* Implemented suggestions
  • Loading branch information
ac-jorellanaf authored Jan 21, 2025
1 parent 0719bf9 commit fe8ba0e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "data-portal-ui",
"version": "1.4.1",
"version": "1.4.2",
"private": true,
"dependencies": {
"@fortawesome/fontawesome-svg-core": "~6.6.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ interface FilesTableProps {
allFiles: any[];
}

const STORAGE_LOCATIONS: { [key: string]: string } = {
B: "Berlin",
DD: "Dresden",
HD: "Heidelberg",
K: "Cologne",
KI: "Kiel",
M: "Munich",
TUE: "Tübingen",
};

/**
* This function creates the schema for the file summary table,
* which is one of three tables in the dataset details view.
Expand Down Expand Up @@ -74,7 +84,12 @@ export const FilesTable = (props: FilesTableProps) => {
},
{
header: "File Location",
data: allFiles.map((x) => x.storage_alias),
data: allFiles.map((x) =>
x.storage_alias.replace(
/^[A-Z]+/,
(m: string) => (STORAGE_LOCATIONS[m] ?? m) + " "
)
),
cssClasses: "",
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/mocks/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,6 @@ export const filesSummary = {
accession: "GHGASF956121331",
sha256_hash: "58b2e5a09936322db4ab1b921847d0f3b83027e0255cd24d7e58c420845286dc",
size: 123456789,
storage_alias: "Tübingen"
storage_alias: "TUE01"
}]
}

0 comments on commit fe8ba0e

Please sign in to comment.