Fix for QueryTab Load More (#907)
This commit is contained in:
parent
39215dc4de
commit
f9bd12eaa6
|
@ -33,6 +33,12 @@ export class EditorReact extends React.Component<EditorReactProps, EditorReactSt
|
|||
this.createEditor(this.configureEditor.bind(this));
|
||||
}
|
||||
|
||||
public componentDidUpdate(previous: EditorReactProps) {
|
||||
if (this.props.content !== previous.content) {
|
||||
this.editor.setValue(this.props.content);
|
||||
}
|
||||
}
|
||||
|
||||
public componentWillUnmount(): void {
|
||||
this.selectionListener && this.selectionListener.dispose();
|
||||
}
|
||||
|
|
|
@ -102,7 +102,6 @@ interface IQueryTabStates {
|
|||
export default class QueryTabComponent extends React.Component<IQueryTabComponentProps, IQueryTabStates> {
|
||||
public queryEditorId: string;
|
||||
public executeQueryButton: Button;
|
||||
public fetchNextPageButton: Button;
|
||||
public saveQueryButton: Button;
|
||||
public splitterId: string;
|
||||
public splitter: Splitter;
|
||||
|
@ -195,23 +194,6 @@ export default class QueryTabComponent extends React.Component<IQueryTabComponen
|
|||
enabled: this.state._isSaveQueriesEnabled,
|
||||
visible: this.state._isSaveQueriesEnabled,
|
||||
};
|
||||
this.fetchNextPageButton = {
|
||||
enabled: (() => {
|
||||
const allResultsMetadata = this.state.allResultsMetadata || [];
|
||||
const numberOfResultsMetadata = allResultsMetadata.length;
|
||||
|
||||
if (numberOfResultsMetadata === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (allResultsMetadata[numberOfResultsMetadata - 1].hasMoreResults) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
})(),
|
||||
visible: true,
|
||||
};
|
||||
|
||||
this._buildCommandBarOptions();
|
||||
props.onTabAccessor({
|
||||
|
@ -981,14 +963,17 @@ export default class QueryTabComponent extends React.Component<IQueryTabComponen
|
|||
<span>
|
||||
<span>{this.state.showingDocumentsDisplayText}</span>
|
||||
</span>
|
||||
{this.fetchNextPageButton.enabled && <span className="queryResultDivider">|</span>}
|
||||
{this.fetchNextPageButton.enabled && (
|
||||
{this.state.allResultsMetadata[this.state.allResultsMetadata.length - 1]
|
||||
.hasMoreResults && (
|
||||
<>
|
||||
<span className="queryResultDivider">|</span>
|
||||
<span className="queryResultNextEnable">
|
||||
<a onClick={this.onFetchNextPageClick}>
|
||||
<a onClick={this.onFetchNextPageClick.bind(this)}>
|
||||
<span>Load more</span>
|
||||
<img className="queryResultnextImg" src={QueryEditorNext} alt="Fetch next page" />
|
||||
</a>
|
||||
</span>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
{this.state.queryResults &&
|
||||
|
|
Loading…
Reference in New Issue