From 28bbba5522e213eef20f171c171d9d90c19d7e53 Mon Sep 17 00:00:00 2001 From: hardiknai-techm Date: Sat, 24 Apr 2021 13:39:13 +0530 Subject: [PATCH] addDatabasePane provide backward compatibility --- src/Explorer/Panes/AddDatabasePane.html | 276 +++++++++--------- src/Explorer/Panes/AddDatabasePane.test.ts | 188 ++++++------ src/Explorer/Panes/AddDatabasePane.ts | 5 +- .../AddDatabasePanelF.test.tsx.snap | 2 +- src/Explorer/Panes/PaneComponents.ts | 1 - .../UploadItemsPane.test.tsx.snap | 4 +- 6 files changed, 237 insertions(+), 239 deletions(-) diff --git a/src/Explorer/Panes/AddDatabasePane.html b/src/Explorer/Panes/AddDatabasePane.html index 94fbe95ba..2a598ade6 100644 --- a/src/Explorer/Panes/AddDatabasePane.html +++ b/src/Explorer/Panes/AddDatabasePane.html @@ -1,131 +1,131 @@
-
-
- -
-
- -
-
- - -
- -
- +
+
+ +
+
+ +
+
+ + +
+ +
+ +
+
+ + \ No newline at end of file +
+ + diff --git a/src/Explorer/Panes/AddDatabasePane.test.ts b/src/Explorer/Panes/AddDatabasePane.test.ts index 97562fd66..711a9cfc1 100644 --- a/src/Explorer/Panes/AddDatabasePane.test.ts +++ b/src/Explorer/Panes/AddDatabasePane.test.ts @@ -6,100 +6,100 @@ import Explorer from "../Explorer"; import AddDatabasePane from "./AddDatabasePane"; describe("Add Database Pane", () => { - describe("getSharedThroughputDefault()", () => { - let explorer: Explorer; - const mockDatabaseAccount: DatabaseAccount = { - id: "mock", - kind: "DocumentDB", - location: "", - name: "mock", - properties: { - documentEndpoint: "", - cassandraEndpoint: "", - gremlinEndpoint: "", - tableEndpoint: "", - enableFreeTier: false, - }, - type: undefined, - tags: [], - }; + describe("getSharedThroughputDefault()", () => { + let explorer: Explorer; + const mockDatabaseAccount: DatabaseAccount = { + id: "mock", + kind: "DocumentDB", + location: "", + name: "mock", + properties: { + documentEndpoint: "", + cassandraEndpoint: "", + gremlinEndpoint: "", + tableEndpoint: "", + enableFreeTier: false, + }, + type: undefined, + tags: [], + }; - const mockFreeTierDatabaseAccount: DatabaseAccount = { - id: "mock", - kind: "DocumentDB", - location: "", - name: "mock", - properties: { - documentEndpoint: "", - cassandraEndpoint: "", - gremlinEndpoint: "", - tableEndpoint: "", - enableFreeTier: true, - }, - type: undefined, - tags: [], - }; + const mockFreeTierDatabaseAccount: DatabaseAccount = { + id: "mock", + kind: "DocumentDB", + location: "", + name: "mock", + properties: { + documentEndpoint: "", + cassandraEndpoint: "", + gremlinEndpoint: "", + tableEndpoint: "", + enableFreeTier: true, + }, + type: undefined, + tags: [], + }; - beforeEach(() => { - explorer = new Explorer(); - }); - - it("should be true if subscription type is Benefits", () => { - updateUserContext({ - subscriptionType: SubscriptionType.Benefits, - }); - const addDatabasePane = explorer.addDatabasePane as AddDatabasePane; - expect(addDatabasePane.getSharedThroughputDefault()).toBe(true); - }); - - it("should be false if subscription type is EA", () => { - updateUserContext({ - subscriptionType: SubscriptionType.EA, - }); - const addDatabasePane = explorer.addDatabasePane as AddDatabasePane; - expect(addDatabasePane.getSharedThroughputDefault()).toBe(false); - }); - - it("should be true if subscription type is Free", () => { - updateUserContext({ - subscriptionType: SubscriptionType.Free, - }); - const addDatabasePane = explorer.addDatabasePane as AddDatabasePane; - expect(addDatabasePane.getSharedThroughputDefault()).toBe(true); - }); - - it("should be true if subscription type is Internal", () => { - updateUserContext({ - subscriptionType: SubscriptionType.Internal, - }); - const addDatabasePane = explorer.addDatabasePane as AddDatabasePane; - expect(addDatabasePane.getSharedThroughputDefault()).toBe(true); - }); - - it("should be true if subscription type is PAYG", () => { - updateUserContext({ - subscriptionType: SubscriptionType.PAYG, - }); - const addDatabasePane = explorer.addDatabasePane as AddDatabasePane; - expect(addDatabasePane.getSharedThroughputDefault()).toBe(true); - }); - - it("should display free tier text in upsell messaging", () => { - explorer.databaseAccount(mockFreeTierDatabaseAccount); - const addDatabasePane = explorer.addDatabasePane as AddDatabasePane; - expect(addDatabasePane.isFreeTierAccount()).toBe(true); - expect(addDatabasePane.upsellMessage()).toContain("With free tier"); - expect(addDatabasePane.upsellAnchorUrl()).toBe(Constants.Urls.freeTierInformation); - expect(addDatabasePane.upsellAnchorText()).toBe("Learn more"); - }); - - it("should display standard texr in upsell messaging", () => { - explorer.databaseAccount(mockDatabaseAccount); - const addDatabasePane = explorer.addDatabasePane as AddDatabasePane; - expect(addDatabasePane.isFreeTierAccount()).toBe(false); - expect(addDatabasePane.upsellMessage()).toContain("Start at"); - expect(addDatabasePane.upsellAnchorUrl()).toBe(Constants.Urls.cosmosPricing); - expect(addDatabasePane.upsellAnchorText()).toBe("More details"); - }); + beforeEach(() => { + explorer = new Explorer(); }); -}); \ No newline at end of file + + it("should be true if subscription type is Benefits", () => { + updateUserContext({ + subscriptionType: SubscriptionType.Benefits, + }); + const addDatabasePane = explorer.addDatabasePane as AddDatabasePane; + expect(addDatabasePane.getSharedThroughputDefault()).toBe(true); + }); + + it("should be false if subscription type is EA", () => { + updateUserContext({ + subscriptionType: SubscriptionType.EA, + }); + const addDatabasePane = explorer.addDatabasePane as AddDatabasePane; + expect(addDatabasePane.getSharedThroughputDefault()).toBe(false); + }); + + it("should be true if subscription type is Free", () => { + updateUserContext({ + subscriptionType: SubscriptionType.Free, + }); + const addDatabasePane = explorer.addDatabasePane as AddDatabasePane; + expect(addDatabasePane.getSharedThroughputDefault()).toBe(true); + }); + + it("should be true if subscription type is Internal", () => { + updateUserContext({ + subscriptionType: SubscriptionType.Internal, + }); + const addDatabasePane = explorer.addDatabasePane as AddDatabasePane; + expect(addDatabasePane.getSharedThroughputDefault()).toBe(true); + }); + + it("should be true if subscription type is PAYG", () => { + updateUserContext({ + subscriptionType: SubscriptionType.PAYG, + }); + const addDatabasePane = explorer.addDatabasePane as AddDatabasePane; + expect(addDatabasePane.getSharedThroughputDefault()).toBe(true); + }); + + it("should display free tier text in upsell messaging", () => { + explorer.databaseAccount(mockFreeTierDatabaseAccount); + const addDatabasePane = explorer.addDatabasePane as AddDatabasePane; + expect(addDatabasePane.isFreeTierAccount()).toBe(true); + expect(addDatabasePane.upsellMessage()).toContain("With free tier"); + expect(addDatabasePane.upsellAnchorUrl()).toBe(Constants.Urls.freeTierInformation); + expect(addDatabasePane.upsellAnchorText()).toBe("Learn more"); + }); + + it("should display standard texr in upsell messaging", () => { + explorer.databaseAccount(mockDatabaseAccount); + const addDatabasePane = explorer.addDatabasePane as AddDatabasePane; + expect(addDatabasePane.isFreeTierAccount()).toBe(false); + expect(addDatabasePane.upsellMessage()).toContain("Start at"); + expect(addDatabasePane.upsellAnchorUrl()).toBe(Constants.Urls.cosmosPricing); + expect(addDatabasePane.upsellAnchorText()).toBe("More details"); + }); + }); +}); diff --git a/src/Explorer/Panes/AddDatabasePane.ts b/src/Explorer/Panes/AddDatabasePane.ts index d011f0338..7e2eac94a 100644 --- a/src/Explorer/Panes/AddDatabasePane.ts +++ b/src/Explorer/Panes/AddDatabasePane.ts @@ -71,8 +71,9 @@ export default class AddDatabasePane extends ContextualPaneBase { this.databaseIdTooltipText = ko.computed(() => { const isCassandraAccount: boolean = userContext.apiType === "Cassandra"; - return `A ${isCassandraAccount ? "keyspace" : "database"} is a logical container of one or more ${isCassandraAccount ? "tables" : "collections" - }`; + return `A ${isCassandraAccount ? "keyspace" : "database"} is a logical container of one or more ${ + isCassandraAccount ? "tables" : "collections" + }`; }); this.databaseLevelThroughputTooltipText = ko.computed(() => { const isCassandraAccount: boolean = userContext.apiType === "Cassandra"; diff --git a/src/Explorer/Panes/AddDatabasePanelF/__snapshots__/AddDatabasePanelF.test.tsx.snap b/src/Explorer/Panes/AddDatabasePanelF/__snapshots__/AddDatabasePanelF.test.tsx.snap index 9ec21fe6d..02db90c8d 100644 --- a/src/Explorer/Panes/AddDatabasePanelF/__snapshots__/AddDatabasePanelF.test.tsx.snap +++ b/src/Explorer/Panes/AddDatabasePanelF/__snapshots__/AddDatabasePanelF.test.tsx.snap @@ -614,7 +614,7 @@ exports[`AddDatabasePane Pane should render Default properly 1`] = ` } } formError="" - id="copynotebookpane" + id="add-database-inputs" isExecuting={false} onClose={[Function]} onSubmit={[Function]} diff --git a/src/Explorer/Panes/PaneComponents.ts b/src/Explorer/Panes/PaneComponents.ts index 12e1b7a40..06d4b4921 100644 --- a/src/Explorer/Panes/PaneComponents.ts +++ b/src/Explorer/Panes/PaneComponents.ts @@ -7,7 +7,6 @@ import StringInputPaneTemplate from "./StringInputPane.html"; import TableAddEntityPaneTemplate from "./Tables/TableAddEntityPane.html"; import TableEditEntityPaneTemplate from "./Tables/TableEditEntityPane.html"; - export class PaneComponent { constructor(data: any) { return data.data; diff --git a/src/Explorer/Panes/UploadItemsPane/__snapshots__/UploadItemsPane.test.tsx.snap b/src/Explorer/Panes/UploadItemsPane/__snapshots__/UploadItemsPane.test.tsx.snap index fb25c11da..6cfb1497e 100644 --- a/src/Explorer/Panes/UploadItemsPane/__snapshots__/UploadItemsPane.test.tsx.snap +++ b/src/Explorer/Panes/UploadItemsPane/__snapshots__/UploadItemsPane.test.tsx.snap @@ -630,9 +630,7 @@ exports[`Upload Items Pane should render Default properly 1`] = ` multiple={true} onUpload={[Function]} tabIndex={0} - tooltip="Select one or more JSON files to upload. Each file can contain a single JSON document or an array of JSON - documents. The combined size of all files in an individual upload operation must be less than 2 MB. You - can perform multiple upload operations for larger data sets." + tooltip="Select one or more JSON files to upload. Each file can contain a single JSON document or an array of JSON documents. The combined size of all files in an individual upload operation must be less than 2 MB. You can perform multiple upload operations for larger data sets." />