-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Refactor API console into REST console * feat: GraphQL console component Adds the GraphQLConsole component, which renders the graphql-playground-react component at the route `/api_console/graphql`. The GraphQL server endpoint must be retrieved from the Parse app instance. * feat: Set default GraphQL playground headers * Fix GraphQL playground style import * fix package-lock.json * GraphQL API Console not configured state * Fix GraphQL console empty state horizontal alignment * Add default toolbar into GraphQL console
- Loading branch information
1 parent
2a7b7b0
commit d04b7f0
Showing
9 changed files
with
2,265 additions
and
1,076 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 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 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 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 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,57 @@ | ||
/* | ||
* Copyright (c) 2016-present, Parse, LLC | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the license found in the LICENSE file in | ||
* the root directory of this source tree. | ||
*/ | ||
import ParseApp from 'lib/ParseApp'; | ||
import PropTypes from 'lib/PropTypes'; | ||
import React, { Component } from 'react'; | ||
import { Provider } from 'react-redux' | ||
import { Playground, store } from 'graphql-playground-react'; | ||
import EmptyState from 'components/EmptyState/EmptyState.react'; | ||
import Toolbar from 'components/Toolbar/Toolbar.react'; | ||
import styles from 'dashboard/Data/ApiConsole/ApiConsole.scss'; | ||
|
||
export default class GraphQLConsole extends Component { | ||
render() { | ||
const { applicationId, graphQLServerURL, masterKey } = this.context.currentApp; | ||
let content; | ||
if (!graphQLServerURL) { | ||
content = ( | ||
<div className={styles.empty}> | ||
<EmptyState | ||
title='GraphQL API Console' | ||
description='Please update Parse-Server to version equal or above | ||
3.5.0 and define the "graphQLServerURL" on your app configuration | ||
in order to use the GraphQL API Console.' | ||
icon='info-solid' /> | ||
</div> | ||
); | ||
} else { | ||
const headers = { | ||
'X-Parse-Application-Id': applicationId, | ||
'X-Parse-Master-Key': masterKey | ||
} | ||
content = ( | ||
<Provider store={store}> | ||
<Playground endpoint={graphQLServerURL} headers={headers} /> | ||
</Provider> | ||
); | ||
} | ||
|
||
return ( | ||
<> | ||
<Toolbar section='Core' subsection='GraphQL API Console' /> | ||
<div className={styles.content}> | ||
{content} | ||
</div> | ||
</> | ||
); | ||
} | ||
} | ||
|
||
GraphQLConsole.contextTypes = { | ||
currentApp: PropTypes.instanceOf(ParseApp) | ||
}; |
Oops, something went wrong.