mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-20 01:11:25 +00:00
Update to ADO 5ed9b2130da7f822153531489d802c28986f5d30
This commit is contained in:
@@ -90,7 +90,10 @@ describe("test function", () => {
|
||||
|
||||
const wrapper = mount(<DefaultDirectoryDropdownComponent {...props} />);
|
||||
|
||||
wrapper.find("div.defaultDirectoryDropdown").simulate("click");
|
||||
wrapper
|
||||
.find("div.defaultDirectoryDropdown")
|
||||
.find("div.ms-Dropdown")
|
||||
.simulate("click");
|
||||
expect(wrapper.exists("div.ms-Callout-main")).toBe(true);
|
||||
wrapper
|
||||
.find("button.ms-Dropdown-item")
|
||||
@@ -99,7 +102,10 @@ describe("test function", () => {
|
||||
expect(props.onDefaultDirectoryChange).toBeCalled();
|
||||
expect(props.onDefaultDirectoryChange).toHaveBeenCalled();
|
||||
|
||||
wrapper.find("div.defaultDirectoryDropdown").simulate("click");
|
||||
wrapper
|
||||
.find("div.defaultDirectoryDropdown")
|
||||
.find("div.ms-Dropdown")
|
||||
.simulate("click");
|
||||
expect(wrapper.exists("div.ms-Callout-main")).toBe(true);
|
||||
wrapper
|
||||
.find("button.ms-Dropdown-item")
|
||||
|
||||
@@ -51,7 +51,7 @@ export class DirectoryListComponent extends React.Component<DirectoryListProps,
|
||||
const textFieldProps: ITextFieldProps = {
|
||||
className: "directoryListFilterTextBox",
|
||||
placeholder: "Filter by directory name",
|
||||
onBeforeChange: this._onFilterChanged,
|
||||
onChange: this._onFilterChanged,
|
||||
ariaLabel: "Directory filter text box"
|
||||
};
|
||||
|
||||
@@ -66,7 +66,7 @@ export class DirectoryListComponent extends React.Component<DirectoryListProps,
|
||||
);
|
||||
}
|
||||
|
||||
private _onFilterChanged = (text: string): void => {
|
||||
private _onFilterChanged = (event: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>, text?: string): void => {
|
||||
this.setState({
|
||||
filterText: text
|
||||
});
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,13 +2,13 @@ import { DefaultButton, IButtonProps, ITextFieldProps, TextField } from "office-
|
||||
import * as React from "react";
|
||||
import * as ViewModels from "../../../Contracts/ViewModels";
|
||||
import * as Constants from "../../../Common/Constants";
|
||||
import { Action, ActionModifiers } from "../../../Shared/Telemetry/TelemetryConstants";
|
||||
import { Areas } from "../../../Common/Constants";
|
||||
import { Action } from "../../../Shared/Telemetry/TelemetryConstants";
|
||||
import { RepoListItem } from "./GitHubReposComponent";
|
||||
import { ChildrenMargin } from "./GitHubStyleConstants";
|
||||
import { GitHubUtils } from "../../../Utils/GitHubUtils";
|
||||
import { IGitHubRepo } from "../../../GitHub/GitHubClient";
|
||||
import TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
||||
import UrlUtility from "../../../Common/UrlUtility";
|
||||
|
||||
export interface AddRepoComponentProps {
|
||||
container: ViewModels.Explorer;
|
||||
@@ -80,24 +80,24 @@ export class AddRepoComponent extends React.Component<AddRepoComponentProps, Add
|
||||
});
|
||||
let enteredUrl = this.state.textFieldValue;
|
||||
if (enteredUrl.indexOf("/tree/") === -1) {
|
||||
enteredUrl = `${enteredUrl}/tree/${AddRepoComponent.DefaultBranchName}`;
|
||||
enteredUrl = UrlUtility.createUri(enteredUrl, `tree/${AddRepoComponent.DefaultBranchName}`);
|
||||
}
|
||||
|
||||
const gitHubInfo = GitHubUtils.fromGitHubUri(enteredUrl);
|
||||
if (gitHubInfo) {
|
||||
const repoInfo = GitHubUtils.fromRepoUri(enteredUrl);
|
||||
if (repoInfo) {
|
||||
this.setState({
|
||||
textFieldValue: "",
|
||||
textFieldErrorMessage: undefined
|
||||
});
|
||||
|
||||
const repo = await this.props.getRepo(gitHubInfo.owner, gitHubInfo.repo);
|
||||
const repo = await this.props.getRepo(repoInfo.owner, repoInfo.repo);
|
||||
if (repo) {
|
||||
const item: RepoListItem = {
|
||||
key: GitHubUtils.toRepoFullName(repo.owner.login, repo.name),
|
||||
repo,
|
||||
branches: [
|
||||
{
|
||||
name: gitHubInfo.branch
|
||||
name: repoInfo.branch
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { DefaultButton, IButtonProps, Link, PrimaryButton } from "office-ui-fabric-react";
|
||||
import { DefaultButton, IButtonProps, PrimaryButton } from "office-ui-fabric-react";
|
||||
import * as React from "react";
|
||||
import { IGitHubBranch, IGitHubRepo } from "../../../GitHub/GitHubClient";
|
||||
import { AddRepoComponent, AddRepoComponentProps } from "./AddRepoComponent";
|
||||
|
||||
@@ -204,7 +204,9 @@ export class ReposListComponent extends React.Component<ReposListComponentProps>
|
||||
return <Dropdown {...dropdownProps} />;
|
||||
};
|
||||
|
||||
private onRenderBranchesDropdownList = (props: ISelectableDroppableTextProps<IDropdown, IDropdown>): JSX.Element => {
|
||||
private onRenderBranchesDropdownList = (
|
||||
props: ISelectableDroppableTextProps<IDropdown, HTMLDivElement>
|
||||
): JSX.Element => {
|
||||
const renderedList: JSX.Element[] = [];
|
||||
props.options.forEach((option: IDropdownOption) => {
|
||||
const item = (
|
||||
|
||||
@@ -112,6 +112,7 @@ export default class Explorer implements ViewModels.Explorer {
|
||||
public collapsedResourceTreeWidth: number = ExplorerMetrics.CollapsedResourceTreeWidth;
|
||||
|
||||
public databaseAccount: ko.Observable<ViewModels.DatabaseAccount>;
|
||||
public collectionCreationDefaults: ViewModels.CollectionCreationDefaults = SharedConstants.CollectionCreationDefaults;
|
||||
public subscriptionType: ko.Observable<ViewModels.SubscriptionType>;
|
||||
public quotaId: ko.Observable<string>;
|
||||
public defaultExperience: ko.Observable<string>;
|
||||
@@ -2161,6 +2162,9 @@ export default class Explorer implements ViewModels.Explorer {
|
||||
const authorizationToken = inputs.authorizationToken || "";
|
||||
const masterKey = inputs.masterKey || "";
|
||||
const databaseAccount = inputs.databaseAccount || null;
|
||||
if (inputs.defaultCollectionThroughput) {
|
||||
this.collectionCreationDefaults = inputs.defaultCollectionThroughput;
|
||||
}
|
||||
this.features(inputs.features);
|
||||
this.serverId(inputs.serverId);
|
||||
this.extensionEndpoint(inputs.extensionEndpoint || "");
|
||||
@@ -2575,7 +2579,7 @@ export default class Explorer implements ViewModels.Explorer {
|
||||
}
|
||||
|
||||
public async importAndOpen(path: string): Promise<boolean> {
|
||||
const name = NotebookUtil.getContentName(path);
|
||||
const name = NotebookUtil.getName(path);
|
||||
const item = NotebookUtil.createNotebookContentItem(name, path, "file");
|
||||
const parent = this.resourceTree.myNotebooksContentRoot;
|
||||
|
||||
@@ -3106,14 +3110,15 @@ export default class Explorer implements ViewModels.Explorer {
|
||||
})
|
||||
.then(() => this.resourceTree.triggerRender())
|
||||
.catch(reason => {
|
||||
NotificationConsoleUtils.logConsoleMessage(ConsoleDataType.Error, reason);
|
||||
const error = `Failed to create a new notebook: ${reason}`;
|
||||
NotificationConsoleUtils.logConsoleMessage(ConsoleDataType.Error, error);
|
||||
TelemetryProcessor.traceFailure(
|
||||
Action.CreateNewNotebook,
|
||||
{
|
||||
databaseAccountName: this.databaseAccount().name,
|
||||
defaultExperience: this.defaultExperience(),
|
||||
dataExplorerArea: Constants.Areas.Notebook,
|
||||
error: JSON.stringify(reason)
|
||||
error
|
||||
},
|
||||
startKey
|
||||
);
|
||||
|
||||
@@ -28,6 +28,7 @@ exports[`test render renders signed in with full info 1`] = `
|
||||
<FocusZone
|
||||
direction={2}
|
||||
isCircularNavigation={false}
|
||||
preventDefaultWhenHandled={true}
|
||||
>
|
||||
<CustomizedDefaultButton
|
||||
className="mecontrolHeaderButton"
|
||||
|
||||
@@ -60,7 +60,7 @@ export class NotebookContentProvider implements IContentProvider {
|
||||
}
|
||||
|
||||
private getContentProvider(path: string): IContentProvider {
|
||||
if (GitHubUtils.fromGitHubUri(path)) {
|
||||
if (GitHubUtils.fromContentUri(path)) {
|
||||
return this.gitHubContentProvider;
|
||||
}
|
||||
|
||||
|
||||
@@ -141,8 +141,7 @@ export class NotebookContentClient implements ViewModels.INotebookContentClient
|
||||
targetName += extension;
|
||||
}
|
||||
}
|
||||
const parsedPath = NotebookContentClient.parsePath(sourcePath);
|
||||
const targetPath = `${parsedPath.dirpath}${targetName}`;
|
||||
const targetPath = NotebookUtil.replaceName(sourcePath, targetName);
|
||||
return this.contentProvider
|
||||
.update<"file" | "notebook" | "directory">(this.getServerConfig(), sourcePath, { path: targetPath })
|
||||
.toPromise()
|
||||
@@ -214,21 +213,6 @@ export class NotebookContentClient implements ViewModels.INotebookContentClient
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param path
|
||||
* @returns basename and dirpath. Note: dirpath has trailing / already
|
||||
*/
|
||||
private static parsePath(path: string): { dirpath: string; basename: string } {
|
||||
const basename = path.split("/").pop();
|
||||
const dirpath = path.split(basename).shift();
|
||||
|
||||
return {
|
||||
dirpath,
|
||||
basename
|
||||
};
|
||||
}
|
||||
|
||||
private deleteNotebookFile(path: string): Promise<string> {
|
||||
return this.contentProvider
|
||||
.remove(this.getServerConfig(), path)
|
||||
|
||||
49
src/Explorer/Notebook/NotebookUtil.test.ts
Normal file
49
src/Explorer/Notebook/NotebookUtil.test.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import { NotebookUtil } from "./NotebookUtil";
|
||||
import { GitHubUtils } from "../../Utils/GitHubUtils";
|
||||
|
||||
const fileName = "file";
|
||||
const notebookName = "file.ipynb";
|
||||
const filePath = `folder/${fileName}`;
|
||||
const notebookPath = `folder/${notebookName}`;
|
||||
const gitHubFileUri = GitHubUtils.toContentUri("owner", "repo", "branch", filePath);
|
||||
const gitHubNotebookUri = GitHubUtils.toContentUri("owner", "repo", "branch", notebookPath);
|
||||
|
||||
describe("NotebookUtil", () => {
|
||||
describe("isNotebookFile", () => {
|
||||
it("works for jupyter file paths", () => {
|
||||
expect(NotebookUtil.isNotebookFile(filePath)).toBeFalsy();
|
||||
expect(NotebookUtil.isNotebookFile(notebookPath)).toBeTruthy();
|
||||
});
|
||||
|
||||
it("works for github file uris", () => {
|
||||
expect(NotebookUtil.isNotebookFile(gitHubFileUri)).toBeFalsy();
|
||||
expect(NotebookUtil.isNotebookFile(gitHubNotebookUri)).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe("getName", () => {
|
||||
it("works for jupyter file paths", () => {
|
||||
expect(NotebookUtil.getName(filePath)).toEqual(fileName);
|
||||
expect(NotebookUtil.getName(notebookPath)).toEqual(notebookName);
|
||||
});
|
||||
|
||||
it("works for github file uris", () => {
|
||||
expect(NotebookUtil.getName(gitHubFileUri)).toEqual(fileName);
|
||||
expect(NotebookUtil.getName(gitHubNotebookUri)).toEqual(notebookName);
|
||||
});
|
||||
});
|
||||
|
||||
describe("replaceName", () => {
|
||||
it("works for jupyter file paths", () => {
|
||||
expect(NotebookUtil.replaceName(filePath, "newName")).toEqual(filePath.replace(fileName, "newName"));
|
||||
expect(NotebookUtil.replaceName(notebookPath, "newName")).toEqual(notebookPath.replace(notebookName, "newName"));
|
||||
});
|
||||
|
||||
it("works for github file uris", () => {
|
||||
expect(NotebookUtil.replaceName(gitHubFileUri, "newName")).toEqual(gitHubFileUri.replace(fileName, "newName"));
|
||||
expect(NotebookUtil.replaceName(gitHubNotebookUri, "newName")).toEqual(
|
||||
gitHubNotebookUri.replace(notebookName, "newName")
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -2,6 +2,7 @@ import path from "path";
|
||||
import { ImmutableNotebook } from "@nteract/commutable";
|
||||
import { NotebookContentItem, NotebookContentItemType } from "./NotebookContentItem";
|
||||
import { StringUtils } from "../../Utils/StringUtils";
|
||||
import { GitHubUtils } from "../../Utils/GitHubUtils";
|
||||
|
||||
// Must match rx-jupyter' FileType
|
||||
export type FileType = "directory" | "file" | "notebook";
|
||||
@@ -11,7 +12,8 @@ export class NotebookUtil {
|
||||
* It's a notebook file if the filename ends with .ipynb.
|
||||
*/
|
||||
public static isNotebookFile(notebookPath: string): boolean {
|
||||
return StringUtils.endsWith(notebookPath, ".ipynb");
|
||||
const fileName = NotebookUtil.getName(notebookPath);
|
||||
return !!fileName && StringUtils.endsWith(fileName, ".ipynb");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,8 +70,34 @@ export class NotebookUtil {
|
||||
};
|
||||
}
|
||||
|
||||
public static getContentName(uri: string): string | undefined {
|
||||
const parts = uri.split("/");
|
||||
return parts.pop() || parts.pop(); // handle potential trailing slash
|
||||
public static getName(path: string): undefined | string {
|
||||
let relativePath: string = path;
|
||||
const contentInfo = GitHubUtils.fromContentUri(path);
|
||||
if (contentInfo) {
|
||||
relativePath = contentInfo.path;
|
||||
}
|
||||
|
||||
return relativePath.split("/").pop();
|
||||
}
|
||||
|
||||
public static replaceName(path: string, newName: string): string {
|
||||
const contentInfo = GitHubUtils.fromContentUri(path);
|
||||
if (contentInfo) {
|
||||
const contentName = contentInfo.path.split("/").pop();
|
||||
if (!contentName) {
|
||||
throw new Error(`Failed to extract name from github path ${contentInfo.path}`);
|
||||
}
|
||||
|
||||
const basePath = contentInfo.path.split(contentName).shift();
|
||||
return GitHubUtils.toContentUri(contentInfo.owner, contentInfo.repo, contentInfo.branch, `${basePath}${newName}`);
|
||||
}
|
||||
|
||||
const contentName = path.split("/").pop();
|
||||
if (!contentName) {
|
||||
throw new Error(`Failed to extract name from path ${path}`);
|
||||
}
|
||||
|
||||
const basePath = path.split(contentName).shift();
|
||||
return `${basePath}${newName}`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import { TextFieldProps } from "./Controls/DialogReactComponent/DialogComponent"
|
||||
import { UploadDetails } from "../workers/upload/definitions";
|
||||
import { UploadFilePane } from "./Panes/UploadFilePane";
|
||||
import { Versions } from "../../src/Contracts/ExplorerContracts";
|
||||
import { CollectionCreationDefaults } from "../Shared/Constants";
|
||||
|
||||
export class ExplorerStub implements ViewModels.Explorer {
|
||||
public flight: ko.Observable<string>;
|
||||
@@ -32,6 +33,7 @@ export class ExplorerStub implements ViewModels.Explorer {
|
||||
public collectionTreeNodeAltText: ko.Observable<string>;
|
||||
public refreshTreeTitle: ko.Observable<string>;
|
||||
public collapsedResourceTreeWidth: number;
|
||||
public collectionCreationDefaults: ViewModels.CollectionCreationDefaults = CollectionCreationDefaults;
|
||||
public hasWriteAccess: ko.Observable<boolean> = ko.observable<boolean>(false);
|
||||
public databaseAccount: ko.Observable<ViewModels.DatabaseAccount>;
|
||||
public subscriptionType: ko.Observable<ViewModels.SubscriptionType>;
|
||||
|
||||
@@ -13,13 +13,13 @@ import EnvironmentUtility from "../../Common/EnvironmentUtility";
|
||||
import Q from "q";
|
||||
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
||||
import { config, Platform } from "../../Config";
|
||||
import { ContextualPaneBase } from "./ContextualPaneBase";
|
||||
import { CosmosClient } from "../../Common/CosmosClient";
|
||||
import { createMongoCollectionWithARM, createMongoCollectionWithProxy } from "../../Common/MongoProxyClient";
|
||||
import { DynamicListItem } from "../Controls/DynamicList/DynamicListComponent";
|
||||
import { HashMap } from "../../Common/HashMap";
|
||||
import { PlatformType } from "../../PlatformType";
|
||||
import { config, Platform } from "../../Config";
|
||||
|
||||
export default class AddCollectionPane extends ContextualPaneBase implements ViewModels.AddCollectionPane {
|
||||
public defaultExperience: ko.Computed<string>;
|
||||
@@ -832,7 +832,7 @@ export default class AddCollectionPane extends ContextualPaneBase implements Vie
|
||||
const isAadUser = EnvironmentUtility.isAadUser();
|
||||
|
||||
// note: v3 autopilot not supported yet for Mongo fixed collections (only tier supported)
|
||||
if (!isAadUser || isFixedCollectionWithSharedThroughputBeingCreated) {
|
||||
if (!isAadUser) {
|
||||
createCollectionFunc = () =>
|
||||
Q(
|
||||
createMongoCollectionWithProxy(
|
||||
@@ -853,6 +853,7 @@ export default class AddCollectionPane extends ContextualPaneBase implements Vie
|
||||
this.container.armEndpoint(),
|
||||
databaseId,
|
||||
this._getAnalyticalStorageTtl(),
|
||||
isFixedCollectionWithSharedThroughputBeingCreated,
|
||||
collectionId,
|
||||
offerThroughput,
|
||||
partitionKeyPath,
|
||||
@@ -1007,14 +1008,14 @@ export default class AddCollectionPane extends ContextualPaneBase implements Vie
|
||||
this.uniqueKeys([]);
|
||||
this.useIndexingForSharedThroughput(true);
|
||||
|
||||
const subscriptionType = this.container.subscriptionType();
|
||||
const flight = this.container.flight();
|
||||
const defaultStorage = AddCollectionUtility.Utilities.getDefaultStorage(flight, subscriptionType);
|
||||
const defaultStorage = this.container.collectionCreationDefaults.storage;
|
||||
this.storage(defaultStorage);
|
||||
|
||||
const defaultThroughput = AddCollectionUtility.Utilities.getDefaultThroughput(flight, subscriptionType);
|
||||
const defaultThroughput = this.container.collectionCreationDefaults.throughput;
|
||||
this.throughputSinglePartition(defaultThroughput.fixed);
|
||||
this.throughputMultiPartition(defaultThroughput.unlimited(this.container));
|
||||
this.throughputMultiPartition(
|
||||
AddCollectionUtility.Utilities.getMaxThroughput(this.container.collectionCreationDefaults, this.container)
|
||||
);
|
||||
|
||||
this.throughputDatabase(defaultThroughput.shared);
|
||||
this.databaseCreateNew(true);
|
||||
@@ -1211,7 +1212,7 @@ export default class AddCollectionPane extends ContextualPaneBase implements Vie
|
||||
) {
|
||||
return !this.hasAutoPilotV2FeatureFlag()
|
||||
? {
|
||||
[Constants.HttpHeaders.autoPilotThroughput]: `{ "maxThroughput": ${this.sharedAutoPilotThroughput() * 1} }`
|
||||
[Constants.HttpHeaders.autoPilotThroughput]: { maxThroughput: this.sharedAutoPilotThroughput() * 1 }
|
||||
}
|
||||
: { [Constants.HttpHeaders.autoPilotTier]: this.selectedSharedAutoPilotTier().toString() };
|
||||
}
|
||||
@@ -1221,7 +1222,7 @@ export default class AddCollectionPane extends ContextualPaneBase implements Vie
|
||||
) {
|
||||
return !this.hasAutoPilotV2FeatureFlag()
|
||||
? {
|
||||
[Constants.HttpHeaders.autoPilotThroughput]: `{ "maxThroughput": ${this.autoPilotThroughput() * 1} }`
|
||||
[Constants.HttpHeaders.autoPilotThroughput]: { maxThroughput: this.autoPilotThroughput() * 1 }
|
||||
}
|
||||
: { [Constants.HttpHeaders.autoPilotTier]: this.selectedAutoPilotTier().toString() };
|
||||
}
|
||||
@@ -1268,12 +1269,16 @@ export default class AddCollectionPane extends ContextualPaneBase implements Vie
|
||||
}
|
||||
|
||||
private _updateThroughputLimitByCollectionStorage() {
|
||||
const subscriptionType = this.container.subscriptionType();
|
||||
const flight = this.container.flight();
|
||||
const storage = this.storage();
|
||||
const minThroughputRU = AddCollectionUtility.Utilities.getMinRUForStorageOption(subscriptionType, flight, storage);
|
||||
const minThroughputRU = AddCollectionUtility.Utilities.getMinRUForStorageOption(
|
||||
this.container.collectionCreationDefaults,
|
||||
storage
|
||||
);
|
||||
|
||||
let maxThroughputRU = AddCollectionUtility.Utilities.getMaxRUForStorageOption(subscriptionType, flight, storage);
|
||||
let maxThroughputRU = AddCollectionUtility.Utilities.getMaxRUForStorageOption(
|
||||
this.container.collectionCreationDefaults,
|
||||
storage
|
||||
);
|
||||
if (this.isTryCosmosDBSubscription()) {
|
||||
maxThroughputRU = Constants.TryCosmosExperience.maxRU;
|
||||
}
|
||||
@@ -1283,10 +1288,7 @@ export default class AddCollectionPane extends ContextualPaneBase implements Vie
|
||||
}
|
||||
|
||||
private _updateThroughputLimitByDatabase() {
|
||||
const subscriptionType = this.container.subscriptionType();
|
||||
const flight = this.container.flight();
|
||||
const defaultThruoghput = AddCollectionUtility.Utilities.getDefaultThroughput(flight, subscriptionType);
|
||||
|
||||
const defaultThruoghput = this.container.collectionCreationDefaults.throughput;
|
||||
this.maxThroughputRU(defaultThruoghput.unlimitedmax);
|
||||
this.minThroughputRU(defaultThruoghput.unlimitedmin);
|
||||
}
|
||||
|
||||
@@ -578,7 +578,7 @@ export default class AddDatabasePane extends ContextualPaneBase implements ViewM
|
||||
) {
|
||||
return !this.hasAutoPilotV2FeatureFlag()
|
||||
? {
|
||||
[Constants.HttpHeaders.autoPilotThroughput]: `{ "maxThroughput": ${this.maxAutoPilotThroughputSet() * 1} }`
|
||||
[Constants.HttpHeaders.autoPilotThroughput]: { maxThroughput: this.maxAutoPilotThroughputSet() * 1 }
|
||||
}
|
||||
: { [Constants.HttpHeaders.autoPilotTier]: this.selectedAutoPilotTier().toString() };
|
||||
}
|
||||
@@ -586,13 +586,7 @@ export default class AddDatabasePane extends ContextualPaneBase implements ViewM
|
||||
}
|
||||
|
||||
private _updateThroughputLimitByDatabase() {
|
||||
const subscriptionType = this.container.subscriptionType();
|
||||
const flight = this.container.flight();
|
||||
const throughputDefaults: AddCollectionUtility.ThroughputDefaults = AddCollectionUtility.Utilities.getDefaultThroughput(
|
||||
flight,
|
||||
subscriptionType
|
||||
);
|
||||
|
||||
const throughputDefaults = this.container.collectionCreationDefaults.throughput;
|
||||
this.throughput(throughputDefaults.shared);
|
||||
this.maxThroughputRU(throughputDefaults.unlimitedmax);
|
||||
this.minThroughputRU(throughputDefaults.unlimitedmin);
|
||||
|
||||
@@ -74,10 +74,7 @@ export default class CassandraAddCollectionPane extends ContextualPaneBase
|
||||
});
|
||||
this.keyspaceId.extend({ rateLimit: 100 });
|
||||
this.dedicateTableThroughput = ko.observable<boolean>(false);
|
||||
|
||||
const flight = this.container.flight();
|
||||
const subscriptionType = this.container.subscriptionType();
|
||||
const throughputDefaults = AddCollectionUtility.Utilities.getDefaultThroughput(flight, subscriptionType);
|
||||
const throughputDefaults = this.container.collectionCreationDefaults.throughput;
|
||||
this.maxThroughputRU = ko.observable<number>(throughputDefaults.unlimitedmax);
|
||||
this.minThroughputRU = ko.observable<number>(throughputDefaults.unlimitedmin);
|
||||
|
||||
@@ -489,17 +486,16 @@ export default class CassandraAddCollectionPane extends ContextualPaneBase
|
||||
|
||||
public resetData() {
|
||||
super.resetData();
|
||||
const throughputDefaults = AddCollectionUtility.Utilities.getDefaultThroughput(
|
||||
this.container.flight(),
|
||||
this.container.subscriptionType()
|
||||
);
|
||||
const throughputDefaults = this.container.collectionCreationDefaults.throughput;
|
||||
this.isAutoPilotSelected(false);
|
||||
this.isSharedAutoPilotSelected(false);
|
||||
this.selectedAutoPilotTier(null);
|
||||
this.selectedSharedAutoPilotTier(null);
|
||||
this.selectedAutoPilotThroughput(AutoPilotUtils.minAutoPilotThroughput);
|
||||
this.sharedAutoPilotThroughput(AutoPilotUtils.minAutoPilotThroughput);
|
||||
this.throughput(throughputDefaults.unlimited(this.container));
|
||||
this.throughput(
|
||||
AddCollectionUtility.Utilities.getMaxThroughput(this.container.collectionCreationDefaults, this.container)
|
||||
);
|
||||
this.keyspaceThroughput(throughputDefaults.shared);
|
||||
this.maxThroughputRU(throughputDefaults.unlimitedmax);
|
||||
this.minThroughputRU(throughputDefaults.unlimitedmin);
|
||||
|
||||
@@ -13,6 +13,7 @@ import { GitHubReposComponentAdapter } from "../Controls/GitHub/GitHubReposCompo
|
||||
import { BranchesProps, PinnedReposProps, UnpinnedReposProps } from "../Controls/GitHub/ReposListComponent";
|
||||
import { ConsoleDataType } from "../Menus/NotificationConsole/NotificationConsoleComponent";
|
||||
import { ContextualPaneBase } from "./ContextualPaneBase";
|
||||
import { JunoUtils } from "../../Utils/JunoUtils";
|
||||
|
||||
export class GitHubReposPane extends ContextualPaneBase {
|
||||
private static readonly PageSize = 30;
|
||||
@@ -84,7 +85,7 @@ export class GitHubReposPane extends ContextualPaneBase {
|
||||
|
||||
public async submit(): Promise<void> {
|
||||
const pinnedReposUpdated = this.pinnedReposUpdated;
|
||||
const reposToPin: IPinnedRepo[] = this.pinnedReposProps.repos.map(repo => GitHubUtils.toPinnedRepo(repo));
|
||||
const reposToPin: IPinnedRepo[] = this.pinnedReposProps.repos.map(repo => JunoUtils.toPinnedRepo(repo));
|
||||
|
||||
// Submit resets data too
|
||||
super.submit();
|
||||
@@ -298,7 +299,7 @@ export class GitHubReposPane extends ContextualPaneBase {
|
||||
({
|
||||
key: GitHubUtils.toRepoFullName(pinnedRepo.owner, pinnedRepo.name),
|
||||
branches: pinnedRepo.branches,
|
||||
repo: GitHubUtils.toGitHubRepo(pinnedRepo)
|
||||
repo: JunoUtils.toGitHubRepo(pinnedRepo)
|
||||
} as RepoListItem)
|
||||
);
|
||||
|
||||
|
||||
@@ -245,11 +245,7 @@ export default class DatabaseSettingsTab extends TabsBase
|
||||
if (collectionThroughputInfo && !!collectionThroughputInfo.minimumRUForCollection) {
|
||||
return collectionThroughputInfo.minimumRUForCollection;
|
||||
}
|
||||
|
||||
const flight = this.container.flight();
|
||||
const subscriptionType = this.container.subscriptionType();
|
||||
const throughputDefaults = AddCollectionUtility.Utilities.getDefaultThroughput(flight, subscriptionType);
|
||||
|
||||
const throughputDefaults = this.container.collectionCreationDefaults.throughput;
|
||||
return throughputDefaults.unlimitedmin;
|
||||
});
|
||||
|
||||
@@ -269,10 +265,7 @@ export default class DatabaseSettingsTab extends TabsBase
|
||||
return SharedConstants.CollectionCreation.MaxRUPerPartition * numPartitions;
|
||||
}
|
||||
|
||||
const flight = this.container.flight();
|
||||
const subscriptionType = this.container.subscriptionType();
|
||||
const throughputDefaults = AddCollectionUtility.Utilities.getDefaultThroughput(flight, subscriptionType);
|
||||
|
||||
const throughputDefaults = this.container.collectionCreationDefaults.throughput;
|
||||
return throughputDefaults.unlimitedmax;
|
||||
});
|
||||
|
||||
|
||||
@@ -329,7 +329,6 @@ export default class QueryTab extends TabsBase implements ViewModels.QueryTab, V
|
||||
this.requestChargeDisplayText(`${queryResults.requestCharge} RUs`);
|
||||
|
||||
if (!this.queryResults() && !results) {
|
||||
const appInsights: any = (<any>window).appInsights;
|
||||
const errorMessage: string = JSON.stringify({
|
||||
error: `Returned no results after query execution`,
|
||||
accountName: this.collection && this.collection.container.databaseAccount(),
|
||||
@@ -341,7 +340,6 @@ export default class QueryTab extends TabsBase implements ViewModels.QueryTab, V
|
||||
responseHeaders: queryResults && queryResults.headers
|
||||
});
|
||||
Logger.logError(errorMessage, "QueryTab");
|
||||
appInsights && appInsights.trackTrace(errorMessage);
|
||||
}
|
||||
|
||||
this.queryResults(results);
|
||||
|
||||
@@ -106,10 +106,7 @@
|
||||
</throughput-input>
|
||||
<!-- /ko -->
|
||||
|
||||
<div
|
||||
class="storageCapacityTitle throughputStorageValue"
|
||||
data-bind="html: storageCapacityTitle, visible: !isAutoPilotSelected()"
|
||||
></div>
|
||||
<div class="storageCapacityTitle throughputStorageValue" data-bind="html: storageCapacityTitle"></div>
|
||||
<!-- /ko -->
|
||||
|
||||
<div data-bind="visible: rupmVisible">
|
||||
|
||||
@@ -103,10 +103,11 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
||||
|
||||
this.sampleNotebooksContentRoot = {
|
||||
name: "Sample Notebooks (View Only)",
|
||||
path: GitHubUtils.toGitHubUriForRepoAndBranch(
|
||||
path: GitHubUtils.toContentUri(
|
||||
ResourceTreeAdapter.SamplesRepo.owner.login,
|
||||
ResourceTreeAdapter.SamplesRepo.name,
|
||||
ResourceTreeAdapter.SamplesBranch.name
|
||||
ResourceTreeAdapter.SamplesBranch.name,
|
||||
""
|
||||
),
|
||||
type: NotebookContentItemType.Directory
|
||||
};
|
||||
@@ -157,7 +158,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
||||
pinnedRepo.branches.forEach(branch => {
|
||||
repoTreeItem.children.push({
|
||||
name: branch.name,
|
||||
path: GitHubUtils.toGitHubUriForRepoAndBranch(pinnedRepo.owner, pinnedRepo.name, branch.name),
|
||||
path: GitHubUtils.toContentUri(pinnedRepo.owner, pinnedRepo.name, branch.name, ""),
|
||||
type: NotebookContentItemType.Directory
|
||||
});
|
||||
});
|
||||
@@ -620,7 +621,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
||||
];
|
||||
|
||||
// For GitHub paths remove "Delete", "Rename", "New Directory", "Upload File"
|
||||
if (GitHubUtils.fromGitHubUri(item.path)) {
|
||||
if (GitHubUtils.fromContentUri(item.path)) {
|
||||
items = items.filter(
|
||||
item =>
|
||||
item.label !== "Delete" &&
|
||||
|
||||
Reference in New Issue
Block a user