mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-07-15 00:14:53 +01:00
Commit code to share
This commit is contained in:
parent
3bce7f764e
commit
754f0b392c
@ -187,6 +187,8 @@ abstract class DataTableViewModel {
|
|||||||
|
|
||||||
this.items(renderData);
|
this.items(renderData);
|
||||||
|
|
||||||
|
console.log("🚀 ~ file: DataTableViewModel.ts ~ line 191 ~ DataTableViewModel ~ renderData", renderData);
|
||||||
|
console.log("🚀 ~ file: DataTableViewModel.ts ~ line 192 ~ DataTableViewModel ~ this.items", this.items());
|
||||||
var render: IDataTableRenderData = {
|
var render: IDataTableRenderData = {
|
||||||
draw: draw,
|
draw: draw,
|
||||||
aaData: renderData,
|
aaData: renderData,
|
||||||
|
@ -15,9 +15,11 @@ class NewQueryTablesTab extends TabsBase {
|
|||||||
public collection: ViewModels.Collection;
|
public collection: ViewModels.Collection;
|
||||||
public tableEntityListViewModel: TableEntityListViewModel;
|
public tableEntityListViewModel: TableEntityListViewModel;
|
||||||
public tableCommands: TableCommands;
|
public tableCommands: TableCommands;
|
||||||
|
public container: Explorer;
|
||||||
|
|
||||||
constructor(options: ViewModels.TabOptions, props: QueryTablesTabProps) {
|
constructor(options: ViewModels.TabOptions, props: QueryTablesTabProps) {
|
||||||
super(options);
|
super(options);
|
||||||
|
this.container = props.container;
|
||||||
this.tableCommands = new TableCommands(props.container);
|
this.tableCommands = new TableCommands(props.container);
|
||||||
this.tableEntityListViewModel = new TableEntityListViewModel(this.tableCommands, this);
|
this.tableEntityListViewModel = new TableEntityListViewModel(this.tableCommands, this);
|
||||||
this.iQueryTablesTabCompProps = {
|
this.iQueryTablesTabCompProps = {
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import * as ko from "knockout";
|
||||||
import React, { Component } from "react";
|
import React, { Component } from "react";
|
||||||
import QueryInformation from "../../../../images//QueryBuilder/QueryInformation_16x.png";
|
import QueryInformation from "../../../../images//QueryBuilder/QueryInformation_16x.png";
|
||||||
import AddProperty from "../../../../images/Add-property.svg";
|
import AddProperty from "../../../../images/Add-property.svg";
|
||||||
@ -26,6 +27,7 @@ import QueryViewModel from "../../Tables/QueryBuilder/QueryViewModel";
|
|||||||
import { CassandraAPIDataClient, TableDataClient } from "../../Tables/TableDataClient";
|
import { CassandraAPIDataClient, TableDataClient } from "../../Tables/TableDataClient";
|
||||||
import TabsBase from "../TabsBase";
|
import TabsBase from "../TabsBase";
|
||||||
import NewQueryTablesTab from "./QueryTablesTab";
|
import NewQueryTablesTab from "./QueryTablesTab";
|
||||||
|
|
||||||
export interface Button {
|
export interface Button {
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
@ -82,15 +84,33 @@ class QueryTablesTabComponent extends Component<IQueryTablesTabComponentProps, I
|
|||||||
public dataTypeLabel: string;
|
public dataTypeLabel: string;
|
||||||
public operatorLabel: string;
|
public operatorLabel: string;
|
||||||
public valueLabel: string;
|
public valueLabel: string;
|
||||||
|
public tableEntityListViewModel1: TableEntityListViewModel;
|
||||||
|
public tableEntityListViewModel2 = ko.observable<TableEntityListViewModel>();
|
||||||
|
|
||||||
constructor(props: IQueryTablesTabComponentProps) {
|
constructor(props: IQueryTablesTabComponentProps) {
|
||||||
super(props);
|
super(props);
|
||||||
this.container = props.collection && props.collection.container;
|
this.container = props.collection && props.collection.container;
|
||||||
this.tableCommands = new TableCommands(this.container);
|
this.tableCommands = new TableCommands(this.container);
|
||||||
this.tableDataClient = this.container.tableDataClient;
|
this.tableDataClient = this.container.tableDataClient;
|
||||||
|
this.tableEntityListViewModel2(new TableEntityListViewModel(this.tableCommands, props.queryTablesTab));
|
||||||
|
const sampleQuerySubscription = this.tableEntityListViewModel2().items.subscribe(() => {
|
||||||
|
if (this.tableEntityListViewModel2().items().length > 0 && userContext.apiType === "Tables") {
|
||||||
|
// this.queryViewModel().queryBuilderViewModel().setExample();
|
||||||
|
console.log(
|
||||||
|
"🚀 ~ file: QueryTablesTab.tsx ~ line 55 ~ QueryTablesTab ~ sampleQuerySubscription ~ this.queryViewModel().queryBuilderViewModel().setExample()"
|
||||||
|
// this.queryViewModel().queryBuilderViewModel().setExample()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
sampleQuerySubscription.dispose();
|
||||||
|
});
|
||||||
|
console.log(
|
||||||
|
"🚀 ~ file: QueryTablesTab.tsx ~ line 54 ~ QueryTablesTab ~ sampleQuerySubscription ~ this.tableEntityListViewModel().items().length",
|
||||||
|
this.tableEntityListViewModel2().items()
|
||||||
|
);
|
||||||
|
this.tableEntityListViewModel1 = new TableEntityListViewModel(this.tableCommands, props.queryTablesTab);
|
||||||
this.state = {
|
this.state = {
|
||||||
tableEntityListViewModel: new TableEntityListViewModel(this.tableCommands, props.queryTablesTab),
|
tableEntityListViewModel: new TableEntityListViewModel(this.tableCommands, props.queryTablesTab),
|
||||||
|
|
||||||
// tableEntityListViewModel.queryTablesTab : this.props.queryTablesTab
|
// tableEntityListViewModel.queryTablesTab : this.props.queryTablesTab
|
||||||
queryViewModel: new QueryViewModel(this.props.queryTablesTab),
|
queryViewModel: new QueryViewModel(this.props.queryTablesTab),
|
||||||
queryText: "PartitionKey eq 'partionKey1'",
|
queryText: "PartitionKey eq 'partionKey1'",
|
||||||
@ -140,7 +160,9 @@ class QueryTablesTabComponent extends Component<IQueryTablesTabComponentProps, I
|
|||||||
", ",
|
", ",
|
||||||
this.state.queryViewModel.queryBuilderViewModel().clauseArray(),
|
this.state.queryViewModel.queryBuilderViewModel().clauseArray(),
|
||||||
", ",
|
", ",
|
||||||
this.state.tableEntityListViewModel.items()
|
this.state.tableEntityListViewModel.items(),
|
||||||
|
", tableEntityList > ",
|
||||||
|
this.state.tableEntityListViewModel
|
||||||
);
|
);
|
||||||
const x = this.state.tableEntityListViewModel.items();
|
const x = this.state.tableEntityListViewModel.items();
|
||||||
console.log("🚀 ~ file: QueryTablesTabComponent.tsx ~ line 146 ~ QueryTablesTabComponent ~ constructor ~ x", x);
|
console.log("🚀 ~ file: QueryTablesTabComponent.tsx ~ line 146 ~ QueryTablesTabComponent ~ constructor ~ x", x);
|
||||||
@ -165,6 +187,11 @@ class QueryTablesTabComponent extends Component<IQueryTablesTabComponentProps, I
|
|||||||
// );
|
// );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
this.props.queryTablesTab.container.tableDataClient.queryDocuments(
|
||||||
|
this.props.queryTablesTab.collection,
|
||||||
|
"SELECT * FROM c",
|
||||||
|
true
|
||||||
|
);
|
||||||
this.buildCommandBarOptions();
|
this.buildCommandBarOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -289,7 +316,7 @@ class QueryTablesTabComponent extends Component<IQueryTablesTabComponentProps, I
|
|||||||
}
|
}
|
||||||
|
|
||||||
render(): JSX.Element {
|
render(): JSX.Element {
|
||||||
// useCommandBar.getState().setContextButtons(this.getTabsButtons());
|
useCommandBar.getState().setContextButtons(this.getTabsButtons());
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="tab-pane tableContainer" id={this.props.tabsBaseInstance.tabId} role="tabpanel">
|
<div className="tab-pane tableContainer" id={this.props.tabsBaseInstance.tabId} role="tabpanel">
|
||||||
@ -459,17 +486,20 @@ class QueryTablesTabComponent extends Component<IQueryTablesTabComponentProps, I
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{this.state.tableEntityListViewModel.items().map((item, index) => (
|
||||||
|
<label key={index}>{item}</label>
|
||||||
|
))}
|
||||||
<div
|
<div
|
||||||
className="tablesQueryTab tableContainer"
|
className="tablesQueryTab tableContainer"
|
||||||
// data-bind="with: tableEntityListViewModel, attr: {
|
data-bind="with: tableEntityListViewModel, attr: {
|
||||||
// id: tableEntityListViewModel.id
|
id: tableEntityListViewModel.id
|
||||||
// }"
|
}"
|
||||||
>
|
>
|
||||||
<table
|
<table
|
||||||
id="storageTable"
|
id="storageTable"
|
||||||
className="storage azure-table show-gridlines"
|
className="storage azure-table show-gridlines"
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
// data-bind="tableSource: items, tableSelection: selected"
|
data-bind="tableSource: items, tableSelection: selected"
|
||||||
></table>
|
></table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user