diff --git a/src/Contracts/ViewModels.ts b/src/Contracts/ViewModels.ts index 38091f611..c851ea8aa 100644 --- a/src/Contracts/ViewModels.ts +++ b/src/Contracts/ViewModels.ts @@ -6,7 +6,7 @@ import { UserDefinedFunctionDefinition, } from "@azure/cosmos"; import Explorer from "../Explorer/Explorer"; -import { ConsoleData } from "../Explorer/Menus/NotificationConsole/NotificationConsoleComponent"; +import { ConsoleData } from "../Explorer/Menus/NotificationConsole/ConsoleData"; import { CassandraTableKey, CassandraTableKeys } from "../Explorer/Tables/TableDataClient"; import ConflictId from "../Explorer/Tree/ConflictId"; import DocumentId from "../Explorer/Tree/DocumentId"; diff --git a/src/Explorer/Controls/Settings/__snapshots__/SettingsComponent.test.tsx.snap b/src/Explorer/Controls/Settings/__snapshots__/SettingsComponent.test.tsx.snap index 3451ec734..18c2e4c7c 100644 --- a/src/Explorer/Controls/Settings/__snapshots__/SettingsComponent.test.tsx.snap +++ b/src/Explorer/Controls/Settings/__snapshots__/SettingsComponent.test.tsx.snap @@ -71,8 +71,6 @@ exports[`SettingsComponent renders 1`] = ` }, "selectedDatabaseId": [Function], "selectedNode": [Function], - "setInProgressConsoleDataIdToBeDeleted": undefined, - "setNotificationConsoleData": undefined, "sparkClusterConnectionInfo": [Function], "tabsManager": TabsManager { "activeTab": [Function], @@ -142,8 +140,6 @@ exports[`SettingsComponent renders 1`] = ` }, "selectedDatabaseId": [Function], "selectedNode": [Function], - "setInProgressConsoleDataIdToBeDeleted": undefined, - "setNotificationConsoleData": undefined, "sparkClusterConnectionInfo": [Function], "tabsManager": TabsManager { "activeTab": [Function], @@ -226,8 +222,6 @@ exports[`SettingsComponent renders 1`] = ` }, "selectedDatabaseId": [Function], "selectedNode": [Function], - "setInProgressConsoleDataIdToBeDeleted": undefined, - "setNotificationConsoleData": undefined, "sparkClusterConnectionInfo": [Function], "tabsManager": TabsManager { "activeTab": [Function], @@ -297,8 +291,6 @@ exports[`SettingsComponent renders 1`] = ` }, "selectedDatabaseId": [Function], "selectedNode": [Function], - "setInProgressConsoleDataIdToBeDeleted": undefined, - "setNotificationConsoleData": undefined, "sparkClusterConnectionInfo": [Function], "tabsManager": TabsManager { "activeTab": [Function], diff --git a/src/Explorer/Explorer.tsx b/src/Explorer/Explorer.tsx index 52535b3c5..b1999e7fa 100644 --- a/src/Explorer/Explorer.tsx +++ b/src/Explorer/Explorer.tsx @@ -41,7 +41,6 @@ import * as ComponentRegisterer from "./ComponentRegisterer"; import { DialogProps, TextFieldProps, useDialog } from "./Controls/Dialog"; import { GalleryTab as GalleryTabKind } from "./Controls/NotebookGallery/GalleryViewerComponent"; import { useCommandBar } from "./Menus/CommandBar/CommandBarComponentAdapter"; -import { ConsoleData } from "./Menus/NotificationConsole/NotificationConsoleComponent"; import * as FileSystemUtil from "./Notebook/FileSystemUtil"; import { SnapshotRequest } from "./Notebook/NotebookComponent/types"; import { NotebookContentItem, NotebookContentItemType } from "./Notebook/NotebookContentItem"; @@ -83,8 +82,6 @@ BindingHandlersRegisterer.registerBindingHandlers(); var tmp = ComponentRegisterer; export interface ExplorerParams { - setNotificationConsoleData: (consoleData: ConsoleData) => void; - setInProgressConsoleDataIdToBeDeleted: (id: string) => void; tabsManager: TabsManager; } @@ -96,9 +93,6 @@ export default class Explorer { public queriesClient: QueriesClient; public tableDataClient: TableDataClient; - private setNotificationConsoleData: (consoleData: ConsoleData) => void; - private setInProgressConsoleDataIdToBeDeleted: (id: string) => void; - // Resource Tree public databases: ko.ObservableArray; public selectedDatabaseId: ko.Computed; @@ -145,9 +139,6 @@ export default class Explorer { private static readonly MaxNbDatabasesToAutoExpand = 5; constructor(params?: ExplorerParams) { - this.setNotificationConsoleData = params?.setNotificationConsoleData; - this.setInProgressConsoleDataIdToBeDeleted = params?.setInProgressConsoleDataIdToBeDeleted; - const startKey: number = TelemetryProcessor.traceStart(Action.InitializeDataExplorer, { dataExplorerArea: Constants.Areas.ResourceTree, }); @@ -444,14 +435,6 @@ export default class Explorer { return this.selectedNode() == null; } - public logConsoleData(consoleData: ConsoleData): void { - this.setNotificationConsoleData(consoleData); - } - - public deleteInProgressConsoleDataWithId(id: string): void { - this.setInProgressConsoleDataIdToBeDeleted(id); - } - public refreshDatabaseForResourceToken(): Q.Promise { const databaseId = this.resourceTokenDatabaseId(); const collectionId = this.resourceTokenCollectionId(); diff --git a/src/Explorer/Graph/GraphExplorerComponent/GraphExplorer.test.tsx b/src/Explorer/Graph/GraphExplorerComponent/GraphExplorer.test.tsx index 1954186c8..6ce0a11bf 100644 --- a/src/Explorer/Graph/GraphExplorerComponent/GraphExplorer.test.tsx +++ b/src/Explorer/Graph/GraphExplorerComponent/GraphExplorer.test.tsx @@ -10,7 +10,7 @@ import { queryDocumentsPage } from "../../../Common/dataAccess/queryDocumentsPag import * as DataModels from "../../../Contracts/DataModels"; import * as StorageUtility from "../../../Shared/StorageUtility"; import { TabComponent } from "../../Controls/Tabs/TabComponent"; -import { ConsoleDataType } from "../../Menus/NotificationConsole/NotificationConsoleComponent"; +import { ConsoleDataType } from "../../Menus/NotificationConsole/ConsoleData"; import GraphTab from "../../Tabs/GraphTab"; import * as D3ForceGraph from "./D3ForceGraph"; import { GraphData } from "./GraphData"; diff --git a/src/Explorer/Graph/GraphExplorerComponent/GraphExplorer.tsx b/src/Explorer/Graph/GraphExplorerComponent/GraphExplorer.tsx index 5b2441e40..cf2fbbb3a 100644 --- a/src/Explorer/Graph/GraphExplorerComponent/GraphExplorer.tsx +++ b/src/Explorer/Graph/GraphExplorerComponent/GraphExplorer.tsx @@ -18,7 +18,7 @@ import { logConsoleError, logConsoleInfo, logConsoleProgress } from "../../../Ut import { EditorReact } from "../../Controls/Editor/EditorReact"; import * as InputTypeaheadComponent from "../../Controls/InputTypeahead/InputTypeaheadComponent"; import * as TabComponent from "../../Controls/Tabs/TabComponent"; -import { ConsoleDataType } from "../../Menus/NotificationConsole/NotificationConsoleComponent"; +import { ConsoleDataType } from "../../Menus/NotificationConsole/ConsoleData"; import { IGraphConfig } from "../../Tabs/GraphTab"; import { ArraysByKeyCache } from "./ArraysByKeyCache"; import * as D3ForceGraph from "./D3ForceGraph"; diff --git a/src/Explorer/Graph/GraphExplorerComponent/NodePropertiesComponent.tsx b/src/Explorer/Graph/GraphExplorerComponent/NodePropertiesComponent.tsx index e308d7ece..3314bf9eb 100644 --- a/src/Explorer/Graph/GraphExplorerComponent/NodePropertiesComponent.tsx +++ b/src/Explorer/Graph/GraphExplorerComponent/NodePropertiesComponent.tsx @@ -5,21 +5,26 @@ */ import * as React from "react"; -import { GraphHighlightedNodeData, EditedProperties, EditedEdges, PossibleVertex } from "./GraphExplorer"; -import { CollapsiblePanel } from "../../Controls/CollapsiblePanel/CollapsiblePanel"; -import { ReadOnlyNodePropertiesComponent } from "./ReadOnlyNodePropertiesComponent"; -import { EditorNodePropertiesComponent } from "./EditorNodePropertiesComponent"; -import { ReadOnlyNeighborsComponent } from "./ReadOnlyNeighborsComponent"; -import * as ViewModels from "../../../Contracts/ViewModels"; -import { Item } from "../../Controls/InputTypeahead/InputTypeaheadComponent"; -import * as EditorNeighbors from "./EditorNeighborsComponent"; -import EditIcon from "../../../../images/edit.svg"; -import DeleteIcon from "../../../../images/delete.svg"; -import CheckIcon from "../../../../images/check.svg"; import CancelIcon from "../../../../images/cancel.svg"; -import { GraphExplorer } from "./GraphExplorer"; -import { ConsoleDataType } from "../../Menus/NotificationConsole/NotificationConsoleComponent"; +import CheckIcon from "../../../../images/check.svg"; +import DeleteIcon from "../../../../images/delete.svg"; +import EditIcon from "../../../../images/edit.svg"; +import * as ViewModels from "../../../Contracts/ViewModels"; import { AccessibleElement } from "../../Controls/AccessibleElement/AccessibleElement"; +import { CollapsiblePanel } from "../../Controls/CollapsiblePanel/CollapsiblePanel"; +import { Item } from "../../Controls/InputTypeahead/InputTypeaheadComponent"; +import { ConsoleDataType } from "../../Menus/NotificationConsole/ConsoleData"; +import * as EditorNeighbors from "./EditorNeighborsComponent"; +import { EditorNodePropertiesComponent } from "./EditorNodePropertiesComponent"; +import { + EditedEdges, + EditedProperties, + GraphExplorer, + GraphHighlightedNodeData, + PossibleVertex, +} from "./GraphExplorer"; +import { ReadOnlyNeighborsComponent } from "./ReadOnlyNeighborsComponent"; +import { ReadOnlyNodePropertiesComponent } from "./ReadOnlyNodePropertiesComponent"; export enum Mode { READONLY_PROP, diff --git a/src/Explorer/Menus/NotificationConsole/ConsoleData.tsx b/src/Explorer/Menus/NotificationConsole/ConsoleData.tsx new file mode 100644 index 000000000..2ede2f003 --- /dev/null +++ b/src/Explorer/Menus/NotificationConsole/ConsoleData.tsx @@ -0,0 +1,16 @@ +/** + * Interface for the data/content that will be recorded + */ + +export interface ConsoleData { + type: ConsoleDataType; + date: string; + message: string; + id?: string; +} + +export enum ConsoleDataType { + Info = 0, + Error = 1, + InProgress = 2, +} diff --git a/src/Explorer/Menus/NotificationConsole/NotificationConsoleComponent.test.tsx b/src/Explorer/Menus/NotificationConsole/NotificationConsoleComponent.test.tsx index 05df0f46f..711e0db35 100644 --- a/src/Explorer/Menus/NotificationConsole/NotificationConsoleComponent.test.tsx +++ b/src/Explorer/Menus/NotificationConsole/NotificationConsoleComponent.test.tsx @@ -1,10 +1,7 @@ import { shallow } from "enzyme"; import React from "react"; -import { - ConsoleDataType, - NotificationConsoleComponent, - NotificationConsoleComponentProps, -} from "./NotificationConsoleComponent"; +import { ConsoleDataType } from "./ConsoleData"; +import { NotificationConsoleComponent, NotificationConsoleComponentProps } from "./NotificationConsoleComponent"; describe("NotificationConsoleComponent", () => { const createBlankProps = (): NotificationConsoleComponentProps => { diff --git a/src/Explorer/Menus/NotificationConsole/NotificationConsoleComponent.tsx b/src/Explorer/Menus/NotificationConsole/NotificationConsoleComponent.tsx index 218bd4893..c715159ca 100644 --- a/src/Explorer/Menus/NotificationConsole/NotificationConsoleComponent.tsx +++ b/src/Explorer/Menus/NotificationConsole/NotificationConsoleComponent.tsx @@ -17,25 +17,7 @@ import ChevronUpIcon from "../../../../images/QueryBuilder/CollapseChevronUp_16x import { ClientDefaults, KeyCodes } from "../../../Common/Constants"; import { useNotificationConsole } from "../../../hooks/useNotificationConsole"; import { userContext } from "../../../UserContext"; - -/** - * Log levels - */ -export enum ConsoleDataType { - Info = 0, - Error = 1, - InProgress = 2, -} - -/** - * Interface for the data/content that will be recorded - */ -export interface ConsoleData { - type: ConsoleDataType; - date: string; - message: string; - id?: string; -} +import { ConsoleData, ConsoleDataType } from "./ConsoleData"; export interface NotificationConsoleComponentProps { isConsoleExpanded: boolean; @@ -323,14 +305,13 @@ const PrPreview = (props: { pr: string }) => { ); }; -export const NotificationConsole: React.FC< - Pick -> = ({ - consoleData, - inProgressConsoleDataIdToBeDeleted, -}: Pick) => { +export const NotificationConsole: React.FC = () => { const setIsExpanded = useNotificationConsole((state) => state.setIsExpanded); const isExpanded = useNotificationConsole((state) => state.isExpanded); + const consoleData = useNotificationConsole((state) => state.consoleData); + const inProgressConsoleDataIdToBeDeleted = useNotificationConsole( + (state) => state.inProgressConsoleDataIdToBeDeleted + ); // TODO Refactor NotificationConsoleComponent into a functional component and remove this wrapper // This component only exists so we can use hooks and pass them down to a non-functional component return ( diff --git a/src/Explorer/Panes/DeleteCollectionConfirmationPane/__snapshots__/DeleteCollectionConfirmationPane.test.tsx.snap b/src/Explorer/Panes/DeleteCollectionConfirmationPane/__snapshots__/DeleteCollectionConfirmationPane.test.tsx.snap index 5032adad2..59e62296b 100644 --- a/src/Explorer/Panes/DeleteCollectionConfirmationPane/__snapshots__/DeleteCollectionConfirmationPane.test.tsx.snap +++ b/src/Explorer/Panes/DeleteCollectionConfirmationPane/__snapshots__/DeleteCollectionConfirmationPane.test.tsx.snap @@ -43,7 +43,7 @@ exports[`Delete Collection Confirmation Pane submit() should call delete collect variant="small" > Confirm by typing the container @@ -347,18 +347,18 @@ exports[`Delete Collection Confirmation Pane submit() should call delete collect value="" >
Help us improve Azure Cosmos DB! @@ -391,7 +391,7 @@ exports[`Delete Collection Confirmation Pane submit() should call delete collect variant="small" > What is the reason why you are deleting this container @@ -697,17 +697,17 @@ exports[`Delete Collection Confirmation Pane submit() should call delete collect value="" >