diff --git a/src/Explorer/Controls/Settings/SettingsComponent.tsx b/src/Explorer/Controls/Settings/SettingsComponent.tsx index 982c74a39..637adc053 100644 --- a/src/Explorer/Controls/Settings/SettingsComponent.tsx +++ b/src/Explorer/Controls/Settings/SettingsComponent.tsx @@ -327,7 +327,6 @@ export class SettingsComponent extends React.Component; public isLeftPaneExpanded: ko.Observable; public selectedNode: ko.Observable; - /** - * @deprecated - * Use a local loading state and spinner instead. Using a global isRefreshing state causes problems. - * */ - public isRefreshingExplorer: ko.Observable; private resourceTree: ResourceTreeAdapter; // Resource Token @@ -299,22 +294,6 @@ export default class Explorer { this.databaseAccount = ko.observable(); this.subscriptionType = ko.observable(SharedConstants.CollectionCreation.DefaultSubscriptionType); - let firstInitialization = true; - this.isRefreshingExplorer = ko.observable(true); - this.isRefreshingExplorer.subscribe((isRefreshing: boolean) => { - if (!isRefreshing && firstInitialization) { - // set focus on first element - firstInitialization = false; - try { - document.getElementById("createNewContainerCommandButton").parentElement.parentElement.focus(); - } catch (e) { - Logger.logWarning( - "getElementById('createNewContainerCommandButton') failed to find element", - "Explorer/this.isRefreshingExplorer.subscribe" - ); - } - } - }); this.isAccountReady = ko.observable(false); this._isInitializingNotebooks = false; this.arcadiaToken = ko.observable(); @@ -1083,7 +1062,6 @@ export default class Explorer { } public refreshAllDatabases(isInitialLoad?: boolean): Q.Promise { - this.isRefreshingExplorer(true); const startKey: number = TelemetryProcessor.traceStart(Action.LoadDatabases, { dataExplorerArea: Constants.Areas.ResourceTree, }); @@ -1113,22 +1091,19 @@ export default class Explorer { this.deleteDatabasesFromList(deltaDatabases.toDelete); this.selectedNode(currentlySelectedNode); this._setLoadingStatusText("Fetching containers..."); - this.refreshAndExpandNewDatabases(deltaDatabases.toAdd) - .then( - () => { - this._setLoadingStatusText("Successfully fetched containers."); - deferred.resolve(); - }, - (reason) => { - this._setLoadingStatusText("Failed to fetch containers."); - deferred.reject(reason); - } - ) - .finally(() => this.isRefreshingExplorer(false)); + this.refreshAndExpandNewDatabases(deltaDatabases.toAdd).then( + () => { + this._setLoadingStatusText("Successfully fetched containers."); + deferred.resolve(); + }, + (reason) => { + this._setLoadingStatusText("Failed to fetch containers."); + deferred.reject(reason); + } + ); }, (error) => { this._setLoadingStatusText("Failed to fetch databases."); - this.isRefreshingExplorer(false); deferred.reject(error); const errorMessage = getErrorMessage(error); TelemetryProcessor.traceFailure( @@ -1188,7 +1163,6 @@ export default class Explorer { description: "Refresh button clicked", dataExplorerArea: Constants.Areas.ResourceTree, }); - this.isRefreshingExplorer(true); userContext.authType === AuthType.ResourceToken ? this.refreshDatabaseForResourceToken() : this.refreshAllDatabases(); diff --git a/src/Explorer/Tabs/DatabaseSettingsTab.ts b/src/Explorer/Tabs/DatabaseSettingsTab.ts index ec89e0ab8..5cff0f36f 100644 --- a/src/Explorer/Tabs/DatabaseSettingsTab.ts +++ b/src/Explorer/Tabs/DatabaseSettingsTab.ts @@ -401,7 +401,6 @@ export default class DatabaseSettingsTab extends TabsBase implements ViewModels. this._setBaseline(); this._wasAutopilotOriginallySet(this.isAutoPilotSelected()); } catch (error) { - this.container.isRefreshingExplorer(false); this.isExecutionError(true); console.error(error); const errorMessage = getErrorMessage(error); diff --git a/src/Explorer/Tree/Collection.ts b/src/Explorer/Tree/Collection.ts index 99df284e8..83fdc47d1 100644 --- a/src/Explorer/Tree/Collection.ts +++ b/src/Explorer/Tree/Collection.ts @@ -4,18 +4,24 @@ import * as _ from "underscore"; import UploadWorker from "worker-loader!../../workers/upload"; import { AuthType } from "../../AuthType"; import * as Constants from "../../Common/Constants"; +import { createDocument } from "../../Common/dataAccess/createDocument"; +import { getCollectionUsageSizeInKB } from "../../Common/dataAccess/getCollectionDataUsageSize"; +import { readCollectionOffer } from "../../Common/dataAccess/readCollectionOffer"; import { readStoredProcedures } from "../../Common/dataAccess/readStoredProcedures"; import { readTriggers } from "../../Common/dataAccess/readTriggers"; import { readUserDefinedFunctions } from "../../Common/dataAccess/readUserDefinedFunctions"; -import { readCollectionOffer } from "../../Common/dataAccess/readCollectionOffer"; -import { getCollectionUsageSizeInKB } from "../../Common/dataAccess/getCollectionDataUsageSize"; +import { getErrorMessage, getErrorStack } from "../../Common/ErrorHandlingUtils"; import * as Logger from "../../Common/Logger"; +import { fetchPortalNotifications } from "../../Common/PortalNotifications"; +import { configContext, Platform } from "../../ConfigContext"; import * as DataModels from "../../Contracts/DataModels"; import * as ViewModels from "../../Contracts/ViewModels"; import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants"; import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor"; +import { userContext } from "../../UserContext"; import * as NotificationConsoleUtils from "../../Utils/NotificationConsoleUtils"; import { StartUploadMessageParams, UploadDetails, UploadDetailsRecord } from "../../workers/upload/definitions"; +import Explorer from "../Explorer"; import { ConsoleDataType } from "../Menus/NotificationConsole/NotificationConsoleComponent"; import { CassandraAPIDataClient, CassandraTableKey, CassandraTableKeys } from "../Tables/TableDataClient"; import ConflictsTab from "../Tabs/ConflictsTab"; @@ -32,12 +38,6 @@ import DocumentId from "./DocumentId"; import StoredProcedure from "./StoredProcedure"; import Trigger from "./Trigger"; import UserDefinedFunction from "./UserDefinedFunction"; -import { configContext, Platform } from "../../ConfigContext"; -import Explorer from "../Explorer"; -import { userContext } from "../../UserContext"; -import { fetchPortalNotifications } from "../../Common/PortalNotifications"; -import { getErrorMessage, getErrorStack } from "../../Common/ErrorHandlingUtils"; -import { createDocument } from "../../Common/dataAccess/createDocument"; export default class Collection implements ViewModels.Collection { public nodeKind: string; @@ -1200,7 +1200,6 @@ export default class Collection implements ViewModels.Collection { public async loadOffer(): Promise { if (!this.container.isServerlessEnabled() && !this.offer()) { - this.container.isRefreshingExplorer(true); const startKey: number = TelemetryProcessor.traceStart(Action.LoadOffers, { databaseName: this.databaseId, collectionName: this.id(), @@ -1237,8 +1236,6 @@ export default class Collection implements ViewModels.Collection { startKey ); throw error; - } finally { - this.container.isRefreshingExplorer(false); } } } diff --git a/src/Main.tsx b/src/Main.tsx index 1ce897294..836dc4e82 100644 --- a/src/Main.tsx +++ b/src/Main.tsx @@ -211,10 +211,7 @@ const App: React.FunctionComponent = () => { {/* Splitter - End */} {/* Collections Tree - End */} -
+
diff --git a/src/RouteHandlers/TabRouteHandler.ts b/src/RouteHandlers/TabRouteHandler.ts index 2c74c53fe..9cb2d8ad8 100644 --- a/src/RouteHandlers/TabRouteHandler.ts +++ b/src/RouteHandlers/TabRouteHandler.ts @@ -1,9 +1,8 @@ +import crossroads from "crossroads"; +import hasher from "hasher"; import * as _ from "underscore"; import * as Constants from "../Common/Constants"; import * as ViewModels from "../Contracts/ViewModels"; - -import crossroads from "crossroads"; -import hasher from "hasher"; import ScriptTabBase from "../Explorer/Tabs/ScriptTabBase"; import TabsBase from "../Explorer/Tabs/TabsBase"; @@ -398,14 +397,7 @@ export class TabRouteHandler { private _executeActionHelper(action: () => void): void { const explorer = window.dataExplorer; - if (!!explorer && (explorer.isRefreshingExplorer() || !explorer.isAccountReady())) { - const refreshSubscription = explorer.isRefreshingExplorer.subscribe((isRefreshing: boolean) => { - if (!isRefreshing) { - action(); - refreshSubscription.dispose(); - } - }); - } else { + if (explorer && explorer.isAccountReady()) { action(); } } diff --git a/src/hooks/useKnockoutExplorer.ts b/src/hooks/useKnockoutExplorer.ts index bed243abb..025669c21 100644 --- a/src/hooks/useKnockoutExplorer.ts +++ b/src/hooks/useKnockoutExplorer.ts @@ -160,7 +160,6 @@ function configureHostedWithResourceToken(config: ResourceToken, explorerParams: databaseAccount, features: extractFeatures(), }); - explorer.isRefreshingExplorer(false); return explorer; }