diff --git a/src/components/dashboard/bakery-card.js b/src/components/dashboard/bakery-card.js deleted file mode 100644 index 27c4d75d..00000000 --- a/src/components/dashboard/bakery-card.js +++ /dev/null @@ -1,73 +0,0 @@ -import { Link } from '@/components' -import { - Badge, - Box, - Heading, - LinkBox, - LinkOverlay, - Stack, - Text, - VStack, - WrapItem, -} from '@chakra-ui/react' -import React from 'react' -import { BsGlobe2 } from 'react-icons/bs' - -export const BakeryCard = ({ name, region, description, id }) => { - const href = `/dashboard/bakery/${id}` - return ( - - - - - - {name} - - - {' '} - - {description} - - - - - - - - - - - - - - ) -} diff --git a/src/components/dashboard/feedstock-card.js b/src/components/dashboard/feedstock-card.js deleted file mode 100644 index 3a61eea6..00000000 --- a/src/components/dashboard/feedstock-card.js +++ /dev/null @@ -1,121 +0,0 @@ -import { Error, Link } from '@/components' -import { MaintainersGroup } from '@/components/dashboard' -import { useMeta, useRepo } from '@/lib/endpoints' -import { TimeDeltaFormatter } from '@/lib/time-delta' -import { - Box, - Heading, - LinkBox, - LinkOverlay, - Skeleton, - Stack, - Text, -} from '@chakra-ui/react' -import { GoMarkGithub } from 'react-icons/go' - -export const FeedstockCard = ({ spec, id }) => { - const href = `/dashboard/feedstock/${id}` - - const { - repo, - repoError, - isLoading: repoIsLoading, - } = useRepo(`https://api.github.com/repos/${spec}/commits/HEAD`) - - const { meta, metaError, isLoading: metaIsLoading } = useMeta(spec) - - if (repoError || metaError) - return ( - - ) - - return ( - - - - - - - {meta?.title - ? meta.title - : spec - .toLowerCase() - .replace('pangeo-forge/', '') - .replace('-feedstock', '')} - - - - - - {meta?.description - ? meta.description - : spec.includes('staged-recipes') - ? 'A place to submit pangeo-forge recipes before they become fully fledged pangeo-forge feedstocks' - : repo?.commit.message} - - - - - - - - - - - - - {TimeDeltaFormatter( - Date.now() - Date.parse(repo?.commit.committer.date), - )}{' '} - via - - - - - - - - - - ) -} diff --git a/src/components/dashboard/feedstock-datasets.js b/src/components/dashboard/feedstock-datasets.js deleted file mode 100644 index 2175510b..00000000 --- a/src/components/dashboard/feedstock-datasets.js +++ /dev/null @@ -1,42 +0,0 @@ -import { Link } from '@/components' -import { DatasetsAccordion } from '@/components/dashboard' -import { Alert, AlertIcon, Box, Stack, Text } from '@chakra-ui/react' - -export const FeedstockDatasets = ({ datasets }) => { - const myBinderLink = - 'https://mybinder.org/v2/gh/pangeo-forge/sandbox/binder?urlpath=git-pull%3Frepo%3Dhttps%253A%252F%252Fgithub.com%252Fpangeo-forge%252Fsandbox%26urlpath%3Dlab%252Ftree%252Fsandbox%252Fscratch.ipynb%26branch%3Dmain' - return ( - <> - {' '} - - - - - - Each dataset can be accessed by running the Python code available - under the dataset's respective section below. This code can be - run on{' '} - - MyBinder - - . - - - - - - - - ) -} diff --git a/src/components/dashboard/feedstock-info.js b/src/components/dashboard/feedstock-info.js deleted file mode 100644 index 471b2be8..00000000 --- a/src/components/dashboard/feedstock-info.js +++ /dev/null @@ -1,106 +0,0 @@ -import { Link } from '@/components' -import { License, Maintainers, Providers } from '@/components/dashboard' -import { - Box, - Button, - Heading, - HStack, - SimpleGrid, - Stack, - Text, - VStack, -} from '@chakra-ui/react' -import { GoRepo } from 'react-icons/go' -import { MdDynamicFeed } from 'react-icons/md' - -export const FeedstockInfo = ({ - id, - repo, - name, - title, - description, - bakery, - license, - license_link, - providers, - maintainers, -}) => { - const details = { - Title: title, - Description: description, - Bakery: bakery, - License: , - Providers: , - Maintainers: , - } - return ( - <> - - {name?.split('-feedstock')[0]} - - - - - - {' '} - {repo == 'pangeo-forge/staged-recipes' && ( - - A place to submit pangeo-forge recipes before they become fully - fledged pangeo-forge feedstocks. - - )} - {repo !== 'pangeo-forge/staged-recipes' && ( - - {Object.keys(details).map((key, index) => ( - - {' '} - - {key} - - - {details[key]} - - - - ))} - - )} - - ) -} diff --git a/src/components/dashboard/flow-runs-accordion.js b/src/components/dashboard/flow-runs-accordion.js deleted file mode 100644 index 13b82017..00000000 --- a/src/components/dashboard/flow-runs-accordion.js +++ /dev/null @@ -1,59 +0,0 @@ -import { LogLine } from '@/components/dashboard' -import { AddIcon, MinusIcon } from '@chakra-ui/icons' -import { - Accordion, - AccordionButton, - AccordionItem, - AccordionPanel, - Box, -} from '@chakra-ui/react' - -const FlowRun = ({ index, run }) => { - return ( - - {({ isExpanded }) => ( - <> -

- - - Flow Run {index} - - {isExpanded ? ( - - ) : ( - - )} - -

- - {run.logs?.map((log, index) => ( - - - - ))} - - - )} -
- ) -} - -export const FlowRunsAccordion = ({ runs }) => { - return ( - - - {runs && ( - <> - {runs.map((run, index) => { - return - })} - - )} - - - ) -} diff --git a/src/components/dashboard/index.js b/src/components/dashboard/index.js deleted file mode 100644 index 8ff0cf7d..00000000 --- a/src/components/dashboard/index.js +++ /dev/null @@ -1,20 +0,0 @@ -export { BakeryCard } from '@/components/dashboard/bakery-card' -export { FeedstockCard } from '@/components/dashboard/feedstock-card' -export { FeedstockDatasets } from '@/components/dashboard/feedstock-datasets' -export { FeedstockInfo } from '@/components/dashboard/feedstock-info' -export { FlowRunsAccordion } from '@/components/dashboard/flow-runs-accordion' -export { License } from '@/components/dashboard/license' -export { LogLine } from '@/components/dashboard/log-line' -export { - Maintainers, - MaintainersGroup, -} from '@/components/dashboard/maintainers' -export { Menu } from '@/components/dashboard/menu' -export { Providers } from '@/components/dashboard/providers' -export { RecipeRunCard } from '@/components/dashboard/recipe-run-card' -export { RecipeRunDetails } from '@/components/dashboard/recipe-run-details' -export { RecipeRuns } from '@/components/dashboard/recipe-runs' -export { StatusBadge } from '@/components/dashboard/status-badge' -export { StatusIndicatorIcon } from '@/components/dashboard/status-indicator-icon' -export { Summary } from '@/components/dashboard/summary' -export { DatasetsAccordion } from '@/components/dataset/datasets-accordion' diff --git a/src/components/dashboard/license.js b/src/components/dashboard/license.js deleted file mode 100644 index b0b3e617..00000000 --- a/src/components/dashboard/license.js +++ /dev/null @@ -1,16 +0,0 @@ -import { Link } from '@/components' - -export const License = ({ name, link }) => { - const href = - name === 'proprietary' ? link?.url : `https://spdx.org/licenses/${name}` - - const text = name === 'proprietary' ? link?.title : name - - return ( - <> - - {text} - - - ) -} diff --git a/src/components/dashboard/log-line.js b/src/components/dashboard/log-line.js deleted file mode 100644 index 5ded0ff3..00000000 --- a/src/components/dashboard/log-line.js +++ /dev/null @@ -1,20 +0,0 @@ -import { SimpleGrid, Text } from '@chakra-ui/react' -import React from 'react' - -export const LogLine = ({ timestamp, level, message }) => { - return ( - - - {' '} - {timestamp} ({level}) - - - {message} - - ) -} diff --git a/src/components/dashboard/maintainers.js b/src/components/dashboard/maintainers.js deleted file mode 100644 index 46f1d133..00000000 --- a/src/components/dashboard/maintainers.js +++ /dev/null @@ -1,49 +0,0 @@ -import { Link } from '@/components' -import { Avatar, AvatarGroup, Wrap, WrapItem } from '@chakra-ui/react' - -export const Maintainers = ({ maintainers }) => { - if (!maintainers) return null - return ( - - {maintainers.map((maintainer) => ( - - - - ))} - - ) -} - -export const MaintainersGroup = ({ maintainers }) => { - if (!maintainers) - return ( - - {' '} - - ) - return ( - - {maintainers.map((maintainer) => ( - - ))} - - ) -} diff --git a/src/components/dashboard/menu.js b/src/components/dashboard/menu.js deleted file mode 100644 index 09ed8096..00000000 --- a/src/components/dashboard/menu.js +++ /dev/null @@ -1,64 +0,0 @@ -import { Link } from '@/components' -import { - Box, - Container, - Tab, - TabList, - TabPanel, - TabPanels, - Tabs, -} from '@chakra-ui/react' -import { useRouter } from 'next/router' -import React from 'react' - -export const Menu = () => { - const router = useRouter() - const tabs = { - '/dashboard/feedstocks': { - index: 0, - label: 'Feedstocks', - }, - '/dashboard/bakeries': { - index: 1, - label: 'Bakeries', - }, - '/dashboard/recipe-runs': { - index: 2, - label: 'Recipe Runs', - }, - } - const [activeTab, setActiveTab] = React.useState(tabs[router.route].index) - const onChange = (index) => setActiveTab(index) - - const selectedColor = { color: 'white', bg: 'teal.500' } - - return ( - - - {' '} - - - {Object.keys(tabs).map((key) => ( - - {tabs[key].label} - - ))} - - - {Object.keys(tabs).map((key) => ( - - ))} - - - - - ) -} diff --git a/src/components/dashboard/providers.js b/src/components/dashboard/providers.js deleted file mode 100644 index 12d49295..00000000 --- a/src/components/dashboard/providers.js +++ /dev/null @@ -1,18 +0,0 @@ -import { Link } from '@/components' -import { List, ListIcon, ListItem, VStack } from '@chakra-ui/react' -import { BsBuilding } from 'react-icons/bs' - -export const Providers = ({ providers }) => { - if (!providers) return null - - return ( - - {providers.map((provider, index) => ( - - - {provider.name} - - ))} - - ) -} diff --git a/src/components/dashboard/recipe-run-card.js b/src/components/dashboard/recipe-run-card.js deleted file mode 100644 index 17f9e0d9..00000000 --- a/src/components/dashboard/recipe-run-card.js +++ /dev/null @@ -1,107 +0,0 @@ -import { Link } from '@/components' -import { StatusBadge, StatusIndicatorIcon } from '@/components/dashboard' -import { TimeDeltaFormatter } from '@/lib/time-delta' -import { - HStack, - Icon, - LinkBox, - LinkOverlay, - SimpleGrid, - Stack, - Text, -} from '@chakra-ui/react' -import { GiSandsOfTime } from 'react-icons/gi' -import { GoCalendar, GoNote, GoTag } from 'react-icons/go' - -export const RecipeRunCard = ({ - id, - recipe_id, - started_at, - message, - status, - conclusion, - version, - feedstock_id, -}) => { - // TODO: have API return timestamps with UTC suffix - // Here I'm mannually adding the +Z - const timeSinceRun = TimeDeltaFormatter( - Date.now() - Date.parse(started_at + 'Z'), - ) - - const href = `/dashboard/recipe-run/${id}?feedstock_id=${feedstock_id}` - - return ( - - - - - - - - {recipe_id} - - {message && ( - - - - {message} - - - )} - - - - - - - {started_at} ({timeSinceRun}) - - - - - - {' '} - - - - - - {version} - - - - - - ) -} diff --git a/src/components/dashboard/recipe-run-details.js b/src/components/dashboard/recipe-run-details.js deleted file mode 100644 index 7598e56e..00000000 --- a/src/components/dashboard/recipe-run-details.js +++ /dev/null @@ -1,60 +0,0 @@ -import { Link } from '@/components' -import { StatusBadge } from '@/components/dashboard' -import { Badge, HStack, SimpleGrid, Text, VStack } from '@chakra-ui/react' -import { formatDistance } from 'date-fns' - -export const RecipeRunDetails = ({ - id, - name, - started_at, - completed_at, - spec, - head_sha, - status, - conclusion, -}) => { - const details = { - Status: , - ID: id, - Name: name, - 'Started at': started_at ? started_at : '-', - 'Finished at': completed_at ? completed_at : '-', - Duration: completed_at - ? formatDistance(new Date(completed_at), new Date(started_at)) - : '-', - 'Git SHA': ( - - {head_sha?.slice(0, 7)} - - ), - } - - return ( - <> - - {Object.keys(details).map((key, index) => ( - - {' '} - - {key} - - {details[key]} - - - - ))} - - - ) -} diff --git a/src/components/dashboard/recipe-runs.js b/src/components/dashboard/recipe-runs.js deleted file mode 100644 index acf3cf52..00000000 --- a/src/components/dashboard/recipe-runs.js +++ /dev/null @@ -1,33 +0,0 @@ -import { RecipeRunCard } from '@/components/dashboard' -import { SimpleGrid } from '@chakra-ui/react' - -export const RecipeRuns = ({ runs }) => { - return ( - <> - - {/* TODO: Add filter options */} - {runs - .sort((a, b) => a.started_at.localeCompare(b.started_at)) - .reverse() - .map((recipe) => ( - - ))} - - - ) -} diff --git a/src/components/dashboard/status-badge.js b/src/components/dashboard/status-badge.js deleted file mode 100644 index 6dd7eeff..00000000 --- a/src/components/dashboard/status-badge.js +++ /dev/null @@ -1,44 +0,0 @@ -import { Badge } from '@/components' - -export const StatusBadge = ({ status, conclusion }) => { - if (status === 'queued') { - return - } - - if (status === 'in_progress') { - return - } - - if (status === 'completed') { - switch (conclusion) { - case 'success': - return - - case 'failure': - return - - case 'action_required': - return - - case 'cancelled': - return - - case 'neutral': - return - - case 'skipped': - return - - case 'stale': - return - - case 'timed_out': - return - - default: - return - } - } - - return -} diff --git a/src/components/dashboard/status-indicator-icon.js b/src/components/dashboard/status-indicator-icon.js deleted file mode 100644 index eb6d3028..00000000 --- a/src/components/dashboard/status-indicator-icon.js +++ /dev/null @@ -1,101 +0,0 @@ -import { Icon } from '@chakra-ui/react' -import { - BsCheckCircleFill, - BsFillDashCircleFill, - BsFillExclamationOctagonFill, - BsFillRecordCircleFill, - BsFillSlashCircleFill, - BsFillXCircleFill, -} from 'react-icons/bs' -import { FaCircle } from 'react-icons/fa' - -export const StatusIndicatorIcon = ({ status, conclusion, ...props }) => { - if (status === 'queued') { - return - } - - if (status === 'in_progress') { - return ( - - ) - } - - if (status === 'completed') { - switch (conclusion) { - case 'success': - return ( - - ) - - case 'failure': - return ( - - ) - - case 'action_required': - return ( - - ) - - case 'neutral': - return ( - - ) - - case 'stale': - return ( - - ) - - case 'cancelled': - return ( - - ) - - case 'skipped': - return ( - - ) - - case 'timed_out': - return ( - - ) - } - } -} diff --git a/src/components/dashboard/summary.js b/src/components/dashboard/summary.js deleted file mode 100644 index d546818b..00000000 --- a/src/components/dashboard/summary.js +++ /dev/null @@ -1,82 +0,0 @@ -import { Link } from '@/components' -import { useStats } from '@/lib/endpoints' -import { - Box, - Container, - Heading, - SimpleGrid, - Stack, - Text, - useBreakpointValue, - useColorModeValue, -} from '@chakra-ui/react' -import React from 'react' - -const Stat = (props) => { - const { label, value, ...boxProps } = props - return ( - - {' '} - - {label} - - {value} - - - - ) -} - -export const Summary = () => { - const borderColor = useColorModeValue('gray.800', 'gray.500') - const feedstocks = useStats('feedstocks') - const recipeRuns = useStats('recipe_runs') - const datasets = useStats('datasets?exclude_test_runs=true') - - const reports = [ - { label: 'Feedstocks', href: '/dashboard/feedstocks', stats: feedstocks }, - { label: 'Recipe Runs', href: '/dashboard/recipe-runs', stats: recipeRuns }, - { label: 'Datasets', href: '/catalog', stats: datasets }, - ] - return ( - - - - {reports.map(({ label, href, stats }) => ( - - ))} - - - - ) -} diff --git a/src/components/dataset/datasets-accordion.js b/src/components/dataset/datasets-accordion.js deleted file mode 100644 index d1adba90..00000000 --- a/src/components/dataset/datasets-accordion.js +++ /dev/null @@ -1,48 +0,0 @@ -import { DatasetRepr } from '@/components/dataset' -import { getDatasetName } from '@/lib/dataset-utils' -import { AddIcon, MinusIcon } from '@chakra-ui/icons' -import { - Accordion, - AccordionButton, - AccordionItem, - AccordionPanel, - Box, -} from '@chakra-ui/react' - -export const DatasetCard = ({ dataset }) => { - const name = getDatasetName(dataset) - - return ( - - {({ isExpanded }) => ( - <> - - - {name} - - - {isExpanded ? ( - - ) : ( - - )} - - - - - - - )} - - ) -} - -export const DatasetsAccordion = ({ datasets }) => { - return ( - - {datasets?.map((dataset, index) => { - return - })} - - ) -} diff --git a/src/components/dataset/index.js b/src/components/dataset/index.js deleted file mode 100644 index a5d38275..00000000 --- a/src/components/dataset/index.js +++ /dev/null @@ -1 +0,0 @@ -export { DatasetRepr } from '@/components/dataset/repr' diff --git a/src/components/dataset/repr.js b/src/components/dataset/repr.js deleted file mode 100644 index 0a659758..00000000 --- a/src/components/dataset/repr.js +++ /dev/null @@ -1,45 +0,0 @@ -import { CodeBlock, Error } from '@/components' -import { useXarrayDatasetRepr } from '@/lib/endpoints' -import { Box, Spinner } from '@chakra-ui/react' - -export const DatasetRepr = ({ dataset, includeSnippet = true }) => { - const code = `import xarray as xr - -store = '${dataset}' -ds = xr.open_dataset(store, engine='zarr', chunks={}) -ds` - const { repr, reprError, isLoading } = useXarrayDatasetRepr(dataset) - - if (reprError) - return ( - - ) - - return ( - <> - {includeSnippet && ( - - {code} - - )} - - - {isLoading && ( - - )} - -
- - - ) -} diff --git a/src/components/header/data.js b/src/components/header/data.js index dd66eaba..2d40fe86 100644 --- a/src/components/header/data.js +++ b/src/components/header/data.js @@ -1,14 +1,4 @@ export const navItems = [ { label: 'Home', href: '/' }, - { label: 'Catalog', href: '/catalog' }, - { - label: 'Dashboard', - href: '/dashboard/feedstocks', - children: [ - { label: 'Feedstocks', href: '/dashboard/feedstocks', subLabel: '' }, - { label: 'Bakeries', href: '/dashboard/bakeries' }, - { label: 'Recipe-Runs', href: '/dashboard/recipe-runs' }, - ], - }, { label: 'Docs', href: 'https://pangeo-forge.readthedocs.io/en/latest/' }, ] diff --git a/src/components/hero.js b/src/components/hero.js index d0161a66..be1ebe20 100644 --- a/src/components/hero.js +++ b/src/components/hero.js @@ -19,17 +19,16 @@ export const Hero = () => { Pangeo-Forge logo - - {' '} - A cloud-native data repository for ocean, weather, and climate - science - + + {' '} + Cloud-native data for ocean, weather, and climate science + ) diff --git a/src/components/layout.js b/src/components/layout.js index f8381bdb..14037420 100644 --- a/src/components/layout.js +++ b/src/components/layout.js @@ -1,5 +1,4 @@ import { Footer, Header } from '@/components' -import { Menu } from '@/components/dashboard' import { getRootURL } from '@/lib/seo-utils' import { Box, Flex } from '@chakra-ui/react' import { NextSeo } from 'next-seo' @@ -39,7 +38,7 @@ export const Layout = ({ >
- {menu && } + {menu} {children}