mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-01-27 21:54:15 +00:00
Migrate SidePanel state to Zustand (#799)
Co-authored-by: hardiknai-techm <HN00734461@TechMahindra.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import NewVertexIcon from "../../../images/NewVertex.svg";
|
||||
import StyleIcon from "../../../images/Style.svg";
|
||||
import { DatabaseAccount } from "../../Contracts/DataModels";
|
||||
import * as ViewModels from "../../Contracts/ViewModels";
|
||||
import { useSidePanel } from "../../hooks/useSidePanel";
|
||||
import { CommandButtonComponentProps } from "../Controls/CommandButton/CommandButtonComponent";
|
||||
import {
|
||||
GraphAccessor,
|
||||
@@ -11,9 +12,6 @@ import {
|
||||
GraphExplorerError,
|
||||
GraphExplorerProps,
|
||||
} from "../Graph/GraphExplorerComponent/GraphExplorer";
|
||||
// import { GraphAccessor, GraphExplorer, GraphExplorerError } from "../Graph/GraphExplorerComponent/GraphExplorer";
|
||||
// import { GraphExplorerAdapter } from "../Graph/GraphExplorerComponent/GraphExplorerAdapter";
|
||||
import { ContextualPaneBase } from "../Panes/ContextualPaneBase";
|
||||
import { GraphStylingPanel } from "../Panes/GraphStylingPanel/GraphStylingPanel";
|
||||
import { NewVertexPanel } from "../Panes/NewVertexPanel/NewVertexPanel";
|
||||
import TabsBase from "./TabsBase";
|
||||
@@ -71,7 +69,6 @@ export default class GraphTab extends TabsBase {
|
||||
private isFilterQueryLoading: ko.Observable<boolean>;
|
||||
private isValidQuery: ko.Observable<boolean>;
|
||||
private collectionPartitionKeyProperty: string;
|
||||
private contextualPane: ContextualPaneBase;
|
||||
public graphExplorer: GraphExplorer;
|
||||
public options: GraphTabOptions;
|
||||
constructor(options: GraphTabOptions) {
|
||||
@@ -159,12 +156,10 @@ export default class GraphTab extends TabsBase {
|
||||
|
||||
/* Command bar */
|
||||
private showNewVertexEditor(): void {
|
||||
this.collection.container.openSidePanel(
|
||||
useSidePanel.getState().openSidePanel(
|
||||
"New Vertex",
|
||||
<NewVertexPanel
|
||||
explorer={this.collection.container}
|
||||
partitionKeyPropertyProp={this.collectionPartitionKeyProperty}
|
||||
openNotificationConsole={() => this.collection.container.expandConsole()}
|
||||
onSubmit={(
|
||||
result: ViewModels.NewVertexData,
|
||||
onError: (errorMessage: string) => void,
|
||||
@@ -173,7 +168,7 @@ export default class GraphTab extends TabsBase {
|
||||
this.graphAccessor.addVertex(result).then(
|
||||
() => {
|
||||
onSuccess();
|
||||
this.contextualPane.cancel();
|
||||
useSidePanel.getState().closeSidePanel();
|
||||
},
|
||||
(error: GraphExplorerError) => {
|
||||
onError(error.title);
|
||||
@@ -184,10 +179,9 @@ export default class GraphTab extends TabsBase {
|
||||
);
|
||||
}
|
||||
public openStyling(): void {
|
||||
this.collection.container.openSidePanel(
|
||||
useSidePanel.getState().openSidePanel(
|
||||
"Graph Style",
|
||||
<GraphStylingPanel
|
||||
closePanel={this.collection.container.closeSidePanel}
|
||||
igraphConfigUiData={this.igraphConfigUiData}
|
||||
igraphConfig={this.igraphConfig}
|
||||
getValues={(igraphConfig?: IGraphConfig): void => {
|
||||
|
||||
Reference in New Issue
Block a user