Skip to content

Commit

Permalink
Make data path as a part of data usage
Browse files Browse the repository at this point in the history
  • Loading branch information
hanbyul-here committed Aug 29, 2023
1 parent 3a411fb commit 8bed731
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 25 deletions.
3 changes: 0 additions & 3 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,3 @@ API_XARRAY_ENDPOINT='https://dev-titiler-xarray.delta-backend.com/tilejson.json'

# Google form for feedback
GOOGLE_FORM = 'https://docs.google.com/forms/d/e/1FAIpQLSfGcd3FDsM3kQIOVKjzdPn4f88hX8RZ4Qef7qBsTtDqxjTSkg/viewform?embedded=true'

# Enpoint for Data Browser
DATA_BROWSER_PATH='https://d36s2ep3ahcq5b.cloudfront.net/browseui/index.html#'
10 changes: 7 additions & 3 deletions app/scripts/components/common/notebook-connect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { Button, ButtonProps } from '@devseed-ui/button';
import {
CollecticonBook,
CollecticonCode,
CollecticonCog
CollecticonCog,
CollecticonDownload2
} from '@devseed-ui/collecticons';
import { Modal } from '@devseed-ui/modal';
import { DatasetData, datasets } from 'veda';
Expand Down Expand Up @@ -78,11 +79,12 @@ const DatasetUsageLabel = styled.div`
}
`;

type DatasetUsageType = 'jupyter' | 'github' | 'unknown';
type DatasetUsageType = 'jupyter' | 'github' | 'download' | 'unknown';

const IconByType: Record<DatasetUsageType, any> = {
jupyter: <CollecticonCog />,
github: <CollecticonBook />,
download: <CollecticonDownload2 />,
unknown: <CollecticonCog />
};

Expand All @@ -100,6 +102,8 @@ export function NotebookConnectModal(props: {
let type = 'unknown';
if (d.url.match('nasa-veda.2i2c.cloud')) type = 'jupyter';
else if (d.url.match('github.com/NASA-IMPACT/veda-docs')) type = 'github';
// TO DO: browser UI url pattern check
else if (d.url.match('browseui')) type = 'download';
return {
...d,
type
Expand Down Expand Up @@ -186,7 +190,7 @@ function NotebookConnectButtonSelf(props: NotebookConnectButtonProps) {
size={size}
>
<CollecticonCode meaningful={compact} title='Open data usage options' />
{compact ? '' : 'Analyze data (Python)'}
{compact ? '' : 'Access Data'}
</Button>
<NotebookConnectModal
dataset={dataset}
Expand Down
16 changes: 2 additions & 14 deletions app/scripts/components/datasets/s-overview/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { lazy } from 'react';
import { Link } from 'react-router-dom';
import { Button } from '@devseed-ui/button';
import { CollecticonCompass, CollecticonDownload } from '@devseed-ui/collecticons';
import { CollecticonCompass } from '@devseed-ui/collecticons';

import { resourceNotFound } from '$components/uhoh';
import { LayoutProps } from '$components/common/layout-root';
Expand All @@ -17,7 +17,7 @@ import {
TAXONOMY_UNCERTAINTY,
useDataset
} from '$utils/veda-data';
import { DATASETS_PATH, getDatasetExplorePath, getDatasetBrowserPath } from '$utils/routes';
import { DATASETS_PATH, getDatasetExplorePath } from '$utils/routes';
import { ContentTaxonomy } from '$components/common/content-taxonomy';
import { DatasetClassification } from '$components/common/dataset-classification';

Expand Down Expand Up @@ -69,18 +69,6 @@ function DatasetsOverview() {
compact={false}
variation='achromic-outline'
/>
{dataset.data.dataPath && (
<a
href={getDatasetBrowserPath(dataset.data)}
target='_blank'
rel='noreferrer'
>
<Button size='large' variation='achromic-outline'>
<CollecticonDownload />
Download
</Button>
</a>
)}
</PageActions>
)}
renderDetailsBlock={() => (
Expand Down
3 changes: 0 additions & 3 deletions app/scripts/utils/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,3 @@ export const getDatasetPath = (d: DatasetData | string) =>

export const getDatasetExplorePath = (d: DatasetData | string) =>
`${DATASETS_PATH}/${typeof d === 'string' ? d : d.id}/explore`;

export const getDatasetBrowserPath = (d: DatasetData | string) =>
`${process.env.DATA_BROWSER_PATH}${typeof d === 'string' ? d : d.dataPath}/`;
4 changes: 3 additions & 1 deletion mock/datasets/no2.data.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ usage:
- url: 'https://github.com/NASA-IMPACT/veda-docs'
label: All the docs for the site
title: 'Documentaion repo'
dataPath: ch4_inverse_flux
- url: https://d36s2ep3ahcq5b.cloudfront.net/browseui/index.html#ch4_inverse_flux
label: Data Broswer
title: Download data
media:
src: ::file ./no2--dataset-cover.jpg
alt: Power plant shooting steam at the sky.
Expand Down
1 change: 0 additions & 1 deletion parcel-resolver-veda/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ declare module 'veda' {
name: string;
taxonomy: Taxonomy[];
description: string;
dataPath?: string;
usage?: DatasetUsage[];
media?: Media;
layers: DatasetLayer[];
Expand Down

0 comments on commit 8bed731

Please sign in to comment.