Skip to content

Commit

Permalink
Remove previewWebhookUrl and prod build calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
pvorozhe committed Oct 8, 2021
1 parent 90500e4 commit 492c333
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 55 deletions.
21 changes: 2 additions & 19 deletions apps/gatsby/src/AppConfig/AppConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,29 +286,12 @@ export class AppConfig extends React.Component {
</div>
<hr className={styles.splitter} />
<Typography>
<Heading>Site Settings</Heading>
<Heading>Configure CMS Preview</Heading>
<Paragraph>Use the Site Settings for your Gatsby Cloud site below.</Paragraph>
<TextField
name="previewWebhookUrl"
id="previewWebhookUrl"
labelText="Preview Webhook"
value={this.state.previewWebhookUrl}
onChange={this.updatePreviewWebhookUrl}
onBlur={this.validatePreviewWebhookUrl}
className={styles.input}
validationMessage={
!this.state.validPreviewWebhook
? urlHelpText
: ""
}
textInputProps={{
type: "text",
}}
/>
<TextField
name="webhookUrl"
id="webhookUrl"
labelText="Builds Webhook"
labelText="Preview Webhook"
value={this.state.webhookUrl}
onChange={this.updateWebhookUrl}
onBlur={this.validateWebhookUrl}
Expand Down
38 changes: 2 additions & 36 deletions apps/gatsby/src/Sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,36 +62,8 @@ export default class Sidebar extends React.Component {
});
}

/**
* lastPublishedDateTime is used to track when the built in Contentful publish button is clicked
* and then kick off production builds of the Gatsby site accordingly
*/
maybeStartProductionBuild = (content) => {
const { webhookUrl, authToken } = this.sdk.parameters.installation;
const { lastPublishedDateTime } = this.state;

/**
* if these timestamps are equal than the content has not been published OR has not been
* re-published after changes to the content have been made
*/
if (!lastPublishedDateTime || lastPublishedDateTime === content.publishedAt) {
return;
}

if (!webhookUrl) {
/**
* @todo add this warning to the UI
*/
console.warn('Warning: Gatsby production build not started since no webhookUrl has been configured.');
return;
}

callWebhook(webhookUrl, authToken);
}

onSysChanged = (content) => {
this.setManifestId(content);
this.maybeStartProductionBuild(content);
this.buildSlug();
};

Expand Down Expand Up @@ -166,13 +138,10 @@ export default class Sidebar extends React.Component {
refreshPreview = () => {
const {
webhookUrl,
previewWebhookUrl,
authToken
} = this.sdk.parameters.installation;

if (previewWebhookUrl) {
callWebhook(previewWebhookUrl, authToken);
} else if (webhookUrl) {
if (webhookUrl) {
callWebhook(webhookUrl, authToken);
} else {
console.warn(`Please add a Preview Webhook URL to your Gatsby Cloud App settings.`)
Expand Down Expand Up @@ -233,15 +202,12 @@ export default class Sidebar extends React.Component {
}, 10000)
}



render = () => {
let {
contentSyncUrl,
authToken,
previewUrl,
webhookUrl,
previewWebhookUrl,
} = this.sdk.parameters.installation;
const { slug } = this.state

Expand All @@ -250,7 +216,7 @@ export default class Sidebar extends React.Component {
return (
<div className="extension">
<div className="flexcontainer">
{(previewWebhookUrl || webhookUrl) ?
{(webhookUrl) ?
<>
<ExtensionUI
disabled={this.state.buttonDisabled}
Expand Down

0 comments on commit 492c333

Please sign in to comment.