mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-23 19:01:28 +00:00
Compare commits
8 Commits
migration/
...
migrate/Qu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e20931fbfe | ||
|
|
1f12940d48 | ||
|
|
44315867ce | ||
|
|
1f979a5fb7 | ||
|
|
474ec70923 | ||
|
|
1277940fe9 | ||
|
|
2b8327d222 | ||
|
|
1b74f619ab |
@@ -14,7 +14,7 @@ import * as Entities from "../../Tables/Entities";
|
||||
import { CassandraAPIDataClient, CassandraTableKey, TableDataClient } from "../../Tables/TableDataClient";
|
||||
import * as TableEntityProcessor from "../../Tables/TableEntityProcessor";
|
||||
import * as Utilities from "../../Tables/Utilities";
|
||||
import QueryTablesTab from "../../Tabs/QueryTablesTab";
|
||||
import { NewQueryTablesTab } from "../../Tabs/QueryTablesTab/NewQueryTablesTab";
|
||||
import { RightPaneForm, RightPaneFormProps } from "../RightPaneForm/RightPaneForm";
|
||||
import {
|
||||
attributeNameLabel,
|
||||
@@ -36,7 +36,7 @@ import {
|
||||
|
||||
interface AddTableEntityPanelProps {
|
||||
tableDataClient: TableDataClient;
|
||||
queryTablesTab: QueryTablesTab;
|
||||
queryTablesTab: NewQueryTablesTab;
|
||||
tableEntityListViewModel: TableEntityListViewModel;
|
||||
cassandraApiClient: CassandraAPIDataClient;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import TableEntityListViewModel from "../../Tables/DataTable/TableEntityListView
|
||||
import * as Entities from "../../Tables/Entities";
|
||||
import { CassandraAPIDataClient, TableDataClient } from "../../Tables/TableDataClient";
|
||||
import * as TableEntityProcessor from "../../Tables/TableEntityProcessor";
|
||||
import QueryTablesTab from "../../Tabs/QueryTablesTab";
|
||||
import { NewQueryTablesTab } from "../../Tabs/QueryTablesTab/NewQueryTablesTab";
|
||||
import { RightPaneForm, RightPaneFormProps } from "../RightPaneForm/RightPaneForm";
|
||||
import {
|
||||
attributeNameLabel,
|
||||
@@ -34,7 +34,7 @@ import {
|
||||
|
||||
interface EditTableEntityPanelProps {
|
||||
tableDataClient: TableDataClient;
|
||||
queryTablesTab: QueryTablesTab;
|
||||
queryTablesTab: NewQueryTablesTab;
|
||||
tableEntityListViewModel: TableEntityListViewModel;
|
||||
cassandraApiClient: CassandraAPIDataClient;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { ItemDefinition, QueryIterator, Resource } from "@azure/cosmos";
|
||||
import * as ko from "knockout";
|
||||
import * as _ from "underscore";
|
||||
|
||||
import { Action } from "../../../Shared/Telemetry/TelemetryConstants";
|
||||
import CacheBase from "./CacheBase";
|
||||
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 Entities from "../Entities";
|
||||
import QueryTablesTab from "../../Tabs/QueryTablesTab";
|
||||
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
||||
import { QueryIterator, ItemDefinition, Resource } from "@azure/cosmos";
|
||||
import CacheBase from "./CacheBase";
|
||||
|
||||
|
||||
// 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.
|
||||
@@ -49,7 +49,7 @@ abstract class DataTableViewModel {
|
||||
|
||||
private dataTableOperationManager: IDataTableOperation;
|
||||
|
||||
public queryTablesTab: QueryTablesTab;
|
||||
public queryTablesTab: NewQueryTablesTab;
|
||||
|
||||
constructor() {
|
||||
this.items([]);
|
||||
|
||||
@@ -7,6 +7,7 @@ import { Action } from "../../../Shared/Telemetry/TelemetryConstants";
|
||||
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
||||
import { userContext } from "../../../UserContext";
|
||||
import QueryTablesTab from "../../Tabs/QueryTablesTab";
|
||||
import { NewQueryTablesTab } from "../../Tabs/QueryTablesTab/NewQueryTablesTab";
|
||||
import * as Constants from "../Constants";
|
||||
import { getQuotedCqlIdentifier } from "../CqlUtilities";
|
||||
import * as Entities from "../Entities";
|
||||
@@ -112,7 +113,7 @@ export default class TableEntityListViewModel extends DataTableViewModel {
|
||||
public queryErrorMessage: ko.Observable<string>;
|
||||
public id: string;
|
||||
|
||||
constructor(tableCommands: TableCommands, queryTablesTab: QueryTablesTab) {
|
||||
constructor(tableCommands: TableCommands, queryTablesTab: NewQueryTablesTab) {
|
||||
super();
|
||||
this.cache = new TableEntityCache();
|
||||
this.queryErrorMessage = ko.observable<string>();
|
||||
|
||||
@@ -5,7 +5,7 @@ import { KeyCodes } from "../../../Common/Constants";
|
||||
import { useSidePanel } from "../../../hooks/useSidePanel";
|
||||
import { userContext } from "../../../UserContext";
|
||||
import { TableQuerySelectPanel } from "../../Panes/Tables/TableQuerySelectPanel/TableQuerySelectPanel";
|
||||
import QueryTablesTab from "../../Tabs/QueryTablesTab";
|
||||
import { NewQueryTablesTab } from "../../Tabs/QueryTablesTab/NewQueryTablesTab";
|
||||
import { getQuotedCqlIdentifier } from "../CqlUtilities";
|
||||
import * as DataTableUtilities from "../DataTable/DataTableUtilities";
|
||||
import TableEntityListViewModel from "../DataTable/TableEntityListViewModel";
|
||||
@@ -39,14 +39,14 @@ export default class QueryViewModel {
|
||||
|
||||
public columnOptions: ko.ObservableArray<string>;
|
||||
|
||||
public queryTablesTab: QueryTablesTab;
|
||||
public queryTablesTab: NewQueryTablesTab;
|
||||
public id: string;
|
||||
private _tableEntityListViewModel: TableEntityListViewModel;
|
||||
|
||||
constructor(queryTablesTab: QueryTablesTab) {
|
||||
constructor(queryTablesTab: NewQueryTablesTab) {
|
||||
this.queryTablesTab = queryTablesTab;
|
||||
this.id = `queryViewModel${this.queryTablesTab.tabId}`;
|
||||
this._tableEntityListViewModel = queryTablesTab.tableEntityListViewModel();
|
||||
this._tableEntityListViewModel = queryTablesTab.tableEntityListViewModel;
|
||||
|
||||
this.queryTextIsReadOnly = ko.computed<boolean>(() => {
|
||||
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 { NewMongoShellTab } from "../Tabs/MongoShellTab/MongoShellTab";
|
||||
import { NewQueryTab } from "../Tabs/QueryTab/QueryTab";
|
||||
import QueryTablesTab from "../Tabs/QueryTablesTab";
|
||||
import { NewQueryTablesTab } from "../Tabs/QueryTablesTab/NewQueryTablesTab";
|
||||
import { CollectionSettingsTabV2 } from "../Tabs/SettingsTabV2";
|
||||
import { useDatabases } from "../useDatabases";
|
||||
import { useSelectedNode } from "../useSelectedNode";
|
||||
@@ -391,13 +391,13 @@ export default class Collection implements ViewModels.Collection {
|
||||
});
|
||||
}
|
||||
|
||||
const queryTablesTabs: QueryTablesTab[] = useTabs
|
||||
const queryTablesTabs: NewQueryTablesTab[] = useTabs
|
||||
.getState()
|
||||
.getTabs(
|
||||
ViewModels.CollectionTabKind.QueryTables,
|
||||
(tab) => tab.collection && tab.collection.databaseId === this.databaseId && tab.collection.id() === this.id()
|
||||
) as QueryTablesTab[];
|
||||
let queryTablesTab: QueryTablesTab = queryTablesTabs && queryTablesTabs[0];
|
||||
) as NewQueryTablesTab[];
|
||||
let queryTablesTab: NewQueryTablesTab = queryTablesTabs && queryTablesTabs[0];
|
||||
|
||||
if (queryTablesTab) {
|
||||
useTabs.getState().activateTab(queryTablesTab);
|
||||
@@ -415,14 +415,14 @@ export default class Collection implements ViewModels.Collection {
|
||||
tabTitle: title,
|
||||
});
|
||||
|
||||
queryTablesTab = new QueryTablesTab({
|
||||
queryTablesTab = new NewQueryTablesTab({
|
||||
tabKind: ViewModels.CollectionTabKind.QueryTables,
|
||||
title: title,
|
||||
tabPath: "",
|
||||
collection: this,
|
||||
node: this,
|
||||
onLoadStartKey: startKey,
|
||||
});
|
||||
}, { container: this.container });
|
||||
|
||||
useTabs.getState().activateNewTab(queryTablesTab);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user