From bc4f18ba79321095d181ad8da4df461a96f1f67e Mon Sep 17 00:00:00 2001 From: Nishtha Ahuja <45535788+nishthaAhujaa@users.noreply.github.com> Date: Sat, 15 Mar 2025 00:41:36 +0530 Subject: [PATCH] Panel Integration (#2075) * integrated panel * edited header text --------- Co-authored-by: nishthaAhujaa Co-authored-by: Asier Isayas --- .../Controls/Settings/SettingsComponent.tsx | 1 + .../MaterializedViewComponent.tsx | 11 ++++++--- .../MaterializedViewSourceComponent.tsx | 23 +++++++++++++++++-- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/src/Explorer/Controls/Settings/SettingsComponent.tsx b/src/Explorer/Controls/Settings/SettingsComponent.tsx index 88e83a83f..11e399410 100644 --- a/src/Explorer/Controls/Settings/SettingsComponent.tsx +++ b/src/Explorer/Controls/Settings/SettingsComponent.tsx @@ -1281,6 +1281,7 @@ export class SettingsComponent extends React.Component = ({ collection }) => { +export const MaterializedViewComponent: React.FC = ({ collection, explorer }) => { const isTargetContainer = !!collection?.materializedViewDefinition(); const isSourceContainer = !!collection?.materializedViews(); @@ -17,14 +19,17 @@ export const MaterializedViewComponent: React.FC This container has the following views defined for it. - + Learn more {" "} about how to define materialized views and how to use them. - {isSourceContainer && } + {isSourceContainer && } {isTargetContainer && } ); diff --git a/src/Explorer/Controls/Settings/SettingsSubComponents/MaterializedViewSourceComponent.tsx b/src/Explorer/Controls/Settings/SettingsSubComponents/MaterializedViewSourceComponent.tsx index 96fbcf290..da7c4dcd3 100644 --- a/src/Explorer/Controls/Settings/SettingsSubComponents/MaterializedViewSourceComponent.tsx +++ b/src/Explorer/Controls/Settings/SettingsSubComponents/MaterializedViewSourceComponent.tsx @@ -1,15 +1,23 @@ import { PrimaryButton } from "@fluentui/react"; +import { MaterializedViewsLabels } from "Common/Constants"; +import Explorer from "Explorer/Explorer"; import { loadMonaco } from "Explorer/LazyMonaco"; +import { AddMaterializedViewPanel } from "Explorer/Panes/AddMaterializedViewPanel/AddMaterializedViewPanel"; import { useDatabases } from "Explorer/useDatabases"; +import { useSidePanel } from "hooks/useSidePanel"; import * as monaco from "monaco-editor"; import React, { useEffect, useRef } from "react"; import * as ViewModels from "../../../../Contracts/ViewModels"; export interface MaterializedViewSourceComponentProps { collection: ViewModels.Collection; + explorer: Explorer; } -export const MaterializedViewSourceComponent: React.FC = ({ collection }) => { +export const MaterializedViewSourceComponent: React.FC = ({ + collection, + explorer, +}) => { const editorContainerRef = useRef(null); const editorRef = useRef(null); @@ -88,7 +96,18 @@ export const MaterializedViewSourceComponent: React.FC - {}} /> + + useSidePanel + .getState() + .openSidePanel( + MaterializedViewsLabels.NewMaterializedView, + , + ) + } + /> ); };