Remove Explorer.openTableSelectQueryPanel (#881)
Co-authored-by: Steve Faulkner <southpolesteve@gmail.com>
This commit is contained in:
parent
615bfeaf48
commit
0c6324a4c1
|
@ -133,7 +133,6 @@ src/Explorer/Tables/QueryBuilder/ClauseGroupViewModel.ts
|
||||||
src/Explorer/Tables/QueryBuilder/CustomTimestampHelper.ts
|
src/Explorer/Tables/QueryBuilder/CustomTimestampHelper.ts
|
||||||
src/Explorer/Tables/QueryBuilder/QueryBuilderViewModel.ts
|
src/Explorer/Tables/QueryBuilder/QueryBuilderViewModel.ts
|
||||||
src/Explorer/Tables/QueryBuilder/QueryClauseViewModel.ts
|
src/Explorer/Tables/QueryBuilder/QueryClauseViewModel.ts
|
||||||
src/Explorer/Tables/QueryBuilder/QueryViewModel.ts
|
|
||||||
src/Explorer/Tables/TableDataClient.ts
|
src/Explorer/Tables/TableDataClient.ts
|
||||||
src/Explorer/Tables/TableEntityProcessor.ts
|
src/Explorer/Tables/TableEntityProcessor.ts
|
||||||
src/Explorer/Tables/Utilities.ts
|
src/Explorer/Tables/Utilities.ts
|
||||||
|
|
|
@ -58,10 +58,8 @@ import { GitHubReposPanel } from "./Panes/GitHubReposPanel/GitHubReposPanel";
|
||||||
import { SaveQueryPane } from "./Panes/SaveQueryPane/SaveQueryPane";
|
import { SaveQueryPane } from "./Panes/SaveQueryPane/SaveQueryPane";
|
||||||
import { SetupNoteBooksPanel } from "./Panes/SetupNotebooksPanel/SetupNotebooksPanel";
|
import { SetupNoteBooksPanel } from "./Panes/SetupNotebooksPanel/SetupNotebooksPanel";
|
||||||
import { StringInputPane } from "./Panes/StringInputPane/StringInputPane";
|
import { StringInputPane } from "./Panes/StringInputPane/StringInputPane";
|
||||||
import { TableQuerySelectPanel } from "./Panes/Tables/TableQuerySelectPanel/TableQuerySelectPanel";
|
|
||||||
import { UploadFilePane } from "./Panes/UploadFilePane/UploadFilePane";
|
import { UploadFilePane } from "./Panes/UploadFilePane/UploadFilePane";
|
||||||
import { UploadItemsPane } from "./Panes/UploadItemsPane/UploadItemsPane";
|
import { UploadItemsPane } from "./Panes/UploadItemsPane/UploadItemsPane";
|
||||||
import QueryViewModel from "./Tables/QueryBuilder/QueryViewModel";
|
|
||||||
import { CassandraAPIDataClient, TableDataClient, TablesAPIDataClient } from "./Tables/TableDataClient";
|
import { CassandraAPIDataClient, TableDataClient, TablesAPIDataClient } from "./Tables/TableDataClient";
|
||||||
import NotebookV2Tab, { NotebookTabOptions } from "./Tabs/NotebookV2Tab";
|
import NotebookV2Tab, { NotebookTabOptions } from "./Tabs/NotebookV2Tab";
|
||||||
import { TabsManager } from "./Tabs/TabsManager";
|
import { TabsManager } from "./Tabs/TabsManager";
|
||||||
|
@ -1513,8 +1511,4 @@ export default class Explorer {
|
||||||
.getState()
|
.getState()
|
||||||
.openSidePanel(title, <SetupNoteBooksPanel explorer={this} panelTitle={title} panelDescription={description} />);
|
.openSidePanel(title, <SetupNoteBooksPanel explorer={this} panelTitle={title} panelDescription={description} />);
|
||||||
}
|
}
|
||||||
|
|
||||||
public openTableSelectQueryPanel(queryViewModal: QueryViewModel): void {
|
|
||||||
useSidePanel.getState().openSidePanel("Select Column", <TableQuerySelectPanel queryViewModel={queryViewModal} />);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -792,7 +792,7 @@ export default class QueryBuilderViewModel {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public checkIfClauseChanged(clause: QueryClauseViewModel): void {
|
public checkIfClauseChanged(): void {
|
||||||
this._queryViewModel.checkIfBuilderChanged(clause);
|
this._queryViewModel.checkIfBuilderChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ export default class QueryClauseViewModel {
|
||||||
);
|
);
|
||||||
|
|
||||||
this.and_or.subscribe((value) => {
|
this.and_or.subscribe((value) => {
|
||||||
this._queryBuilderViewModel.checkIfClauseChanged(this);
|
this._queryBuilderViewModel.checkIfClauseChanged();
|
||||||
});
|
});
|
||||||
this.field.subscribe((value) => {
|
this.field.subscribe((value) => {
|
||||||
this.changeField();
|
this.changeField();
|
||||||
|
@ -103,13 +103,13 @@ export default class QueryClauseViewModel {
|
||||||
// }
|
// }
|
||||||
});
|
});
|
||||||
this.customTimeValue.subscribe((value) => {
|
this.customTimeValue.subscribe((value) => {
|
||||||
this._queryBuilderViewModel.checkIfClauseChanged(this);
|
this._queryBuilderViewModel.checkIfClauseChanged();
|
||||||
});
|
});
|
||||||
this.value.subscribe((value) => {
|
this.value.subscribe((value) => {
|
||||||
this._queryBuilderViewModel.checkIfClauseChanged(this);
|
this._queryBuilderViewModel.checkIfClauseChanged();
|
||||||
});
|
});
|
||||||
this.operator.subscribe((value) => {
|
this.operator.subscribe((value) => {
|
||||||
this._queryBuilderViewModel.checkIfClauseChanged(this);
|
this._queryBuilderViewModel.checkIfClauseChanged();
|
||||||
});
|
});
|
||||||
this._groupCheckSubscription = this.checkedForGrouping.subscribe((value) => {
|
this._groupCheckSubscription = this.checkedForGrouping.subscribe((value) => {
|
||||||
this._queryBuilderViewModel.updateCanGroupClauses();
|
this._queryBuilderViewModel.updateCanGroupClauses();
|
||||||
|
@ -184,7 +184,7 @@ export default class QueryClauseViewModel {
|
||||||
this.type(QueryBuilderConstants.TableType.String);
|
this.type(QueryBuilderConstants.TableType.String);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this._queryBuilderViewModel.checkIfClauseChanged(this);
|
this._queryBuilderViewModel.checkIfClauseChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private resetFromTimestamp(): void {
|
private resetFromTimestamp(): void {
|
||||||
|
@ -216,7 +216,7 @@ export default class QueryClauseViewModel {
|
||||||
this.timeValue("");
|
this.timeValue("");
|
||||||
this.customTimeValue("");
|
this.customTimeValue("");
|
||||||
}
|
}
|
||||||
this._queryBuilderViewModel.checkIfClauseChanged(this);
|
this._queryBuilderViewModel.checkIfClauseChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
// private customTimestampDialog(): Promise<any> {
|
// private customTimestampDialog(): Promise<any> {
|
||||||
|
|
|
@ -1,16 +1,18 @@
|
||||||
import * as ko from "knockout";
|
import * as ko from "knockout";
|
||||||
|
import React from "react";
|
||||||
import * as _ from "underscore";
|
import * as _ from "underscore";
|
||||||
import { KeyCodes } from "../../../Common/Constants";
|
import { KeyCodes } from "../../../Common/Constants";
|
||||||
|
import { useSidePanel } from "../../../hooks/useSidePanel";
|
||||||
import { userContext } from "../../../UserContext";
|
import { userContext } from "../../../UserContext";
|
||||||
|
import { TableQuerySelectPanel } from "../../Panes/Tables/TableQuerySelectPanel/TableQuerySelectPanel";
|
||||||
import QueryTablesTab from "../../Tabs/QueryTablesTab";
|
import QueryTablesTab from "../../Tabs/QueryTablesTab";
|
||||||
import { getQuotedCqlIdentifier } from "../CqlUtilities";
|
import { getQuotedCqlIdentifier } from "../CqlUtilities";
|
||||||
import * as DataTableUtilities from "../DataTable/DataTableUtilities";
|
import * as DataTableUtilities from "../DataTable/DataTableUtilities";
|
||||||
import TableEntityListViewModel from "../DataTable/TableEntityListViewModel";
|
import TableEntityListViewModel from "../DataTable/TableEntityListViewModel";
|
||||||
import QueryBuilderViewModel from "./QueryBuilderViewModel";
|
import QueryBuilderViewModel from "./QueryBuilderViewModel";
|
||||||
import QueryClauseViewModel from "./QueryClauseViewModel";
|
|
||||||
|
|
||||||
export default class QueryViewModel {
|
export default class QueryViewModel {
|
||||||
public topValueLimitMessage: string = "Please input a number between 0 and 1000.";
|
public readonly topValueLimitMessage: string = "Please input a number between 0 and 1000.";
|
||||||
public queryBuilderViewModel = ko.observable<QueryBuilderViewModel>();
|
public queryBuilderViewModel = ko.observable<QueryBuilderViewModel>();
|
||||||
public isHelperActive = ko.observable<boolean>(true);
|
public isHelperActive = ko.observable<boolean>(true);
|
||||||
public isEditorActive = ko.observable<boolean>(false);
|
public isEditorActive = ko.observable<boolean>(false);
|
||||||
|
@ -49,7 +51,7 @@ export default class QueryViewModel {
|
||||||
this.queryTextIsReadOnly = ko.computed<boolean>(() => {
|
this.queryTextIsReadOnly = ko.computed<boolean>(() => {
|
||||||
return userContext.apiType !== "Cassandra";
|
return userContext.apiType !== "Cassandra";
|
||||||
});
|
});
|
||||||
let initialOptions = this._tableEntityListViewModel.headers;
|
const initialOptions = this._tableEntityListViewModel.headers;
|
||||||
this.columnOptions = ko.observableArray<string>(initialOptions);
|
this.columnOptions = ko.observableArray<string>(initialOptions);
|
||||||
this.focusTopResult = ko.observable<boolean>(false);
|
this.focusTopResult = ko.observable<boolean>(false);
|
||||||
this.focusExpandIcon = ko.observable<boolean>(false);
|
this.focusExpandIcon = ko.observable<boolean>(false);
|
||||||
|
@ -63,12 +65,12 @@ export default class QueryViewModel {
|
||||||
this.topValue() !== this.unchangedSaveTop()
|
this.topValue() !== this.unchangedSaveTop()
|
||||||
);
|
);
|
||||||
|
|
||||||
this.queryBuilderViewModel().clauseArray.subscribe((value) => {
|
this.queryBuilderViewModel().clauseArray.subscribe(() => {
|
||||||
this.setFilter();
|
this.setFilter();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.isExceedingLimit = ko.computed<boolean>(() => {
|
this.isExceedingLimit = ko.computed<boolean>(() => {
|
||||||
var currentTopValue: number = this.topValue();
|
const currentTopValue: number = this.topValue();
|
||||||
return currentTopValue < 0 || currentTopValue > 1000;
|
return currentTopValue < 0 || currentTopValue > 1000;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -111,7 +113,7 @@ export default class QueryViewModel {
|
||||||
DataTableUtilities.forceRecalculateTableSize(); // Fix for 261924, forces the resize event so DataTableBindingManager will redo the calculation on table size.
|
DataTableUtilities.forceRecalculateTableSize(); // Fix for 261924, forces the resize event so DataTableBindingManager will redo the calculation on table size.
|
||||||
};
|
};
|
||||||
|
|
||||||
public ontoggleAdvancedOptionsKeyDown = (source: any, event: KeyboardEvent): boolean => {
|
public ontoggleAdvancedOptionsKeyDown = (source: string, event: KeyboardEvent): boolean => {
|
||||||
if (event.keyCode === KeyCodes.Enter || event.keyCode === KeyCodes.Space) {
|
if (event.keyCode === KeyCodes.Enter || event.keyCode === KeyCodes.Space) {
|
||||||
this.toggleAdvancedOptions();
|
this.toggleAdvancedOptions();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
@ -125,31 +127,29 @@ export default class QueryViewModel {
|
||||||
};
|
};
|
||||||
|
|
||||||
private setFilter = (): string => {
|
private setFilter = (): string => {
|
||||||
var queryString = this.isEditorActive()
|
const queryString = this.isEditorActive()
|
||||||
? this.queryText()
|
? this.queryText()
|
||||||
: userContext.apiType === "Cassandra"
|
: userContext.apiType === "Cassandra"
|
||||||
? this.queryBuilderViewModel().getCqlFilterFromClauses()
|
? this.queryBuilderViewModel().getCqlFilterFromClauses()
|
||||||
: this.queryBuilderViewModel().getODataFilterFromClauses();
|
: this.queryBuilderViewModel().getODataFilterFromClauses();
|
||||||
var filter = queryString;
|
const filter = queryString;
|
||||||
this.queryText(filter);
|
this.queryText(filter);
|
||||||
return this.queryText();
|
return this.queryText();
|
||||||
};
|
};
|
||||||
|
|
||||||
private setSqlFilter = (): string => {
|
private setSqlFilter = (): string => {
|
||||||
var filter = this.queryBuilderViewModel().getSqlFilterFromClauses();
|
return this.queryBuilderViewModel().getSqlFilterFromClauses();
|
||||||
return filter;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private setCqlFilter = (): string => {
|
private setCqlFilter = (): string => {
|
||||||
var filter = this.queryBuilderViewModel().getCqlFilterFromClauses();
|
return this.queryBuilderViewModel().getCqlFilterFromClauses();
|
||||||
return filter;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public isHelperEnabled = ko
|
public isHelperEnabled = ko
|
||||||
.computed<boolean>(() => {
|
.computed<boolean>(() => {
|
||||||
return (
|
return (
|
||||||
this.queryText() === this.unchangedText() ||
|
this.queryText() === this.unchangedText() ||
|
||||||
this.queryText() === null ||
|
this.queryText() === undefined ||
|
||||||
this.queryText() === "" ||
|
this.queryText() === "" ||
|
||||||
this.isHelperActive()
|
this.isHelperActive()
|
||||||
);
|
);
|
||||||
|
@ -159,13 +159,13 @@ export default class QueryViewModel {
|
||||||
});
|
});
|
||||||
|
|
||||||
public runQuery = (): DataTables.DataTable => {
|
public runQuery = (): DataTables.DataTable => {
|
||||||
var filter = this.setFilter();
|
let filter = this.setFilter();
|
||||||
if (filter && userContext.apiType !== "Cassandra") {
|
if (filter && userContext.apiType !== "Cassandra") {
|
||||||
filter = filter.replace(/"/g, "'");
|
filter = filter.replace(/"/g, "'");
|
||||||
}
|
}
|
||||||
var top = this.topValue();
|
const top = this.topValue();
|
||||||
var selectOptions = this._getSelectedResults();
|
const selectOptions = this._getSelectedResults();
|
||||||
var select = selectOptions;
|
const select = selectOptions;
|
||||||
this._tableEntityListViewModel.tableQuery.filter = filter;
|
this._tableEntityListViewModel.tableQuery.filter = filter;
|
||||||
this._tableEntityListViewModel.tableQuery.top = top;
|
this._tableEntityListViewModel.tableQuery.top = top;
|
||||||
this._tableEntityListViewModel.tableQuery.select = select;
|
this._tableEntityListViewModel.tableQuery.select = select;
|
||||||
|
@ -177,16 +177,16 @@ export default class QueryViewModel {
|
||||||
};
|
};
|
||||||
|
|
||||||
public clearQuery = (): DataTables.DataTable => {
|
public clearQuery = (): DataTables.DataTable => {
|
||||||
this.queryText(null);
|
this.queryText();
|
||||||
this.topValue(null);
|
this.topValue();
|
||||||
this.selectText(null);
|
this.selectText();
|
||||||
this.selectMessage("");
|
this.selectMessage("");
|
||||||
// clears the queryBuilder and adds a new blank clause
|
// clears the queryBuilder and adds a new blank clause
|
||||||
this.queryBuilderViewModel().queryClauses.removeAll();
|
this.queryBuilderViewModel().queryClauses.removeAll();
|
||||||
this.queryBuilderViewModel().addNewClause();
|
this.queryBuilderViewModel().addNewClause();
|
||||||
this._tableEntityListViewModel.tableQuery.filter = null;
|
this._tableEntityListViewModel.tableQuery.filter = undefined;
|
||||||
this._tableEntityListViewModel.tableQuery.top = null;
|
this._tableEntityListViewModel.tableQuery.top = undefined;
|
||||||
this._tableEntityListViewModel.tableQuery.select = null;
|
this._tableEntityListViewModel.tableQuery.select = undefined;
|
||||||
this._tableEntityListViewModel.oDataQuery("");
|
this._tableEntityListViewModel.oDataQuery("");
|
||||||
this._tableEntityListViewModel.sqlQuery("SELECT * FROM c");
|
this._tableEntityListViewModel.sqlQuery("SELECT * FROM c");
|
||||||
this._tableEntityListViewModel.cqlQuery(
|
this._tableEntityListViewModel.cqlQuery(
|
||||||
|
@ -197,12 +197,11 @@ export default class QueryViewModel {
|
||||||
return this._tableEntityListViewModel.reloadTable(false);
|
return this._tableEntityListViewModel.reloadTable(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
public selectQueryOptions(): Promise<any> {
|
public selectQueryOptions() {
|
||||||
this.queryTablesTab.container.openTableSelectQueryPanel(this);
|
useSidePanel.getState().openSidePanel("Select Column", <TableQuerySelectPanel queryViewModel={this} />);
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public onselectQueryOptionsKeyDown = (source: any, event: KeyboardEvent): boolean => {
|
public onselectQueryOptionsKeyDown = (source: string, event: KeyboardEvent): boolean => {
|
||||||
if (event.keyCode === KeyCodes.Enter || event.keyCode === KeyCodes.Space) {
|
if (event.keyCode === KeyCodes.Enter || event.keyCode === KeyCodes.Space) {
|
||||||
this.selectQueryOptions();
|
this.selectQueryOptions();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
@ -212,7 +211,7 @@ export default class QueryViewModel {
|
||||||
};
|
};
|
||||||
|
|
||||||
public getSelectMessage(): void {
|
public getSelectMessage(): void {
|
||||||
if (_.isEmpty(this.selectText()) || this.selectText() === null) {
|
if (_.isEmpty(this.selectText()) || this.selectText() === undefined) {
|
||||||
this.selectMessage("");
|
this.selectMessage("");
|
||||||
} else {
|
} else {
|
||||||
this.selectMessage(`${this.selectText().length} of ${this.columnOptions().length} columns selected.`);
|
this.selectMessage(`${this.selectText().length} of ${this.columnOptions().length} columns selected.`);
|
||||||
|
@ -220,7 +219,7 @@ export default class QueryViewModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
public isSelected = ko.computed<boolean>(() => {
|
public isSelected = ko.computed<boolean>(() => {
|
||||||
return !(_.isEmpty(this.selectText()) || this.selectText() === null);
|
return !(_.isEmpty(this.selectText()) || this.selectText() === undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
private setCheckToSave(): void {
|
private setCheckToSave(): void {
|
||||||
|
@ -230,7 +229,7 @@ export default class QueryViewModel {
|
||||||
this.isSaveEnabled(false);
|
this.isSaveEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public checkIfBuilderChanged(clause: QueryClauseViewModel): void {
|
public checkIfBuilderChanged(): void {
|
||||||
this.setFilter();
|
this.setFilter();
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue