make events and remote-schema tabs independent of update checker (#1604)

* fix a bug where update check request failure would stop remote-schemas and event triggers tab from loading

* update graphiql test for with and without admin secret

* remove dev data api url from localDev env
This commit is contained in:
Rishichandra Wawhal 2019-02-17 17:14:52 +05:30 committed by Rikin Kachhia
parent 75674859b3
commit 386ab81b96
5 changed files with 48 additions and 20 deletions

View File

@ -65,8 +65,13 @@ export const checkExecuteQueryButton = () => {
};
export const checkQuery = () => {
if (adminSecret) {
cy.get(getElementFromAlias('header-key-2')).type('someKey');
cy.get(getElementFromAlias('header-value-2')).type('someValue');
} else {
cy.get(getElementFromAlias('header-key-1')).type('someKey');
cy.get(getElementFromAlias('header-value-1')).type('someValue');
}
cy.get('textarea')
.first()

View File

@ -95,5 +95,4 @@ if (globals.consoleMode === SERVER_CONSOLE_MODE) {
}
*/
}
export default globals;

View File

@ -40,9 +40,6 @@ class Main extends React.Component {
dispatch(checkServerUpdates()).then(() => {
let isUpdateAvailable = false;
try {
this.checkEventsTab().then(() => {
this.checkSchemaStitch();
});
isUpdateAvailable = semver.gt(
this.props.latestServerVersion,
this.props.serverVersion
@ -62,8 +59,12 @@ class Main extends React.Component {
console.error(e);
}
});
this.checkEventsTab().then(() => {
this.checkSchemaStitch();
});
});
}
checkSchemaStitch() {
const showSchemaStitch = semverCheck(
'schemaStitching',

View File

@ -1,6 +1,7 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Helmet from 'react-helmet';
import { env } from './localDev';
/**
* Wrapper component containing HTML metadata and boilerplate tags.
* Used in server-side code only to wrap the string output of the
@ -20,7 +21,6 @@ export default class Html extends Component {
render() {
const { assets } = this.props;
const head = Helmet.rewind();
return (
<html lang="en-us">
<head>
@ -38,19 +38,7 @@ export default class Html extends Component {
<script
dangerouslySetInnerHTML={{
__html: `window.__env={
apiHost: '${process.env.API_HOST}',
apiPort: '${process.env.API_PORT}',
dataApiUrl: '${process.env.DATA_API_URL}',
devDataApiUrl: '${process.env.DEV_DATA_API_URL}',
adminSecret: '${process.env.ACCESS_KEY}',
isAdminKeySet: ${process.env.IS_ADMIN_SECRET_SET ||
process.env.IS_ACCESS_KEY_SET},
consoleMode: '${process.env.CONSOLE_MODE}',
nodeEnv: '${process.env.NODE_ENV}',
urlPrefix: '${process.env.URL_PREFIX}',
enableTelemetry: ${process.env.ENABLE_TELEMETRY}
};`,
__html: env,
}}
/>
</head>

View File

@ -0,0 +1,35 @@
const envObj = `apiHost: '${process.env.API_HOST}',
apiPort: '${process.env.API_PORT}',
dataApiUrl: '${process.env.DATA_API_URL}',
adminSecret: '${process.env.ADMIN_SECRET}',
consoleMode: '${process.env.CONSOLE_MODE}',
nodeEnv: '${process.env.NODE_ENV}',
urlPrefix: '${process.env.URL_PREFIX}',
enableTelemetry: ${process.env.ENABLE_TELEMETRY},
`;
let appendObj;
if (process.env.ADMIN_SECRET !== undefined) {
appendObj = `
adminSecret: '${process.env.ADMIN_SECRET}`;
} else {
// ADMIN_SECRET is undefined
if (process.env.IS_ADMIN_SECRET_SET !== undefined) {
appendObj = `isAdminSecretSet: ${process.env.IS_ADMIN_SECRET_SET}`;
} else {
// Both ADMIN_SECRET and IS_ADMIN_SECRET_SET is undefined
if (process.env.ACCESS_KEY !== undefined) {
appendObj = `accessKey: ${process.env.ACCESS_KEY}`;
} else {
appendObj = `isAccessKeySet: ${process.env.IS_ACCESS_KEY_SET}`;
}
}
}
const env = `
window.__env={\n\t\t${envObj}\t\t${appendObj}
};
`;
export { env };