2021-01-20 15:15:01 +00:00
|
|
|
// CSS Dependencies
|
2023-09-15 16:33:27 +01:00
|
|
|
import { initializeIcons, loadTheme } from "@fluentui/react";
|
2023-10-19 22:12:52 +01:00
|
|
|
import "bootstrap/dist/css/bootstrap.css";
|
2022-09-14 22:42:09 +01:00
|
|
|
import { QuickstartCarousel } from "Explorer/Quickstart/QuickstartCarousel";
|
|
|
|
import { MongoQuickstartTutorial } from "Explorer/Quickstart/Tutorials/MongoQuickstartTutorial";
|
|
|
|
import { SQLQuickstartTutorial } from "Explorer/Quickstart/Tutorials/SQLQuickstartTutorial";
|
2022-05-24 04:52:21 +01:00
|
|
|
import { useCarousel } from "hooks/useCarousel";
|
2021-03-15 03:53:16 +00:00
|
|
|
import React, { useState } from "react";
|
|
|
|
import ReactDOM from "react-dom";
|
2023-10-19 22:12:52 +01:00
|
|
|
import { userContext } from "UserContext";
|
2021-03-15 03:53:16 +00:00
|
|
|
import "../externals/jquery-ui.min.css";
|
|
|
|
import "../externals/jquery-ui.min.js";
|
|
|
|
import "../externals/jquery-ui.structure.min.css";
|
|
|
|
import "../externals/jquery-ui.theme.min.css";
|
|
|
|
import "../externals/jquery.dataTables.min.css";
|
|
|
|
import "../externals/jquery.typeahead.min.css";
|
|
|
|
import "../externals/jquery.typeahead.min.js";
|
|
|
|
// Image Dependencies
|
2023-10-19 22:12:52 +01:00
|
|
|
import { Platform } from "ConfigContext";
|
2023-06-06 19:43:53 +01:00
|
|
|
import { QueryCopilotCarousel } from "Explorer/QueryCopilot/CopilotCarousel";
|
2023-07-19 01:38:36 +01:00
|
|
|
import { QueryCopilotFeedbackModal } from "Explorer/QueryCopilot/Modal/QueryCopilotFeedbackModal";
|
2023-07-10 09:59:05 +01:00
|
|
|
import { useQueryCopilot } from "hooks/useQueryCopilot";
|
2021-03-15 03:53:16 +00:00
|
|
|
import "../images/CosmosDB_rgb_ui_lighttheme.ico";
|
2023-06-06 19:43:53 +01:00
|
|
|
import "../images/favicon.ico";
|
2023-10-19 22:12:52 +01:00
|
|
|
import hdeConnectImage from "../images/HdeConnectCosmosDB.svg";
|
2021-01-20 15:15:01 +00:00
|
|
|
import "../less/documentDB.less";
|
|
|
|
import "../less/forms.less";
|
|
|
|
import "../less/infobox.less";
|
2021-03-15 03:53:16 +00:00
|
|
|
import "../less/menus.less";
|
2021-01-20 15:15:01 +00:00
|
|
|
import "../less/messagebox.less";
|
2021-03-15 03:53:16 +00:00
|
|
|
import "../less/resourceTree.less";
|
2023-10-19 22:12:52 +01:00
|
|
|
import "../less/TableStyles/CustomizeColumns.less";
|
|
|
|
import "../less/TableStyles/EntityEditor.less";
|
|
|
|
import "../less/TableStyles/fulldatatables.less";
|
|
|
|
import "../less/TableStyles/queryBuilder.less";
|
2021-03-15 03:53:16 +00:00
|
|
|
import "../less/tree.less";
|
2021-05-25 21:26:36 +01:00
|
|
|
import { CollapsedResourceTree } from "./Common/CollapsedResourceTree";
|
2021-07-20 19:40:04 +01:00
|
|
|
import { ResourceTreeContainer } from "./Common/ResourceTreeContainer";
|
2023-10-19 22:12:52 +01:00
|
|
|
import * as StyleConstants from "./Common/StyleConstants";
|
2021-03-15 03:53:16 +00:00
|
|
|
import "./Explorer/Controls/Accordion/AccordionComponent.less";
|
2021-01-20 15:15:01 +00:00
|
|
|
import "./Explorer/Controls/CollapsiblePanel/CollapsiblePanelComponent.less";
|
2021-05-20 15:54:26 +01:00
|
|
|
import { Dialog } from "./Explorer/Controls/Dialog";
|
2021-03-15 03:53:16 +00:00
|
|
|
import "./Explorer/Controls/ErrorDisplayComponent/ErrorDisplayComponent.less";
|
2021-01-20 15:15:01 +00:00
|
|
|
import "./Explorer/Controls/JsonEditor/JsonEditorComponent.less";
|
2021-03-15 03:53:16 +00:00
|
|
|
import "./Explorer/Controls/Notebook/NotebookTerminalComponent.less";
|
|
|
|
import "./Explorer/Controls/TreeComponent/treeComponent.less";
|
2021-01-20 15:15:01 +00:00
|
|
|
import "./Explorer/Graph/GraphExplorerComponent/graphExplorer.less";
|
2021-03-15 03:53:16 +00:00
|
|
|
import "./Explorer/Menus/CommandBar/CommandBarComponent.less";
|
2021-05-28 21:20:59 +01:00
|
|
|
import { CommandBar } from "./Explorer/Menus/CommandBar/CommandBarComponentAdapter";
|
2021-09-04 07:04:26 +01:00
|
|
|
import "./Explorer/Menus/CommandBar/ConnectionStatusComponent.less";
|
2021-03-15 03:53:16 +00:00
|
|
|
import "./Explorer/Menus/CommandBar/MemoryTrackerComponent.less";
|
|
|
|
import "./Explorer/Menus/NotificationConsole/NotificationConsole.less";
|
2021-05-27 22:07:07 +01:00
|
|
|
import { NotificationConsole } from "./Explorer/Menus/NotificationConsole/NotificationConsoleComponent";
|
2021-03-15 03:53:16 +00:00
|
|
|
import "./Explorer/Panes/PanelComponent.less";
|
2021-05-27 22:07:07 +01:00
|
|
|
import { SidePanel } from "./Explorer/Panes/PanelContainerComponent";
|
2021-02-23 19:15:57 +00:00
|
|
|
import "./Explorer/SplashScreen/SplashScreen.less";
|
2021-04-19 21:11:48 +01:00
|
|
|
import { Tabs } from "./Explorer/Tabs/Tabs";
|
2023-06-06 19:43:53 +01:00
|
|
|
import { useConfig } from "./hooks/useConfig";
|
|
|
|
import { useKnockoutExplorer } from "./hooks/useKnockoutExplorer";
|
2023-10-19 22:12:52 +01:00
|
|
|
import "./Libs/jquery";
|
2023-09-15 16:33:27 +01:00
|
|
|
import { appThemeFabric } from "./Platform/Fabric/FabricTheme";
|
2023-10-19 22:12:52 +01:00
|
|
|
import "./Shared/appInsights";
|
2021-01-20 15:15:01 +00:00
|
|
|
|
2021-01-25 19:56:15 +00:00
|
|
|
initializeIcons();
|
2021-01-20 15:15:01 +00:00
|
|
|
|
2021-01-25 19:56:15 +00:00
|
|
|
const App: React.FunctionComponent = () => {
|
2021-05-25 21:26:36 +01:00
|
|
|
const [isLeftPaneExpanded, setIsLeftPaneExpanded] = useState<boolean>(true);
|
2022-05-24 04:52:21 +01:00
|
|
|
const isCarouselOpen = useCarousel((state) => state.shouldOpen);
|
2023-06-06 19:43:53 +01:00
|
|
|
const isCopilotCarouselOpen = useCarousel((state) => state.showCopilotCarousel);
|
2023-07-10 09:59:05 +01:00
|
|
|
const shouldShowModal = useQueryCopilot((state) => state.showFeedbackModal);
|
2021-04-07 17:15:00 +01:00
|
|
|
|
2021-01-25 19:56:15 +00:00
|
|
|
const config = useConfig();
|
2023-09-15 16:33:27 +01:00
|
|
|
if (config?.platform === Platform.Fabric) {
|
|
|
|
loadTheme(appThemeFabric);
|
2023-10-19 22:12:52 +01:00
|
|
|
import("../less/documentDBFabric.less");
|
2023-09-15 16:33:27 +01:00
|
|
|
}
|
|
|
|
StyleConstants.updateStyles();
|
2021-07-09 05:32:22 +01:00
|
|
|
const explorer = useKnockoutExplorer(config?.platform);
|
2021-01-20 15:15:01 +00:00
|
|
|
|
2021-05-25 21:26:36 +01:00
|
|
|
const toggleLeftPaneExpanded = () => {
|
|
|
|
setIsLeftPaneExpanded(!isLeftPaneExpanded);
|
|
|
|
if (isLeftPaneExpanded) {
|
|
|
|
document.getElementById("expandToggleLeftPaneButton").focus();
|
|
|
|
} else {
|
|
|
|
document.getElementById("collapseToggleLeftPaneButton").focus();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-03-15 03:53:16 +00:00
|
|
|
if (!explorer) {
|
|
|
|
return <LoadingExplorer />;
|
|
|
|
}
|
|
|
|
|
2021-01-20 15:15:01 +00:00
|
|
|
return (
|
2023-08-14 17:18:25 +01:00
|
|
|
<div className="flexContainer" aria-hidden="false">
|
2021-05-19 05:41:44 +01:00
|
|
|
<div id="divExplorer" className="flexContainer hideOverflows">
|
2023-03-27 23:33:55 +01:00
|
|
|
<div id="freeTierTeachingBubble"> </div>
|
2021-03-10 21:55:05 +00:00
|
|
|
{/* Main Command Bar - Start */}
|
2021-05-28 21:20:59 +01:00
|
|
|
<CommandBar container={explorer} />
|
2021-01-20 15:15:01 +00:00
|
|
|
{/* Collections Tree and Tabs - Begin */}
|
|
|
|
<div className="resourceTreeAndTabs">
|
|
|
|
{/* Collections Tree - Start */}
|
2023-09-13 02:03:59 +01:00
|
|
|
{userContext.apiType !== "Postgres" && userContext.apiType !== "VCoreMongo" && (
|
2022-09-14 22:42:09 +01:00
|
|
|
<div id="resourcetree" data-test="resourceTreeId" className="resourceTree">
|
|
|
|
<div className="collectionsTreeWithSplitter">
|
|
|
|
{/* Collections Tree Expanded - Start */}
|
|
|
|
<ResourceTreeContainer
|
|
|
|
container={explorer}
|
|
|
|
toggleLeftPaneExpanded={toggleLeftPaneExpanded}
|
|
|
|
isLeftPaneExpanded={isLeftPaneExpanded}
|
|
|
|
/>
|
|
|
|
{/* Collections Tree Expanded - End */}
|
|
|
|
{/* Collections Tree Collapsed - Start */}
|
|
|
|
<CollapsedResourceTree
|
|
|
|
toggleLeftPaneExpanded={toggleLeftPaneExpanded}
|
|
|
|
isLeftPaneExpanded={isLeftPaneExpanded}
|
|
|
|
/>
|
|
|
|
{/* Collections Tree Collapsed - End */}
|
|
|
|
</div>
|
2021-01-20 15:15:01 +00:00
|
|
|
</div>
|
2022-09-14 22:42:09 +01:00
|
|
|
)}
|
2022-07-06 18:54:35 +01:00
|
|
|
<Tabs explorer={explorer} />
|
2021-01-20 15:15:01 +00:00
|
|
|
</div>
|
|
|
|
{/* Collections Tree and Tabs - End */}
|
|
|
|
<div
|
|
|
|
className="dataExplorerErrorConsoleContainer"
|
|
|
|
role="contentinfo"
|
|
|
|
aria-label="Notification console"
|
|
|
|
id="explorerNotificationConsole"
|
2021-01-26 23:32:37 +00:00
|
|
|
>
|
2021-06-09 21:11:12 +01:00
|
|
|
<NotificationConsole />
|
2021-01-26 23:32:37 +00:00
|
|
|
</div>
|
2021-01-20 15:15:01 +00:00
|
|
|
</div>
|
2021-05-27 22:07:07 +01:00
|
|
|
<SidePanel />
|
2021-05-20 15:54:26 +01:00
|
|
|
<Dialog />
|
2022-05-24 04:52:21 +01:00
|
|
|
{<QuickstartCarousel isOpen={isCarouselOpen} />}
|
2022-09-14 22:42:09 +01:00
|
|
|
{<SQLQuickstartTutorial />}
|
2022-08-03 21:54:01 +01:00
|
|
|
{<MongoQuickstartTutorial />}
|
2023-06-06 19:43:53 +01:00
|
|
|
{<QueryCopilotCarousel isOpen={isCopilotCarouselOpen} explorer={explorer} />}
|
2023-08-18 09:47:19 +01:00
|
|
|
{shouldShowModal && <QueryCopilotFeedbackModal explorer={explorer} />}
|
2021-01-20 15:15:01 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2023-10-19 22:12:52 +01:00
|
|
|
const mainElement = document.getElementById("Main");
|
|
|
|
ReactDOM.render(<App />, mainElement);
|
2023-09-15 16:33:27 +01:00
|
|
|
|
2021-03-15 03:53:16 +00:00
|
|
|
function LoadingExplorer(): JSX.Element {
|
|
|
|
return (
|
|
|
|
<div className="splashLoaderContainer">
|
|
|
|
<div className="splashLoaderContentContainer">
|
|
|
|
<p className="connectExplorerContent">
|
|
|
|
<img src={hdeConnectImage} alt="Azure Cosmos DB" />
|
|
|
|
</p>
|
|
|
|
<p className="splashLoaderTitle" id="explorerLoadingStatusTitle">
|
|
|
|
Welcome to Azure Cosmos DB
|
|
|
|
</p>
|
|
|
|
<p className="splashLoaderText" id="explorerLoadingStatusText" role="alert">
|
|
|
|
Connecting...
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|