mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-01-23 11:44:03 +00:00
Migrate Mongo Shell tab to React (#900)
This commit is contained in:
39
src/Explorer/Tabs/MongoShellTab/MongoShellTab.tsx
Normal file
39
src/Explorer/Tabs/MongoShellTab/MongoShellTab.tsx
Normal file
@@ -0,0 +1,39 @@
|
||||
import React from "react";
|
||||
import * as DataModels from "../../../Contracts/DataModels";
|
||||
import type { TabOptions } from "../../../Contracts/ViewModels";
|
||||
import Explorer from "../../Explorer";
|
||||
import TabsBase from "../TabsBase";
|
||||
import MongoShellTabComponent, { IMongoShellTabAccessor, IMongoShellTabComponentProps } from "./MongoShellTabComponent";
|
||||
|
||||
export interface IMongoShellTabProps {
|
||||
container: Explorer;
|
||||
}
|
||||
|
||||
export class NewMongoShellTab extends TabsBase {
|
||||
public queryText: string;
|
||||
public currentQuery: string;
|
||||
public partitionKey: DataModels.PartitionKey;
|
||||
public iMongoShellTabComponentProps: IMongoShellTabComponentProps;
|
||||
public iMongoShellTabAccessor: IMongoShellTabAccessor;
|
||||
|
||||
constructor(options: TabOptions, private props: IMongoShellTabProps) {
|
||||
super(options);
|
||||
this.iMongoShellTabComponentProps = {
|
||||
collection: this.collection,
|
||||
tabsBaseInstance: this,
|
||||
container: this.props.container,
|
||||
onMongoShellTabAccessor: (instance: IMongoShellTabAccessor) => {
|
||||
this.iMongoShellTabAccessor = instance;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
public render(): JSX.Element {
|
||||
return <MongoShellTabComponent {...this.iMongoShellTabComponentProps} />;
|
||||
}
|
||||
|
||||
public onTabClick(): void {
|
||||
this.manager?.activateTab(this);
|
||||
this.iMongoShellTabAccessor.onTabClickEvent();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user