mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-20 09:20:16 +00:00
Remove Explorer Stub and ViewModel.Explorer (#101)
This commit is contained in:
@@ -20,6 +20,7 @@ import DiscardIcon from "../../../images/discard.svg";
|
||||
import DeleteIcon from "../../../images/delete.svg";
|
||||
import { QueryIterator, ItemDefinition, Resource, ConflictDefinition } from "@azure/cosmos";
|
||||
import { MinimalQueryIterator } from "../../Common/IteratorUtilities";
|
||||
import Explorer from "../Explorer";
|
||||
|
||||
export default class ConflictsTab extends TabsBase implements ViewModels.ConflictsTab {
|
||||
public selectedConflictId: ko.Observable<ViewModels.ConflictId>;
|
||||
@@ -49,7 +50,7 @@ export default class ConflictsTab extends TabsBase implements ViewModels.Conflic
|
||||
public conflictIds: ko.ObservableArray<ViewModels.ConflictId>;
|
||||
|
||||
private _documentsIterator: MinimalQueryIterator;
|
||||
private _container: ViewModels.Explorer;
|
||||
private _container: Explorer;
|
||||
private _acceptButtonLabel: ko.Observable<string> = ko.observable("Save");
|
||||
protected _selfLink: string;
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import { Action } from "../../Shared/Telemetry/TelemetryConstants";
|
||||
import { CosmosClient } from "../../Common/CosmosClient";
|
||||
import { PlatformType } from "../../PlatformType";
|
||||
import { RequestOptions } from "@azure/cosmos/dist-esm";
|
||||
import Explorer from "../Explorer";
|
||||
|
||||
const updateThroughputBeyondLimitWarningMessage: string = `
|
||||
You are about to request an increase in throughput beyond the pre-allocated capacity.
|
||||
@@ -94,7 +95,7 @@ export default class DatabaseSettingsTab extends TabsBase
|
||||
private _hasProvisioningTypeChanged: ko.Computed<boolean>;
|
||||
private _wasAutopilotOriginallySet: ko.Observable<boolean>;
|
||||
private _offerReplacePending: ko.Computed<boolean>;
|
||||
private container: ViewModels.Explorer;
|
||||
private container: Explorer;
|
||||
|
||||
constructor(options: ViewModels.TabOptions) {
|
||||
super(options);
|
||||
|
||||
@@ -25,6 +25,7 @@ import SynapseIcon from "../../../images/synapse-link.svg";
|
||||
import { extractPartitionKey, PartitionKeyDefinition, QueryIterator, ItemDefinition, Resource } from "@azure/cosmos";
|
||||
import { ConsoleDataType } from "../Menus/NotificationConsole/NotificationConsoleComponent";
|
||||
import { NotificationConsoleUtils } from "../../Utils/NotificationConsoleUtils";
|
||||
import Explorer from "../Explorer";
|
||||
|
||||
export default class DocumentsTab extends TabsBase implements ViewModels.DocumentsTab {
|
||||
public selectedDocumentId: ko.Observable<ViewModels.DocumentId>;
|
||||
@@ -957,7 +958,7 @@ export default class DocumentsTab extends TabsBase implements ViewModels.Documen
|
||||
);
|
||||
}
|
||||
|
||||
public static _createUploadButton(container: ViewModels.Explorer): ViewModels.NavbarButtonConfig {
|
||||
public static _createUploadButton(container: Explorer): ViewModels.NavbarButtonConfig {
|
||||
const label = "Upload Item";
|
||||
return {
|
||||
iconSrc: UploadIcon,
|
||||
|
||||
@@ -3,12 +3,13 @@ import { GalleryAndNotebookViewerComponentProps } from "../Controls/NotebookGall
|
||||
import { GalleryAndNotebookViewerComponentAdapter } from "../Controls/NotebookGallery/GalleryAndNotebookViewerComponentAdapter";
|
||||
import { GalleryTab as GalleryViewerTab, SortBy } from "../Controls/NotebookGallery/GalleryViewerComponent";
|
||||
import TabsBase from "./TabsBase";
|
||||
import Explorer from "../Explorer";
|
||||
|
||||
/**
|
||||
* Notebook gallery tab
|
||||
*/
|
||||
export default class GalleryTab extends TabsBase implements ViewModels.Tab {
|
||||
private container: ViewModels.Explorer;
|
||||
private container: Explorer;
|
||||
public galleryAndNotebookViewerComponentAdapter: GalleryAndNotebookViewerComponentAdapter;
|
||||
|
||||
constructor(options: ViewModels.GalleryTabOptions) {
|
||||
@@ -29,7 +30,7 @@ export default class GalleryTab extends TabsBase implements ViewModels.Tab {
|
||||
this.galleryAndNotebookViewerComponentAdapter = new GalleryAndNotebookViewerComponentAdapter(props);
|
||||
}
|
||||
|
||||
protected getContainer(): ViewModels.Explorer {
|
||||
protected getContainer(): Explorer {
|
||||
return this.container;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,10 +13,11 @@ import { CosmosClient } from "../../Common/CosmosClient";
|
||||
import { HashMap } from "../../Common/HashMap";
|
||||
import { NotificationConsoleUtils } from "../../Utils/NotificationConsoleUtils";
|
||||
import { PlatformType } from "../../PlatformType";
|
||||
import Explorer from "../Explorer";
|
||||
|
||||
export default class MongoShellTab extends TabsBase implements ViewModels.MongoShellTab {
|
||||
public url: ko.Computed<string>;
|
||||
private _container: ViewModels.Explorer;
|
||||
private _container: Explorer;
|
||||
private _runtimeEndpoint: string;
|
||||
private _logTraces: HashMap<number>;
|
||||
|
||||
|
||||
@@ -27,10 +27,11 @@ import { NotebookComponentAdapter } from "../Notebook/NotebookComponent/Notebook
|
||||
import { NotebookConfigurationUtils } from "../../Utils/NotebookConfigurationUtils";
|
||||
import { KernelSpecsDisplay, NotebookClientV2 } from "../Notebook/NotebookClientV2";
|
||||
import { config } from "../../Config";
|
||||
import Explorer from "../Explorer";
|
||||
|
||||
export default class NotebookTabV2 extends TabsBase implements ViewModels.Tab {
|
||||
private static clientManager: NotebookClientV2;
|
||||
private container: ViewModels.Explorer;
|
||||
private container: Explorer;
|
||||
public notebookPath: ko.Observable<string>;
|
||||
private selectedSparkPool: ko.Observable<string>;
|
||||
private notebookComponentAdapter: NotebookComponentAdapter;
|
||||
@@ -104,7 +105,7 @@ export default class NotebookTabV2 extends TabsBase implements ViewModels.Tab {
|
||||
return await this.configureServiceEndpoints(this.notebookComponentAdapter.getCurrentKernelName());
|
||||
}
|
||||
|
||||
protected getContainer(): ViewModels.Explorer {
|
||||
protected getContainer(): Explorer {
|
||||
return this.container;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
NotebookViewerComponentProps
|
||||
} from "../Controls/NotebookViewer/NotebookViewerComponent";
|
||||
import TabsBase from "./TabsBase";
|
||||
import Explorer from "../Explorer";
|
||||
|
||||
/**
|
||||
* Notebook Viewer tab
|
||||
@@ -29,7 +30,7 @@ class NotebookViewerComponentAdapter implements ReactAdapter {
|
||||
}
|
||||
|
||||
export default class NotebookViewerTab extends TabsBase implements ViewModels.Tab {
|
||||
private container: ViewModels.Explorer;
|
||||
private container: Explorer;
|
||||
public notebookUrl: string;
|
||||
|
||||
public notebookViewerComponentAdapter: NotebookViewerComponentAdapter;
|
||||
@@ -49,7 +50,7 @@ export default class NotebookViewerTab extends TabsBase implements ViewModels.Ta
|
||||
});
|
||||
}
|
||||
|
||||
protected getContainer(): ViewModels.Explorer {
|
||||
protected getContainer(): Explorer {
|
||||
return this.container;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { CollectionStub, DatabaseStub } from "../../Explorer/OpenActionsStubs";
|
||||
import QueryTab from "./QueryTab";
|
||||
|
||||
describe("Query Tab", () => {
|
||||
function getNewQueryTabForContainer(container: ViewModels.Explorer): ViewModels.QueryTab {
|
||||
function getNewQueryTabForContainer(container: Explorer): ViewModels.QueryTab {
|
||||
const database: ViewModels.Database = new DatabaseStub({
|
||||
container: container,
|
||||
id: ko.observable<string>("test"),
|
||||
@@ -54,7 +54,7 @@ describe("Query Tab", () => {
|
||||
});
|
||||
|
||||
describe("isQueryMetricsEnabled()", () => {
|
||||
let explorer: ViewModels.Explorer;
|
||||
let explorer: Explorer;
|
||||
|
||||
beforeEach(() => {
|
||||
explorer = new Explorer({ documentClientUtility: null, notificationsClient: null, isEmulator: false });
|
||||
@@ -74,7 +74,7 @@ describe("Query Tab", () => {
|
||||
});
|
||||
|
||||
describe("Save Queries command button", () => {
|
||||
let explorer: ViewModels.Explorer;
|
||||
let explorer: Explorer;
|
||||
|
||||
beforeEach(() => {
|
||||
explorer = new Explorer({ documentClientUtility: null, notificationsClient: null, isEmulator: false });
|
||||
|
||||
@@ -115,7 +115,7 @@ export default class QueryTab extends TabsBase implements ViewModels.QueryTab, V
|
||||
};
|
||||
|
||||
this._isSaveQueriesEnabled = ko.computed<boolean>(() => {
|
||||
const container: ViewModels.Explorer = this.collection && this.collection.container;
|
||||
const container = this.collection && this.collection.container;
|
||||
return (container && (container.isPreferredApiDocumentDB() || container.isPreferredApiGraph())) || false;
|
||||
});
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import ExecuteQueryIcon from "../../../images/ExecuteQuery.svg";
|
||||
import AddEntityIcon from "../../../images/AddEntity.svg";
|
||||
import EditEntityIcon from "../../../images/Edit-entity.svg";
|
||||
import DeleteEntitiesIcon from "../../../images/DeleteEntities.svg";
|
||||
import Explorer from "../Explorer";
|
||||
|
||||
// Will act as table explorer class
|
||||
export default class QueryTablesTab extends TabsBase {
|
||||
@@ -31,7 +32,7 @@ export default class QueryTablesTab extends TabsBase {
|
||||
public deleteEntityButton: ViewModels.Button;
|
||||
public queryBuilderButton: ViewModels.Button;
|
||||
public queryTextButton: ViewModels.Button;
|
||||
public container: ViewModels.Explorer;
|
||||
public container: Explorer;
|
||||
|
||||
constructor(options: ViewModels.TabOptions) {
|
||||
super(options);
|
||||
|
||||
@@ -177,7 +177,7 @@ describe("Settings tab", () => {
|
||||
});
|
||||
|
||||
describe("Should update collection", () => {
|
||||
let explorer: ViewModels.Explorer;
|
||||
let explorer: Explorer;
|
||||
|
||||
beforeEach(() => {
|
||||
explorer = new Explorer({ documentClientUtility: null, notificationsClient: null, isEmulator: false });
|
||||
@@ -259,7 +259,7 @@ describe("Settings tab", () => {
|
||||
});
|
||||
|
||||
describe("Get Conflict Resolution configuration from user", () => {
|
||||
let explorer: ViewModels.Explorer;
|
||||
let explorer: Explorer;
|
||||
|
||||
beforeEach(() => {
|
||||
explorer = new Explorer({ documentClientUtility: null, notificationsClient: null, isEmulator: false });
|
||||
|
||||
@@ -17,6 +17,7 @@ import { Action } from "../../Shared/Telemetry/TelemetryConstants";
|
||||
import { CosmosClient } from "../../Common/CosmosClient";
|
||||
import { PlatformType } from "../../PlatformType";
|
||||
import { RequestOptions } from "@azure/cosmos/dist-esm";
|
||||
import Explorer from "../Explorer";
|
||||
|
||||
const ttlWarning: string = `
|
||||
The system will automatically delete items based on the TTL value (in seconds) you provide, without needing a delete operation explicitly issued by a client application.
|
||||
@@ -218,7 +219,7 @@ export default class SettingsTab extends TabsBase implements ViewModels.Settings
|
||||
public throughputModeRadioName: string;
|
||||
|
||||
private _offerReplacePending: ko.PureComputed<boolean>;
|
||||
private container: ViewModels.Explorer;
|
||||
private container: Explorer;
|
||||
private _wasAutopilotOriginallySet: ko.Observable<boolean>;
|
||||
private _isAutoPilotDirty: ko.Computed<boolean>;
|
||||
private _hasProvisioningTypeChanged: ko.Computed<boolean>;
|
||||
|
||||
@@ -2,12 +2,13 @@ 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";
|
||||
|
||||
export default class SparkMasterTab extends TabsBase {
|
||||
public sparkMasterSrc: ko.Observable<string>;
|
||||
|
||||
private _clusterConnectionInfo: DataModels.SparkClusterConnectionInfo;
|
||||
private _container: ViewModels.Explorer;
|
||||
private _container: Explorer;
|
||||
|
||||
constructor(options: ViewModels.SparkMasterTabOptions) {
|
||||
super(options);
|
||||
|
||||
@@ -8,6 +8,7 @@ import { WaitsForTemplateViewModel } from "../WaitsForTemplateViewModel";
|
||||
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||
import ThemeUtility from "../../Common/ThemeUtility";
|
||||
import DocumentClientUtilityBase from "../../Common/DocumentClientUtilityBase";
|
||||
import Explorer from "../Explorer";
|
||||
|
||||
// TODO: Use specific actions for logging telemetry data
|
||||
export default class TabsBase extends WaitsForTemplateViewModel implements ViewModels.Tab {
|
||||
@@ -79,7 +80,7 @@ export default class TabsBase extends WaitsForTemplateViewModel implements ViewM
|
||||
}
|
||||
|
||||
public onCloseTabButtonClick(): void {
|
||||
const explorer: ViewModels.Explorer = this.getContainer();
|
||||
const explorer = this.getContainer();
|
||||
explorer.tabsManager.closeTab(this.tabId, explorer);
|
||||
|
||||
TelemetryProcessor.trace(Action.Tab, ActionModifiers.Close, {
|
||||
@@ -173,7 +174,7 @@ export default class TabsBase extends WaitsForTemplateViewModel implements ViewM
|
||||
return Q();
|
||||
}
|
||||
|
||||
protected getContainer(): ViewModels.Explorer {
|
||||
protected getContainer(): Explorer {
|
||||
return (this.collection && this.collection.container) || (this.database && this.database.container);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import QueryTab from "./QueryTab";
|
||||
|
||||
describe("Tabs manager tests", () => {
|
||||
let tabsManager: TabsManager;
|
||||
let explorer: ViewModels.Explorer;
|
||||
let explorer: Explorer;
|
||||
let database: ViewModels.Database;
|
||||
let collection: ViewModels.Collection;
|
||||
let queryTab: QueryTab;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import * as ko from "knockout";
|
||||
import * as ViewModels from "../../Contracts/ViewModels";
|
||||
import TabsManagerTemplate from "./TabsManager.html";
|
||||
import Explorer from "../Explorer";
|
||||
|
||||
export class TabsManager {
|
||||
public openedTabs: ko.ObservableArray<ViewModels.Tab>;
|
||||
@@ -62,7 +63,7 @@ export class TabsManager {
|
||||
this.openedTabs([]);
|
||||
}
|
||||
|
||||
public closeTab(tabId: string, explorer: ViewModels.Explorer): void {
|
||||
public closeTab(tabId: string, explorer: Explorer): void {
|
||||
const tabIndex: number = this.openedTabs().findIndex((tab: ViewModels.Tab) => tab.tabId === tabId);
|
||||
if (tabIndex !== -1) {
|
||||
const tabToActive: ViewModels.Tab = this.openedTabs()[tabIndex + 1] || this.openedTabs()[tabIndex - 1];
|
||||
|
||||
@@ -5,6 +5,7 @@ import TabsBase from "./TabsBase";
|
||||
import * as React from "react";
|
||||
import { ReactAdapter } from "../../Bindings/ReactBindingHandler";
|
||||
import { NotebookTerminalComponent } from "../Controls/Notebook/NotebookTerminalComponent";
|
||||
import Explorer from "../Explorer";
|
||||
|
||||
/**
|
||||
* Notebook terminal tab
|
||||
@@ -30,7 +31,7 @@ class NotebookTerminalComponentAdapter implements ReactAdapter {
|
||||
}
|
||||
|
||||
export default class TerminalTab extends TabsBase implements ViewModels.Tab {
|
||||
private container: ViewModels.Explorer;
|
||||
private container: Explorer;
|
||||
private notebookTerminalComponentAdapter: NotebookTerminalComponentAdapter;
|
||||
|
||||
constructor(options: ViewModels.TerminalTabOptions) {
|
||||
@@ -48,7 +49,7 @@ export default class TerminalTab extends TabsBase implements ViewModels.Tab {
|
||||
});
|
||||
}
|
||||
|
||||
protected getContainer(): ViewModels.Explorer {
|
||||
protected getContainer(): Explorer {
|
||||
return this.container;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user