-
Notifications
You must be signed in to change notification settings - Fork 0
feature: link related ideas #84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
69 commits
Select commit
Hold shift + click to select a range
37fd2cf
register custom widget for variable type resources
interim17 5e1c540
use resourceDetails in nested fields on resource markdown
interim17 75fbc17
query new resources collection
interim17 9f43b2b
Update src/cms/widgets/VariableResourceWidget/copyResourceNameHandler.ts
interim17 a345633
Update static/admin/config.yml
interim17 478c946
reference resourceDetails in relational widget
interim17 e0fd5b2
Merge branch 'main' of https://github.com/AllenCell/idea-board into f…
interim17 cc336ee
remove redundant fields from config
interim17 6653ea5
fix typo
interim17 eb6b692
run format
interim17 3e89540
Merge branch 'run-format' of https://github.com/AllenCell/idea-board …
interim17 211c55a
update comment
interim17 ee27bd4
Merge branch 'feature/resource' of https://github.com/AllenCell/idea-…
interim17 00d073e
add resources to schema
interim17 2bdcb98
add pages for resources
interim17 879d577
format resource template
interim17 1a50470
add ResourceDetailsField fragment
interim17 1e1ee25
build resource pages separately from MarkdownRemark
interim17 079639a
Merge branch 'main' of https://github.com/AllenCell/idea-board into f…
interim17 f9283a8
format and lint
interim17 be3ef5c
Merge branch 'feature/resource' of https://github.com/AllenCell/idea-…
interim17 971039c
import resources path
interim17 c12a1aa
add a resources index page and a second dev example tool
interim17 72038d2
make programs an array and next steps a markdown string
interim17 fc2b31f
Merge branch 'main' of https://github.com/AllenCell/idea-board into f…
interim17 f793be6
Merge branch 'fix/next-steps' of https://github.com/AllenCell/idea-bo…
interim17 89d19e2
fix duplicated fields in dev-example
interim17 a517a79
flatten resource details when building gatsby nodes
interim17 666a21a
fix typos
interim17 7369d06
migrate software and dataset markdown content to resources collection
interim17 d98830e
migrate cell lines to resource markdown
interim17 6104fb3
bucket resource types in resource index with compsed fragments
interim17 2e00e4c
use resources collection data in MaterialsAndMethods component
interim17 10bdf7a
remove materials and methods from markdown, schema and gatsby node api
interim17 a23a49f
remove data and utilities associated with old multi resourece collect…
interim17 2c3bf14
patch idea roll component to use resources
interim17 137179e
add reporter to resource resolver
interim17 0c37800
update tests to cover resourceQuery
interim17 8d88a8d
Update gatsby-node.js
interim17 8264972
remove tags fields from createPages calls
interim17 0d4765e
Merge branch 'feature/resource-query' of https://github.com/AllenCell…
interim17 2b14e68
Update gatsby/utils/gatsby-resolver-utils.js
interim17 2c25a81
Update gatsby/schema/base.gql
interim17 2127cba
update comments
interim17 8411c40
remove extra layout
interim17 8d3b7b9
Merge branch 'feature/resource-query' of https://github.com/AllenCell…
interim17 1ff999e
Merge branch 'feature/resource-query' of https://github.com/AllenCell…
interim17 fbe2502
fix authors schema typing
interim17 23a5c69
Merge branch 'main' of https://github.com/AllenCell/idea-board into f…
interim17 3febfd8
Merge branch 'feature/resource-query' of https://github.com/AllenCell…
interim17 5965024
add noopener to NameWithLink util
interim17 a097dae
Merge branch 'feature/resource-query' of https://github.com/AllenCell…
interim17 432db80
Merge branch 'migrate-resources-1' of https://github.com/AllenCell/id…
interim17 7b2f553
don't use constant in resolver tests
interim17 65ad0e6
add related ideas field to decap config
interim17 c6d0d75
query and render related ideas
interim17 4d6d314
working refactor of idea roll to query idea posts instead of markdown…
interim17 71df358
move idea post to use idea post nodes instead of markdown nodes
interim17 9aa262d
alphabetize types in schema
interim17 5fe20c7
Merge branch 'main' of https://github.com/AllenCell/idea-board into l…
interim17 d4d0817
Update gatsby/resolvers/resolvers.js
interim17 321cd62
Update src/templates/idea-post.tsx
interim17 ceb8f95
Update src/components/IdeaRoll.tsx
interim17 28a3ea1
Merge branch 'main' of https://github.com/AllenCell/idea-board into l…
interim17 8d5f520
Merge branch 'main' into link-ideas
interim17 8febdd9
change hint text for related ideas
interim17 4b2004b
lint and format
interim17 e9d001d
Apply suggestion from @ShrimpCryptid
interim17 558376e
reorder schema types
interim17 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| const { | ||
| stringWithDefault, | ||
| resolveToArray, | ||
| ideaPostQuery, | ||
| resourceQuery, | ||
| } = require("../utils/gatsby-resolver-utils"); | ||
|
|
||
| const createIdeaPostResolver = (reporter) => ({ | ||
| title: { | ||
| resolve: (source) => | ||
| stringWithDefault(source.title, "No title provided."), | ||
| }, | ||
| description: { | ||
| resolve: (source) => | ||
| stringWithDefault(source.description, "No description provided."), | ||
| }, | ||
| nextSteps: { | ||
| resolve: (source) => source.nextSteps ?? null, | ||
| }, | ||
| relatedIdeas: { | ||
| resolve: async (source, _args, context) => { | ||
| const names = resolveToArray(source.related_ideas); | ||
| const results = await Promise.all( | ||
| names.map((name) => | ||
| context.nodeModel.findOne(ideaPostQuery(name)), | ||
| ), | ||
| ); | ||
| results.forEach((result, i) => { | ||
| if (!result) { | ||
| const msg = `Idea post "${names[i]}" not found for idea "${source.title}". Check for typos and ensure the idea post file exists with the correct templateKey.`; | ||
| reporter.error(msg, new Error(msg)); | ||
| } | ||
| }); | ||
| return results.filter(Boolean); | ||
| }, | ||
| }, | ||
| authors: { | ||
| resolve: (source) => resolveToArray(source.authors), | ||
| }, | ||
| tags: { | ||
| resolve: (source) => resolveToArray(source.tags), | ||
| }, | ||
| program: { | ||
| resolve: (source) => resolveToArray(source.program), | ||
| }, | ||
| resources: { | ||
| resolve: async (source, _args, context) => { | ||
| const names = resolveToArray(source.resources); | ||
| const results = await Promise.all( | ||
| names.map((name) => | ||
| context.nodeModel.findOne(resourceQuery(name)), | ||
| ), | ||
| ); | ||
| results.forEach((result, i) => { | ||
| if (!result) { | ||
| const msg = `Resource "${names[i]}" not found for idea "${source.title}". Check for typos and ensure the resource file exists with the correct templateKey.`; | ||
| reporter.error(msg, new Error(msg)); | ||
| } | ||
| }); | ||
| return results.filter(Boolean); | ||
| }, | ||
| }, | ||
| preliminaryFindings: { | ||
| resolve: (source) => { | ||
| const raw = source.preliminaryFindings; | ||
| if (!raw || typeof raw !== "object") { | ||
| return { summary: "", figures: [] }; | ||
| } | ||
| return { | ||
| summary: stringWithDefault(raw.summary, ""), | ||
| figures: resolveToArray(raw.figures), | ||
| }; | ||
| }, | ||
| }, | ||
| }); | ||
|
|
||
| module.exports = { createIdeaPostResolver }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly the same code as our our old frontmatter resolver, just in a new file and with "relatedIdeas" added