mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-20 09:20:16 +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 => {
|
||||
|
||||
@@ -10,6 +10,7 @@ import { MinimalQueryIterator } from "../../Common/IteratorUtilities";
|
||||
import { Splitter, SplitterBounds, SplitterDirection } from "../../Common/Splitter";
|
||||
import * as DataModels from "../../Contracts/DataModels";
|
||||
import * as ViewModels from "../../Contracts/ViewModels";
|
||||
import { useNotificationConsole } from "../../hooks/useNotificationConsole";
|
||||
import { Action } from "../../Shared/Telemetry/TelemetryConstants";
|
||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||
import { userContext } from "../../UserContext";
|
||||
@@ -198,7 +199,7 @@ export default class QueryTab extends TabsBase implements ViewModels.WaitsForTem
|
||||
}
|
||||
|
||||
public onErrorDetailsClick = (src: any, event: MouseEvent): boolean => {
|
||||
this.collection && this.collection.container.expandConsole();
|
||||
useNotificationConsole.getState().expandConsole();
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
@@ -9,6 +9,7 @@ import { updateStoredProcedure } from "../../Common/dataAccess/updateStoredProce
|
||||
import editable from "../../Common/EditableUtility";
|
||||
import { getErrorMessage, getErrorStack } from "../../Common/ErrorHandlingUtils";
|
||||
import * as ViewModels from "../../Contracts/ViewModels";
|
||||
import { useNotificationConsole } from "../../hooks/useNotificationConsole";
|
||||
import { Action } from "../../Shared/Telemetry/TelemetryConstants";
|
||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||
import { CommandButtonComponentProps } from "../Controls/CommandButton/CommandButtonComponent";
|
||||
@@ -136,7 +137,7 @@ export default class StoredProcedureTab extends ScriptTabBase {
|
||||
}
|
||||
|
||||
public onErrorDetailsClick = (src: any, event: MouseEvent): boolean => {
|
||||
this.collection && this.collection.container.expandConsole();
|
||||
useNotificationConsole.getState().expandConsole();
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
@@ -3,6 +3,7 @@ import * as Constants from "../../Common/Constants";
|
||||
import * as ThemeUtility from "../../Common/ThemeUtility";
|
||||
import * as DataModels from "../../Contracts/DataModels";
|
||||
import * as ViewModels from "../../Contracts/ViewModels";
|
||||
import { useNotificationConsole } from "../../hooks/useNotificationConsole";
|
||||
import { RouteHandler } from "../../RouteHandlers/RouteHandler";
|
||||
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||
@@ -122,8 +123,8 @@ export default class TabsBase extends WaitsForTemplateViewModel {
|
||||
}
|
||||
|
||||
public onErrorDetailsClick = (src: any, event: MouseEvent): boolean => {
|
||||
this.collection?.container?.expandConsole();
|
||||
this.database?.container?.expandConsole();
|
||||
useNotificationConsole.getState().expandConsole();
|
||||
useNotificationConsole.getState().expandConsole();
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user