这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
3e6f9f9
[skip ci] generate relay schema
0x777 Apr 15, 2020
615fccb
[skip ci] wip: query generation logic for Relay Connection spec
0x777 Apr 17, 2020
a16bc0b
implement 'mkConnectionSelect' function with minimal cursors.
rakeshkky Apr 29, 2020
e257138
validation support for unions and interfaces
0x777 May 8, 2020
94153cf
use the new normal form everywhere
0x777 May 8, 2020
f1955aa
use 'normalize' over 'denormalize' in type names
0x777 May 8, 2020
fb87e28
minor cleanup
0x777 May 11, 2020
8e28ed3
generate connection SQL with complete Relay features
rakeshkky May 15, 2020
b3dd4fd
'/v1/relay' endpoint for relay schema
rakeshkky May 18, 2020
9ba9443
Merge branch 'master' into relay
rakeshkky May 20, 2020
7bad35b
Merge branch 'master' into interface-support
rakeshkky May 21, 2020
1785d86
Merge branch 'master' into interface-support
rakeshkky May 22, 2020
4205dc6
Merge branch 'interface-support' into relay-new
rakeshkky Jun 3, 2020
e797e32
implement 'Node' interface and top level 'node' field resolver
rakeshkky May 26, 2020
45cc7fe
add relay toggle on graphiql
May 26, 2020
44843e6
fix explain api response & index plan id with query type
rakeshkky May 27, 2020
2759f25
add hasura mutations to relay
rakeshkky May 27, 2020
a36102d
update relay toggle margin
rikinsk May 28, 2020
db3d396
fix postgres query error when simple and connection array field exist…
rakeshkky May 28, 2020
0ec539b
fix top level connection field types in relay
rakeshkky May 28, 2020
84cef32
fix __typename field not resolving in Node interface
rakeshkky Jun 2, 2020
508b7cf
Merge branch 'master' into relay-new
rakeshkky Jun 4, 2020
1459754
add relay pytests
rakeshkky Jun 3, 2020
3cc4a1d
fix relay tests if any authorization set
rakeshkky Jun 3, 2020
ed107c3
update CHANGELOG.md
rakeshkky Jun 4, 2020
a737c08
remove unused import warning
rakeshkky Jun 4, 2020
e7cd5a5
fix array relation connection field type & minor no-op refactor
rakeshkky Jun 4, 2020
6622649
requested changes
Jun 4, 2020
2d836ea
persist graphiql mode
Jun 4, 2020
2c0725d
lint
Jun 4, 2020
6cf3c97
reduce margin betweent toggle and URL; remove usage of negative margin
Jun 8, 2020
5a17d51
revert the logic of remote schema query execution
rakeshkky Jun 8, 2020
9508156
filter 'id' column by taking custom field name into account
rakeshkky Jun 8, 2020
78b3024
Merge branch 'master' into relay
rakeshkky Jun 8, 2020
ae59e0f
Merge branch 'relay' of github.com:0x777/graphql-engine into relay
rakeshkky Jun 8, 2020
52e2c1d
Merge branch 'master' into relay
0x777 Jun 8, 2020
acca92c
Update cabal.project
0x777 Jun 8, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

## Next release

### Relay

The Hasura GraphQL Engine serves [Relay](https://relay.dev/en/) schema for Postgres tables which has a primary key defined.

The Relay schema can be accessed through `/v1/relay` endpoint.

[Add docs links][add console screenshot for relay toggle]

### Remote Joins

Remote Joins extend the concept of joining data across tables, to being able to join data across tables and remote schemas.
Expand Down
1 change: 1 addition & 0 deletions console/src/Endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const Endpoints = {
getSchema: `${baseUrl}/v1/query`,
serverConfig: `${baseUrl}/v1alpha1/config`,
graphQLUrl: `${baseUrl}/v1/graphql`,
relayURL: `${baseUrl}/v1/relay`,
schemaChange: `${baseUrl}/v1/query`,
query: `${baseUrl}/v1/query`,
rawSQL: `${baseUrl}/v1/query`,
Expand Down
6 changes: 0 additions & 6 deletions console/src/components/Common/Common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1263,12 +1263,6 @@ code {
display: block;
top: 0;
z-index: 11;

.stickySeparator {
padding-top: 60px;
margin-left: -15px;
margin-right: -15px;
}
}

.fixed_header_internal_link {
Expand Down
21 changes: 9 additions & 12 deletions console/src/components/Common/Tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,21 @@ import React from 'react';
import OverlayTrigger from 'react-bootstrap/lib/OverlayTrigger';
import Tooltip from 'react-bootstrap/lib/Tooltip';
import styles from './Tooltip.scss';

const tooltipGen = (message: string) => {
return <Tooltip id={message}>{message}</Tooltip>;
};

export interface TooltipProps extends React.ComponentProps<'i'> {
};export interface TooltipProps extends React.ComponentProps<'i'> {
message: string;
placement?: 'right' | 'left' | 'top' | 'bottom';
className?: string;
}

const ToolTip: React.FC<TooltipProps> = ({ message, placement = 'right' }) => (
const ToolTip: React.FC<TooltipProps> = ({ message, placement = 'right', children }) => (
<OverlayTrigger placement={placement} overlay={tooltipGen(message)}>
<i
className={`fa fa-question-circle + ${styles.tooltipIcon}`}
aria-hidden="true"
/>
{children || (
<i
className={`fa fa-question-circle ${styles.tooltipIcon}`}
aria-hidden="true"
/>
)}
</OverlayTrigger>
);

export default ToolTip;
export default ToolTip;
10 changes: 9 additions & 1 deletion console/src/components/Common/utils/graphqlUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ import {
import React from 'react';
import endpoints from '../../../Endpoints';

export const getGraphQLQueryPayload = (
query: string,
variables: Record<string, any>
) => ({
query,
variables,
});

export const useIntrospectionSchema = (headers = {}) => {
const [schema, setSchema] = React.useState<GraphQLSchema | null>(null);
const [loading, setLoading] = React.useState(true);
Expand All @@ -17,7 +25,7 @@ export const useIntrospectionSchema = (headers = {}) => {
fetch(endpoints.graphQLUrl, {
method: 'POST',
headers,
body: JSON.stringify({ query: getIntrospectionQuery() }),
body: JSON.stringify(getGraphQLQueryPayload(getIntrospectionQuery(), {})),
})
.then(r => r.json())
.then(response => {
Expand Down
34 changes: 29 additions & 5 deletions console/src/components/Services/ApiExplorer/Actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { WebSocketLink } from 'apollo-link-ws';
import { parse } from 'graphql';
import { execute } from 'apollo-link';

import { getHeadersAsJSON } from './utils';
import { getHeadersAsJSON, getGraphQLEndpoint } from './utils';
import { saveAppState, clearState } from '../../AppState.js';
import { ADMIN_SECRET_HEADER_KEY } from '../../../constants';

Expand Down Expand Up @@ -44,6 +44,18 @@ const CREATE_WEBSOCKET_CLIENT = 'ApiExplorer/CREATE_WEBSOCKET_CLIENT';
const FOCUS_ROLE_HEADER = 'ApiExplorer/FOCUS_ROLE_HEADER';
const UNFOCUS_ROLE_HEADER = 'ApiExplorer/UNFOCUS_ROLE_HEADER';

const SET_LOADING = 'ApiExplorer/SET_LOADING';
export const setLoading = isLoading => ({
type: SET_LOADING,
data: isLoading,
});

const SWITCH_GRAPHIQL_MODE = 'ApiExplorer/SWITCH_GRAPHIQL_MODE';
export const switchGraphiQLMode = mode => ({
type: SWITCH_GRAPHIQL_MODE,
mode,
});

const clearHistory = () => {
return {
type: CLEAR_HISTORY,
Expand Down Expand Up @@ -88,8 +100,9 @@ const getChangedHeaders = (headers, changedHeaderDetails) => {
return nonEmptyHeaders;
};

const verifyJWTToken = token => dispatch => {
const url = Endpoints.graphQLUrl;
const verifyJWTToken = token => (dispatch, getState) => {
const { mode: graphiqlMode } = getState().apiexplorer;
const url = getGraphQLEndpoint(graphiqlMode);
const body = {
query: '{ __type(name: "dummy") {name}}',
variables: null,
Expand Down Expand Up @@ -199,10 +212,11 @@ const graphQLFetcherFinal = (graphQLParams, url, headers) => {
};

/* Analyse Fetcher */
const analyzeFetcher = (url, headers) => {
const analyzeFetcher = (headers, mode) => {
return query => {
const editedQuery = {
query,
is_relay: mode === 'relay',
};

const user = {
Expand All @@ -227,7 +241,7 @@ const analyzeFetcher = (url, headers) => {

editedQuery.user = user;

return fetch(`${url}/explain`, {
return fetch(`${Endpoints.graphQLUrl}/explain`, {
method: 'post',
headers: reqHeaders,
body: JSON.stringify(editedQuery),
Expand Down Expand Up @@ -619,6 +633,16 @@ const apiExplorerReducer = (state = defaultState, action) => {
},
},
};
case SWITCH_GRAPHIQL_MODE:
return {
...state,
mode: action.mode,
};
case SET_LOADING:
return {
...state,
loading: action.data,
};
default:
return state;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import QueryAnalyzer from './QueryAnalyzer';
import GraphiQL from 'graphiql';
import { print, parse } from 'graphql';
import { isValidGraphQLOperation } from '../utils';
import { getGraphQLQueryPayload } from '../../../Common/utils/graphqlUtils';

export default class AnalyseButton extends React.Component {
constructor(props) {
Expand All @@ -20,7 +21,7 @@ export default class AnalyseButton extends React.Component {
};
}
render() {
const operations = this.props.operations;
const { operations, mode } = this.props;
const optionsOpen = this.state.optionsOpen;
const hasOptions = operations && operations.length > 1;

Expand Down Expand Up @@ -67,6 +68,7 @@ export default class AnalyseButton extends React.Component {
{this.state.analyseQuery && (
<QueryAnalyzer
show={this.state.isAnalysing}
mode={mode}
analyseQuery={this.state.analyseQuery}
clearAnalyse={this.clearAnalyse.bind(this)}
{...this.props}
Expand Down Expand Up @@ -125,15 +127,13 @@ export default class AnalyseButton extends React.Component {
}

const plainQuery = print(parseQuery);
const query = {
query: plainQuery,
variables: jsonVariables,
};
const query = getGraphQLQueryPayload(plainQuery, jsonVariables);
if (operation) {
query.operationName = operation;
}
const analyseQuery = {
query,
is_relay: this.props.mode === 'relay',
};
this.setState({
analyseQuery,
Expand Down
5 changes: 5 additions & 0 deletions console/src/components/Services/ApiExplorer/ApiExplorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ class ApiExplorer extends Component {
location,
serverVersion,
serverConfig,
mode,
loading,
} = this.props;

const styles = require('./ApiExplorer.scss');
Expand All @@ -83,12 +85,14 @@ class ApiExplorer extends Component {
details={displayedApi.details}
request={displayedApi.request}
route={route}
mode={mode}
dataHeaders={dataHeaders}
numberOfTables={tables.length}
headerFocus={headerFocus}
urlParams={location.query}
serverVersion={serverVersion}
consoleUrl={consoleUrl}
loading={loading}
serverConfig={serverConfig}
/>
</div>
Expand All @@ -105,6 +109,7 @@ ApiExplorer.propTypes = {
tables: PropTypes.array.isRequired,
headerFocus: PropTypes.bool.isRequired,
location: PropTypes.object.isRequired,
mode: PropTypes.string.isRequired,
};

const generatedApiExplorer = connect => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -827,3 +827,7 @@ label {
}
}
}

.graphiqlModeToggle {
float: right;
}
Loading