mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 06:39:48 +00:00
Show operationName and some tweaks
This commit is contained in:
parent
10fb8b19e3
commit
07b4e02693
@ -122,7 +122,11 @@ class GraphQLEditor extends React.PureComponent<Props, State> {
|
||||
}
|
||||
}
|
||||
|
||||
return this.state.body.operationName || null;
|
||||
return null;
|
||||
}
|
||||
|
||||
_handleQueryFocus() {
|
||||
this._handleQueryUserActivity();
|
||||
}
|
||||
|
||||
_handleQueryUserActivity() {
|
||||
@ -444,26 +448,31 @@ class GraphQLEditor extends React.PureComponent<Props, State> {
|
||||
clearTimeout(this._schemaFetchTimeout);
|
||||
}
|
||||
|
||||
renderSelectedOperationName() {
|
||||
const { operationName } = this.state.body;
|
||||
if (!operationName) {
|
||||
return null;
|
||||
} else {
|
||||
return <span title="Current operationName">{operationName}</span>;
|
||||
}
|
||||
}
|
||||
|
||||
renderSchemaFetchMessage() {
|
||||
let message;
|
||||
const { schemaLastFetchTime, schemaIsFetching } = this.state;
|
||||
if (schemaIsFetching) {
|
||||
message = 'Fetching schema...';
|
||||
message = 'fetching schema...';
|
||||
} else if (schemaLastFetchTime > 0) {
|
||||
message = (
|
||||
<span className="faded">
|
||||
<span>
|
||||
schema fetched <TimeFromNow timestamp={schemaLastFetchTime} />
|
||||
</span>
|
||||
);
|
||||
} else {
|
||||
message = 'schema not yet fetched';
|
||||
message = <span>schema not yet fetched</span>;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="txt-sm super-faint italic pad-sm no-pad-right inline-block">
|
||||
{message}
|
||||
</div>
|
||||
);
|
||||
return message;
|
||||
}
|
||||
|
||||
render() {
|
||||
@ -516,7 +525,7 @@ class GraphQLEditor extends React.PureComponent<Props, State> {
|
||||
onChange={this._handleQueryChange}
|
||||
onCodeMirrorInit={this._handleQueryEditorInit}
|
||||
onCursorActivity={this._handleQueryUserActivity}
|
||||
onClick={this._handleQueryUserActivity}
|
||||
onFocus={this._handleQueryFocus}
|
||||
mode="graphql"
|
||||
lineWrapping={settings.editorLineWrapping}
|
||||
placeholder=""
|
||||
@ -545,6 +554,7 @@ class GraphQLEditor extends React.PureComponent<Props, State> {
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="graphql-editor__meta">
|
||||
<div className="graphql-editor__schema-notice">
|
||||
{this.renderSchemaFetchMessage()}
|
||||
{!schemaIsFetching && (
|
||||
@ -555,6 +565,10 @@ class GraphQLEditor extends React.PureComponent<Props, State> {
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
<div className="graphql-editor__operation-name">
|
||||
{this.renderSelectedOperationName()}
|
||||
</div>
|
||||
</div>
|
||||
<h2 className="no-margin pad-left-sm pad-top-sm pad-bottom-sm">
|
||||
Query Variables{' '}
|
||||
<HelpTooltip>
|
||||
|
@ -26,7 +26,27 @@
|
||||
}
|
||||
|
||||
.graphql-editor__query .cm-gql-disabled {
|
||||
opacity: 0.7;
|
||||
filter: grayscale(0.7);
|
||||
opacity: 0.8;
|
||||
filter: grayscale(0.8);
|
||||
}
|
||||
|
||||
.graphql-editor__schema-notice {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.graphql-editor__operation-name {
|
||||
margin-left: auto;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.graphql-editor__meta {
|
||||
color: var(--hl);
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
padding: 0 @padding-sm;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user