Skip to content

Commit 740118f

Browse files
committed
Fixes the JSON buttons by removing th clickableRoute function which is no longer needed and was causing the button to fail (do nothing). Removed some commented out code that has been there a while. Update version in helm README.
1 parent e1e75eb commit 740118f

File tree

6 files changed

+4
-125
lines changed

6 files changed

+4
-125
lines changed

frontend/src/api/routes.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,6 @@ type ApiRoutes = {
4545
introMarkdown: ApiRoute;
4646
};
4747

48-
/**
49-
* Stripping the prefix proxy string is necessary if the route needs to be
50-
* served as a clickable link within the browser.
51-
*/
52-
export const clickableRoute = (route: string): string => route.replace('/proxy/search', '');
53-
5448
// Any path with parameters (e.g. '/:datasetID/') must be in camelCase
5549
// https://mswjs.io/docs/basics/path-matching#path-with-parameters
5650
const apiRoutes: ApiRoutes = {

frontend/src/components/Cart/SearchesCard.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import React from 'react';
99
import { useAsync } from 'react-async';
1010
import { useNavigate } from 'react-router-dom';
1111
import { fetchSearchResults, generateSearchURLQuery } from '../../api';
12-
import { clickableRoute } from '../../api/routes';
1312
import { savedSearchTourTargets } from '../../common/reactJoyrideSteps';
1413
import { CSSinJS } from '../../common/types';
1514
import { stringifyFilters } from '../Search';
@@ -104,7 +103,7 @@ const SearchesCard: React.FC<React.PropsWithChildren<Props>> = ({
104103
<Tooltip title="View results in JSON format">
105104
<a
106105
className={savedSearchTourTargets.jsonBtn.class()}
107-
href={clickableRoute(url)}
106+
href={url}
108107
rel="noopener noreferrer"
109108
target="blank_"
110109
>

frontend/src/components/NavBar/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ const NavBar: React.FC<React.PropsWithChildren<Props>> = ({
4343
<div className="navbar-logo">
4444
<Link
4545
href="https://esgf.github.io/nodes.html"
46+
target="_blank"
4647
style={{
4748
fontWeight: 'bold',
4849
fontSize: '.9em',

frontend/src/components/Search/Tabs.tsx

Lines changed: 0 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -196,115 +196,6 @@ const Tabs: React.FC<React.PropsWithChildren<Props>> = ({ record, filenameVars }
196196
}
197197

198198
return <TabsD activeKey={record.retracted === true ? '2' : undefined} items={tabList} />;
199-
// Disable all tabs excep metadata if the record is retracted
200-
/* <TabsD activeKey={record.retracted === true ? '2' : undefined} />;
201-
<TabsD.TabPane
202-
disabled={record.retracted === true}
203-
tab={<div className={innerDataRowTargets.filesTab.class()}>Files</div>}
204-
key="1"
205-
>
206-
<FilesTable
207-
id={record.id}
208-
numResults={record.number_of_files}
209-
filenameVars={filenameVars}
210-
/>
211-
</TabsD.TabPane>
212-
<TabsD.TabPane
213-
tab={
214-
<div className={innerDataRowTargets.metadataTab.class()}>
215-
Metadata
216-
</div>
217-
}
218-
key="2"
219-
>
220-
<h4>Displaying {Object.keys(record).length} keys</h4>
221-
<AutoComplete
222-
style={{ width: '100%' }}
223-
className={innerDataRowTargets.metadataLookupField.class()}
224-
options={metaData}
225-
placeholder="Lookup a key..."
226-
filterOption={
227-
/* istanbul ignore next (inputValue, option) =>
228-
(option as Record<'value', string>).value
229-
.toUpperCase()
230-
.indexOf(inputValue.toUpperCase()) !== -1
231-
}
232-
/>
233-
<Divider />
234-
{Object.keys(record).map((key) => (
235-
<p key={key} style={{ margin: 0 }}>
236-
<span style={{ fontWeight: 'bold' }}>{key}</span>:{' '}
237-
{String(record[key])}
238-
</p>
239-
))}
240-
</TabsD.TabPane>
241-
{showCitation && (
242-
<TabsD.TabPane
243-
disabled={record.retracted === true}
244-
tab={
245-
<div className={innerDataRowTargets.citationTab.class()}>
246-
Citation
247-
</div>
248-
}
249-
key="3"
250-
>
251-
<Citation
252-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
253-
url={record.citation_url![0]}
254-
/>
255-
</TabsD.TabPane>
256-
)}
257-
{showAdditionalTab && (
258-
<TabsD.TabPane
259-
disabled={record.retracted === true}
260-
tab={
261-
<div className={innerDataRowTargets.additionalTab.class()}>
262-
Additional
263-
</div>
264-
}
265-
key="4"
266-
>
267-
{showAdditionalLinks && additionalLinks}
268-
{showESDOC &&
269-
((record.further_info_url as unknown) as string)[0] !== '' && (
270-
<Button
271-
type="link"
272-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
273-
href={record.further_info_url![0]}
274-
target="_blank"
275-
>
276-
ES-DOC
277-
</Button>
278-
)}
279-
{showQualityFlags && (
280-
<Button
281-
type="link"
282-
href="https://esgf-node.llnl.gov/projects/obs4mips/DatasetIndicators"
283-
target="_blank"
284-
>
285-
<Popover
286-
placement="topLeft"
287-
content={
288-
<img
289-
src={qualityFlagsImg}
290-
alt="Quality Flags Indicator"
291-
></img>
292-
}
293-
>
294-
<span style={styles.qualityFlagsRow}>
295-
{Object.keys(qualityFlags).map((key) => (
296-
<QualityFlag
297-
index={key}
298-
color={qualityFlags[key]}
299-
key={key}
300-
/>
301-
))}
302-
</span>
303-
</Popover>
304-
</Button>
305-
)}
306-
</TabsD.TabPane>
307-
)}*/
308199
};
309200

310201
export default Tabs;

frontend/src/components/Search/index.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
fetchSearchResults,
1414
generateSearchURLQuery,
1515
} from '../../api';
16-
import { clickableRoute } from '../../api/routes';
1716
import { searchTableTargets } from '../../common/reactJoyrideSteps';
1817
import { CSSinJS } from '../../common/types';
1918
import { objectIsEmpty } from '../../common/utils';
@@ -392,12 +391,7 @@ const Search: React.FC<React.PropsWithChildren<Props>> = ({
392391
</div>
393392
</Col>
394393
{results && currentRequestURL && (
395-
<Button
396-
type="default"
397-
href={clickableRoute(currentRequestURL)}
398-
target="_blank"
399-
icon={<ExportOutlined />}
400-
>
394+
<Button type="default" href={currentRequestURL} target="_blank" icon={<ExportOutlined />}>
401395
Open as JSON
402396
</Button>
403397
)}

helm/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
## Install
1919
```shell
20-
helm install <name> oci://ghcr.io/esgf2-us/metagrid --version v1.3.4
20+
helm install <name> oci://ghcr.io/esgf2-us/metagrid --version v1.3.5
2121
```
2222

2323
## Testing locally

0 commit comments

Comments
 (0)