- Provision maximum RU/s required by this resource. Estimate your required RU/s withÂ
+ Estimate your required RU/s withÂ
- Max RU/s
+ Container
+ Max RU/s
;
public isPublishNotebookPaneEnabled: ko.Observable;
public isHostedDataExplorerEnabled: ko.Computed;
public isRightPanelV2Enabled: ko.Computed;
@@ -212,6 +216,8 @@ export default class Explorer {
private static readonly MaxNbDatabasesToAutoExpand = 5;
constructor(params?: ExplorerParams) {
+ this.gitHubClient = new GitHubClient(this.onGitHubClientError);
+ this.junoClient = new JunoClient();
this.setIsNotificationConsoleExpanded = params?.setIsNotificationConsoleExpanded;
this.setNotificationConsoleData = params?.setNotificationConsoleData;
this.setInProgressConsoleDataIdToBeDeleted = params?.setInProgressConsoleDataIdToBeDeleted;
@@ -318,7 +324,6 @@ export default class Explorer {
this.resourceTokenCollectionId = ko.observable();
this.resourceTokenCollection = ko.observable();
this.resourceTokenPartitionKey = ko.observable();
- this.isGitHubPaneEnabled = ko.observable(false);
this.isMongoIndexingEnabled = ko.observable(false);
this.isPublishNotebookPaneEnabled = ko.observable(false);
@@ -598,9 +603,6 @@ export default class Explorer {
refreshCommandBarButtons: () => this.refreshCommandBarButtons(),
refreshNotebookList: () => this.refreshNotebookList(),
});
-
- this.gitHubReposPane = this.notebookManager.gitHubReposPane;
- this.isGitHubPaneEnabled(true);
}
this.refreshCommandBarButtons();
@@ -648,6 +650,23 @@ export default class Explorer {
}
}
+ private onGitHubClientError = (error: any): void => {
+ Logger.logError(getErrorMessage(error), "NotebookManager/onGitHubClientError");
+
+ if (error.status === HttpStatusCodes.Unauthorized) {
+ this.gitHubOAuthService.resetToken();
+
+ this.showOkCancelModalDialog(
+ undefined,
+ "Cosmos DB cannot access your Github account anymore. Please connect to GitHub again.",
+ "Connect to GitHub",
+ () => this.openGitHubReposPanel("Connect to GitHub"),
+ "Cancel",
+ undefined
+ );
+ }
+ };
+
public openEnableSynapseLinkDialog(): void {
const addSynapseLinkDialogProps: DialogProps = {
linkProps: {
@@ -1951,14 +1970,14 @@ export default class Explorer {
}
}
- public onNewCollectionClicked(): void {
+ public onNewCollectionClicked(databaseId?: string): void {
if (userContext.apiType === "Cassandra") {
this.cassandraAddCollectionPane.open();
- } else if (userContext.features.enableReactPane) {
- this.openAddCollectionPanel();
- } else {
+ } else if (userContext.features.enableKOPanel) {
this.addCollectionPane.open(this.selectedDatabaseId());
document.getElementById("linkAddCollection").focus();
+ } else {
+ this.openAddCollectionPanel(databaseId);
}
}
@@ -2062,14 +2081,9 @@ export default class Explorer {
}
public openDeleteCollectionConfirmationPane(): void {
- let collectionName = PricingUtils.getCollectionName(userContext.apiType);
this.openSidePanel(
- "Delete " + collectionName,
-
+ "Delete " + getCollectionName(),
+
);
}
@@ -2090,28 +2104,32 @@ export default class Explorer {
}
public openSettingPane(): void {
- this.openSidePanel("Settings", );
+ this.openSidePanel(
+ "Settings",
+ this.expandConsole()} closePanel={this.closeSidePanel} />
+ );
}
public openExecuteSprocParamsPanel(storedProcedure: StoredProcedure): void {
this.openSidePanel(
"Input parameters",
this.expandConsole()}
closePanel={() => this.closeSidePanel()}
/>
);
}
- public async openAddCollectionPanel(): Promise {
+ public async openAddCollectionPanel(databaseId?: string): Promise {
await this.loadDatabaseOffers();
this.openSidePanel(
- "New Collection",
+ "New " + getCollectionName(),
this.closeSidePanel()}
openNotificationConsole={() => this.expandConsole()}
+ databaseId={databaseId}
/>
);
}
@@ -2148,13 +2166,26 @@ export default class Explorer {
this.openSidePanel(
"Upload File",
this.expandConsole()}
closePanel={this.closeSidePanel}
uploadFile={(name: string, content: string) => this.uploadFile(name, content, parent)}
/>
);
}
+ public openGitHubReposPanel(header: string, junoClient?: JunoClient): void {
+ this.openSidePanel(
+ header,
+ this.expandConsole()}
+ />
+ );
+ }
+
public openAddTableEntityPanel(queryTablesTab: QueryTablesTab, tableEntityListViewModel: TableListViewModal): void {
this.openSidePanel(
"Add Table Entity",
diff --git a/src/Explorer/Graph/GraphExplorerComponent/GraphExplorerAdapter.tsx b/src/Explorer/Graph/GraphExplorerComponent/GraphExplorerAdapter.tsx
deleted file mode 100644
index 77ab623fc..000000000
--- a/src/Explorer/Graph/GraphExplorerComponent/GraphExplorerAdapter.tsx
+++ /dev/null
@@ -1,63 +0,0 @@
-import * as React from "react";
-import { ReactAdapter } from "../../../Bindings/ReactBindingHandler";
-import { GraphConfig } from "../../Tabs/GraphTab";
-import * as ViewModels from "../../../Contracts/ViewModels";
-import { GraphExplorer, GraphAccessor } from "./GraphExplorer";
-
-interface Parameter {
- onIsNewVertexDisabledChange: (isEnabled: boolean) => void;
- onGraphAccessorCreated: (instance: GraphAccessor) => void;
- onIsFilterQueryLoading: (isFilterQueryLoading: boolean) => void;
- onIsValidQuery: (isValidQuery: boolean) => void;
- onIsPropertyEditing: (isEditing: boolean) => void;
- onIsGraphDisplayed: (isDisplayed: boolean) => void;
- onResetDefaultGraphConfigValues: () => void;
-
- graphConfigUiData: ViewModels.GraphConfigUiData;
- graphConfig?: GraphConfig;
-
- collectionPartitionKeyProperty: string;
- graphBackendEndpoint: string;
- databaseId: string;
- collectionId: string;
- masterKey: string;
-
- onLoadStartKey: number;
- onLoadStartKeyChange: (newKey: number) => void;
- resourceId: string;
-}
-
-export class GraphExplorerAdapter implements ReactAdapter {
- public params: Parameter;
- public parameters = {};
- public isNewVertexDisabled: boolean;
-
- public constructor(params: Parameter) {
- this.params = params;
- }
-
- public renderComponent(): JSX.Element {
- return (
-
- );
- }
-}
diff --git a/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.tsx b/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.tsx
index 0080771ad..409e57db5 100644
--- a/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.tsx
+++ b/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.tsx
@@ -19,11 +19,8 @@ import SettingsIcon from "../../../../images/settings_15x15.svg";
import SynapseIcon from "../../../../images/synapse-link.svg";
import { AuthType } from "../../../AuthType";
import * as Constants from "../../../Common/Constants";
-import { Areas } from "../../../Common/Constants";
import { configContext, Platform } from "../../../ConfigContext";
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 { CommandButtonComponentProps } from "../../Controls/CommandButton/CommandButtonComponent";
import Explorer from "../../Explorer";
@@ -537,14 +534,7 @@ function createManageGitHubAccountButton(container: Explorer): CommandButtonComp
return {
iconSrc: GitHubIcon,
iconAlt: label,
- onCommandClick: () => {
- if (!connectedToGitHub) {
- TelemetryProcessor.trace(Action.NotebooksGitHubConnect, ActionModifiers.Mark, {
- dataExplorerArea: Areas.Notebook,
- });
- }
- container.gitHubReposPane.open();
- },
+ onCommandClick: () => container.openGitHubReposPanel(label),
commandButtonLabel: label,
hasPopup: false,
disabled: false,
diff --git a/src/Explorer/Notebook/NotebookManager.tsx b/src/Explorer/Notebook/NotebookManager.tsx
index cba1b0ccd..53b3220c0 100644
--- a/src/Explorer/Notebook/NotebookManager.tsx
+++ b/src/Explorer/Notebook/NotebookManager.tsx
@@ -21,7 +21,7 @@ import { getFullName } from "../../Utils/UserUtils";
import Explorer from "../Explorer";
import { ContextualPaneBase } from "../Panes/ContextualPaneBase";
import { CopyNotebookPane } from "../Panes/CopyNotebookPane/CopyNotebookPane";
-import { GitHubReposPane } from "../Panes/GitHubReposPane";
+// import { GitHubReposPane } from "../Panes/GitHubReposPane";
import { PublishNotebookPane } from "../Panes/PublishNotebookPane/PublishNotebookPane";
import { ResourceTreeAdapter } from "../Tree/ResourceTreeAdapter";
import { NotebookContentProvider } from "./NotebookComponent/NotebookContentProvider";
@@ -50,7 +50,7 @@ export default class NotebookManager {
private gitHubContentProvider: GitHubContentProvider;
public gitHubOAuthService: GitHubOAuthService;
- private gitHubClient: GitHubClient;
+ public gitHubClient: GitHubClient;
public gitHubReposPane: ContextualPaneBase;
@@ -60,13 +60,6 @@ export default class NotebookManager {
this.gitHubOAuthService = new GitHubOAuthService(this.junoClient);
this.gitHubClient = new GitHubClient(this.onGitHubClientError);
- this.gitHubReposPane = new GitHubReposPane({
- id: "gitHubReposPane",
- visible: ko.observable(false),
- container: this.params.container,
- junoClient: this.junoClient,
- gitHubClient: this.gitHubClient,
- });
this.gitHubContentProvider = new GitHubContentProvider({
gitHubClient: this.gitHubClient,
@@ -92,9 +85,9 @@ export default class NotebookManager {
this.gitHubOAuthService.getTokenObservable().subscribe((token) => {
this.gitHubClient.setToken(token?.access_token);
-
- if (this.gitHubReposPane.visible()) {
- this.gitHubReposPane.open();
+ if (this?.gitHubOAuthService.isLoggedIn()) {
+ this.params.container.closeSidePanel();
+ this.params.container.openGitHubReposPanel("Manager GitHub settings", this.junoClient);
}
this.params.refreshCommandBarButtons();
@@ -163,7 +156,7 @@ export default class NotebookManager {
undefined,
"Cosmos DB cannot access your Github account anymore. Please connect to GitHub again.",
"Connect to GitHub",
- () => this.gitHubReposPane.open(),
+ () => this.params.container.openGitHubReposPanel("Connect to GitHub"),
"Cancel",
undefined
);
diff --git a/src/Explorer/OpenActions.test.ts b/src/Explorer/OpenActions.test.ts
index 47a3003af..e8113455f 100644
--- a/src/Explorer/OpenActions.test.ts
+++ b/src/Explorer/OpenActions.test.ts
@@ -3,7 +3,6 @@ import { ActionContracts } from "../Contracts/ExplorerContracts";
import * as ViewModels from "../Contracts/ViewModels";
import Explorer from "./Explorer";
import { handleOpenAction } from "./OpenActions";
-import AddCollectionPane from "./Panes/AddCollectionPane";
import CassandraAddCollectionPane from "./Panes/CassandraAddCollectionPane";
describe("OpenActions", () => {
@@ -15,8 +14,7 @@ describe("OpenActions", () => {
beforeEach(() => {
explorer = {} as Explorer;
- explorer.addCollectionPane = {} as AddCollectionPane;
- explorer.addCollectionPane.open = jest.fn();
+ explorer.onNewCollectionClicked = jest.fn();
explorer.cassandraAddCollectionPane = {} as CassandraAddCollectionPane;
explorer.cassandraAddCollectionPane.open = jest.fn();
explorer.closeAllPanes = () => {};
@@ -90,24 +88,24 @@ describe("OpenActions", () => {
});
describe("AddCollection pane kind", () => {
- it("string value should call addCollectionPane.open", () => {
+ it("string value should call explorer.onNewCollectionClicked", () => {
const action = {
actionType: "OpenPane",
paneKind: "AddCollection",
};
const actionHandled = handleOpenAction(action, [], explorer);
- expect(explorer.addCollectionPane.open).toHaveBeenCalled();
+ expect(explorer.onNewCollectionClicked).toHaveBeenCalled();
});
- it("enum value should call addCollectionPane.open", () => {
+ it("enum value should call explorer.onNewCollectionClicked", () => {
const action = {
actionType: "OpenPane",
paneKind: ActionContracts.PaneKind.AddCollection,
};
const actionHandled = handleOpenAction(action, [], explorer);
- expect(explorer.addCollectionPane.open).toHaveBeenCalled();
+ expect(explorer.onNewCollectionClicked).toHaveBeenCalled();
});
});
});
diff --git a/src/Explorer/OpenActions.ts b/src/Explorer/OpenActions.ts
index 4742978cc..8a7c87f53 100644
--- a/src/Explorer/OpenActions.ts
+++ b/src/Explorer/OpenActions.ts
@@ -141,7 +141,7 @@ function openPane(action: ActionContracts.OpenPane, explorer: Explorer) {
(action).paneKind === ActionContracts.PaneKind[ActionContracts.PaneKind.AddCollection]
) {
explorer.closeAllPanes();
- explorer.addCollectionPane.open();
+ explorer.onNewCollectionClicked();
} else if (
action.paneKind === ActionContracts.PaneKind.CassandraAddCollection ||
(action).paneKind === ActionContracts.PaneKind[ActionContracts.PaneKind.CassandraAddCollection]
diff --git a/src/Explorer/Panes/AddCollectionPane.html b/src/Explorer/Panes/AddCollectionPane.html
index 8f917cafd..4bba48d36 100644
--- a/src/Explorer/Panes/AddCollectionPane.html
+++ b/src/Explorer/Panes/AddCollectionPane.html
@@ -143,7 +143,6 @@
size="40"
class="collid"
data-bind="visible: databaseCreateNew, textInput: databaseId, hasFocus: firstFieldHasFocus"
- aria-label="Database id"
autofocus
/>
@@ -161,7 +160,6 @@
size="40"
class="collid"
data-bind="visible: !databaseCreateNew(), textInput: databaseId, hasFocus: firstFieldHasFocus"
- aria-label="Database id"
/>