diff --git a/packages/builder/cypress/integration/renameAnApplication.spec.js b/packages/builder/cypress/integration/renameAnApplication.spec.js index b9da64989b..95a152c017 100644 --- a/packages/builder/cypress/integration/renameAnApplication.spec.js +++ b/packages/builder/cypress/integration/renameAnApplication.spec.js @@ -11,7 +11,8 @@ it("should rename an unpublished application", () => { renameApp(appRename) cy.searchForApplication(appRename) cy.get(".appGrid").find(".wrapper").should("have.length", 1) - }) + cy.deleteApp(appRename) +}) xit("Should rename a published application", () => { // It is not possible to rename a published application diff --git a/packages/builder/cypress/support/commands.js b/packages/builder/cypress/support/commands.js index 82e3c45a1f..ca758e46d0 100644 --- a/packages/builder/cypress/support/commands.js +++ b/packages/builder/cypress/support/commands.js @@ -43,24 +43,26 @@ Cypress.Commands.add("createApp", name => { }) }) -Cypress.Commands.add("deleteApp", () => { +Cypress.Commands.add("deleteApp", appName => { cy.visit(`localhost:${Cypress.env("PORT")}/builder`) cy.wait(1000) cy.request(`localhost:${Cypress.env("PORT")}/api/applications?status=all`) .its("body") .then(val => { - console.log(val) if (val.length > 0) { cy.get(".title > :nth-child(3) > .spectrum-Icon").click() cy.contains("Delete").click() - cy.get(".spectrum-Button--warning").click() + cy.get(".spectrum-Modal").within(() => { + cy.get("input").type(appName) + cy.get(".spectrum-Button--warning").click() + }) } }) }) Cypress.Commands.add("createTestApp", () => { const appName = "Cypress Tests" - cy.deleteApp() + cy.deleteApp(appName) cy.createApp(appName, "This app is used for Cypress testing.") }) diff --git a/packages/builder/src/components/common/ConfirmDialog.svelte b/packages/builder/src/components/common/ConfirmDialog.svelte index cf2bf989b9..ece20fe102 100644 --- a/packages/builder/src/components/common/ConfirmDialog.svelte +++ b/packages/builder/src/components/common/ConfirmDialog.svelte @@ -8,6 +8,7 @@ export let onOk = undefined export let onCancel = undefined export let warning = true + export let disabled let modal @@ -26,6 +27,7 @@ confirmText={okText} {cancelText} {warning} + {disabled} >
{body} diff --git a/packages/builder/src/components/deploy/RevertModal.svelte b/packages/builder/src/components/deploy/RevertModal.svelte index 7f4decebee..bc2ad0d0aa 100644 --- a/packages/builder/src/components/deploy/RevertModal.svelte +++ b/packages/builder/src/components/deploy/RevertModal.svelte @@ -1,9 +1,16 @@ diff --git a/packages/builder/src/components/start/CreateAppModal.svelte b/packages/builder/src/components/start/CreateAppModal.svelte index 1db5e46261..68845e075b 100644 --- a/packages/builder/src/components/start/CreateAppModal.svelte +++ b/packages/builder/src/components/start/CreateAppModal.svelte @@ -157,6 +157,11 @@ } return title } + + async function onCancel() { + template = null + await auth.setInitInfo({}) + } {#if showTemplateSelection} @@ -186,7 +191,7 @@ title={getModalTitle()} confirmText={template?.fromFile ? "Import app" : "Create app"} onConfirm={createNewApp} - onCancel={inline ? () => (template = null) : null} + onCancel={inline ? onCancel : null} cancelText={inline ? "Back" : undefined} showCloseIcon={!inline} disabled={!valid} diff --git a/packages/builder/src/pages/builder/_layout.svelte b/packages/builder/src/pages/builder/_layout.svelte index 179131107f..bf55be5534 100644 --- a/packages/builder/src/pages/builder/_layout.svelte +++ b/packages/builder/src/pages/builder/_layout.svelte @@ -28,9 +28,13 @@ } if (user && user.tenantId) { - // no tenant in the url - send to account portal to fix this if (!urlTenantId) { - window.location.href = $admin.accountPortalUrl + // redirect to correct tenantId subdomain + if (!window.location.host.includes("localhost")) { + let redirectUrl = window.location.href + redirectUrl = redirectUrl.replace("://", `://${user.tenantId}.`) + window.location.href = redirectUrl + } return } diff --git a/packages/builder/src/pages/builder/portal/apps/index.svelte b/packages/builder/src/pages/builder/portal/apps/index.svelte index 2c8cbb1097..53ad661f72 100644 --- a/packages/builder/src/pages/builder/portal/apps/index.svelte +++ b/packages/builder/src/pages/builder/portal/apps/index.svelte @@ -6,6 +6,7 @@ ActionButton, ActionGroup, ButtonGroup, + Input, Select, Modal, Page, @@ -36,6 +37,7 @@ let loaded = false let searchTerm = "" let cloud = $admin.cloud + let appName = "" $: enrichedApps = enrichApps($apps, $auth.user, sortBy) $: filteredApps = enrichedApps.filter(app => @@ -296,8 +298,12 @@ title="Confirm deletion" okText="Delete app" onOk={confirmDeleteApp} + disabled={appName !== selectedApp?.name} > Are you sure you want to delete the app {selectedApp?.name}? + +Please enter the app name below to confirm.
+