Remove Explorer.isPreferredCassandraAPI (#654)
Co-authored-by: Steve Faulkner <471400+southpolesteve@users.noreply.github.com>
This commit is contained in:
parent
a264ea2275
commit
02ea26da71
|
@ -123,7 +123,7 @@ export class ResourceTreeContextMenuButtonFactory {
|
||||||
container: Explorer,
|
container: Explorer,
|
||||||
storedProcedure: StoredProcedure
|
storedProcedure: StoredProcedure
|
||||||
): TreeNodeMenuItem[] {
|
): TreeNodeMenuItem[] {
|
||||||
if (container.isPreferredApiCassandra()) {
|
if (userContext.apiType === "Cassandra") {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ export class ResourceTreeContextMenuButtonFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static createTriggerContextMenuItems(container: Explorer, trigger: Trigger): TreeNodeMenuItem[] {
|
public static createTriggerContextMenuItems(container: Explorer, trigger: Trigger): TreeNodeMenuItem[] {
|
||||||
if (container.isPreferredApiCassandra()) {
|
if (userContext.apiType === "Cassandra") {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ export class ResourceTreeContextMenuButtonFactory {
|
||||||
container: Explorer,
|
container: Explorer,
|
||||||
userDefinedFunction: UserDefinedFunction
|
userDefinedFunction: UserDefinedFunction
|
||||||
): TreeNodeMenuItem[] {
|
): TreeNodeMenuItem[] {
|
||||||
if (container.isPreferredApiCassandra()) {
|
if (userContext.apiType === "Cassandra") {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { updateCollection } from "../../../Common/dataAccess/updateCollection";
|
||||||
import { updateOffer } from "../../../Common/dataAccess/updateOffer";
|
import { updateOffer } from "../../../Common/dataAccess/updateOffer";
|
||||||
import * as DataModels from "../../../Contracts/DataModels";
|
import * as DataModels from "../../../Contracts/DataModels";
|
||||||
import * as ViewModels from "../../../Contracts/ViewModels";
|
import * as ViewModels from "../../../Contracts/ViewModels";
|
||||||
|
import { updateUserContext } from "../../../UserContext";
|
||||||
import Explorer from "../../Explorer";
|
import Explorer from "../../Explorer";
|
||||||
import { CollectionSettingsTabV2 } from "../../Tabs/SettingsTabV2";
|
import { CollectionSettingsTabV2 } from "../../Tabs/SettingsTabV2";
|
||||||
import { SettingsComponent, SettingsComponentProps, SettingsComponentState } from "./SettingsComponent";
|
import { SettingsComponent, SettingsComponentProps, SettingsComponentState } from "./SettingsComponent";
|
||||||
|
@ -107,7 +108,13 @@ describe("SettingsComponent", () => {
|
||||||
expect(settingsComponentInstance.shouldShowKeyspaceSharedThroughputMessage()).toEqual(false);
|
expect(settingsComponentInstance.shouldShowKeyspaceSharedThroughputMessage()).toEqual(false);
|
||||||
|
|
||||||
const newContainer = new Explorer();
|
const newContainer = new Explorer();
|
||||||
newContainer.isPreferredApiCassandra = ko.computed(() => true);
|
updateUserContext({
|
||||||
|
databaseAccount: {
|
||||||
|
properties: {
|
||||||
|
capabilities: [{ name: "EnableCassandra" }],
|
||||||
|
},
|
||||||
|
} as DataModels.DatabaseAccount,
|
||||||
|
});
|
||||||
|
|
||||||
const newCollection = { ...collection };
|
const newCollection = { ...collection };
|
||||||
newCollection.container = newContainer;
|
newCollection.container = newContainer;
|
||||||
|
|
|
@ -137,7 +137,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
||||||
this.offer = this.collection?.offer();
|
this.offer = this.collection?.offer();
|
||||||
this.isAnalyticalStorageEnabled = !!this.collection?.analyticalStorageTtl();
|
this.isAnalyticalStorageEnabled = !!this.collection?.analyticalStorageTtl();
|
||||||
this.shouldShowIndexingPolicyEditor =
|
this.shouldShowIndexingPolicyEditor =
|
||||||
this.container && !this.container.isPreferredApiCassandra() && !this.container.isPreferredApiMongoDB();
|
this.container && userContext.apiType !== "Cassandra" && !this.container.isPreferredApiMongoDB();
|
||||||
|
|
||||||
this.changeFeedPolicyVisible = userContext.features.enableChangeFeedPolicy;
|
this.changeFeedPolicyVisible = userContext.features.enableChangeFeedPolicy;
|
||||||
|
|
||||||
|
@ -299,7 +299,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
||||||
this.state.wasAutopilotOriginallySet !== this.state.isAutoPilotSelected;
|
this.state.wasAutopilotOriginallySet !== this.state.isAutoPilotSelected;
|
||||||
|
|
||||||
public shouldShowKeyspaceSharedThroughputMessage = (): boolean =>
|
public shouldShowKeyspaceSharedThroughputMessage = (): boolean =>
|
||||||
this.container && this.container.isPreferredApiCassandra() && hasDatabaseSharedThroughput(this.collection);
|
this.container && userContext.apiType === "Cassandra" && hasDatabaseSharedThroughput(this.collection);
|
||||||
|
|
||||||
public hasConflictResolution = (): boolean =>
|
public hasConflictResolution = (): boolean =>
|
||||||
this.container?.databaseAccount &&
|
this.container?.databaseAccount &&
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { shallow } from "enzyme";
|
import { shallow } from "enzyme";
|
||||||
import ko from "knockout";
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
import { DatabaseAccount } from "../../../../Contracts/DataModels";
|
||||||
|
import { updateUserContext } from "../../../../UserContext";
|
||||||
import Explorer from "../../../Explorer";
|
import Explorer from "../../../Explorer";
|
||||||
import { ChangeFeedPolicyState, GeospatialConfigType, TtlOff, TtlOn, TtlOnNoDefault, TtlType } from "../SettingsUtils";
|
import { ChangeFeedPolicyState, GeospatialConfigType, TtlOff, TtlOn, TtlOnNoDefault, TtlType } from "../SettingsUtils";
|
||||||
import { collection, container } from "../TestUtils";
|
import { collection, container } from "../TestUtils";
|
||||||
|
@ -104,8 +105,13 @@ describe("SubSettingsComponent", () => {
|
||||||
|
|
||||||
it("partitionKey not visible", () => {
|
it("partitionKey not visible", () => {
|
||||||
const newContainer = new Explorer();
|
const newContainer = new Explorer();
|
||||||
|
updateUserContext({
|
||||||
newContainer.isPreferredApiCassandra = ko.computed(() => true);
|
databaseAccount: {
|
||||||
|
properties: {
|
||||||
|
capabilities: [{ name: "EnableCassandra" }],
|
||||||
|
},
|
||||||
|
} as DatabaseAccount,
|
||||||
|
});
|
||||||
const props = { ...baseProps, container: newContainer };
|
const props = { ...baseProps, container: newContainer };
|
||||||
const subSettingsComponent = new SubSettingsComponent(props);
|
const subSettingsComponent = new SubSettingsComponent(props);
|
||||||
expect(subSettingsComponent.getPartitionKeyVisible()).toEqual(false);
|
expect(subSettingsComponent.getPartitionKeyVisible()).toEqual(false);
|
||||||
|
|
|
@ -320,7 +320,7 @@ export class SubSettingsComponent extends React.Component<SubSettingsComponentPr
|
||||||
|
|
||||||
public getPartitionKeyVisible = (): boolean => {
|
public getPartitionKeyVisible = (): boolean => {
|
||||||
if (
|
if (
|
||||||
this.props.container.isPreferredApiCassandra() ||
|
userContext.apiType === "Cassandra" ||
|
||||||
this.props.container.isPreferredApiTable() ||
|
this.props.container.isPreferredApiTable() ||
|
||||||
!this.props.collection.partitionKeyProperty ||
|
!this.props.collection.partitionKeyProperty ||
|
||||||
(this.props.container.isPreferredApiMongoDB() && this.props.collection.partitionKey.systemKey)
|
(this.props.container.isPreferredApiMongoDB() && this.props.collection.partitionKey.systemKey)
|
||||||
|
|
|
@ -647,7 +647,6 @@ exports[`SettingsComponent renders 1`] = `
|
||||||
"isMongoIndexingEnabled": [Function],
|
"isMongoIndexingEnabled": [Function],
|
||||||
"isNotebookEnabled": [Function],
|
"isNotebookEnabled": [Function],
|
||||||
"isNotebooksEnabledForAccount": [Function],
|
"isNotebooksEnabledForAccount": [Function],
|
||||||
"isPreferredApiCassandra": [Function],
|
|
||||||
"isPreferredApiGraph": [Function],
|
"isPreferredApiGraph": [Function],
|
||||||
"isPreferredApiMongoDB": [Function],
|
"isPreferredApiMongoDB": [Function],
|
||||||
"isPreferredApiTable": [Function],
|
"isPreferredApiTable": [Function],
|
||||||
|
@ -1411,7 +1410,6 @@ exports[`SettingsComponent renders 1`] = `
|
||||||
"isMongoIndexingEnabled": [Function],
|
"isMongoIndexingEnabled": [Function],
|
||||||
"isNotebookEnabled": [Function],
|
"isNotebookEnabled": [Function],
|
||||||
"isNotebooksEnabledForAccount": [Function],
|
"isNotebooksEnabledForAccount": [Function],
|
||||||
"isPreferredApiCassandra": [Function],
|
|
||||||
"isPreferredApiGraph": [Function],
|
"isPreferredApiGraph": [Function],
|
||||||
"isPreferredApiMongoDB": [Function],
|
"isPreferredApiMongoDB": [Function],
|
||||||
"isPreferredApiTable": [Function],
|
"isPreferredApiTable": [Function],
|
||||||
|
@ -2188,7 +2186,6 @@ exports[`SettingsComponent renders 1`] = `
|
||||||
"isMongoIndexingEnabled": [Function],
|
"isMongoIndexingEnabled": [Function],
|
||||||
"isNotebookEnabled": [Function],
|
"isNotebookEnabled": [Function],
|
||||||
"isNotebooksEnabledForAccount": [Function],
|
"isNotebooksEnabledForAccount": [Function],
|
||||||
"isPreferredApiCassandra": [Function],
|
|
||||||
"isPreferredApiGraph": [Function],
|
"isPreferredApiGraph": [Function],
|
||||||
"isPreferredApiMongoDB": [Function],
|
"isPreferredApiMongoDB": [Function],
|
||||||
"isPreferredApiTable": [Function],
|
"isPreferredApiTable": [Function],
|
||||||
|
@ -2952,7 +2949,6 @@ exports[`SettingsComponent renders 1`] = `
|
||||||
"isMongoIndexingEnabled": [Function],
|
"isMongoIndexingEnabled": [Function],
|
||||||
"isNotebookEnabled": [Function],
|
"isNotebookEnabled": [Function],
|
||||||
"isNotebooksEnabledForAccount": [Function],
|
"isNotebooksEnabledForAccount": [Function],
|
||||||
"isPreferredApiCassandra": [Function],
|
|
||||||
"isPreferredApiGraph": [Function],
|
"isPreferredApiGraph": [Function],
|
||||||
"isPreferredApiMongoDB": [Function],
|
"isPreferredApiMongoDB": [Function],
|
||||||
"isPreferredApiTable": [Function],
|
"isPreferredApiTable": [Function],
|
||||||
|
|
|
@ -17,7 +17,6 @@ describe("ContainerSampleGenerator", () => {
|
||||||
explorerStub.isPreferredApiGraph = ko.computed<boolean>(() => false);
|
explorerStub.isPreferredApiGraph = ko.computed<boolean>(() => false);
|
||||||
explorerStub.isPreferredApiMongoDB = ko.computed<boolean>(() => false);
|
explorerStub.isPreferredApiMongoDB = ko.computed<boolean>(() => false);
|
||||||
explorerStub.isPreferredApiTable = ko.computed<boolean>(() => false);
|
explorerStub.isPreferredApiTable = ko.computed<boolean>(() => false);
|
||||||
explorerStub.isPreferredApiCassandra = ko.computed<boolean>(() => false);
|
|
||||||
explorerStub.canExceedMaximumValue = ko.computed<boolean>(() => false);
|
explorerStub.canExceedMaximumValue = ko.computed<boolean>(() => false);
|
||||||
explorerStub.findDatabaseWithId = () => database;
|
explorerStub.findDatabaseWithId = () => database;
|
||||||
explorerStub.refreshAllDatabases = () => Q.resolve();
|
explorerStub.refreshAllDatabases = () => Q.resolve();
|
||||||
|
@ -156,8 +155,6 @@ describe("ContainerSampleGenerator", () => {
|
||||||
|
|
||||||
it("should not create any sample for Cassandra API account", async () => {
|
it("should not create any sample for Cassandra API account", async () => {
|
||||||
const experience = "Sample generation not supported for this API Cassandra";
|
const experience = "Sample generation not supported for this API Cassandra";
|
||||||
const explorerStub = createExplorerStub(undefined);
|
|
||||||
|
|
||||||
updateUserContext({
|
updateUserContext({
|
||||||
databaseAccount: {
|
databaseAccount: {
|
||||||
properties: {
|
properties: {
|
||||||
|
@ -165,6 +162,7 @@ describe("ContainerSampleGenerator", () => {
|
||||||
},
|
},
|
||||||
} as DatabaseAccount,
|
} as DatabaseAccount,
|
||||||
});
|
});
|
||||||
|
const explorerStub = createExplorerStub(undefined);
|
||||||
// Rejects with error that contains experience
|
// Rejects with error that contains experience
|
||||||
await expect(ContainerSampleGenerator.createSampleGeneratorAsync(explorerStub)).rejects.toMatch(experience);
|
await expect(ContainerSampleGenerator.createSampleGeneratorAsync(explorerStub)).rejects.toMatch(experience);
|
||||||
});
|
});
|
||||||
|
|
|
@ -116,11 +116,6 @@ export default class Explorer {
|
||||||
* Use userContext.apiType instead
|
* Use userContext.apiType instead
|
||||||
* */
|
* */
|
||||||
public defaultExperience: ko.Observable<string>;
|
public defaultExperience: ko.Observable<string>;
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* Compare a string with userContext.apiType instead: userContext.apiType === "Cassandra"
|
|
||||||
* */
|
|
||||||
public isPreferredApiCassandra: ko.Computed<boolean>;
|
|
||||||
/**
|
/**
|
||||||
* @deprecated
|
* @deprecated
|
||||||
* Compare a string with userContext.apiType instead: userContext.apiType === "Mongo"
|
* Compare a string with userContext.apiType instead: userContext.apiType === "Mongo"
|
||||||
|
@ -414,10 +409,6 @@ export default class Explorer {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.isPreferredApiCassandra = ko.computed(() => {
|
|
||||||
const defaultExperience = (this.defaultExperience && this.defaultExperience()) || "";
|
|
||||||
return defaultExperience.toLowerCase() === Constants.DefaultAccountExperience.Cassandra.toLowerCase();
|
|
||||||
});
|
|
||||||
this.isPreferredApiGraph = ko.computed(() => {
|
this.isPreferredApiGraph = ko.computed(() => {
|
||||||
const defaultExperience = (this.defaultExperience && this.defaultExperience()) || "";
|
const defaultExperience = (this.defaultExperience && this.defaultExperience()) || "";
|
||||||
return defaultExperience.toLowerCase() === Constants.DefaultAccountExperience.Graph.toLowerCase();
|
return defaultExperience.toLowerCase() === Constants.DefaultAccountExperience.Graph.toLowerCase();
|
||||||
|
@ -2097,7 +2088,7 @@ export default class Explorer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public onNewCollectionClicked(): void {
|
public onNewCollectionClicked(): void {
|
||||||
if (this.isPreferredApiCassandra()) {
|
if (userContext.apiType === "Cassandra") {
|
||||||
this.cassandraAddCollectionPane.open();
|
this.cassandraAddCollectionPane.open();
|
||||||
} else if (userContext.features.enableReactPane) {
|
} else if (userContext.features.enableReactPane) {
|
||||||
this.openAddCollectionPanel();
|
this.openAddCollectionPanel();
|
||||||
|
|
|
@ -31,7 +31,6 @@ export class CommandBarComponentAdapter implements ReactAdapter {
|
||||||
const toWatch = [
|
const toWatch = [
|
||||||
container.isPreferredApiTable,
|
container.isPreferredApiTable,
|
||||||
container.isPreferredApiMongoDB,
|
container.isPreferredApiMongoDB,
|
||||||
container.isPreferredApiCassandra,
|
|
||||||
container.isPreferredApiGraph,
|
container.isPreferredApiGraph,
|
||||||
container.deleteCollectionText,
|
container.deleteCollectionText,
|
||||||
container.deleteDatabaseText,
|
container.deleteDatabaseText,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import * as ko from "knockout";
|
import * as ko from "knockout";
|
||||||
import { AuthType } from "../../../AuthType";
|
import { AuthType } from "../../../AuthType";
|
||||||
|
import { DatabaseAccount } from "../../../Contracts/DataModels";
|
||||||
import { GitHubOAuthService } from "../../../GitHub/GitHubOAuthService";
|
import { GitHubOAuthService } from "../../../GitHub/GitHubOAuthService";
|
||||||
import { updateUserContext } from "../../../UserContext";
|
import { updateUserContext } from "../../../UserContext";
|
||||||
import Explorer from "../../Explorer";
|
import Explorer from "../../Explorer";
|
||||||
|
@ -17,7 +18,6 @@ describe("CommandBarComponentButtonFactory tests", () => {
|
||||||
mockExplorer.addCollectionText = ko.observable("mockText");
|
mockExplorer.addCollectionText = ko.observable("mockText");
|
||||||
mockExplorer.isPreferredApiTable = ko.computed(() => true);
|
mockExplorer.isPreferredApiTable = ko.computed(() => true);
|
||||||
mockExplorer.isPreferredApiMongoDB = ko.computed<boolean>(() => false);
|
mockExplorer.isPreferredApiMongoDB = ko.computed<boolean>(() => false);
|
||||||
mockExplorer.isPreferredApiCassandra = ko.computed<boolean>(() => false);
|
|
||||||
mockExplorer.isSparkEnabled = ko.observable(true);
|
mockExplorer.isSparkEnabled = ko.observable(true);
|
||||||
mockExplorer.isSynapseLinkUpdating = ko.observable(false);
|
mockExplorer.isSynapseLinkUpdating = ko.observable(false);
|
||||||
|
|
||||||
|
@ -56,7 +56,6 @@ describe("CommandBarComponentButtonFactory tests", () => {
|
||||||
mockExplorer.addCollectionText = ko.observable("mockText");
|
mockExplorer.addCollectionText = ko.observable("mockText");
|
||||||
mockExplorer.isPreferredApiTable = ko.computed(() => true);
|
mockExplorer.isPreferredApiTable = ko.computed(() => true);
|
||||||
mockExplorer.isPreferredApiMongoDB = ko.computed<boolean>(() => false);
|
mockExplorer.isPreferredApiMongoDB = ko.computed<boolean>(() => false);
|
||||||
mockExplorer.isPreferredApiCassandra = ko.computed<boolean>(() => false);
|
|
||||||
mockExplorer.isSynapseLinkUpdating = ko.observable(false);
|
mockExplorer.isSynapseLinkUpdating = ko.observable(false);
|
||||||
mockExplorer.isSparkEnabled = ko.observable(true);
|
mockExplorer.isSparkEnabled = ko.observable(true);
|
||||||
mockExplorer.isSynapseLinkUpdating = ko.observable(false);
|
mockExplorer.isSynapseLinkUpdating = ko.observable(false);
|
||||||
|
@ -119,7 +118,6 @@ describe("CommandBarComponentButtonFactory tests", () => {
|
||||||
mockExplorer = {} as Explorer;
|
mockExplorer = {} as Explorer;
|
||||||
mockExplorer.addCollectionText = ko.observable("mockText");
|
mockExplorer.addCollectionText = ko.observable("mockText");
|
||||||
mockExplorer.isPreferredApiTable = ko.computed(() => true);
|
mockExplorer.isPreferredApiTable = ko.computed(() => true);
|
||||||
mockExplorer.isPreferredApiCassandra = ko.computed<boolean>(() => false);
|
|
||||||
mockExplorer.isSparkEnabled = ko.observable(true);
|
mockExplorer.isSparkEnabled = ko.observable(true);
|
||||||
mockExplorer.isSynapseLinkUpdating = ko.observable(false);
|
mockExplorer.isSynapseLinkUpdating = ko.observable(false);
|
||||||
|
|
||||||
|
@ -208,15 +206,26 @@ describe("CommandBarComponentButtonFactory tests", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
mockExplorer.isPreferredApiCassandra = ko.computed<boolean>(() => true);
|
updateUserContext({
|
||||||
|
databaseAccount: {
|
||||||
|
properties: {
|
||||||
|
capabilities: [{ name: "EnableCassandra" }],
|
||||||
|
},
|
||||||
|
} as DatabaseAccount,
|
||||||
|
});
|
||||||
mockExplorer.isNotebookEnabled = ko.observable(false);
|
mockExplorer.isNotebookEnabled = ko.observable(false);
|
||||||
mockExplorer.isNotebooksEnabledForAccount = ko.observable(false);
|
mockExplorer.isNotebooksEnabledForAccount = ko.observable(false);
|
||||||
mockExplorer.isRunningOnNationalCloud = ko.observable(false);
|
mockExplorer.isRunningOnNationalCloud = ko.observable(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Cassandra Api not available - button should be hidden", () => {
|
it("Cassandra Api not available - button should be hidden", () => {
|
||||||
mockExplorer.isPreferredApiCassandra = ko.computed<boolean>(() => false);
|
updateUserContext({
|
||||||
|
databaseAccount: {
|
||||||
|
properties: {
|
||||||
|
capabilities: [{ name: "EnableMongo" }],
|
||||||
|
},
|
||||||
|
} as DatabaseAccount,
|
||||||
|
});
|
||||||
const buttons = CommandBarComponentButtonFactory.createStaticCommandBarButtons(mockExplorer);
|
const buttons = CommandBarComponentButtonFactory.createStaticCommandBarButtons(mockExplorer);
|
||||||
const openCassandraShellBtn = buttons.find((button) => button.commandButtonLabel === openCassandraShellBtnLabel);
|
const openCassandraShellBtn = buttons.find((button) => button.commandButtonLabel === openCassandraShellBtnLabel);
|
||||||
expect(openCassandraShellBtn).toBeUndefined();
|
expect(openCassandraShellBtn).toBeUndefined();
|
||||||
|
@ -281,7 +290,6 @@ describe("CommandBarComponentButtonFactory tests", () => {
|
||||||
mockExplorer.addCollectionText = ko.observable("mockText");
|
mockExplorer.addCollectionText = ko.observable("mockText");
|
||||||
mockExplorer.isPreferredApiTable = ko.computed(() => true);
|
mockExplorer.isPreferredApiTable = ko.computed(() => true);
|
||||||
mockExplorer.isPreferredApiMongoDB = ko.computed<boolean>(() => false);
|
mockExplorer.isPreferredApiMongoDB = ko.computed<boolean>(() => false);
|
||||||
mockExplorer.isPreferredApiCassandra = ko.computed<boolean>(() => false);
|
|
||||||
|
|
||||||
mockExplorer.isSynapseLinkUpdating = ko.observable(false);
|
mockExplorer.isSynapseLinkUpdating = ko.observable(false);
|
||||||
mockExplorer.isSparkEnabled = ko.observable(true);
|
mockExplorer.isSparkEnabled = ko.observable(true);
|
||||||
|
@ -346,6 +354,11 @@ describe("CommandBarComponentButtonFactory tests", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should only show New SQL Query and Open Query buttons", () => {
|
it("should only show New SQL Query and Open Query buttons", () => {
|
||||||
|
updateUserContext({
|
||||||
|
databaseAccount: {
|
||||||
|
kind: "DocumentDB",
|
||||||
|
} as DatabaseAccount,
|
||||||
|
});
|
||||||
const buttons = CommandBarComponentButtonFactory.createStaticCommandBarButtons(mockExplorer);
|
const buttons = CommandBarComponentButtonFactory.createStaticCommandBarButtons(mockExplorer);
|
||||||
expect(buttons.length).toBe(2);
|
expect(buttons.length).toBe(2);
|
||||||
expect(buttons[0].commandButtonLabel).toBe("New SQL Query");
|
expect(buttons[0].commandButtonLabel).toBe("New SQL Query");
|
||||||
|
|
|
@ -74,7 +74,7 @@ export function createStaticCommandBarButtons(container: Explorer): CommandButto
|
||||||
buttons.push(createOpenMongoTerminalButton(container));
|
buttons.push(createOpenMongoTerminalButton(container));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (container.isPreferredApiCassandra()) {
|
if (userContext.apiType === "Cassandra") {
|
||||||
buttons.push(createOpenCassandraTerminalButton(container));
|
buttons.push(createOpenCassandraTerminalButton(container));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -289,7 +289,7 @@ function createNewDatabase(container: Explorer): CommandButtonComponentProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
function createNewSQLQueryButton(container: Explorer): CommandButtonComponentProps {
|
function createNewSQLQueryButton(container: Explorer): CommandButtonComponentProps {
|
||||||
if (userContext.apiType === "SQL" || container.isPreferredApiGraph()) {
|
if (userContext.apiType === "SQL" || userContext.apiType === "Gremlin") {
|
||||||
const label = "New SQL Query";
|
const label = "New SQL Query";
|
||||||
return {
|
return {
|
||||||
iconSrc: AddSqlQueryIcon,
|
iconSrc: AddSqlQueryIcon,
|
||||||
|
@ -303,7 +303,7 @@ function createNewSQLQueryButton(container: Explorer): CommandButtonComponentPro
|
||||||
hasPopup: true,
|
hasPopup: true,
|
||||||
disabled: container.isDatabaseNodeOrNoneSelected(),
|
disabled: container.isDatabaseNodeOrNoneSelected(),
|
||||||
};
|
};
|
||||||
} else if (container.isPreferredApiMongoDB()) {
|
} else if (userContext.apiType === "Mongo") {
|
||||||
const label = "New Query";
|
const label = "New Query";
|
||||||
return {
|
return {
|
||||||
iconSrc: AddSqlQueryIcon,
|
iconSrc: AddSqlQueryIcon,
|
||||||
|
|
|
@ -388,7 +388,7 @@ export default class AddCollectionPane extends ContextualPaneBase {
|
||||||
this.container == null ||
|
this.container == null ||
|
||||||
!!this.container.isPreferredApiMongoDB() ||
|
!!this.container.isPreferredApiMongoDB() ||
|
||||||
!!this.container.isPreferredApiTable() ||
|
!!this.container.isPreferredApiTable() ||
|
||||||
!!this.container.isPreferredApiCassandra() ||
|
userContext.apiType === "Cassandra" ||
|
||||||
!!this.container.isPreferredApiGraph()
|
!!this.container.isPreferredApiGraph()
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -599,7 +599,7 @@ export default class AddCollectionPane extends ContextualPaneBase {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.container.isPreferredApiCassandra() && this.container.hasStorageAnalyticsAfecFeature()) {
|
if (userContext.apiType === "Cassandra" && this.container.hasStorageAnalyticsAfecFeature()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,21 +62,21 @@ export default class AddDatabasePane extends ContextualPaneBase {
|
||||||
this.databaseCreateNewShared = ko.observable<boolean>(this.getSharedThroughputDefault());
|
this.databaseCreateNewShared = ko.observable<boolean>(this.getSharedThroughputDefault());
|
||||||
|
|
||||||
this.databaseIdLabel = ko.computed<string>(() =>
|
this.databaseIdLabel = ko.computed<string>(() =>
|
||||||
this.container.isPreferredApiCassandra() ? "Keyspace id" : "Database id"
|
userContext.apiType === "Cassandra" ? "Keyspace id" : "Database id"
|
||||||
);
|
);
|
||||||
|
|
||||||
this.databaseIdPlaceHolder = ko.computed<string>(() =>
|
this.databaseIdPlaceHolder = ko.computed<string>(() =>
|
||||||
this.container.isPreferredApiCassandra() ? "Type a new keyspace id" : "Type a new database id"
|
userContext.apiType === "Cassandra" ? "Type a new keyspace id" : "Type a new database id"
|
||||||
);
|
);
|
||||||
|
|
||||||
this.databaseIdTooltipText = ko.computed<string>(() => {
|
this.databaseIdTooltipText = ko.computed<string>(() => {
|
||||||
const isCassandraAccount: boolean = this.container.isPreferredApiCassandra();
|
const isCassandraAccount: boolean = userContext.apiType === "Cassandra";
|
||||||
return `A ${isCassandraAccount ? "keyspace" : "database"} is a logical container of one or more ${
|
return `A ${isCassandraAccount ? "keyspace" : "database"} is a logical container of one or more ${
|
||||||
isCassandraAccount ? "tables" : "collections"
|
isCassandraAccount ? "tables" : "collections"
|
||||||
}`;
|
}`;
|
||||||
});
|
});
|
||||||
this.databaseLevelThroughputTooltipText = ko.computed<string>(() => {
|
this.databaseLevelThroughputTooltipText = ko.computed<string>(() => {
|
||||||
const isCassandraAccount: boolean = this.container.isPreferredApiCassandra();
|
const isCassandraAccount: boolean = userContext.apiType === "Cassandra";
|
||||||
const databaseLabel: string = isCassandraAccount ? "keyspace" : "database";
|
const databaseLabel: string = isCassandraAccount ? "keyspace" : "database";
|
||||||
const collectionsLabel: string = isCassandraAccount ? "tables" : "collections";
|
const collectionsLabel: string = isCassandraAccount ? "tables" : "collections";
|
||||||
return `Provisioned throughput at the ${databaseLabel} level will be shared across all ${collectionsLabel} within the ${databaseLabel}.`;
|
return `Provisioned throughput at the ${databaseLabel} level will be shared across all ${collectionsLabel} within the ${databaseLabel}.`;
|
||||||
|
|
|
@ -623,7 +623,6 @@ exports[`Settings Pane should render Default properly 1`] = `
|
||||||
"isMongoIndexingEnabled": [Function],
|
"isMongoIndexingEnabled": [Function],
|
||||||
"isNotebookEnabled": [Function],
|
"isNotebookEnabled": [Function],
|
||||||
"isNotebooksEnabledForAccount": [Function],
|
"isNotebooksEnabledForAccount": [Function],
|
||||||
"isPreferredApiCassandra": [Function],
|
|
||||||
"isPreferredApiGraph": [Function],
|
"isPreferredApiGraph": [Function],
|
||||||
"isPreferredApiMongoDB": [Function],
|
"isPreferredApiMongoDB": [Function],
|
||||||
"isPreferredApiTable": [Function],
|
"isPreferredApiTable": [Function],
|
||||||
|
@ -1510,7 +1509,6 @@ exports[`Settings Pane should render Gremlin properly 1`] = `
|
||||||
"isMongoIndexingEnabled": [Function],
|
"isMongoIndexingEnabled": [Function],
|
||||||
"isNotebookEnabled": [Function],
|
"isNotebookEnabled": [Function],
|
||||||
"isNotebooksEnabledForAccount": [Function],
|
"isNotebooksEnabledForAccount": [Function],
|
||||||
"isPreferredApiCassandra": [Function],
|
|
||||||
"isPreferredApiGraph": [Function],
|
"isPreferredApiGraph": [Function],
|
||||||
"isPreferredApiMongoDB": [Function],
|
"isPreferredApiMongoDB": [Function],
|
||||||
"isPreferredApiTable": [Function],
|
"isPreferredApiTable": [Function],
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
import * as ko from "knockout";
|
import * as ko from "knockout";
|
||||||
import * as _ from "underscore";
|
import * as _ from "underscore";
|
||||||
import * as ViewModels from "../../../Contracts/ViewModels";
|
import * as ViewModels from "../../../Contracts/ViewModels";
|
||||||
import { CassandraTableKey, CassandraAPIDataClient } from "../../Tables/TableDataClient";
|
import { userContext } from "../../../UserContext";
|
||||||
|
import * as TableConstants from "../../Tables/Constants";
|
||||||
import * as DataTableUtilities from "../../Tables/DataTable/DataTableUtilities";
|
import * as DataTableUtilities from "../../Tables/DataTable/DataTableUtilities";
|
||||||
import * as Entities from "../../Tables/Entities";
|
import * as Entities from "../../Tables/Entities";
|
||||||
import * as TableConstants from "../../Tables/Constants";
|
import { CassandraAPIDataClient, CassandraTableKey } from "../../Tables/TableDataClient";
|
||||||
import * as Utilities from "../../Tables/Utilities";
|
import * as Utilities from "../../Tables/Utilities";
|
||||||
import EntityPropertyViewModel from "./EntityPropertyViewModel";
|
import EntityPropertyViewModel from "./EntityPropertyViewModel";
|
||||||
import TableEntityPane from "./TableEntityPane";
|
import TableEntityPane from "./TableEntityPane";
|
||||||
|
@ -24,11 +25,9 @@ export default class AddTableEntityPane extends TableEntityPane {
|
||||||
constructor(options: ViewModels.PaneOptions) {
|
constructor(options: ViewModels.PaneOptions) {
|
||||||
super(options);
|
super(options);
|
||||||
this.submitButtonText("Add Entity");
|
this.submitButtonText("Add Entity");
|
||||||
this.container.isPreferredApiCassandra.subscribe((isCassandra) => {
|
if (userContext.apiType === "Cassandra") {
|
||||||
if (isCassandra) {
|
this.submitButtonText("Add Row");
|
||||||
this.submitButtonText("Add Row");
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
this.scrollId = ko.observable<string>("addEntityScroll");
|
this.scrollId = ko.observable<string>("addEntityScroll");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +56,7 @@ export default class AddTableEntityPane extends TableEntityPane {
|
||||||
headers = [TableConstants.EntityKeyNames.PartitionKey, TableConstants.EntityKeyNames.RowKey];
|
headers = [TableConstants.EntityKeyNames.PartitionKey, TableConstants.EntityKeyNames.RowKey];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.container.isPreferredApiCassandra()) {
|
if (userContext.apiType === "Cassandra") {
|
||||||
(<CassandraAPIDataClient>this.container.tableDataClient)
|
(<CassandraAPIDataClient>this.container.tableDataClient)
|
||||||
.getTableSchema(this.tableViewModel.queryTablesTab.collection)
|
.getTableSchema(this.tableViewModel.queryTablesTab.collection)
|
||||||
.then((columns: CassandraTableKey[]) => {
|
.then((columns: CassandraTableKey[]) => {
|
||||||
|
@ -94,7 +93,7 @@ export default class AddTableEntityPane extends TableEntityPane {
|
||||||
headers &&
|
headers &&
|
||||||
headers.forEach((key: string) => {
|
headers.forEach((key: string) => {
|
||||||
if (!_.contains<string>(AddTableEntityPane._excludedFields, key)) {
|
if (!_.contains<string>(AddTableEntityPane._excludedFields, key)) {
|
||||||
if (this.container.isPreferredApiCassandra()) {
|
if (userContext.apiType === "Cassandra") {
|
||||||
const cassandraKeys = this.tableViewModel.queryTablesTab.collection.cassandraKeys.partitionKeys
|
const cassandraKeys = this.tableViewModel.queryTablesTab.collection.cassandraKeys.partitionKeys
|
||||||
.concat(this.tableViewModel.queryTablesTab.collection.cassandraKeys.clusteringKeys)
|
.concat(this.tableViewModel.queryTablesTab.collection.cassandraKeys.clusteringKeys)
|
||||||
.map((key) => key.property);
|
.map((key) => key.property);
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
import * as ko from "knockout";
|
import * as ko from "knockout";
|
||||||
import _ from "underscore";
|
import _ from "underscore";
|
||||||
import * as ViewModels from "../../../Contracts/ViewModels";
|
import * as ViewModels from "../../../Contracts/ViewModels";
|
||||||
import { CassandraTableKey, CassandraAPIDataClient } from "../../Tables/TableDataClient";
|
import { userContext } from "../../../UserContext";
|
||||||
import * as Entities from "../../Tables/Entities";
|
|
||||||
import TableEntityPane from "./TableEntityPane";
|
|
||||||
import * as Utilities from "../../Tables/Utilities";
|
|
||||||
import * as TableConstants from "../../Tables/Constants";
|
|
||||||
import EntityPropertyViewModel from "./EntityPropertyViewModel";
|
|
||||||
import * as TableEntityProcessor from "../../Tables/TableEntityProcessor";
|
|
||||||
import Explorer from "../../Explorer";
|
import Explorer from "../../Explorer";
|
||||||
|
import * as TableConstants from "../../Tables/Constants";
|
||||||
|
import * as Entities from "../../Tables/Entities";
|
||||||
|
import { CassandraAPIDataClient, CassandraTableKey } from "../../Tables/TableDataClient";
|
||||||
|
import * as TableEntityProcessor from "../../Tables/TableEntityProcessor";
|
||||||
|
import * as Utilities from "../../Tables/Utilities";
|
||||||
|
import EntityPropertyViewModel from "./EntityPropertyViewModel";
|
||||||
|
import TableEntityPane from "./TableEntityPane";
|
||||||
|
|
||||||
export default class EditTableEntityPane extends TableEntityPane {
|
export default class EditTableEntityPane extends TableEntityPane {
|
||||||
container: Explorer;
|
container: Explorer;
|
||||||
|
@ -21,11 +22,9 @@ export default class EditTableEntityPane extends TableEntityPane {
|
||||||
constructor(options: ViewModels.PaneOptions) {
|
constructor(options: ViewModels.PaneOptions) {
|
||||||
super(options);
|
super(options);
|
||||||
this.submitButtonText("Update Entity");
|
this.submitButtonText("Update Entity");
|
||||||
this.container.isPreferredApiCassandra.subscribe((isCassandra) => {
|
if (userContext.apiType === "Cassandra") {
|
||||||
if (isCassandra) {
|
this.submitButtonText("Update Row");
|
||||||
this.submitButtonText("Update Row");
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
this.scrollId = ko.observable<string>("editEntityScroll");
|
this.scrollId = ko.observable<string>("editEntityScroll");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +43,7 @@ export default class EditTableEntityPane extends TableEntityPane {
|
||||||
property !== TableEntityProcessor.keyProperties.etag &&
|
property !== TableEntityProcessor.keyProperties.etag &&
|
||||||
property !== TableEntityProcessor.keyProperties.resourceId &&
|
property !== TableEntityProcessor.keyProperties.resourceId &&
|
||||||
property !== TableEntityProcessor.keyProperties.self &&
|
property !== TableEntityProcessor.keyProperties.self &&
|
||||||
(!this.container.isPreferredApiCassandra() || property !== TableConstants.EntityKeyNames.RowKey)
|
(userContext.apiType !== "Cassandra" || property !== TableConstants.EntityKeyNames.RowKey)
|
||||||
) {
|
) {
|
||||||
numberOfProperties++;
|
numberOfProperties++;
|
||||||
}
|
}
|
||||||
|
@ -93,9 +92,9 @@ export default class EditTableEntityPane extends TableEntityPane {
|
||||||
key !== TableEntityProcessor.keyProperties.etag &&
|
key !== TableEntityProcessor.keyProperties.etag &&
|
||||||
key !== TableEntityProcessor.keyProperties.resourceId &&
|
key !== TableEntityProcessor.keyProperties.resourceId &&
|
||||||
key !== TableEntityProcessor.keyProperties.self &&
|
key !== TableEntityProcessor.keyProperties.self &&
|
||||||
(!this.container.isPreferredApiCassandra() || key !== TableConstants.EntityKeyNames.RowKey)
|
(userContext.apiType !== "Cassandra" || key !== TableConstants.EntityKeyNames.RowKey)
|
||||||
) {
|
) {
|
||||||
if (this.container.isPreferredApiCassandra()) {
|
if (userContext.apiType === "Cassandra") {
|
||||||
const cassandraKeys = this.tableViewModel.queryTablesTab.collection.cassandraKeys.partitionKeys
|
const cassandraKeys = this.tableViewModel.queryTablesTab.collection.cassandraKeys.partitionKeys
|
||||||
.concat(this.tableViewModel.queryTablesTab.collection.cassandraKeys.clusteringKeys)
|
.concat(this.tableViewModel.queryTablesTab.collection.cassandraKeys.clusteringKeys)
|
||||||
.map((key) => key.property);
|
.map((key) => key.property);
|
||||||
|
@ -150,7 +149,7 @@ export default class EditTableEntityPane extends TableEntityPane {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (this.container.isPreferredApiCassandra()) {
|
if (userContext.apiType === "Cassandra") {
|
||||||
(<CassandraAPIDataClient>this.container.tableDataClient)
|
(<CassandraAPIDataClient>this.container.tableDataClient)
|
||||||
.getTableSchema(this.tableViewModel.queryTablesTab.collection)
|
.getTableSchema(this.tableViewModel.queryTablesTab.collection)
|
||||||
.then((properties: CassandraTableKey[]) => {
|
.then((properties: CassandraTableKey[]) => {
|
||||||
|
@ -169,10 +168,7 @@ export default class EditTableEntityPane extends TableEntityPane {
|
||||||
var updatedEntity: any = {};
|
var updatedEntity: any = {};
|
||||||
displayedAttributes &&
|
displayedAttributes &&
|
||||||
displayedAttributes.forEach((attribute: EntityPropertyViewModel) => {
|
displayedAttributes.forEach((attribute: EntityPropertyViewModel) => {
|
||||||
if (
|
if (attribute.name() && (userContext.apiType !== "Cassandra" || attribute.value() !== "")) {
|
||||||
attribute.name() &&
|
|
||||||
(!this.tableViewModel.queryTablesTab.container.isPreferredApiCassandra() || attribute.value() !== "")
|
|
||||||
) {
|
|
||||||
var value = attribute.getPropertyValue();
|
var value = attribute.getPropertyValue();
|
||||||
var type = attribute.type();
|
var type = attribute.type();
|
||||||
if (type === TableConstants.TableType.Int64) {
|
if (type === TableConstants.TableType.Int64) {
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
import * as ko from "knockout";
|
import * as ko from "knockout";
|
||||||
import _ from "underscore";
|
import _ from "underscore";
|
||||||
import * as DataTableUtilities from "../../Tables/DataTable/DataTableUtilities";
|
import { KeyCodes } from "../../../Common/Constants";
|
||||||
import * as Entities from "../../Tables/Entities";
|
import * as ViewModels from "../../../Contracts/ViewModels";
|
||||||
import EntityPropertyViewModel from "./EntityPropertyViewModel";
|
import { userContext } from "../../../UserContext";
|
||||||
import * as TableConstants from "../../Tables/Constants";
|
import * as TableConstants from "../../Tables/Constants";
|
||||||
|
import * as DataTableUtilities from "../../Tables/DataTable/DataTableUtilities";
|
||||||
import TableEntityListViewModel from "../../Tables/DataTable/TableEntityListViewModel";
|
import TableEntityListViewModel from "../../Tables/DataTable/TableEntityListViewModel";
|
||||||
|
import * as Entities from "../../Tables/Entities";
|
||||||
import * as TableEntityProcessor from "../../Tables/TableEntityProcessor";
|
import * as TableEntityProcessor from "../../Tables/TableEntityProcessor";
|
||||||
import * as Utilities from "../../Tables/Utilities";
|
import * as Utilities from "../../Tables/Utilities";
|
||||||
import * as ViewModels from "../../../Contracts/ViewModels";
|
|
||||||
import { KeyCodes } from "../../../Common/Constants";
|
|
||||||
import { ContextualPaneBase } from "../ContextualPaneBase";
|
import { ContextualPaneBase } from "../ContextualPaneBase";
|
||||||
|
import EntityPropertyViewModel from "./EntityPropertyViewModel";
|
||||||
|
|
||||||
// Class with variables and functions that are common to both adding and editing entities
|
// Class with variables and functions that are common to both adding and editing entities
|
||||||
export default abstract class TableEntityPane extends ContextualPaneBase {
|
export default abstract class TableEntityPane extends ContextualPaneBase {
|
||||||
|
@ -52,31 +53,29 @@ export default abstract class TableEntityPane extends ContextualPaneBase {
|
||||||
|
|
||||||
constructor(options: ViewModels.PaneOptions) {
|
constructor(options: ViewModels.PaneOptions) {
|
||||||
super(options);
|
super(options);
|
||||||
this.container.isPreferredApiCassandra.subscribe((isCassandra) => {
|
if (userContext.apiType === "Cassandra") {
|
||||||
if (isCassandra) {
|
this.edmTypes([
|
||||||
this.edmTypes([
|
TableConstants.CassandraType.Text,
|
||||||
TableConstants.CassandraType.Text,
|
TableConstants.CassandraType.Ascii,
|
||||||
TableConstants.CassandraType.Ascii,
|
TableConstants.CassandraType.Bigint,
|
||||||
TableConstants.CassandraType.Bigint,
|
TableConstants.CassandraType.Blob,
|
||||||
TableConstants.CassandraType.Blob,
|
TableConstants.CassandraType.Boolean,
|
||||||
TableConstants.CassandraType.Boolean,
|
TableConstants.CassandraType.Decimal,
|
||||||
TableConstants.CassandraType.Decimal,
|
TableConstants.CassandraType.Double,
|
||||||
TableConstants.CassandraType.Double,
|
TableConstants.CassandraType.Float,
|
||||||
TableConstants.CassandraType.Float,
|
TableConstants.CassandraType.Int,
|
||||||
TableConstants.CassandraType.Int,
|
TableConstants.CassandraType.Uuid,
|
||||||
TableConstants.CassandraType.Uuid,
|
TableConstants.CassandraType.Varchar,
|
||||||
TableConstants.CassandraType.Varchar,
|
TableConstants.CassandraType.Varint,
|
||||||
TableConstants.CassandraType.Varint,
|
TableConstants.CassandraType.Inet,
|
||||||
TableConstants.CassandraType.Inet,
|
TableConstants.CassandraType.Smallint,
|
||||||
TableConstants.CassandraType.Smallint,
|
TableConstants.CassandraType.Tinyint,
|
||||||
TableConstants.CassandraType.Tinyint,
|
]);
|
||||||
]);
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.canAdd = ko.computed<boolean>(() => {
|
this.canAdd = ko.computed<boolean>(() => {
|
||||||
// Cassandra can't add since the schema can't be changed once created
|
// Cassandra can't add since the schema can't be changed once created
|
||||||
if (this.container.isPreferredApiCassandra()) {
|
if (userContext.apiType === "Cassandra") {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Adding '2' to the maximum to take into account PartitionKey and RowKey
|
// Adding '2' to the maximum to take into account PartitionKey and RowKey
|
||||||
|
@ -163,7 +162,7 @@ export default abstract class TableEntityPane extends ContextualPaneBase {
|
||||||
|
|
||||||
public insertAttribute = (name?: string, type?: string): void => {
|
public insertAttribute = (name?: string, type?: string): void => {
|
||||||
let entityProperty: EntityPropertyViewModel;
|
let entityProperty: EntityPropertyViewModel;
|
||||||
if (!!name && !!type && this.container.isPreferredApiCassandra()) {
|
if (!!name && !!type && userContext.apiType === "Cassandra") {
|
||||||
// TODO figure out validation story for blob and Inet so we can allow adding/editing them
|
// TODO figure out validation story for blob and Inet so we can allow adding/editing them
|
||||||
const nonEditableType: boolean =
|
const nonEditableType: boolean =
|
||||||
type === TableConstants.CassandraType.Blob || type === TableConstants.CassandraType.Inet;
|
type === TableConstants.CassandraType.Blob || type === TableConstants.CassandraType.Inet;
|
||||||
|
@ -253,8 +252,7 @@ export default abstract class TableEntityPane extends ContextualPaneBase {
|
||||||
key !== TableEntityProcessor.keyProperties.etag &&
|
key !== TableEntityProcessor.keyProperties.etag &&
|
||||||
key !== TableEntityProcessor.keyProperties.resourceId &&
|
key !== TableEntityProcessor.keyProperties.resourceId &&
|
||||||
key !== TableEntityProcessor.keyProperties.self &&
|
key !== TableEntityProcessor.keyProperties.self &&
|
||||||
(!viewModel.queryTablesTab.container.isPreferredApiCassandra() ||
|
(userContext.apiType !== "Cassandra" || key !== TableConstants.EntityKeyNames.RowKey)
|
||||||
key !== TableConstants.EntityKeyNames.RowKey)
|
|
||||||
) {
|
) {
|
||||||
newHeaders.push(key);
|
newHeaders.push(key);
|
||||||
}
|
}
|
||||||
|
|
|
@ -623,7 +623,6 @@ exports[`Upload Items Pane should render Default properly 1`] = `
|
||||||
"isMongoIndexingEnabled": [Function],
|
"isMongoIndexingEnabled": [Function],
|
||||||
"isNotebookEnabled": [Function],
|
"isNotebookEnabled": [Function],
|
||||||
"isNotebooksEnabledForAccount": [Function],
|
"isNotebooksEnabledForAccount": [Function],
|
||||||
"isPreferredApiCassandra": [Function],
|
|
||||||
"isPreferredApiGraph": [Function],
|
"isPreferredApiGraph": [Function],
|
||||||
"isPreferredApiMongoDB": [Function],
|
"isPreferredApiMongoDB": [Function],
|
||||||
"isPreferredApiTable": [Function],
|
"isPreferredApiTable": [Function],
|
||||||
|
|
|
@ -626,7 +626,6 @@ exports[`Delete Database Confirmation Pane submit() Should call delete database
|
||||||
"isMongoIndexingEnabled": [Function],
|
"isMongoIndexingEnabled": [Function],
|
||||||
"isNotebookEnabled": [Function],
|
"isNotebookEnabled": [Function],
|
||||||
"isNotebooksEnabledForAccount": [Function],
|
"isNotebooksEnabledForAccount": [Function],
|
||||||
"isPreferredApiCassandra": [Function],
|
|
||||||
"isPreferredApiGraph": [Function],
|
"isPreferredApiGraph": [Function],
|
||||||
"isPreferredApiMongoDB": [Function],
|
"isPreferredApiMongoDB": [Function],
|
||||||
"isPreferredApiTable": [Function],
|
"isPreferredApiTable": [Function],
|
||||||
|
|
|
@ -256,7 +256,7 @@ export class SplashScreen extends React.Component<SplashScreenProps> {
|
||||||
onClick: () => this.container.openBrowseQueriesPanel(),
|
onClick: () => this.container.openBrowseQueriesPanel(),
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!this.container.isPreferredApiCassandra()) {
|
if (userContext.apiType !== "Cassandra") {
|
||||||
items.push({
|
items.push({
|
||||||
iconSrc: NewStoredProcedureIcon,
|
iconSrc: NewStoredProcedureIcon,
|
||||||
title: "New Stored Procedure",
|
title: "New Stored Procedure",
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import Q from "q";
|
import Q from "q";
|
||||||
|
import { userContext } from "../../../UserContext";
|
||||||
import Explorer from "../../Explorer";
|
import Explorer from "../../Explorer";
|
||||||
import * as Entities from "../Entities";
|
import * as Entities from "../Entities";
|
||||||
import * as DataTableUtilities from "./DataTableUtilities";
|
import * as DataTableUtilities from "./DataTableUtilities";
|
||||||
|
@ -73,7 +74,7 @@ export default class TableCommands {
|
||||||
}
|
}
|
||||||
var entitiesToDelete: Entities.ITableEntity[] = viewModel.selected();
|
var entitiesToDelete: Entities.ITableEntity[] = viewModel.selected();
|
||||||
let deleteMessage: string = "Are you sure you want to delete the selected entities?";
|
let deleteMessage: string = "Are you sure you want to delete the selected entities?";
|
||||||
if (viewModel.queryTablesTab.container.isPreferredApiCassandra()) {
|
if (userContext.apiType === "Cassandra") {
|
||||||
deleteMessage = "Are you sure you want to delete the selected rows?";
|
deleteMessage = "Are you sure you want to delete the selected rows?";
|
||||||
}
|
}
|
||||||
if (window.confirm(deleteMessage)) {
|
if (window.confirm(deleteMessage)) {
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { Areas } from "../../../Common/Constants";
|
||||||
import * as ViewModels from "../../../Contracts/ViewModels";
|
import * as ViewModels from "../../../Contracts/ViewModels";
|
||||||
import { Action } from "../../../Shared/Telemetry/TelemetryConstants";
|
import { Action } from "../../../Shared/Telemetry/TelemetryConstants";
|
||||||
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
||||||
|
import { userContext } from "../../../UserContext";
|
||||||
import QueryTablesTab from "../../Tabs/QueryTablesTab";
|
import QueryTablesTab from "../../Tabs/QueryTablesTab";
|
||||||
import * as Constants from "../Constants";
|
import * as Constants from "../Constants";
|
||||||
import { getQuotedCqlIdentifier } from "../CqlUtilities";
|
import { getQuotedCqlIdentifier } from "../CqlUtilities";
|
||||||
|
@ -412,10 +413,7 @@ export default class TableEntityListViewModel extends DataTableViewModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
var entities = this.cache.data;
|
var entities = this.cache.data;
|
||||||
if (
|
if (userContext.apiType === "Cassandra" && DataTableUtilities.checkForDefaultHeader(this.headers)) {
|
||||||
this.queryTablesTab.container.isPreferredApiCassandra() &&
|
|
||||||
DataTableUtilities.checkForDefaultHeader(this.headers)
|
|
||||||
) {
|
|
||||||
(<CassandraAPIDataClient>this.queryTablesTab.container.tableDataClient)
|
(<CassandraAPIDataClient>this.queryTablesTab.container.tableDataClient)
|
||||||
.getTableSchema(this.queryTablesTab.collection)
|
.getTableSchema(this.queryTablesTab.collection)
|
||||||
.then((headers: CassandraTableKey[]) => {
|
.then((headers: CassandraTableKey[]) => {
|
||||||
|
@ -427,7 +425,7 @@ export default class TableEntityListViewModel extends DataTableViewModel {
|
||||||
} else {
|
} else {
|
||||||
var selectedHeadersUnion: string[] = DataTableUtilities.getPropertyIntersectionFromTableEntities(
|
var selectedHeadersUnion: string[] = DataTableUtilities.getPropertyIntersectionFromTableEntities(
|
||||||
entities,
|
entities,
|
||||||
this.queryTablesTab.container.isPreferredApiCassandra()
|
userContext.apiType === "Cassandra"
|
||||||
);
|
);
|
||||||
var newHeaders: string[] = _.difference(selectedHeadersUnion, this.headers);
|
var newHeaders: string[] = _.difference(selectedHeadersUnion, this.headers);
|
||||||
if (newHeaders.length > 0) {
|
if (newHeaders.length > 0) {
|
||||||
|
@ -512,7 +510,7 @@ export default class TableEntityListViewModel extends DataTableViewModel {
|
||||||
return Q.resolve(finalEntities);
|
return Q.resolve(finalEntities);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
} else if (this.continuationToken && this.queryTablesTab.container.isPreferredApiCassandra()) {
|
} else if (this.continuationToken && userContext.apiType === "Cassandra") {
|
||||||
promise = Q(
|
promise = Q(
|
||||||
this.queryTablesTab.container.tableDataClient.queryDocuments(
|
this.queryTablesTab.container.tableDataClient.queryDocuments(
|
||||||
this.queryTablesTab.collection,
|
this.queryTablesTab.collection,
|
||||||
|
@ -523,7 +521,7 @@ export default class TableEntityListViewModel extends DataTableViewModel {
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
let query = this.sqlQuery();
|
let query = this.sqlQuery();
|
||||||
if (this.queryTablesTab.container.isPreferredApiCassandra()) {
|
if (userContext.apiType === "Cassandra") {
|
||||||
query = this.cqlQuery();
|
query = this.cqlQuery();
|
||||||
}
|
}
|
||||||
promise = Q(
|
promise = Q(
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import * as ko from "knockout";
|
import * as ko from "knockout";
|
||||||
import { KeyCodes } from "../../../Common/Constants";
|
import { KeyCodes } from "../../../Common/Constants";
|
||||||
|
import { userContext } from "../../../UserContext";
|
||||||
import * as Constants from "../Constants";
|
import * as Constants from "../Constants";
|
||||||
import { getQuotedCqlIdentifier } from "../CqlUtilities";
|
import { getQuotedCqlIdentifier } from "../CqlUtilities";
|
||||||
import * as DataTableUtilities from "../DataTable/DataTableUtilities";
|
import * as DataTableUtilities from "../DataTable/DataTableUtilities";
|
||||||
|
@ -70,7 +71,7 @@ export default class QueryBuilderViewModel {
|
||||||
private scrollEventListener: boolean;
|
private scrollEventListener: boolean;
|
||||||
|
|
||||||
constructor(queryViewModel: QueryViewModel, tableEntityListViewModel: TableEntityListViewModel) {
|
constructor(queryViewModel: QueryViewModel, tableEntityListViewModel: TableEntityListViewModel) {
|
||||||
if (tableEntityListViewModel.queryTablesTab.container.isPreferredApiCassandra()) {
|
if (userContext.apiType === "Cassandra") {
|
||||||
this.edmTypes([
|
this.edmTypes([
|
||||||
Constants.CassandraType.Text,
|
Constants.CassandraType.Text,
|
||||||
Constants.CassandraType.Ascii,
|
Constants.CassandraType.Ascii,
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import * as ko from "knockout";
|
import * as ko from "knockout";
|
||||||
import _ from "underscore";
|
import _ from "underscore";
|
||||||
|
import { userContext } from "../../../UserContext";
|
||||||
import * as QueryBuilderConstants from "../Constants";
|
import * as QueryBuilderConstants from "../Constants";
|
||||||
import QueryBuilderViewModel from "./QueryBuilderViewModel";
|
|
||||||
import ClauseGroup from "./ClauseGroup";
|
|
||||||
import * as Utilities from "../Utilities";
|
import * as Utilities from "../Utilities";
|
||||||
|
import ClauseGroup from "./ClauseGroup";
|
||||||
|
import QueryBuilderViewModel from "./QueryBuilderViewModel";
|
||||||
|
|
||||||
export default class QueryClauseViewModel {
|
export default class QueryClauseViewModel {
|
||||||
public checkedForGrouping: ko.Observable<boolean>;
|
public checkedForGrouping: ko.Observable<boolean>;
|
||||||
|
@ -68,7 +69,7 @@ export default class QueryClauseViewModel {
|
||||||
this.getValueType();
|
this.getValueType();
|
||||||
|
|
||||||
this.isOperaterEditable = ko.pureComputed<boolean>(() => {
|
this.isOperaterEditable = ko.pureComputed<boolean>(() => {
|
||||||
const isPreferredApiCassandra = this._queryBuilderViewModel.tableEntityListViewModel.queryTablesTab.container.isPreferredApiCassandra();
|
const isPreferredApiCassandra = userContext.apiType === "Cassandra";
|
||||||
const cassandraKeys = isPreferredApiCassandra
|
const cassandraKeys = isPreferredApiCassandra
|
||||||
? this._queryBuilderViewModel.tableEntityListViewModel.queryTablesTab.collection.cassandraKeys.partitionKeys.map(
|
? this._queryBuilderViewModel.tableEntityListViewModel.queryTablesTab.collection.cassandraKeys.partitionKeys.map(
|
||||||
(key) => key.property
|
(key) => key.property
|
||||||
|
@ -84,7 +85,7 @@ export default class QueryClauseViewModel {
|
||||||
this.field() !== "Timestamp" &&
|
this.field() !== "Timestamp" &&
|
||||||
this.field() !== "PartitionKey" &&
|
this.field() !== "PartitionKey" &&
|
||||||
this.field() !== "RowKey" &&
|
this.field() !== "RowKey" &&
|
||||||
!this._queryBuilderViewModel.tableEntityListViewModel.queryTablesTab.container.isPreferredApiCassandra()
|
userContext.apiType !== "Cassandra"
|
||||||
);
|
);
|
||||||
|
|
||||||
this.and_or.subscribe((value) => {
|
this.and_or.subscribe((value) => {
|
||||||
|
@ -170,7 +171,7 @@ export default class QueryClauseViewModel {
|
||||||
this.type(QueryBuilderConstants.TableType.String);
|
this.type(QueryBuilderConstants.TableType.String);
|
||||||
} else {
|
} else {
|
||||||
this.resetFromTimestamp();
|
this.resetFromTimestamp();
|
||||||
if (this._queryBuilderViewModel.tableEntityListViewModel.queryTablesTab.container.isPreferredApiCassandra()) {
|
if (userContext.apiType === "Cassandra") {
|
||||||
const cassandraSchema = this._queryBuilderViewModel.tableEntityListViewModel.queryTablesTab.collection
|
const cassandraSchema = this._queryBuilderViewModel.tableEntityListViewModel.queryTablesTab.collection
|
||||||
.cassandraSchema;
|
.cassandraSchema;
|
||||||
for (let i = 0, len = cassandraSchema.length; i < len; i++) {
|
for (let i = 0, len = cassandraSchema.length; i < len; i++) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import * as ko from "knockout";
|
import * as ko from "knockout";
|
||||||
import * as _ from "underscore";
|
import * as _ from "underscore";
|
||||||
import { KeyCodes } from "../../../Common/Constants";
|
import { KeyCodes } from "../../../Common/Constants";
|
||||||
|
import { userContext } from "../../../UserContext";
|
||||||
import QueryTablesTab from "../../Tabs/QueryTablesTab";
|
import QueryTablesTab from "../../Tabs/QueryTablesTab";
|
||||||
import { getQuotedCqlIdentifier } from "../CqlUtilities";
|
import { getQuotedCqlIdentifier } from "../CqlUtilities";
|
||||||
import * as DataTableUtilities from "../DataTable/DataTableUtilities";
|
import * as DataTableUtilities from "../DataTable/DataTableUtilities";
|
||||||
|
@ -46,7 +47,7 @@ export default class QueryViewModel {
|
||||||
this._tableEntityListViewModel = queryTablesTab.tableEntityListViewModel();
|
this._tableEntityListViewModel = queryTablesTab.tableEntityListViewModel();
|
||||||
|
|
||||||
this.queryTextIsReadOnly = ko.computed<boolean>(() => {
|
this.queryTextIsReadOnly = ko.computed<boolean>(() => {
|
||||||
return !this.queryTablesTab.container.isPreferredApiCassandra();
|
return userContext.apiType !== "Cassandra";
|
||||||
});
|
});
|
||||||
let initialOptions = this._tableEntityListViewModel.headers;
|
let initialOptions = this._tableEntityListViewModel.headers;
|
||||||
this.columnOptions = ko.observableArray<string>(initialOptions);
|
this.columnOptions = ko.observableArray<string>(initialOptions);
|
||||||
|
@ -126,7 +127,7 @@ export default class QueryViewModel {
|
||||||
private setFilter = (): string => {
|
private setFilter = (): string => {
|
||||||
var queryString = this.isEditorActive()
|
var queryString = this.isEditorActive()
|
||||||
? this.queryText()
|
? this.queryText()
|
||||||
: this.queryTablesTab.container.isPreferredApiCassandra()
|
: userContext.apiType === "Cassandra"
|
||||||
? this.queryBuilderViewModel().getCqlFilterFromClauses()
|
? this.queryBuilderViewModel().getCqlFilterFromClauses()
|
||||||
: this.queryBuilderViewModel().getODataFilterFromClauses();
|
: this.queryBuilderViewModel().getODataFilterFromClauses();
|
||||||
var filter = queryString;
|
var filter = queryString;
|
||||||
|
@ -159,7 +160,7 @@ export default class QueryViewModel {
|
||||||
|
|
||||||
public runQuery = (): DataTables.DataTable => {
|
public runQuery = (): DataTables.DataTable => {
|
||||||
var filter = this.setFilter();
|
var filter = this.setFilter();
|
||||||
if (filter && !this.queryTablesTab.container.isPreferredApiCassandra()) {
|
if (filter && userContext.apiType !== "Cassandra") {
|
||||||
filter = filter.replace(/"/g, "'");
|
filter = filter.replace(/"/g, "'");
|
||||||
}
|
}
|
||||||
var top = this.topValue();
|
var top = this.topValue();
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
import * as ko from "knockout";
|
import * as ko from "knockout";
|
||||||
import Q from "q";
|
import Q from "q";
|
||||||
import * as ViewModels from "../../Contracts/ViewModels";
|
import AddEntityIcon from "../../../images/AddEntity.svg";
|
||||||
import TabsBase from "./TabsBase";
|
import DeleteEntitiesIcon from "../../../images/DeleteEntities.svg";
|
||||||
import TableEntityListViewModel from "../Tables/DataTable/TableEntityListViewModel";
|
import EditEntityIcon from "../../../images/Edit-entity.svg";
|
||||||
import QueryViewModel from "../Tables/QueryBuilder/QueryViewModel";
|
import ExecuteQueryIcon from "../../../images/ExecuteQuery.svg";
|
||||||
import TableCommands from "../Tables/DataTable/TableCommands";
|
|
||||||
import { TableDataClient } from "../Tables/TableDataClient";
|
|
||||||
|
|
||||||
import QueryBuilderIcon from "../../../images/Query-Builder.svg";
|
import QueryBuilderIcon from "../../../images/Query-Builder.svg";
|
||||||
import QueryTextIcon from "../../../images/Query-Text.svg";
|
import QueryTextIcon from "../../../images/Query-Text.svg";
|
||||||
import ExecuteQueryIcon from "../../../images/ExecuteQuery.svg";
|
import * as ViewModels from "../../Contracts/ViewModels";
|
||||||
import AddEntityIcon from "../../../images/AddEntity.svg";
|
import { userContext } from "../../UserContext";
|
||||||
import EditEntityIcon from "../../../images/Edit-entity.svg";
|
|
||||||
import DeleteEntitiesIcon from "../../../images/DeleteEntities.svg";
|
|
||||||
import Explorer from "../Explorer";
|
|
||||||
import { CommandButtonComponentProps } from "../Controls/CommandButton/CommandButtonComponent";
|
import { CommandButtonComponentProps } from "../Controls/CommandButton/CommandButtonComponent";
|
||||||
|
import Explorer from "../Explorer";
|
||||||
|
import TableCommands from "../Tables/DataTable/TableCommands";
|
||||||
|
import TableEntityListViewModel from "../Tables/DataTable/TableEntityListViewModel";
|
||||||
|
import QueryViewModel from "../Tables/QueryBuilder/QueryViewModel";
|
||||||
|
import { TableDataClient } from "../Tables/TableDataClient";
|
||||||
import template from "./QueryTablesTab.html";
|
import template from "./QueryTablesTab.html";
|
||||||
|
import TabsBase from "./TabsBase";
|
||||||
|
|
||||||
// Will act as table explorer class
|
// Will act as table explorer class
|
||||||
export default class QueryTablesTab extends TabsBase {
|
export default class QueryTablesTab extends TabsBase {
|
||||||
|
@ -176,7 +176,7 @@ export default class QueryTablesTab extends TabsBase {
|
||||||
protected getTabsButtons(): CommandButtonComponentProps[] {
|
protected getTabsButtons(): CommandButtonComponentProps[] {
|
||||||
const buttons: CommandButtonComponentProps[] = [];
|
const buttons: CommandButtonComponentProps[] = [];
|
||||||
if (this.queryBuilderButton.visible()) {
|
if (this.queryBuilderButton.visible()) {
|
||||||
const label = this.container.isPreferredApiCassandra() ? "CQL Query Builder" : "Query Builder";
|
const label = userContext.apiType === "Cassandra" ? "CQL Query Builder" : "Query Builder";
|
||||||
buttons.push({
|
buttons.push({
|
||||||
iconSrc: QueryBuilderIcon,
|
iconSrc: QueryBuilderIcon,
|
||||||
iconAlt: label,
|
iconAlt: label,
|
||||||
|
@ -190,7 +190,7 @@ export default class QueryTablesTab extends TabsBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.queryTextButton.visible()) {
|
if (this.queryTextButton.visible()) {
|
||||||
const label = this.container.isPreferredApiCassandra() ? "CQL Query Text" : "Query Text";
|
const label = userContext.apiType === "Cassandra" ? "CQL Query Text" : "Query Text";
|
||||||
buttons.push({
|
buttons.push({
|
||||||
iconSrc: QueryTextIcon,
|
iconSrc: QueryTextIcon,
|
||||||
iconAlt: label,
|
iconAlt: label,
|
||||||
|
@ -217,7 +217,7 @@ export default class QueryTablesTab extends TabsBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.addEntityButton.visible()) {
|
if (this.addEntityButton.visible()) {
|
||||||
const label = this.container.isPreferredApiCassandra() ? "Add Row" : "Add Entity";
|
const label = userContext.apiType === "Cassandra" ? "Add Row" : "Add Entity";
|
||||||
buttons.push({
|
buttons.push({
|
||||||
iconSrc: AddEntityIcon,
|
iconSrc: AddEntityIcon,
|
||||||
iconAlt: label,
|
iconAlt: label,
|
||||||
|
@ -230,7 +230,7 @@ export default class QueryTablesTab extends TabsBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.editEntityButton.visible()) {
|
if (this.editEntityButton.visible()) {
|
||||||
const label = this.container.isPreferredApiCassandra() ? "Edit Row" : "Edit Entity";
|
const label = userContext.apiType === "Cassandra" ? "Edit Row" : "Edit Entity";
|
||||||
buttons.push({
|
buttons.push({
|
||||||
iconSrc: EditEntityIcon,
|
iconSrc: EditEntityIcon,
|
||||||
iconAlt: label,
|
iconAlt: label,
|
||||||
|
@ -243,7 +243,7 @@ export default class QueryTablesTab extends TabsBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.deleteEntityButton.visible()) {
|
if (this.deleteEntityButton.visible()) {
|
||||||
const label = this.container.isPreferredApiCassandra() ? "Delete Rows" : "Delete Entities";
|
const label = userContext.apiType === "Cassandra" ? "Delete Rows" : "Delete Entities";
|
||||||
buttons.push({
|
buttons.push({
|
||||||
iconSrc: DeleteEntitiesIcon,
|
iconSrc: DeleteEntitiesIcon,
|
||||||
iconAlt: label,
|
iconAlt: label,
|
||||||
|
|
|
@ -34,9 +34,7 @@ describe("Collection", () => {
|
||||||
mockContainer.isPreferredApiMongoDB = ko.computed(() => {
|
mockContainer.isPreferredApiMongoDB = ko.computed(() => {
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
mockContainer.isPreferredApiCassandra = ko.computed(() => {
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
mockContainer.isDatabaseNodeOrNoneSelected = () => {
|
mockContainer.isDatabaseNodeOrNoneSelected = () => {
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
|
@ -374,7 +374,7 @@ export default class Collection implements ViewModels.Collection {
|
||||||
dataExplorerArea: Constants.Areas.ResourceTree,
|
dataExplorerArea: Constants.Areas.ResourceTree,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.container.isPreferredApiCassandra() && !this.cassandraKeys) {
|
if (userContext.apiType === "Cassandra" && !this.cassandraKeys) {
|
||||||
(<CassandraAPIDataClient>this.container.tableDataClient).getTableKeys(this).then((keys: CassandraTableKeys) => {
|
(<CassandraAPIDataClient>this.container.tableDataClient).getTableKeys(this).then((keys: CassandraTableKeys) => {
|
||||||
this.cassandraKeys = keys;
|
this.cassandraKeys = keys;
|
||||||
});
|
});
|
||||||
|
@ -391,7 +391,7 @@ export default class Collection implements ViewModels.Collection {
|
||||||
} else {
|
} else {
|
||||||
this.documentIds([]);
|
this.documentIds([]);
|
||||||
let title = `Entities`;
|
let title = `Entities`;
|
||||||
if (this.container.isPreferredApiCassandra()) {
|
if (userContext.apiType === "Cassandra") {
|
||||||
title = `Rows`;
|
title = `Rows`;
|
||||||
}
|
}
|
||||||
const startKey: number = TelemetryProcessor.traceStart(Action.Tab, {
|
const startKey: number = TelemetryProcessor.traceStart(Action.Tab, {
|
||||||
|
@ -1084,7 +1084,7 @@ export default class Collection implements ViewModels.Collection {
|
||||||
if (this.container.isPreferredApiTable()) {
|
if (this.container.isPreferredApiTable()) {
|
||||||
this.onTableEntitiesClick();
|
this.onTableEntitiesClick();
|
||||||
return;
|
return;
|
||||||
} else if (this.container.isPreferredApiCassandra()) {
|
} else if (userContext.apiType === "Cassandra") {
|
||||||
this.onTableEntitiesClick();
|
this.onTableEntitiesClick();
|
||||||
return;
|
return;
|
||||||
} else if (this.container.isPreferredApiGraph()) {
|
} else if (this.container.isPreferredApiGraph()) {
|
||||||
|
@ -1104,7 +1104,7 @@ export default class Collection implements ViewModels.Collection {
|
||||||
public getLabel(): string {
|
public getLabel(): string {
|
||||||
if (this.container.isPreferredApiTable()) {
|
if (this.container.isPreferredApiTable()) {
|
||||||
return "Entities";
|
return "Entities";
|
||||||
} else if (this.container.isPreferredApiCassandra()) {
|
} else if (userContext.apiType === "Cassandra") {
|
||||||
return "Rows";
|
return "Rows";
|
||||||
} else if (this.container.isPreferredApiGraph()) {
|
} else if (this.container.isPreferredApiGraph()) {
|
||||||
return "Graph";
|
return "Graph";
|
||||||
|
|
|
@ -273,7 +273,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
||||||
contextMenu: ResourceTreeContextMenuButtonFactory.createCollectionContextMenuButton(this.container, collection),
|
contextMenu: ResourceTreeContextMenuButtonFactory.createCollectionContextMenuButton(this.container, collection),
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!this.container.isPreferredApiCassandra() || !this.container.isServerlessEnabled()) {
|
if (userContext.apiType !== "Cassandra" || !this.container.isServerlessEnabled()) {
|
||||||
children.push({
|
children.push({
|
||||||
label: database.isDatabaseShared() || this.container.isServerlessEnabled() ? "Settings" : "Scale & Settings",
|
label: database.isDatabaseShared() || this.container.isServerlessEnabled() ? "Settings" : "Scale & Settings",
|
||||||
onClick: collection.onSettingsClick.bind(collection),
|
onClick: collection.onSettingsClick.bind(collection),
|
||||||
|
|
|
@ -147,7 +147,7 @@ export class TabRouteHandler {
|
||||||
);
|
);
|
||||||
collection &&
|
collection &&
|
||||||
collection.container &&
|
collection.container &&
|
||||||
(collection.container.isPreferredApiTable() || collection.container.isPreferredApiCassandra()) &&
|
(collection.container.isPreferredApiTable() || userContext.apiType === "Cassandra") &&
|
||||||
collection.onTableEntitiesClick();
|
collection.onTableEntitiesClick();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue