diff --git a/packages/builder/cypress/integration/createTable.spec.js b/packages/builder/cypress/integration/createTable.spec.js index 214727ab7d..d2c5f2d6a6 100644 --- a/packages/builder/cypress/integration/createTable.spec.js +++ b/packages/builder/cypress/integration/createTable.spec.js @@ -1,70 +1,62 @@ -context('Create a Table', () => { - before(() => { - cy.visit('localhost:4001/_builder') - cy.createApp('Table App', 'Table App Description') - }) +context("Create a Table", () => { + before(() => { + cy.visit("localhost:4001/_builder") + cy.createApp("Table App", "Table App Description") + }) - it('should create a new Table', () => { - cy.createTable('dog') + it("should create a new Table", () => { + cy.createTable("dog") - // Check if Table exists - cy.get('.title').should('have.text', 'dog') - }) + // Check if Table exists + cy.get(".title").should("have.text", "dog") + }) - it('adds a new column to the table', () => { - cy.addColumn('dog', 'name', 'Plain Text') + it("adds a new column to the table", () => { + cy.addColumn("dog", "name", "Plain Text") + cy.contains("name").should("be.visible") + }) - cy.contains('name').should("be.visible") - }) + it("creates a record in the table", () => { + cy.addRecord(["Rover"]) + cy.contains("Rover").should("be.visible") + }) - it('creates a record in the table', () => { - cy.addRecord(["Rover"]) + it("updates a column on the table", () => { + cy.contains("name").click() + cy.get("[data-cy='edit-column-header']").click() + cy.get("[placeholder=Name]").type("updated") + cy.get("select").select("Plain Text") + cy.contains("Save Column").click() + cy.contains("nameupdated").should("have.text", "nameupdated ") + }) - cy.contains('Rover').should("be.visible") - }) + it("edits a record", () => { + cy.get("tbody .ri-more-line").click() + cy.get("[data-cy=edit-row]").click() + cy.get(".actions input").type("Updated") + cy.contains("Save").click() + cy.contains("RoverUpdated").should("have.text", "RoverUpdated") + }) - it('updates a column on the table', () => { - cy.contains("name").click() - cy.get("[data-cy='edit-column-header']").click() + it("deletes a record", () => { + cy.get("tbody .ri-more-line").click() + cy.get("[data-cy=delete-row]").click() + cy.contains("Delete Row").click() + cy.contains("RoverUpdated").should("not.exist") + }) - cy.get("[placeholder=Name]").type("updated") - cy.get("select").select("Plain Text") - - cy.contains("Save Column").click() - - cy.contains('nameupdated').should('have.text', 'nameupdated ') - }) - - it('edits a record', () => { - cy.get("tbody .ri-more-line").click() - cy.get("[data-cy=edit-row]").click() - cy.get(".actions input").type("Updated") - cy.contains("Save").click() - - cy.contains('RoverUpdated').should('have.text', 'RoverUpdated') - }) - - it('deletes a record', () => { - cy.get("tbody .ri-more-line").click() - cy.get("[data-cy=delete-row]").click() - cy.get(".modal-actions").contains("Delete").click() - - cy.contains('RoverUpdated').should('not.exist') - }) - - it('deletes a column', () => { - cy.contains("name").click() - cy.get("[data-cy='delete-column-header']").click() - - cy.contains('nameupdated').should('not.exist') - }) - - it('deletes a table', () => { - cy.contains("div", "dog").get(".ri-more-line").click() - cy.get("[data-cy=delete-table]").click() - cy.get(".modal-actions").contains("Delete").click() - - cy.contains('dog').should('not.exist') - }) + it("deletes a column", () => { + cy.contains("name").click() + cy.get("[data-cy='delete-column-header']").click() + cy.contains("nameupdated").should("not.exist") + }) + it("deletes a table", () => { + cy.contains("div", "dog") + .get(".ri-more-line") + .click() + cy.get("[data-cy=delete-table]").click() + cy.contains("Delete Table").click() + cy.contains("dog").should("not.exist") + }) }) diff --git a/packages/builder/cypress/integration/createView.spec.js b/packages/builder/cypress/integration/createView.spec.js index 3ccf4d5cfd..c817d98237 100644 --- a/packages/builder/cypress/integration/createView.spec.js +++ b/packages/builder/cypress/integration/createView.spec.js @@ -1,90 +1,100 @@ +context("Create a View", () => { + before(() => { + cy.visit("localhost:4001/_builder") + cy.createApp("View App", "View App Description") + cy.createTable("data") + cy.addColumn("data", "group", "Plain Text") + cy.addColumn("data", "age", "Number") + cy.addColumn("data", "rating", "Number") -context('Create a View', () => { - before(() => { - cy.visit('localhost:4001/_builder') - cy.createApp('View App', 'View App Description') - cy.createTable('data') - cy.addColumn('data', 'group', 'Plain Text') - cy.addColumn('data', 'age', 'Number') - cy.addColumn('data', 'rating', 'Number') + // 6 Records + cy.addRecord(["Students", 25, 1]) + cy.addRecord(["Students", 20, 3]) + cy.addRecord(["Students", 18, 6]) + cy.addRecord(["Students", 25, 2]) + cy.addRecord(["Teachers", 49, 5]) + cy.addRecord(["Teachers", 36, 3]) + }) - // 6 Records - cy.addRecord(["Students", 25, 1]) - cy.addRecord(["Students", 20, 3]) - cy.addRecord(["Students", 18, 6]) - cy.addRecord(["Students", 25, 2]) - cy.addRecord(["Teachers", 49, 5]) - cy.addRecord(["Teachers", 36, 3]) + it("creates a view", () => { + cy.contains("Create New View").click() + cy.get("[placeholder='View Name']").type("Test View") + cy.contains("Save View").click() + cy.get(".title").contains("Test View") + cy.get("thead th").should($headers => { + expect($headers).to.have.length(3) + const headers = $headers.map((i, header) => Cypress.$(header).text()) + expect(headers.get()).to.deep.eq(["group", "age", "rating"]) }) + }) - it('creates a view', () => { - cy.contains("Create New View").click() - cy.get("[placeholder='View Name']").type("Test View") - cy.contains("Save View").click() - cy.get(".title").contains("Test View") - cy.get("thead th").should(($headers) => { - expect($headers).to.have.length(3) - const headers = $headers.map((i, header) => Cypress.$(header).text()) - expect(headers.get()).to.deep.eq([ - "group", - "age", - "rating" - ]) - }) - }); - - it('filters the view by age over 10', () => { - cy.contains("Filter").click() - cy.contains("Add Filter").click() - cy.get(".menu-container").find("select").first().select("age") - cy.get(".menu-container").find("select").eq(1).select("More Than") - cy.get("input[placeholder='age']").type(18) - cy.contains("Save").click() - cy.get("tbody tr").should(($values) => { - expect($values).to.have.length(5) - }) - }); - - it('creates a stats calculation view based on age', () => { - cy.contains("Calculate").click() - cy.get(".menu-container").find("select").first().select("Statistics") - cy.get(".menu-container").find("select").eq(1).select("age") - cy.contains("Save").click() - cy.get("thead th").should(($headers) => { - expect($headers).to.have.length(7) - const headers = $headers.map((i, header) => Cypress.$(header).text()) - expect(headers.get()).to.deep.eq([ - "field", - "sum", - "min", - "max", - "count", - "sumsqr", - "avg", - ]) - }) - cy.get("tbody td").should(($values) => { - const values = $values.map((i, value) => Cypress.$(value).text()) - expect(values.get()).to.deep.eq([ - "age", - "155", - "20", - "49", - "5", - "5347", - "31" - ]) - }) + it("filters the view by age over 10", () => { + cy.contains("Filter").click() + cy.contains("Add Filter").click() + cy.get(".menu-container") + .find("select") + .first() + .select("age") + cy.get(".menu-container") + .find("select") + .eq(1) + .select("More Than") + cy.get("input[placeholder='age']").type(18) + cy.contains("Save").click() + cy.get("tbody tr").should($values => { + expect($values).to.have.length(5) }) + }) - it('groups the view by group', () => { - cy.contains("Group By").click() - cy.get("select").select("group") - cy.contains("Save").click() - cy.contains("Students").should("be.visible") - cy.contains("Teachers").should("be.visible") + it("creates a stats calculation view based on age", () => { + cy.contains("Calculate").click() + cy.get(".menu-container") + .find("select") + .first() + .select("Statistics") + cy.get(".menu-container") + .find("select") + .eq(1) + .select("age") + cy.contains("Save").click() + cy.get("thead th").should($headers => { + expect($headers).to.have.length(7) + const headers = $headers.map((i, header) => Cypress.$(header).text()) + expect(headers.get()).to.deep.eq([ + "field", + "sum", + "min", + "max", + "count", + "sumsqr", + "avg", + ]) + }) + cy.get("tbody td").should($values => { + const values = $values.map((i, value) => Cypress.$(value).text()) + expect(values.get()).to.deep.eq([ + "age", + "155", + "20", + "49", + "5", + "5347", + "31", + ]) + }) + }) - cy.get("tbody tr").first().find("td").should(($values) => { + it("groups the view by group", () => { + cy.contains("Group By").click() + cy.get("select").select("group") + cy.contains("Save").click() + cy.contains("Students").should("be.visible") + cy.contains("Teachers").should("be.visible") + + cy.get("tbody tr") + .first() + .find("td") + .should($values => { const values = $values.map((i, value) => Cypress.$(value).text()) expect(values.get()).to.deep.eq([ "Students", @@ -93,24 +103,28 @@ context('Create a View', () => { "25", "3", "1650", - "23.333333333333332" + "23.333333333333332", ]) }) - }) + }) - it('renames a view', () => { - cy.contains("[data-cy=model-nav-item]", "Test View").find(".ri-more-line").click() - cy.contains("Edit").click() - cy.get("[placeholder='View Name']").type(" Updated") - cy.contains("Save").click() - cy.contains("Test View Updated").should("be.visible") - }) + it("renames a view", () => { + cy.contains("[data-cy=model-nav-item]", "Test View") + .find(".ri-more-line") + .click() + cy.contains("Edit").click() + cy.get("[placeholder='View Name']").type(" Updated") + cy.contains("Save").click() + cy.contains("Test View Updated").should("be.visible") + }) - it('deletes a view', () => { - cy.contains("[data-cy=model-nav-item]", "Test View Updated").click() - cy.contains("[data-cy=model-nav-item]", "Test View Updated").find(".ri-more-line").click() - cy.contains("Delete").click() - cy.get(".content").contains("button", "Delete").click() - cy.contains("TestView Updated").should("not.be.visible") - }) + it("deletes a view", () => { + cy.contains("[data-cy=model-nav-item]", "Test View Updated").click() + cy.contains("[data-cy=model-nav-item]", "Test View Updated") + .find(".ri-more-line") + .click() + cy.contains("Delete").click() + cy.contains("Delete View").click() + cy.contains("TestView Updated").should("not.be.visible") + }) }) diff --git a/packages/builder/package.json b/packages/builder/package.json index fcf3d7a9f6..db548f138d 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -63,7 +63,7 @@ } }, "dependencies": { - "@budibase/bbui": "^1.34.2", + "@budibase/bbui": "^1.34.5", "@budibase/client": "^0.1.21", "@budibase/colorpicker": "^1.0.1", "@fortawesome/fontawesome-free": "^5.14.0", diff --git a/packages/builder/src/components/automation/AutomationPanel/AutomationList/CreateAutomationModal.svelte b/packages/builder/src/components/automation/AutomationPanel/AutomationList/CreateAutomationModal.svelte index 6f07c97f4d..70d339bea9 100644 --- a/packages/builder/src/components/automation/AutomationPanel/AutomationList/CreateAutomationModal.svelte +++ b/packages/builder/src/components/automation/AutomationPanel/AutomationList/CreateAutomationModal.svelte @@ -50,7 +50,7 @@ header { font-size: var(--font-size-xl); color: var(--ink); - font-weight: bold; + font-weight: 600; display: flex; flex-direction: row; justify-content: flex-start; diff --git a/packages/builder/src/components/automation/SetupPanel/DeleteAutomationModal.svelte b/packages/builder/src/components/automation/SetupPanel/DeleteAutomationModal.svelte deleted file mode 100644 index 51909850b0..0000000000 --- a/packages/builder/src/components/automation/SetupPanel/DeleteAutomationModal.svelte +++ /dev/null @@ -1,89 +0,0 @@ - - -
- - Delete Automation -
-
-

- Are you sure you want to delete this automation? This action can't be - undone. -

-
- - - diff --git a/packages/builder/src/components/automation/SetupPanel/ParamInputs/RecordSelector.svelte b/packages/builder/src/components/automation/SetupPanel/ParamInputs/RecordSelector.svelte index d560107642..87ff341f3b 100644 --- a/packages/builder/src/components/automation/SetupPanel/ParamInputs/RecordSelector.svelte +++ b/packages/builder/src/components/automation/SetupPanel/ParamInputs/RecordSelector.svelte @@ -28,9 +28,9 @@ {#if schemaFields.length} -
+
{#each schemaFields as [field, schema]} -
+
{#if schemaHasOptions(schema)}
{field}
- {#each CONJUNCTIONS as conjunction} - - {/each} - - {/if} - + + {#each CONJUNCTIONS as conjunction} + + {/each} + + {/if} + + + {#if filter.key && isMultipleChoice(filter.key)} + + {:else} + + {/if} + removeFilter(idx)} /> {/each} - - - {#if filter.key && isMultipleChoice(filter.key)} - - {:else} - - {/if} - removeFilter(idx)} /> - {/each} -
-
- -
- - +
+ {/if} +
diff --git a/packages/builder/src/components/nav/ModelNavigator/CreateTable.svelte b/packages/builder/src/components/backend/ModelNavigator/CreateTable.svelte similarity index 68% rename from packages/builder/src/components/nav/ModelNavigator/CreateTable.svelte rename to packages/builder/src/components/backend/ModelNavigator/CreateTable.svelte index 79612ea3ff..2c84e2f42b 100644 --- a/packages/builder/src/components/nav/ModelNavigator/CreateTable.svelte +++ b/packages/builder/src/components/backend/ModelNavigator/CreateTable.svelte @@ -31,52 +31,36 @@
-
+
Create Table
-
-
-
+
-
-
-
-
+ +
diff --git a/packages/builder/src/components/nav/ModelNavigator/EditTable.svelte b/packages/builder/src/components/backend/ModelNavigator/EditTable.svelte similarity index 53% rename from packages/builder/src/components/nav/ModelNavigator/EditTable.svelte rename to packages/builder/src/components/backend/ModelNavigator/EditTable.svelte index e7926063dd..c7398838a7 100644 --- a/packages/builder/src/components/nav/ModelNavigator/EditTable.svelte +++ b/packages/builder/src/components/backend/ModelNavigator/EditTable.svelte @@ -1,18 +1,17 @@ -
+
- + {#if editing} -
Edit Table
-
+
+
Edit Table
-
-
-
+
-
-
-
-
+ +
{:else}
  • Edit
  • -
  • +
  • confirmDeleteDialog.show()}> Delete
{/if}
+ diff --git a/packages/builder/src/components/nav/ModelNavigator/EditView.svelte b/packages/builder/src/components/backend/ModelNavigator/EditView.svelte similarity index 55% rename from packages/builder/src/components/nav/ModelNavigator/EditView.svelte rename to packages/builder/src/components/backend/ModelNavigator/EditView.svelte index 7faf9b980e..df7f6232da 100644 --- a/packages/builder/src/components/nav/ModelNavigator/EditView.svelte +++ b/packages/builder/src/components/backend/ModelNavigator/EditView.svelte @@ -1,20 +1,19 @@ -
+
- + {#if editing} -
Edit View
-
+
+
Edit View
-
-
-
+
-
-
-
-
+ +
{:else}
  • Edit
  • -
  • +
  • confirmDeleteDialog.show()}> Delete
{/if}
+ diff --git a/packages/builder/src/components/nav/ModelNavigator/ListItem.svelte b/packages/builder/src/components/backend/ModelNavigator/ListItem.svelte similarity index 74% rename from packages/builder/src/components/nav/ModelNavigator/ListItem.svelte rename to packages/builder/src/components/backend/ModelNavigator/ListItem.svelte index 54d9eef0e9..31dd5b5ac4 100644 --- a/packages/builder/src/components/nav/ModelNavigator/ListItem.svelte +++ b/packages/builder/src/components/backend/ModelNavigator/ListItem.svelte @@ -19,26 +19,24 @@ diff --git a/packages/builder/src/components/nav/ModelNavigator/ModelNavigator.svelte b/packages/builder/src/components/backend/ModelNavigator/ModelNavigator.svelte similarity index 91% rename from packages/builder/src/components/nav/ModelNavigator/ModelNavigator.svelte rename to packages/builder/src/components/backend/ModelNavigator/ModelNavigator.svelte index a055c0dc67..e92903ae3c 100644 --- a/packages/builder/src/components/nav/ModelNavigator/ModelNavigator.svelte +++ b/packages/builder/src/components/backend/ModelNavigator/ModelNavigator.svelte @@ -30,7 +30,7 @@ {#if $backendUiStore.selectedDatabase && $backendUiStore.selectedDatabase._id}
-

Tables

+
Tables
{#each $backendUiStore.models as model} @@ -63,17 +63,18 @@
diff --git a/packages/builder/src/components/common/ConfirmDialog.svelte b/packages/builder/src/components/common/ConfirmDialog.svelte index 31e2d3ad86..437f657fac 100644 --- a/packages/builder/src/components/common/ConfirmDialog.svelte +++ b/packages/builder/src/components/common/ConfirmDialog.svelte @@ -34,7 +34,9 @@

{title}

- {body} +
+ {body} +