Skip to content
This repository has been archived by the owner on Jun 16, 2024. It is now read-only.

Commit

Permalink
[Cards UI fix] - dataset path now matches URL
Browse files Browse the repository at this point in the history
Previous logic worked for core datasets but not other sources
  • Loading branch information
jameshadfield committed Jun 2, 2023
1 parent 4b9a186 commit 6730c25
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,8 @@ npm run dev:local
Upload cards to S3 (change filenames as appropriate)
```sh
jq -c . < cache/cards-core.json > ./cache/cards-core.min.json # minimise
nextstrain remote upload s3://nextstrain-staging/james/ cache/cards-core.min.json
rm ./cache/cards-core.min.json
```
jq -c . < cache/cards-blab.json > ./cache/cards-blab.min.json # minimise
nextstrain remote upload s3://nextstrain-staging/james/ cache/cards-blab.min.json
jq -c . < cache/cards-staging.json > ./cache/cards-staging.min.json # minimise
nextstrain remote upload s3://nextstrain-staging/james/ cache/cards-staging.min.json
nextstrain remote upload s3://nextstrain-staging/james/ cache/cards-*.min.json
rm ./cache/cards-*.min.json
```
23 changes: 19 additions & 4 deletions src/intelligent-collapsing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,24 @@ import YAML from 'yaml';
import { S3ContentEntry, S3VersionEntry, readReallyLargeYamlFile } from "./sources/s3.ts";


const IO = {'objects': './cache/nextstrain-data.yaml', versions: './cache/nextstrain-data.versions.yaml', output: './cache/cards-core.json', ignoreKeys: (key:string) => key.includes('/')}
// const IO = {'objects': './cache/nextstrain-groups.yaml', versions: './cache/nextstrain-groups.versions.yaml', output: './cache/cards-blab.json', ignoreKeys: (key:string) => !key.startsWith('blab/datasets/')}
// const IO = {'objects': './cache/nextstrain-staging.yaml', versions: './cache/nextstrain-staging.versions.yaml', output: './cache/cards-staging.json', ignoreKeys: (key:string) => key.includes('/')}
const IO = {
objects: './cache/nextstrain-data.yaml', versions: './cache/nextstrain-data.versions.yaml',
output: './cache/cards-core.json',
ignoreKeys: (key:string) => key.includes('/'),
keyToName: (key:string) => key.replace(/\.json$/, '').split("_"),
}
// const IO = {
// objects: './cache/nextstrain-groups.yaml', versions: './cache/nextstrain-groups.versions.yaml',
// output: './cache/cards-blab.json',
// ignoreKeys: (key:string) => !key.startsWith('blab/datasets/'),
// keyToName: (key:string) => key.replace(/^blab\/datasets/, 'groups/blab').replace(/\.json$/, '').split("_"),
// }
// const IO = {
// objects: './cache/nextstrain-staging.yaml', versions: './cache/nextstrain-staging.versions.yaml',
// output: './cache/cards-staging.json',
// ignoreKeys: (key:string) => key.includes('/'),
// keyToName: (key:string) => key.replace(/^/, 'staging/').replace(/\.json$/, '').split("_"),
// }

main();

Expand All @@ -30,7 +45,7 @@ async function main() {
return;
}

const fields: string[] = r.Key.replace(/\.json$/, '').split("_");
const fields: string[] = IO.keyToName(r.Key);

if (fields.filter((k) => k.match(/\d{4}-\d{2}-\d{2}/)).length) return;

Expand Down
2 changes: 1 addition & 1 deletion viz/src/cards-ui/card-component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ function Name({name, isDataset}:{name:string, isDataset:boolean}) {
}

function Logo(name:string) {
if (name.startsWith('blab/')) return <BlabLogo/>
if (name.startsWith('groups/blab/')) return <BlabLogo/>
return <NextstrainLogo/>
}

Expand Down

0 comments on commit 6730c25

Please sign in to comment.