From 2d2d8b6efed7d7ecf654df108dd4093ce4f750c3 Mon Sep 17 00:00:00 2001 From: Steve Faulkner Date: Wed, 24 Feb 2021 17:48:33 -0600 Subject: [PATCH] Remove Unused Tabs (#450) --- .eslintignore | 1 - src/Contracts/ViewModels.ts | 2 +- src/Explorer/ComponentRegisterer.test.ts | 8 --- src/Explorer/ComponentRegisterer.ts | 3 - .../CollapsiblePanelComponent.ts | 56 ------------------- .../collapsible-panel-component.html | 44 --------------- src/Explorer/Tabs/SparkMasterTab.html | 7 --- src/Explorer/Tabs/SparkMasterTab.ts | 35 ------------ src/Explorer/Tabs/TabComponents.ts | 10 ---- tsconfig.strict.json | 1 - 10 files changed, 1 insertion(+), 166 deletions(-) delete mode 100644 src/Explorer/Controls/CollapsiblePanel/CollapsiblePanelComponent.ts delete mode 100644 src/Explorer/Controls/CollapsiblePanel/collapsible-panel-component.html delete mode 100644 src/Explorer/Tabs/SparkMasterTab.html delete mode 100644 src/Explorer/Tabs/SparkMasterTab.ts diff --git a/.eslintignore b/.eslintignore index 5f664a0b7..9caea52ea 100644 --- a/.eslintignore +++ b/.eslintignore @@ -200,7 +200,6 @@ src/Explorer/Tabs/QueryTab.test.ts src/Explorer/Tabs/QueryTab.ts src/Explorer/Tabs/QueryTablesTab.ts src/Explorer/Tabs/ScriptTabBase.ts -src/Explorer/Tabs/SparkMasterTab.ts src/Explorer/Tabs/StoredProcedureTab.ts src/Explorer/Tabs/TabComponents.ts src/Explorer/Tabs/TabsBase.ts diff --git a/src/Contracts/ViewModels.ts b/src/Contracts/ViewModels.ts index 661f2758f..d4f0a07a2 100644 --- a/src/Contracts/ViewModels.ts +++ b/src/Contracts/ViewModels.ts @@ -355,7 +355,7 @@ export enum CollectionTabKind { Notebook = 13 /* Deprecated */, Terminal = 14, NotebookV2 = 15, - SparkMasterTab = 16, + SparkMasterTab = 16 /* Deprecated */, Gallery = 17, NotebookViewer = 18, Schema = 19, diff --git a/src/Explorer/ComponentRegisterer.test.ts b/src/Explorer/ComponentRegisterer.test.ts index 7ad1dba5b..4820c2357 100644 --- a/src/Explorer/ComponentRegisterer.test.ts +++ b/src/Explorer/ComponentRegisterer.test.ts @@ -20,10 +20,6 @@ describe("Component Registerer", () => { expect(ko.components.isRegistered("graph-style")).toBe(true); }); - it("should register collapsible-panel component", () => { - expect(ko.components.isRegistered("collapsible-panel")).toBe(true); - }); - it("should register json-editor component", () => { expect(ko.components.isRegistered("json-editor")).toBe(true); }); @@ -69,10 +65,6 @@ describe("Component Registerer", () => { expect(ko.components.isRegistered("terminal-tab")).toBe(true); }); - it("should register spark-master-tab component", () => { - expect(ko.components.isRegistered("spark-master-tab")).toBe(true); - }); - it("should register mongo-shell-tab component", () => { expect(ko.components.isRegistered("mongo-shell-tab")).toBe(true); }); diff --git a/src/Explorer/ComponentRegisterer.ts b/src/Explorer/ComponentRegisterer.ts index de781159a..b02c485e8 100644 --- a/src/Explorer/ComponentRegisterer.ts +++ b/src/Explorer/ComponentRegisterer.ts @@ -1,7 +1,6 @@ import * as ko from "knockout"; import * as PaneComponents from "./Panes/PaneComponents"; import * as TabComponents from "./Tabs/TabComponents"; -import { CollapsiblePanelComponent } from "./Controls/CollapsiblePanel/CollapsiblePanelComponent"; import { DiffEditorComponent } from "./Controls/DiffEditor/DiffEditorComponent"; import { DynamicListComponent } from "./Controls/DynamicList/DynamicListComponent"; import { EditorComponent } from "./Controls/Editor/EditorComponent"; @@ -17,7 +16,6 @@ ko.components.register("input-typeahead", new InputTypeaheadComponent()); ko.components.register("new-vertex-form", NewVertexComponent); ko.components.register("error-display", new ErrorDisplayComponent()); ko.components.register("graph-style", GraphStyleComponent); -ko.components.register("collapsible-panel", new CollapsiblePanelComponent()); ko.components.register("editor", new EditorComponent()); ko.components.register("json-editor", new JsonEditorComponent()); ko.components.register("diff-editor", new DiffEditorComponent()); @@ -39,7 +37,6 @@ ko.components.register("mongo-shell-tab", new TabComponents.MongoShellTab()); ko.components.register("conflicts-tab", new TabComponents.ConflictsTab()); ko.components.register("notebookv2-tab", new TabComponents.NotebookV2Tab()); ko.components.register("terminal-tab", new TabComponents.TerminalTab()); -ko.components.register("spark-master-tab", new TabComponents.SparkMasterTab()); ko.components.register("gallery-tab", new TabComponents.GalleryTab()); ko.components.register("notebook-viewer-tab", new TabComponents.NotebookViewerTab()); diff --git a/src/Explorer/Controls/CollapsiblePanel/CollapsiblePanelComponent.ts b/src/Explorer/Controls/CollapsiblePanel/CollapsiblePanelComponent.ts deleted file mode 100644 index 9297a0423..000000000 --- a/src/Explorer/Controls/CollapsiblePanel/CollapsiblePanelComponent.ts +++ /dev/null @@ -1,56 +0,0 @@ -import * as ko from "knockout"; -import template from "./collapsible-panel-component.html"; - -/** - * Helper class for ko component registration - */ -export class CollapsiblePanelComponent { - constructor() { - return { - viewModel: CollapsiblePanelViewModel, - template, - }; - } -} - -/** - * Parameters for this component - */ -interface CollapsiblePanelParams { - collapsedTitle: ko.Observable; - expandedTitle: ko.Observable; - isCollapsed?: ko.Observable; - collapseToLeft?: boolean; -} - -/** - * Collapsible panel: - * Contains a header with [>] button to collapse and an title ("expandedTitle"). - * Collapsing the panel: - * - shrinks width to narrow amount - * - hides children - * - shows [<] - * - shows vertical title ("collapsedTitle") - * - the default behavior is to collapse to the right (ie, place this component on the right or use "collapseToLeft" parameter) - * - * How to use in your markup: - * - * - * - * - * Use the optional "isCollapsed" parameter to programmatically collapse/expand the pane from outside the component. - * Use the optional "collapseToLeft" parameter to collapse to the left. - */ -class CollapsiblePanelViewModel { - public params: CollapsiblePanelParams; - private isCollapsed: ko.Observable; - - public constructor(params: CollapsiblePanelParams) { - this.params = params; - this.isCollapsed = params.isCollapsed || ko.observable(false); - } - - public toggleCollapse(): void { - this.isCollapsed(!this.isCollapsed()); - } -} diff --git a/src/Explorer/Controls/CollapsiblePanel/collapsible-panel-component.html b/src/Explorer/Controls/CollapsiblePanel/collapsible-panel-component.html deleted file mode 100644 index 95e7bb523..000000000 --- a/src/Explorer/Controls/CollapsiblePanel/collapsible-panel-component.html +++ /dev/null @@ -1,44 +0,0 @@ -
-
- - Collapse - - -
- - - -
- - - - -
-
diff --git a/src/Explorer/Tabs/SparkMasterTab.html b/src/Explorer/Tabs/SparkMasterTab.html deleted file mode 100644 index ee27f00ee..000000000 --- a/src/Explorer/Tabs/SparkMasterTab.html +++ /dev/null @@ -1,7 +0,0 @@ -
- - -
diff --git a/src/Explorer/Tabs/SparkMasterTab.ts b/src/Explorer/Tabs/SparkMasterTab.ts deleted file mode 100644 index 2af66f8fd..000000000 --- a/src/Explorer/Tabs/SparkMasterTab.ts +++ /dev/null @@ -1,35 +0,0 @@ -import * as ko from "knockout"; -import * as DataModels from "../../Contracts/DataModels"; -import * as ViewModels from "../../Contracts/ViewModels"; -import TabsBase from "./TabsBase"; -import Explorer from "../Explorer"; - -interface SparkMasterTabOptions extends ViewModels.TabOptions { - clusterConnectionInfo: DataModels.SparkClusterConnectionInfo; - container: Explorer; -} - -export default class SparkMasterTab extends TabsBase { - public sparkMasterSrc: ko.Observable; - - private _clusterConnectionInfo: DataModels.SparkClusterConnectionInfo; - private _container: Explorer; - - constructor(options: SparkMasterTabOptions) { - super(options); - super.onActivate.bind(this); - this._container = options.container; - this._clusterConnectionInfo = options.clusterConnectionInfo; - const sparkMasterEndpoint = - this._clusterConnectionInfo && - this._clusterConnectionInfo.endpoints && - this._clusterConnectionInfo.endpoints.find( - (endpoint) => endpoint.kind === DataModels.SparkClusterEndpointKind.SparkUI - ); - this.sparkMasterSrc = ko.observable(sparkMasterEndpoint && sparkMasterEndpoint.endpoint); - } - - public getContainer() { - return this._container; - } -} diff --git a/src/Explorer/Tabs/TabComponents.ts b/src/Explorer/Tabs/TabComponents.ts index 23ee05c02..5c10289dd 100644 --- a/src/Explorer/Tabs/TabComponents.ts +++ b/src/Explorer/Tabs/TabComponents.ts @@ -1,7 +1,6 @@ import DocumentsTabTemplate from "./DocumentsTab.html"; import ConflictsTabTemplate from "./ConflictsTab.html"; import GraphTabTemplate from "./GraphTab.html"; -import SparkMasterTabTemplate from "./SparkMasterTab.html"; import NotebookV2TabTemplate from "./NotebookV2Tab.html"; import TerminalTabTemplate from "./TerminalTab.html"; import MongoDocumentsTabTemplate from "./MongoDocumentsTab.html"; @@ -60,15 +59,6 @@ export class GraphTab { } } -export class SparkMasterTab { - constructor() { - return { - viewModel: TabComponent, - template: SparkMasterTabTemplate, - }; - } -} - export class NotebookV2Tab { constructor() { return { diff --git a/tsconfig.strict.json b/tsconfig.strict.json index ab1df0c27..378251ebe 100644 --- a/tsconfig.strict.json +++ b/tsconfig.strict.json @@ -41,7 +41,6 @@ "./src/Definitions/plotly.js-cartesian-dist.d-min.ts", "./src/Definitions/svg.d.ts", "./src/Explorer/Controls/ErrorDisplayComponent/ErrorDisplayComponent.ts", - "./src/Explorer/Controls/CollapsiblePanel/CollapsiblePanelComponent.ts", "./src/Explorer/Controls/GitHub/GitHubStyleConstants.ts", "./src/Explorer/Controls/InputTypeahead/InputTypeahead.ts", "./src/Explorer/Controls/SmartUi/InputUtils.ts",