mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-23 19:01:28 +00:00
Compare commits
8 Commits
tsStrict/f
...
migrate/Qu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e20931fbfe | ||
|
|
1f12940d48 | ||
|
|
44315867ce | ||
|
|
1f979a5fb7 | ||
|
|
474ec70923 | ||
|
|
1277940fe9 | ||
|
|
2b8327d222 | ||
|
|
1b74f619ab |
@@ -54,11 +54,11 @@ export const SET_HOVERED_CELL = "SET_HOVERED_CELL";
|
|||||||
export interface SetHoveredCellAction {
|
export interface SetHoveredCellAction {
|
||||||
type: "SET_HOVERED_CELL";
|
type: "SET_HOVERED_CELL";
|
||||||
payload: {
|
payload: {
|
||||||
cellId?: CellId;
|
cellId: CellId;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const setHoveredCell = (payload: { cellId?: CellId }): SetHoveredCellAction => {
|
export const setHoveredCell = (payload: { cellId: CellId }): SetHoveredCellAction => {
|
||||||
return {
|
return {
|
||||||
type: SET_HOVERED_CELL,
|
type: SET_HOVERED_CELL,
|
||||||
payload,
|
payload,
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ import { SnapshotRequest } from "./NotebookComponent/types";
|
|||||||
import { NotebookContainerClient } from "./NotebookContainerClient";
|
import { NotebookContainerClient } from "./NotebookContainerClient";
|
||||||
import { NotebookContentClient } from "./NotebookContentClient";
|
import { NotebookContentClient } from "./NotebookContentClient";
|
||||||
import { SchemaAnalyzerNotebook } from "./SchemaAnalyzer/SchemaAnalyzerUtils";
|
import { SchemaAnalyzerNotebook } from "./SchemaAnalyzer/SchemaAnalyzerUtils";
|
||||||
import { useNotebook } from "./useNotebook";
|
|
||||||
|
|
||||||
type NotebookPaneContent = string | ImmutableNotebook;
|
type NotebookPaneContent = string | ImmutableNotebook;
|
||||||
|
|
||||||
@@ -111,7 +110,6 @@ export default class NotebookManager {
|
|||||||
this.junoClient.subscribeToPinnedRepos((pinnedRepos) => {
|
this.junoClient.subscribeToPinnedRepos((pinnedRepos) => {
|
||||||
this.params.resourceTree.initializeGitHubRepos(pinnedRepos);
|
this.params.resourceTree.initializeGitHubRepos(pinnedRepos);
|
||||||
this.params.resourceTree.triggerRender();
|
this.params.resourceTree.triggerRender();
|
||||||
useNotebook.getState().initializeGitHubRepos(pinnedRepos);
|
|
||||||
});
|
});
|
||||||
this.refreshPinnedRepos();
|
this.refreshPinnedRepos();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,12 +6,10 @@ import { getErrorMessage } from "../../Common/ErrorHandlingUtils";
|
|||||||
import * as Logger from "../../Common/Logger";
|
import * as Logger from "../../Common/Logger";
|
||||||
import { configContext } from "../../ConfigContext";
|
import { configContext } from "../../ConfigContext";
|
||||||
import * as DataModels from "../../Contracts/DataModels";
|
import * as DataModels from "../../Contracts/DataModels";
|
||||||
import { IPinnedRepo } from "../../Juno/JunoClient";
|
|
||||||
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import { userContext } from "../../UserContext";
|
import { userContext } from "../../UserContext";
|
||||||
import { getAuthorizationHeader } from "../../Utils/AuthorizationUtils";
|
import { getAuthorizationHeader } from "../../Utils/AuthorizationUtils";
|
||||||
import * as GitHubUtils from "../../Utils/GitHubUtils";
|
|
||||||
import { NotebookContentItem, NotebookContentItemType } from "./NotebookContentItem";
|
import { NotebookContentItem, NotebookContentItemType } from "./NotebookContentItem";
|
||||||
import NotebookManager from "./NotebookManager";
|
import NotebookManager from "./NotebookManager";
|
||||||
|
|
||||||
@@ -41,7 +39,6 @@ interface NotebookState {
|
|||||||
updateNotebookItem: (item: NotebookContentItem) => void;
|
updateNotebookItem: (item: NotebookContentItem) => void;
|
||||||
deleteNotebookItem: (item: NotebookContentItem) => void;
|
deleteNotebookItem: (item: NotebookContentItem) => void;
|
||||||
initializeNotebooksTree: (notebookManager: NotebookManager) => Promise<void>;
|
initializeNotebooksTree: (notebookManager: NotebookManager) => Promise<void>;
|
||||||
initializeGitHubRepos: (pinnedRepos: IPinnedRepo[]) => void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useNotebook: UseStore<NotebookState> = create((set, get) => ({
|
export const useNotebook: UseStore<NotebookState> = create((set, get) => ({
|
||||||
@@ -205,31 +202,4 @@ export const useNotebook: UseStore<NotebookState> = create((set, get) => ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
initializeGitHubRepos: (pinnedRepos: IPinnedRepo[]): void => {
|
|
||||||
const gitHubNotebooksContentRoot = cloneDeep(get().gitHubNotebooksContentRoot);
|
|
||||||
if (gitHubNotebooksContentRoot) {
|
|
||||||
gitHubNotebooksContentRoot.children = [];
|
|
||||||
pinnedRepos?.forEach((pinnedRepo) => {
|
|
||||||
const repoFullName = GitHubUtils.toRepoFullName(pinnedRepo.owner, pinnedRepo.name);
|
|
||||||
const repoTreeItem: NotebookContentItem = {
|
|
||||||
name: repoFullName,
|
|
||||||
path: "PsuedoDir",
|
|
||||||
type: NotebookContentItemType.Directory,
|
|
||||||
children: [],
|
|
||||||
};
|
|
||||||
|
|
||||||
pinnedRepo.branches.forEach((branch) => {
|
|
||||||
repoTreeItem.children.push({
|
|
||||||
name: branch.name,
|
|
||||||
path: GitHubUtils.toContentUri(pinnedRepo.owner, pinnedRepo.name, branch.name, ""),
|
|
||||||
type: NotebookContentItemType.Directory,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
gitHubNotebooksContentRoot.children.push(repoTreeItem);
|
|
||||||
});
|
|
||||||
|
|
||||||
set({ gitHubNotebooksContentRoot });
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export interface InputParameterProps {
|
|||||||
onDeleteParamKeyPress?: () => void;
|
onDeleteParamKeyPress?: () => void;
|
||||||
onAddNewParamKeyPress?: () => void;
|
onAddNewParamKeyPress?: () => void;
|
||||||
onParamValueChange: (event: React.FormEvent<HTMLElement>, newInput?: string) => void;
|
onParamValueChange: (event: React.FormEvent<HTMLElement>, newInput?: string) => void;
|
||||||
onParamKeyChange: (event: React.FormEvent<HTMLElement>, selectedParam?: IDropdownOption) => void;
|
onParamKeyChange: (event: React.FormEvent<HTMLElement>, selectedParam: IDropdownOption) => void;
|
||||||
paramValue: string;
|
paramValue: string;
|
||||||
selectedKey: string | number;
|
selectedKey: string | number;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import * as Entities from "../../Tables/Entities";
|
|||||||
import { CassandraAPIDataClient, CassandraTableKey, TableDataClient } from "../../Tables/TableDataClient";
|
import { CassandraAPIDataClient, CassandraTableKey, TableDataClient } from "../../Tables/TableDataClient";
|
||||||
import * as TableEntityProcessor from "../../Tables/TableEntityProcessor";
|
import * as TableEntityProcessor from "../../Tables/TableEntityProcessor";
|
||||||
import * as Utilities from "../../Tables/Utilities";
|
import * as Utilities from "../../Tables/Utilities";
|
||||||
import QueryTablesTab from "../../Tabs/QueryTablesTab";
|
import { NewQueryTablesTab } from "../../Tabs/QueryTablesTab/NewQueryTablesTab";
|
||||||
import { RightPaneForm, RightPaneFormProps } from "../RightPaneForm/RightPaneForm";
|
import { RightPaneForm, RightPaneFormProps } from "../RightPaneForm/RightPaneForm";
|
||||||
import {
|
import {
|
||||||
attributeNameLabel,
|
attributeNameLabel,
|
||||||
@@ -36,7 +36,7 @@ import {
|
|||||||
|
|
||||||
interface AddTableEntityPanelProps {
|
interface AddTableEntityPanelProps {
|
||||||
tableDataClient: TableDataClient;
|
tableDataClient: TableDataClient;
|
||||||
queryTablesTab: QueryTablesTab;
|
queryTablesTab: NewQueryTablesTab;
|
||||||
tableEntityListViewModel: TableEntityListViewModel;
|
tableEntityListViewModel: TableEntityListViewModel;
|
||||||
cassandraApiClient: CassandraAPIDataClient;
|
cassandraApiClient: CassandraAPIDataClient;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import TableEntityListViewModel from "../../Tables/DataTable/TableEntityListView
|
|||||||
import * as Entities from "../../Tables/Entities";
|
import * as Entities from "../../Tables/Entities";
|
||||||
import { CassandraAPIDataClient, TableDataClient } from "../../Tables/TableDataClient";
|
import { CassandraAPIDataClient, TableDataClient } from "../../Tables/TableDataClient";
|
||||||
import * as TableEntityProcessor from "../../Tables/TableEntityProcessor";
|
import * as TableEntityProcessor from "../../Tables/TableEntityProcessor";
|
||||||
import QueryTablesTab from "../../Tabs/QueryTablesTab";
|
import { NewQueryTablesTab } from "../../Tabs/QueryTablesTab/NewQueryTablesTab";
|
||||||
import { RightPaneForm, RightPaneFormProps } from "../RightPaneForm/RightPaneForm";
|
import { RightPaneForm, RightPaneFormProps } from "../RightPaneForm/RightPaneForm";
|
||||||
import {
|
import {
|
||||||
attributeNameLabel,
|
attributeNameLabel,
|
||||||
@@ -34,7 +34,7 @@ import {
|
|||||||
|
|
||||||
interface EditTableEntityPanelProps {
|
interface EditTableEntityPanelProps {
|
||||||
tableDataClient: TableDataClient;
|
tableDataClient: TableDataClient;
|
||||||
queryTablesTab: QueryTablesTab;
|
queryTablesTab: NewQueryTablesTab;
|
||||||
tableEntityListViewModel: TableEntityListViewModel;
|
tableEntityListViewModel: TableEntityListViewModel;
|
||||||
cassandraApiClient: CassandraAPIDataClient;
|
cassandraApiClient: CassandraAPIDataClient;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
|
import { ItemDefinition, QueryIterator, Resource } from "@azure/cosmos";
|
||||||
import * as ko from "knockout";
|
import * as ko from "knockout";
|
||||||
import * as _ from "underscore";
|
import * as _ from "underscore";
|
||||||
|
|
||||||
import { Action } from "../../../Shared/Telemetry/TelemetryConstants";
|
|
||||||
import CacheBase from "./CacheBase";
|
|
||||||
import * as CommonConstants from "../../../Common/Constants";
|
import * as CommonConstants from "../../../Common/Constants";
|
||||||
|
import { Action } from "../../../Shared/Telemetry/TelemetryConstants";
|
||||||
|
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
||||||
|
import { NewQueryTablesTab } from "../../Tabs/QueryTablesTab/NewQueryTablesTab";
|
||||||
import * as Constants from "../Constants";
|
import * as Constants from "../Constants";
|
||||||
import * as Entities from "../Entities";
|
import * as Entities from "../Entities";
|
||||||
import QueryTablesTab from "../../Tabs/QueryTablesTab";
|
import CacheBase from "./CacheBase";
|
||||||
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
|
||||||
import { QueryIterator, ItemDefinition, Resource } from "@azure/cosmos";
|
|
||||||
|
|
||||||
// This is the format of the data we will have to pass to Datatable render callback,
|
// This is the format of the data we will have to pass to Datatable render callback,
|
||||||
// and property names are defined by Datatable as well.
|
// and property names are defined by Datatable as well.
|
||||||
@@ -49,7 +49,7 @@ abstract class DataTableViewModel {
|
|||||||
|
|
||||||
private dataTableOperationManager: IDataTableOperation;
|
private dataTableOperationManager: IDataTableOperation;
|
||||||
|
|
||||||
public queryTablesTab: QueryTablesTab;
|
public queryTablesTab: NewQueryTablesTab;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.items([]);
|
this.items([]);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { Action } from "../../../Shared/Telemetry/TelemetryConstants";
|
|||||||
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import { userContext } from "../../../UserContext";
|
import { userContext } from "../../../UserContext";
|
||||||
import QueryTablesTab from "../../Tabs/QueryTablesTab";
|
import QueryTablesTab from "../../Tabs/QueryTablesTab";
|
||||||
|
import { NewQueryTablesTab } from "../../Tabs/QueryTablesTab/NewQueryTablesTab";
|
||||||
import * as Constants from "../Constants";
|
import * as Constants from "../Constants";
|
||||||
import { getQuotedCqlIdentifier } from "../CqlUtilities";
|
import { getQuotedCqlIdentifier } from "../CqlUtilities";
|
||||||
import * as Entities from "../Entities";
|
import * as Entities from "../Entities";
|
||||||
@@ -112,7 +113,7 @@ export default class TableEntityListViewModel extends DataTableViewModel {
|
|||||||
public queryErrorMessage: ko.Observable<string>;
|
public queryErrorMessage: ko.Observable<string>;
|
||||||
public id: string;
|
public id: string;
|
||||||
|
|
||||||
constructor(tableCommands: TableCommands, queryTablesTab: QueryTablesTab) {
|
constructor(tableCommands: TableCommands, queryTablesTab: NewQueryTablesTab) {
|
||||||
super();
|
super();
|
||||||
this.cache = new TableEntityCache();
|
this.cache = new TableEntityCache();
|
||||||
this.queryErrorMessage = ko.observable<string>();
|
this.queryErrorMessage = ko.observable<string>();
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { KeyCodes } from "../../../Common/Constants";
|
|||||||
import { useSidePanel } from "../../../hooks/useSidePanel";
|
import { useSidePanel } from "../../../hooks/useSidePanel";
|
||||||
import { userContext } from "../../../UserContext";
|
import { userContext } from "../../../UserContext";
|
||||||
import { TableQuerySelectPanel } from "../../Panes/Tables/TableQuerySelectPanel/TableQuerySelectPanel";
|
import { TableQuerySelectPanel } from "../../Panes/Tables/TableQuerySelectPanel/TableQuerySelectPanel";
|
||||||
import QueryTablesTab from "../../Tabs/QueryTablesTab";
|
import { NewQueryTablesTab } from "../../Tabs/QueryTablesTab/NewQueryTablesTab";
|
||||||
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";
|
||||||
@@ -39,14 +39,14 @@ export default class QueryViewModel {
|
|||||||
|
|
||||||
public columnOptions: ko.ObservableArray<string>;
|
public columnOptions: ko.ObservableArray<string>;
|
||||||
|
|
||||||
public queryTablesTab: QueryTablesTab;
|
public queryTablesTab: NewQueryTablesTab;
|
||||||
public id: string;
|
public id: string;
|
||||||
private _tableEntityListViewModel: TableEntityListViewModel;
|
private _tableEntityListViewModel: TableEntityListViewModel;
|
||||||
|
|
||||||
constructor(queryTablesTab: QueryTablesTab) {
|
constructor(queryTablesTab: NewQueryTablesTab) {
|
||||||
this.queryTablesTab = queryTablesTab;
|
this.queryTablesTab = queryTablesTab;
|
||||||
this.id = `queryViewModel${this.queryTablesTab.tabId}`;
|
this.id = `queryViewModel${this.queryTablesTab.tabId}`;
|
||||||
this._tableEntityListViewModel = queryTablesTab.tableEntityListViewModel();
|
this._tableEntityListViewModel = queryTablesTab.tableEntityListViewModel;
|
||||||
|
|
||||||
this.queryTextIsReadOnly = ko.computed<boolean>(() => {
|
this.queryTextIsReadOnly = ko.computed<boolean>(() => {
|
||||||
return userContext.apiType !== "Cassandra";
|
return userContext.apiType !== "Cassandra";
|
||||||
|
|||||||
52
src/Explorer/Tabs/QueryTablesTab/NewQueryTablesTab.tsx
Normal file
52
src/Explorer/Tabs/QueryTablesTab/NewQueryTablesTab.tsx
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
import React from "react";
|
||||||
|
import * as DataModels from "../../../Contracts/DataModels";
|
||||||
|
import type { TabOptions } from "../../../Contracts/ViewModels";
|
||||||
|
import { useTabs } from "../../../hooks/useTabs";
|
||||||
|
import Explorer from "../../Explorer";
|
||||||
|
import TableCommands from "../../Tables/DataTable/TableCommands";
|
||||||
|
import TableEntityListViewModel from "../../Tables/DataTable/TableEntityListViewModel";
|
||||||
|
import TabsBase from "../TabsBase";
|
||||||
|
import {
|
||||||
|
IQueryTablesTabAccessor,
|
||||||
|
IQueryTablesTabComponentProps,
|
||||||
|
QueryTablesTabComponent,
|
||||||
|
} from "./QueryTablesTabComponent";
|
||||||
|
|
||||||
|
export interface IQueryTablesTabProps {
|
||||||
|
container: Explorer;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class NewQueryTablesTab extends TabsBase {
|
||||||
|
public queryText: string;
|
||||||
|
public currentQuery: string;
|
||||||
|
public partitionKey: DataModels.PartitionKey;
|
||||||
|
public iQueryTablesTabComponentProps: IQueryTablesTabComponentProps;
|
||||||
|
public tableEntityListViewModel: TableEntityListViewModel;
|
||||||
|
public tableCommands: TableCommands;
|
||||||
|
public iQueryTablesTabAccessor: IQueryTablesTabAccessor;
|
||||||
|
|
||||||
|
constructor(options: TabOptions, private props: IQueryTablesTabProps) {
|
||||||
|
super(options);
|
||||||
|
this.tableCommands = new TableCommands(props.container);
|
||||||
|
this.tableEntityListViewModel = new TableEntityListViewModel(this.tableCommands, this);
|
||||||
|
this.iQueryTablesTabComponentProps = {
|
||||||
|
collection: this.collection,
|
||||||
|
tabId: this.tabId,
|
||||||
|
tabsBaseInstance: this,
|
||||||
|
queryTablesTab: this,
|
||||||
|
container: this.props.container,
|
||||||
|
onQueryTablesTabAccessor: (instance: IQueryTablesTabAccessor) => {
|
||||||
|
this.iQueryTablesTabAccessor = instance;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public render(): JSX.Element {
|
||||||
|
return <QueryTablesTabComponent {...this.iQueryTablesTabComponentProps} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
public onTabClick(): void {
|
||||||
|
useTabs.getState().activateTab(this);
|
||||||
|
this.iQueryTablesTabAccessor.onTabClickEvent();
|
||||||
|
}
|
||||||
|
}
|
||||||
619
src/Explorer/Tabs/QueryTablesTab/QueryTablesTabComponent.tsx
Normal file
619
src/Explorer/Tabs/QueryTablesTab/QueryTablesTabComponent.tsx
Normal file
@@ -0,0 +1,619 @@
|
|||||||
|
import React from "react";
|
||||||
|
import AddEntityIcon from "../../../../images/AddEntity.svg";
|
||||||
|
import DeleteEntitiesIcon from "../../../../images/DeleteEntities.svg";
|
||||||
|
import EditEntityIcon from "../../../../images/Edit-entity.svg";
|
||||||
|
import ExecuteQueryIcon from "../../../../images/ExecuteQuery.svg";
|
||||||
|
import QueryBuilderIcon from "../../../../images/Query-Builder.svg";
|
||||||
|
import QueryTextIcon from "../../../../images/Query-Text.svg";
|
||||||
|
import * as ViewModels from "../../../Contracts/ViewModels";
|
||||||
|
import { useSidePanel } from "../../../hooks/useSidePanel";
|
||||||
|
import { userContext } from "../../../UserContext";
|
||||||
|
import { CommandButtonComponentProps } from "../../Controls/CommandButton/CommandButtonComponent";
|
||||||
|
import Explorer from "../../Explorer";
|
||||||
|
import { AddTableEntityPanel } from "../../Panes/Tables/AddTableEntityPanel";
|
||||||
|
import { EditTableEntityPanel } from "../../Panes/Tables/EditTableEntityPanel";
|
||||||
|
import TableCommands from "../../Tables/DataTable/TableCommands";
|
||||||
|
import TableEntityListViewModel from "../../Tables/DataTable/TableEntityListViewModel";
|
||||||
|
import QueryViewModel from "../../Tables/QueryBuilder/QueryViewModel";
|
||||||
|
import { CassandraAPIDataClient, TableDataClient } from "../../Tables/TableDataClient";
|
||||||
|
import TabsBase from "../TabsBase";
|
||||||
|
import { NewQueryTablesTab } from "./NewQueryTablesTab";
|
||||||
|
|
||||||
|
export interface IQueryTablesTabAccessor {
|
||||||
|
onTabClickEvent: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Button {
|
||||||
|
visible: boolean;
|
||||||
|
enabled: boolean;
|
||||||
|
isSelected?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IQueryTablesTabComponentStates {
|
||||||
|
queryViewModel: QueryViewModel;
|
||||||
|
queryText: string;
|
||||||
|
selectedQueryText: string;
|
||||||
|
executeQueryButton: Button;
|
||||||
|
queryBuilderButton: Button;
|
||||||
|
queryTextButton: Button;
|
||||||
|
addEntityButton: Button;
|
||||||
|
editEntityButton: Button;
|
||||||
|
deleteEntityButton: Button;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IQueryTablesTabComponentProps {
|
||||||
|
collection: ViewModels.CollectionBase;
|
||||||
|
tabsBaseInstance: TabsBase;
|
||||||
|
tabId: string;
|
||||||
|
queryTablesTab: NewQueryTablesTab;
|
||||||
|
container: Explorer;
|
||||||
|
onQueryTablesTabAccessor: (instance: IQueryTablesTabAccessor) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class QueryTablesTabComponent extends React.Component<
|
||||||
|
IQueryTablesTabComponentProps,
|
||||||
|
IQueryTablesTabComponentStates
|
||||||
|
> {
|
||||||
|
public collection: ViewModels.Collection;
|
||||||
|
public tableEntityListViewModel: TableEntityListViewModel;
|
||||||
|
public tableCommands: TableCommands;
|
||||||
|
public tableDataClient: TableDataClient;
|
||||||
|
public container: Explorer;
|
||||||
|
public queryViewModel: QueryViewModel;
|
||||||
|
|
||||||
|
constructor(props: IQueryTablesTabComponentProps) {
|
||||||
|
super(props);
|
||||||
|
this.container = props.collection && props.collection.container;
|
||||||
|
this.tableCommands = new TableCommands(this.container);
|
||||||
|
this.tableDataClient = this.container.tableDataClient;
|
||||||
|
this.tableEntityListViewModel = new TableEntityListViewModel(this.tableCommands, props.queryTablesTab);
|
||||||
|
this.tableEntityListViewModel.queryTablesTab = props.queryTablesTab;
|
||||||
|
this.queryViewModel = new QueryViewModel(props.queryTablesTab);
|
||||||
|
this.state = {
|
||||||
|
queryViewModel: this.queryViewModel,
|
||||||
|
queryText: "PartitionKey eq 'partitionKey1'",
|
||||||
|
selectedQueryText: "",
|
||||||
|
executeQueryButton: {
|
||||||
|
enabled: true,
|
||||||
|
visible: true,
|
||||||
|
},
|
||||||
|
queryBuilderButton: {
|
||||||
|
enabled: true,
|
||||||
|
visible: true,
|
||||||
|
isSelected: this.queryViewModel ? this.queryViewModel.isHelperActive() : false,
|
||||||
|
},
|
||||||
|
queryTextButton: {
|
||||||
|
enabled: true,
|
||||||
|
visible: true,
|
||||||
|
isSelected: this.queryViewModel ? this.queryViewModel.isEditorActive() : false,
|
||||||
|
},
|
||||||
|
addEntityButton: {
|
||||||
|
enabled: true,
|
||||||
|
visible: true,
|
||||||
|
},
|
||||||
|
editEntityButton: {
|
||||||
|
enabled: this.tableCommands.isEnabled(
|
||||||
|
TableCommands.editEntityCommand,
|
||||||
|
this.tableEntityListViewModel.selected()
|
||||||
|
),
|
||||||
|
visible: true,
|
||||||
|
},
|
||||||
|
deleteEntityButton: {
|
||||||
|
enabled: this.tableCommands.isEnabled(
|
||||||
|
TableCommands.deleteEntitiesCommand,
|
||||||
|
this.tableEntityListViewModel.selected()
|
||||||
|
),
|
||||||
|
visible: true,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
if (this.tableEntityListViewModel.items().length > 0 && userContext.apiType === "Tables") {
|
||||||
|
const sampleQuerySubscription = this.state.queryViewModel.queryBuilderViewModel().setExample();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public onExecuteQueryClick(): void {
|
||||||
|
this.state.queryViewModel.runQuery();
|
||||||
|
}
|
||||||
|
|
||||||
|
public onQueryBuilderClick(): void {
|
||||||
|
this.state.queryViewModel.selectHelper();
|
||||||
|
}
|
||||||
|
|
||||||
|
public onQueryTextClick(): void {
|
||||||
|
this.state.queryViewModel.selectEditor();
|
||||||
|
}
|
||||||
|
|
||||||
|
public onAddEntityClick(): void {
|
||||||
|
useSidePanel
|
||||||
|
.getState()
|
||||||
|
.openSidePanel(
|
||||||
|
"Add Table Row",
|
||||||
|
<AddTableEntityPanel
|
||||||
|
tableDataClient={this.tableDataClient}
|
||||||
|
queryTablesTab={this.props.queryTablesTab}
|
||||||
|
tableEntityListViewModel={this.tableEntityListViewModel}
|
||||||
|
cassandraApiClient={new CassandraAPIDataClient()}
|
||||||
|
/>,
|
||||||
|
"700px"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public onEditEntityClick(): void {
|
||||||
|
useSidePanel
|
||||||
|
.getState()
|
||||||
|
.openSidePanel(
|
||||||
|
"Edit Table Entity",
|
||||||
|
<EditTableEntityPanel
|
||||||
|
tableDataClient={this.tableDataClient}
|
||||||
|
queryTablesTab={this.props.queryTablesTab}
|
||||||
|
tableEntityListViewModel={this.tableEntityListViewModel}
|
||||||
|
cassandraApiClient={new CassandraAPIDataClient()}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public onDeleteEntityClick(): void {
|
||||||
|
this.tableCommands.deleteEntitiesCommand(this.tableEntityListViewModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public onActivate(): void {
|
||||||
|
const columns =
|
||||||
|
!!this.tableEntityListViewModel &&
|
||||||
|
!!this.tableEntityListViewModel.table &&
|
||||||
|
this.tableEntityListViewModel.table.columns;
|
||||||
|
if (!!columns) {
|
||||||
|
columns.adjust();
|
||||||
|
$(window).resize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public getTabsButtons(): CommandButtonComponentProps[] {
|
||||||
|
const buttons: CommandButtonComponentProps[] = [];
|
||||||
|
if (this.state.queryBuilderButton.visible) {
|
||||||
|
const label = userContext.apiType === "Cassandra" ? "CQL Query Builder" : "Query Builder";
|
||||||
|
buttons.push({
|
||||||
|
iconSrc: QueryBuilderIcon,
|
||||||
|
iconAlt: label,
|
||||||
|
onCommandClick: this.onQueryBuilderClick,
|
||||||
|
commandButtonLabel: label,
|
||||||
|
ariaLabel: label,
|
||||||
|
hasPopup: false,
|
||||||
|
disabled: !this.state.queryBuilderButton.enabled,
|
||||||
|
isSelected: this.state.queryBuilderButton.isSelected,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.state.queryTextButton.visible) {
|
||||||
|
const label = userContext.apiType === "Cassandra" ? "CQL Query Text" : "Query Text";
|
||||||
|
buttons.push({
|
||||||
|
iconSrc: QueryTextIcon,
|
||||||
|
iconAlt: label,
|
||||||
|
onCommandClick: this.onQueryTextClick,
|
||||||
|
commandButtonLabel: label,
|
||||||
|
ariaLabel: label,
|
||||||
|
hasPopup: false,
|
||||||
|
disabled: !this.state.queryTextButton.enabled,
|
||||||
|
isSelected: this.state.queryTextButton.isSelected,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.state.executeQueryButton.visible) {
|
||||||
|
const label = "Run Query";
|
||||||
|
buttons.push({
|
||||||
|
iconSrc: ExecuteQueryIcon,
|
||||||
|
iconAlt: label,
|
||||||
|
onCommandClick: this.onExecuteQueryClick,
|
||||||
|
commandButtonLabel: label,
|
||||||
|
ariaLabel: label,
|
||||||
|
hasPopup: false,
|
||||||
|
disabled: !this.state.executeQueryButton.enabled,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.state.addEntityButton.visible) {
|
||||||
|
const label = userContext.apiType === "Cassandra" ? "Add Row" : "Add Entity";
|
||||||
|
buttons.push({
|
||||||
|
iconSrc: AddEntityIcon,
|
||||||
|
iconAlt: label,
|
||||||
|
onCommandClick: this.onAddEntityClick,
|
||||||
|
commandButtonLabel: label,
|
||||||
|
ariaLabel: label,
|
||||||
|
hasPopup: true,
|
||||||
|
disabled: !this.state.addEntityButton.enabled,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.state.editEntityButton.visible) {
|
||||||
|
const label = userContext.apiType === "Cassandra" ? "Edit Row" : "Edit Entity";
|
||||||
|
buttons.push({
|
||||||
|
iconSrc: EditEntityIcon,
|
||||||
|
iconAlt: label,
|
||||||
|
onCommandClick: this.onEditEntityClick,
|
||||||
|
commandButtonLabel: label,
|
||||||
|
ariaLabel: label,
|
||||||
|
hasPopup: true,
|
||||||
|
disabled: !this.state.editEntityButton.enabled,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.state.deleteEntityButton.visible) {
|
||||||
|
const label = userContext.apiType === "Cassandra" ? "Delete Rows" : "Delete Entities";
|
||||||
|
buttons.push({
|
||||||
|
iconSrc: DeleteEntitiesIcon,
|
||||||
|
iconAlt: label,
|
||||||
|
onCommandClick: this.onDeleteEntityClick,
|
||||||
|
commandButtonLabel: label,
|
||||||
|
ariaLabel: label,
|
||||||
|
hasPopup: true,
|
||||||
|
disabled: !this.state.deleteEntityButton.enabled,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return buttons;
|
||||||
|
}
|
||||||
|
|
||||||
|
public render(): JSX.Element {
|
||||||
|
const { tabId } = this.props;
|
||||||
|
const { queryViewModel, queryText } = this.state;
|
||||||
|
const {
|
||||||
|
isEditorActive,
|
||||||
|
isHelperActive,
|
||||||
|
hasQueryError,
|
||||||
|
queryErrorMessage,
|
||||||
|
queryBuilderViewModel,
|
||||||
|
toggleAdvancedOptions,
|
||||||
|
ontoggleAdvancedOptionsKeyDown,
|
||||||
|
} = queryViewModel;
|
||||||
|
const {
|
||||||
|
canGroupClauses,
|
||||||
|
andLabel,
|
||||||
|
actionLabel,
|
||||||
|
groupClauses,
|
||||||
|
groupSelectedClauses,
|
||||||
|
fieldLabel,
|
||||||
|
dataTypeLabel,
|
||||||
|
operatorLabel,
|
||||||
|
valueLabel,
|
||||||
|
clauseArray,
|
||||||
|
columnOptions,
|
||||||
|
clauseRules,
|
||||||
|
operators,
|
||||||
|
insertNewFilterLine,
|
||||||
|
onAddClauseKeyDown,
|
||||||
|
addClauseIndex,
|
||||||
|
removeThisFilterLine,
|
||||||
|
onDeleteClauseKeyDown,
|
||||||
|
deleteClause,
|
||||||
|
getClauseGroupViewModels,
|
||||||
|
updateColumnOptions,
|
||||||
|
edmTypes,
|
||||||
|
addNewClause,
|
||||||
|
addNewClauseLine,
|
||||||
|
} = queryBuilderViewModel();
|
||||||
|
console.log("queryBuilderViewModel()", queryBuilderViewModel());
|
||||||
|
console.log("clauseArray()", clauseArray());
|
||||||
|
console.log("clauseRules()", clauseRules());
|
||||||
|
console.log("columnOptions()", columnOptions());
|
||||||
|
console.log("operators()", operators());
|
||||||
|
return (
|
||||||
|
<div className="tab-pane tableContainer" id={tabId} role="tabpanel">
|
||||||
|
<div className="query-builder" id={queryViewModel.id}>
|
||||||
|
<div className="error-bar">
|
||||||
|
{hasQueryError && (
|
||||||
|
<div className="error-message" aria-label="Error Message">
|
||||||
|
<span>
|
||||||
|
<img className="entity-error-Img" src="/error_red.svg" />
|
||||||
|
</span>
|
||||||
|
<span className="error-text" role="alert">
|
||||||
|
{queryErrorMessage}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{isEditorActive() && (
|
||||||
|
<div className="query-editor-panel">
|
||||||
|
<div>
|
||||||
|
<textarea
|
||||||
|
className="query-editor-text"
|
||||||
|
data-bind="
|
||||||
|
css: { 'query-editor-text-invalid': hasQueryError },
|
||||||
|
readOnly: true"
|
||||||
|
name="query-editor"
|
||||||
|
rows={5}
|
||||||
|
cols={100}
|
||||||
|
>
|
||||||
|
{queryText}
|
||||||
|
</textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{isHelperActive && (
|
||||||
|
<div style={{ paddingLeft: "13px" }}>
|
||||||
|
<div className="clause-table" data-bind="with: queryBuilderViewModel ">
|
||||||
|
<div className="scroll-box scrollable" id="scroll">
|
||||||
|
<table className="clause-table">
|
||||||
|
<thead>
|
||||||
|
<tr className="clause-table-row">
|
||||||
|
<th className="clause-table-cell header-background action-header">
|
||||||
|
<span>{actionLabel}</span>
|
||||||
|
</th>
|
||||||
|
<th className="clause-table-cell header-background group-control-header">
|
||||||
|
{canGroupClauses && (
|
||||||
|
<button type="button" onClick={groupClauses} title={groupSelectedClauses}>
|
||||||
|
<img className="and-or-svg" src="/And-Or.svg" alt="Group selected clauses" />
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</th>
|
||||||
|
<th className="clause-table-cell header-background"></th>
|
||||||
|
<th className="clause-table-cell header-background and-or-header">
|
||||||
|
<span>{andLabel}</span>
|
||||||
|
</th>
|
||||||
|
<th className="clause-table-cell header-background field-header">
|
||||||
|
<span>{fieldLabel}</span>
|
||||||
|
</th>
|
||||||
|
<th className="clause-table-cell header-background type-header">
|
||||||
|
<span>{dataTypeLabel}</span>
|
||||||
|
</th>
|
||||||
|
<th className="clause-table-cell header-background operator-header">
|
||||||
|
<span>{operatorLabel}</span>
|
||||||
|
</th>
|
||||||
|
<th className="clause-table-cell header-background value-header">
|
||||||
|
<span>{valueLabel}</span>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{clauseArray().map((data, index) => (
|
||||||
|
<tr className="clause-table-row">
|
||||||
|
<td className="clause-table-cell action-column">
|
||||||
|
<span
|
||||||
|
className="entity-Add-Cancel"
|
||||||
|
role="button"
|
||||||
|
tabIndex={0}
|
||||||
|
onClick={addClauseIndex.bind(data, index)}
|
||||||
|
onKeyDown={onAddClauseKeyDown.bind(data, index)}
|
||||||
|
title={insertNewFilterLine}
|
||||||
|
>
|
||||||
|
<img className="querybuilder-addpropertyImg" src="/Add-property.svg" alt="Add clause" />
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
className="entity-Add-Cancel"
|
||||||
|
role="button"
|
||||||
|
tabIndex={0}
|
||||||
|
data-bind="hasFocus: isDeleteButtonFocused"
|
||||||
|
onClick={deleteClause.bind(data, index)}
|
||||||
|
onKeyDown={onDeleteClauseKeyDown.bind(data, index)}
|
||||||
|
title={removeThisFilterLine}
|
||||||
|
>
|
||||||
|
<img className="querybuilder-cancelImg" src="/Entity_cancel.svg" alt="Delete clause" />
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
{/* <td className="clause-table-cell group-control-column">
|
||||||
|
<input type="checkbox" aria-label="And/Or" checked={checkedForGrouping} />
|
||||||
|
</td> */}
|
||||||
|
{/* <td>
|
||||||
|
<table className="group-indicator-table">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
{getClauseGroupViewModels(data).map((gi, index) => (
|
||||||
|
<td
|
||||||
|
className="group-indicator-column"
|
||||||
|
style={{
|
||||||
|
backgroundColor: gi.backgroundColor,
|
||||||
|
borderTop: gi.showTopBorder.peek() ? "solid thin #CCCCCC" : "none",
|
||||||
|
borderLeft: gi.showLeftBorder.peek() ? "solid thin #CCCCCC" : "none",
|
||||||
|
borderBottom: gi.showBottomBorder.peek()
|
||||||
|
? "solid thin #CCCCCC"
|
||||||
|
: gi.borderBackgroundColor,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{gi.canUngroup && (
|
||||||
|
<button type="button" onClick={} title={ungroupClausesLabel}>
|
||||||
|
<img src="/QueryBuilder/UngroupClause_16x.png" alt="Ungroup clauses" />
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</td>
|
||||||
|
))}
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
<td className="clause-table-cell and-or-column">
|
||||||
|
{canAnd && (
|
||||||
|
<select
|
||||||
|
className="clause-table-field and-or-column"
|
||||||
|
data-bind=" value: and_or, "
|
||||||
|
autoFocus={isAndOrFocused}
|
||||||
|
aria-label=" and_or "
|
||||||
|
>
|
||||||
|
{clauseRules().map((data, index) => (
|
||||||
|
<option value={data}>{data}</option>
|
||||||
|
))}
|
||||||
|
</select>
|
||||||
|
)}
|
||||||
|
</td>
|
||||||
|
<td className="clause-table-cell field-column" onClick={updateColumnOptions}>
|
||||||
|
<select
|
||||||
|
aria-label={field}
|
||||||
|
className="clause-table-field field-column"
|
||||||
|
data-bind=" value: field"
|
||||||
|
>
|
||||||
|
{columnOptions().map((data, index) => (
|
||||||
|
<option value={data}>{data}</option>
|
||||||
|
))}
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
<td className="clause-table-cell type-column">
|
||||||
|
{isTypeEditable && (
|
||||||
|
<select
|
||||||
|
className="clause-table-field type-column"
|
||||||
|
aria-label={type}
|
||||||
|
value={type}
|
||||||
|
data-bind="css: {'query-builder-isDisabled': !isTypeEditable()}"
|
||||||
|
>
|
||||||
|
{edmTypes.map((data) => (
|
||||||
|
<option>{parent.edmTypes} </option>
|
||||||
|
))}
|
||||||
|
</select>
|
||||||
|
)}
|
||||||
|
</td>
|
||||||
|
<td className="clause-table-cell operator-column">
|
||||||
|
{isOperaterEditable && (
|
||||||
|
<select
|
||||||
|
className="clause-table-field operator-column"
|
||||||
|
aria-label={operator}
|
||||||
|
data-bind="
|
||||||
|
value: operator,
|
||||||
|
css: {'query-builder-isDisabled': !isOperaterEditable()}"
|
||||||
|
>
|
||||||
|
{operators().map((data, index) => (
|
||||||
|
<option key={index}>{data}</option>
|
||||||
|
))}
|
||||||
|
</select>
|
||||||
|
)}
|
||||||
|
</td>
|
||||||
|
<td className="clause-table-cell value-column">
|
||||||
|
{isValue && (
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="clause-table-field value-column"
|
||||||
|
type="search"
|
||||||
|
data-bind="textInput: value"
|
||||||
|
aria-label={valueLabel}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{isTimestamp && (
|
||||||
|
<select
|
||||||
|
className="clause-table-field time-column"
|
||||||
|
data-bind="options: $parent.timeOptions, value: timeValue"
|
||||||
|
></select>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{isCustomLastTimestamp && (
|
||||||
|
<input
|
||||||
|
className="clause-table-field time-column"
|
||||||
|
value={customTimeValue}
|
||||||
|
onClick={customTimestampDialog}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{isCustomRangeTimestamp && (
|
||||||
|
<input
|
||||||
|
className="clause-table-field time-column"
|
||||||
|
type="datetime-local"
|
||||||
|
step="1"
|
||||||
|
value={customTimeValue}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</td>
|
||||||
|
*/}
|
||||||
|
</tr>
|
||||||
|
))}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className="addClause"
|
||||||
|
role="button"
|
||||||
|
onClick={addNewClause}
|
||||||
|
data-bind="event: { keydown: onAddNewClauseKeyDown }"
|
||||||
|
title={addNewClauseLine}
|
||||||
|
tabIndex={0}
|
||||||
|
>
|
||||||
|
<div className="addClause-heading">
|
||||||
|
<span className="clause-table addClause-title">
|
||||||
|
<img
|
||||||
|
className="addclauseProperty-Img"
|
||||||
|
style={{ marginBottom: "5px" }}
|
||||||
|
src="/Add-property.svg"
|
||||||
|
alt="Add new clause"
|
||||||
|
/>
|
||||||
|
<span style={{ marginLeft: "5px" }}>{addNewClauseLine}</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<div className="advanced-options-panel">
|
||||||
|
{/* <div className="advanced-heading">
|
||||||
|
<span
|
||||||
|
className="advanced-title"
|
||||||
|
role="button"
|
||||||
|
onClick={toggleAdvancedOptions}
|
||||||
|
onKeyDown={ontoggleAdvancedOptionsKeyDown}
|
||||||
|
aria-expanded={isExpanded() ? "true" : "false"}
|
||||||
|
tabIndex={0}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="themed-images"
|
||||||
|
type="text/html"
|
||||||
|
id="ExpandChevronRight"
|
||||||
|
data-bind="hasFocus: focusExpandIcon"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
className="imgiconwidth expand-triangle expand-triangle-right"
|
||||||
|
src="/Triangle-right.svg"
|
||||||
|
alt="toggle"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="themed-images" type="text/html" id="ExpandChevronDown">
|
||||||
|
<img className="imgiconwidth expand-triangle" src="/Triangle-down.svg" alt="toggle" />
|
||||||
|
</div>
|
||||||
|
<span>Advanced Options</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
{isExpanded && (
|
||||||
|
<div className="advanced-options">
|
||||||
|
<div className="top">
|
||||||
|
<span>Show top results:</span>
|
||||||
|
<input
|
||||||
|
className="top-input"
|
||||||
|
type="number"
|
||||||
|
autoFocus={focusTopResult}
|
||||||
|
value={topValue}
|
||||||
|
title={topValueLimitMessage}
|
||||||
|
role="textbox"
|
||||||
|
aria-label="Show top results"
|
||||||
|
/>
|
||||||
|
{isExceedingLimit && (
|
||||||
|
<div role="alert" aria-atomic="true" className="inline-div">
|
||||||
|
<img className="advanced-options-icon" src="/QueryBuilder/StatusWarning_16x.png" />
|
||||||
|
<span>{topValueLimitMessage}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<div className="select">
|
||||||
|
<span> Select fields for query: </span>
|
||||||
|
{isSelected && (
|
||||||
|
<div>
|
||||||
|
<img className="advanced-options-icon" src="/QueryBuilder/QueryInformation_16x.png" />
|
||||||
|
<span className="select-options-text">{selectMessage}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<a
|
||||||
|
className="select-options-link"
|
||||||
|
onKeyDown={onselectQueryOptionsKeyDown}
|
||||||
|
onClick={selectQueryOptions}
|
||||||
|
tabIndex={0}
|
||||||
|
role="link"
|
||||||
|
>
|
||||||
|
<span>Choose Columns... </span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)} */}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="tablesQueryTab tableContainer" id={this.tableEntityListViewModel.id}>
|
||||||
|
<table
|
||||||
|
id="storageTable"
|
||||||
|
className="storage azure-table show-gridlines"
|
||||||
|
tabIndex={0}
|
||||||
|
data-bind="tableSource: items, tableSelection: selected"
|
||||||
|
></table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -32,7 +32,7 @@ import MongoDocumentsTab from "../Tabs/MongoDocumentsTab";
|
|||||||
import { NewMongoQueryTab } from "../Tabs/MongoQueryTab/MongoQueryTab";
|
import { NewMongoQueryTab } from "../Tabs/MongoQueryTab/MongoQueryTab";
|
||||||
import { NewMongoShellTab } from "../Tabs/MongoShellTab/MongoShellTab";
|
import { NewMongoShellTab } from "../Tabs/MongoShellTab/MongoShellTab";
|
||||||
import { NewQueryTab } from "../Tabs/QueryTab/QueryTab";
|
import { NewQueryTab } from "../Tabs/QueryTab/QueryTab";
|
||||||
import QueryTablesTab from "../Tabs/QueryTablesTab";
|
import { NewQueryTablesTab } from "../Tabs/QueryTablesTab/NewQueryTablesTab";
|
||||||
import { CollectionSettingsTabV2 } from "../Tabs/SettingsTabV2";
|
import { CollectionSettingsTabV2 } from "../Tabs/SettingsTabV2";
|
||||||
import { useDatabases } from "../useDatabases";
|
import { useDatabases } from "../useDatabases";
|
||||||
import { useSelectedNode } from "../useSelectedNode";
|
import { useSelectedNode } from "../useSelectedNode";
|
||||||
@@ -391,13 +391,13 @@ export default class Collection implements ViewModels.Collection {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const queryTablesTabs: QueryTablesTab[] = useTabs
|
const queryTablesTabs: NewQueryTablesTab[] = useTabs
|
||||||
.getState()
|
.getState()
|
||||||
.getTabs(
|
.getTabs(
|
||||||
ViewModels.CollectionTabKind.QueryTables,
|
ViewModels.CollectionTabKind.QueryTables,
|
||||||
(tab) => tab.collection && tab.collection.databaseId === this.databaseId && tab.collection.id() === this.id()
|
(tab) => tab.collection && tab.collection.databaseId === this.databaseId && tab.collection.id() === this.id()
|
||||||
) as QueryTablesTab[];
|
) as NewQueryTablesTab[];
|
||||||
let queryTablesTab: QueryTablesTab = queryTablesTabs && queryTablesTabs[0];
|
let queryTablesTab: NewQueryTablesTab = queryTablesTabs && queryTablesTabs[0];
|
||||||
|
|
||||||
if (queryTablesTab) {
|
if (queryTablesTab) {
|
||||||
useTabs.getState().activateTab(queryTablesTab);
|
useTabs.getState().activateTab(queryTablesTab);
|
||||||
@@ -415,14 +415,14 @@ export default class Collection implements ViewModels.Collection {
|
|||||||
tabTitle: title,
|
tabTitle: title,
|
||||||
});
|
});
|
||||||
|
|
||||||
queryTablesTab = new QueryTablesTab({
|
queryTablesTab = new NewQueryTablesTab({
|
||||||
tabKind: ViewModels.CollectionTabKind.QueryTables,
|
tabKind: ViewModels.CollectionTabKind.QueryTables,
|
||||||
title: title,
|
title: title,
|
||||||
tabPath: "",
|
tabPath: "",
|
||||||
collection: this,
|
collection: this,
|
||||||
node: this,
|
node: this,
|
||||||
onLoadStartKey: startKey,
|
onLoadStartKey: startKey,
|
||||||
});
|
}, { container: this.container });
|
||||||
|
|
||||||
useTabs.getState().activateNewTab(queryTablesTab);
|
useTabs.getState().activateNewTab(queryTablesTab);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import _ from "underscore";
|
|||||||
import create, { UseStore } from "zustand";
|
import create, { UseStore } from "zustand";
|
||||||
import * as Constants from "../Common/Constants";
|
import * as Constants from "../Common/Constants";
|
||||||
import * as ViewModels from "../Contracts/ViewModels";
|
import * as ViewModels from "../Contracts/ViewModels";
|
||||||
import { userContext } from "../UserContext";
|
|
||||||
import { useSelectedNode } from "./useSelectedNode";
|
import { useSelectedNode } from "./useSelectedNode";
|
||||||
|
|
||||||
interface DatabasesState {
|
interface DatabasesState {
|
||||||
@@ -137,11 +136,6 @@ export const useDatabases: UseStore<DatabasesState> = create((set, get) => ({
|
|||||||
},
|
},
|
||||||
validateCollectionId: async (databaseId: string, collectionId: string): Promise<boolean> => {
|
validateCollectionId: async (databaseId: string, collectionId: string): Promise<boolean> => {
|
||||||
const database = get().databases.find((db) => db.id() === databaseId);
|
const database = get().databases.find((db) => db.id() === databaseId);
|
||||||
// For a new tables account, database is undefined when creating the first table
|
|
||||||
if (!database && userContext.apiType === "Tables") {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
await database.loadCollections();
|
await database.loadCollections();
|
||||||
return !database.collections().some((collection) => collection.id() === collectionId);
|
return !database.collections().some((collection) => collection.id() === collectionId);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
"noUnusedParameters": true
|
"noUnusedParameters": true
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"./src/Explorer/Panes/ExecuteSprocParamsPane/InputParameter.tsx",
|
|
||||||
"./src/AuthType.ts",
|
"./src/AuthType.ts",
|
||||||
"./src/Bindings/ReactBindingHandler.ts",
|
"./src/Bindings/ReactBindingHandler.ts",
|
||||||
"./src/Common/ArrayHashMap.ts",
|
"./src/Common/ArrayHashMap.ts",
|
||||||
@@ -61,7 +60,6 @@
|
|||||||
"./src/Explorer/Notebook/NotebookRenderer/StatusBar.tsx",
|
"./src/Explorer/Notebook/NotebookRenderer/StatusBar.tsx",
|
||||||
"./src/Explorer/Notebook/NotebookRenderer/decorators/CellCreator.tsx",
|
"./src/Explorer/Notebook/NotebookRenderer/decorators/CellCreator.tsx",
|
||||||
"./src/Explorer/Notebook/NotebookRenderer/decorators/CellLabeler.tsx",
|
"./src/Explorer/Notebook/NotebookRenderer/decorators/CellLabeler.tsx",
|
||||||
"./src/Explorer/Notebook/NotebookRenderer/decorators/HoverableCell.tsx",
|
|
||||||
"./src/Explorer/Notebook/NotebookUtil.ts",
|
"./src/Explorer/Notebook/NotebookUtil.ts",
|
||||||
"./src/Explorer/Notebook/SchemaAnalyzer/SchemaAnalyzerSplashScreen.tsx",
|
"./src/Explorer/Notebook/SchemaAnalyzer/SchemaAnalyzerSplashScreen.tsx",
|
||||||
"./src/Explorer/Notebook/SchemaAnalyzer/SchemaAnalyzerUtils.ts",
|
"./src/Explorer/Notebook/SchemaAnalyzer/SchemaAnalyzerUtils.ts",
|
||||||
|
|||||||
Reference in New Issue
Block a user