Skip to content
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

Support document, variables and headers in AS Landing Page config #5711

Merged
merged 14 commits into from
Oct 28, 2021

Conversation

mayakoneval
Copy link
Contributor

@mayakoneval mayakoneval commented Sep 14, 2021

This PR supports sending a document, variable, or headers to Sandbox (if this is a local graph) or your graph (if this is production), and will populate them. Here is an example URL:

https://studio.apollographql.com/graph/Apollo-Fullstack-Demo-o3tsz8/explorer?variant=current&document=query%20ExampleQuery%20%7B%0A%20%20me%20%7B%0A%20%20%20%20email%0A%20%20%7D%0A%20%20tripsBooked%0A%7D%0A&variables=%7B%22test1%22%3A%22hello%22%7D

Headers has a bug in studio-ui, I have a PR up for it here

@mayakoneval
Copy link
Contributor Author

@glasser not sure how to add you here

@@ -37,6 +37,9 @@ interface LandingPageConfig {
graphRef?: string | undefined;
isProd?: boolean;
apolloStudioEnv?: 'staging' | 'prod';
document?: string;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mayakoneval Oh I think this isn't complete. You've added to the interface of "what we put in the JSON blob" but not the other interfaces above that are the actual options passed by the user to the plugin.

<tr>
<td>

###### `document`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should also be documented in the production plugin section right? Probably OK to say that they have the same semantics as in this section and only take effect when graphRef is set rather than fully describing them again.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Folks can specify a document, variables and headers for prod graphs regardless of whether they have a graphRef. If they don't pass a graphRef, the document, variables and headers will populate their Sandbox that the landing page links to rather than their registered graph.

Could you clarify this part please?

Probably OK to say that they have the same semantics as in this section and only take effect when graphRef is set rather than fully describing them again.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Folks can specify a document, variables and headers for prod graphs regardless of whether they have a graphRef. If they don't pass a graphRef, the document, variables and headers will populate their Sandbox that the landing page links to rather than their registered graph.

I thought that if you're using the "prod graph" version of the plugin but have no graph ref then there won't be any link to Studio (Sandbox or otherwise)?
Folks can specify a document, variables and headers for prod graphs regardless of whether they have a graphRef. If they don't pass a graphRef, the document, variables and headers will populate their Sandbox that the landing page links to rather than their registered graph.

Could you clarify this part please?

Probably OK to say that they have the same semantics as in this section and only take effect when graphRef is set rather than fully describing them again.

Just saying that if you want, you don't have to repeat the same text twice in the two sections but can have the second one refer to the first. Either way's ok though.

@@ -30,13 +30,23 @@ export interface ApolloServerPluginLandingPageProductionDefaultOptions
* accessible you may not want to display the graph ref publicly.)
*/
graphRef?: string;
/**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the production options but it's needed in the local options too? up at line 22?

@@ -14,6 +14,13 @@ export interface ApolloServerPluginLandingPageDefaultBaseOptions {
* landing page.
*/
footer?: boolean;
/**
* Folks can configure their landing page to link to Studio Explorer with a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might be a little confusing that this does nothing if you're in production without graph ref. Could do something fancy with & in the production options to make that work. But meh this seems fine :)

@glasser glasser enabled auto-merge (squash) October 28, 2021 22:41
@glasser glasser merged commit 1ef5171 into apollographql:main Oct 28, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants