From 21305a646af3a40a275ce88c743565f6915d99d6 Mon Sep 17 00:00:00 2001 From: Maurits Lourens Date: Fri, 3 Jun 2022 00:41:16 +0200 Subject: [PATCH] move the unpublish link --- .../integration/appPublishWorkflow.spec.js | 25 ++++++++----------- packages/builder/cypress/support/interact.js | 6 ++++- .../src/components/deploy/DeployModal.svelte | 2 +- .../src/components/start/AppRow.svelte | 2 +- .../overview/[application]/index.svelte | 7 +----- .../overview/_components/OverviewTab.svelte | 9 +++++++ 6 files changed, 27 insertions(+), 24 deletions(-) diff --git a/packages/builder/cypress/integration/appPublishWorkflow.spec.js b/packages/builder/cypress/integration/appPublishWorkflow.spec.js index d05a97f691..af412555a3 100644 --- a/packages/builder/cypress/integration/appPublishWorkflow.spec.js +++ b/packages/builder/cypress/integration/appPublishWorkflow.spec.js @@ -1,4 +1,5 @@ import filterTests from "../support/filterTests" +import { APP_TABLE_APP_NAME, DEPLOY_SUCCESS_MODAL } from "../support/interact"; const interact = require('../support/interact') filterTests(['all'], () => { @@ -20,10 +21,10 @@ filterTests(['all'], () => { cy.get(interact.APP_TABLE_ROW_ACTION).eq(0) .within(() => { - cy.get(interact.SPECTRUM_BUTTON_TEMPLATE).contains("Preview") + //cy.get(interact.SPECTRUM_BUTTON_TEMPLATE).contains("Preview") cy.get(interact.SPECTRUM_BUTTON_TEMPLATE).contains("Edit").click({ force: true }) }) - + cy.get(interact.DEPLOYMENT_TOP_NAV_GLOBESTRIKE).should("exist") cy.get(interact.DEPLOYMENT_TOP_GLOBE).should("not.exist") }) @@ -39,7 +40,7 @@ filterTests(['all'], () => { }); //Verify that the app url is presented correctly to the user - cy.get(interact.DEPLOY_APP_MODAL) + cy.get(interact.DEPLOY_SUCCESS_MODAL) .should("be.visible") .within(() => { let appUrl = Cypress.config().baseUrl + '/app/cypress-tests' @@ -63,7 +64,7 @@ filterTests(['all'], () => { }) cy.get(interact.DEPLOYMENT_TOP_GLOBE).should("exist").click({ force: true }) - + cy.get(interact.PUBLISH_POPOVER_MENU).should("be.visible") .within(() => { cy.get(interact.PUBLISH_POPOVER_ACTION).should("exist") @@ -72,9 +73,9 @@ filterTests(['all'], () => { }) }) - it("Should unpublish an application from the top navigation and reflect the status change", () => { + it("Should unpublish an application using the link and reflect the status change", () => { //Assuming the previous test app exists and is published - + cy.visit(`${Cypress.config().baseUrl}/builder`) cy.get(interact.APP_TABLE_STATUS).eq(0) @@ -85,17 +86,11 @@ filterTests(['all'], () => { cy.get(interact.APP_TABLE_ROW_ACTION).eq(0) .within(() => { - cy.get(interact.SPECTRUM_BUTTON).contains("View app") - cy.get(interact.SPECTRUM_BUTTON).contains("Edit").click({ force: true }) + cy.get(interact.SPECTRUM_BUTTON).contains("View") + cy.get(interact.APP_TABLE_APP_NAME).click({ force: true }) }) - //The published status - cy.get(interact.DEPLOYMENT_TOP_GLOBE).should("exist") - .click({ force: true }) - - cy.get(interact.PUBLISH_POPOVER_MENU).should("be.visible") - cy.get("[data-cy='publish-popover-menu'] [data-cy='publish-popover-action']") - .click({ force : true }) + cy.get(interact.SPECTRUM_LINK).contains('Unpublish').click(); cy.get(interact.UNPUBLISH_MODAL).should("be.visible") .within(() => { diff --git a/packages/builder/cypress/support/interact.js b/packages/builder/cypress/support/interact.js index 22ab13a48b..43df8eec81 100644 --- a/packages/builder/cypress/support/interact.js +++ b/packages/builder/cypress/support/interact.js @@ -26,6 +26,7 @@ export const SPECTRUM_POPOVER = ".spectrum-Popover" export const OPTION_SOURCE_PROP_CONROL = '[data-cy="optionsSource-prop-control' export const APP_TABLE_STATUS = ".appTable .app-status" export const APP_TABLE_ROW_ACTION = ".appTable .app-row-actions" +export const APP_TABLE_APP_NAME = '[data-cy="app-name-link"]' export const DEPLOYMENT_TOP_NAV_GLOBESTRIKE = ".deployment-top-nav svg[aria-label=GlobeStrike]" export const DEPLOYMENT_TOP_GLOBE = ".deployment-top-nav svg[aria-label=Globe]" @@ -33,13 +34,14 @@ export const PUBLISH_POPOVER_MENU = '[data-cy="publish-popover-menu"]' export const PUBLISH_POPOVER_ACTION = '[data-cy="publish-popover-action"]' export const PUBLISH_POPOVER_MESSAGE = ".publish-popover-message" export const SPECTRUM_BUTTON = ".spectrum-Button" +export const SPECTRUM_LINK = ".spectrum-Link" export const TOPRIGHTNAV_BUTTON_SPECTRUM = ".toprightnav button.spectrum-Button" //createComponents export const SETTINGS = "[data-cy=Settings]" export const SETTINGS_INPUT = "[data-cy=setting-text] input" export const DESIGN = "[data-cy=Design]" -export const FONT_SIZE_PROP_CONTRO = "[data-cy=font-size-prop-control]" +export const FONT_SIZE_PROP_CONTROL = "[data-cy=font-size-prop-control]" export const DATA_CY_DATASOURCE = "[data-cy=setting-dataSource]" export const DROPDOWN_CONTAINER = ".dropdown-container" export const SPECTRUM_PICKER = ".spectrum-Picker" @@ -53,6 +55,8 @@ export const NAV_ITEMS_CONTAINER = ".nav-items-container" //publishWorkFlow export const DEPLOY_APP_MODAL = ".spectrum-Modal [data-cy=deploy-app-modal]" +export const DEPLOY_SUCCESS_MODAL = + ".spectrum-Modal [data-cy=deploy-app-success-modal]" export const DEPLOY_APP_URL_INPUT = "[data-cy=deployed-app-url] input" export const GLOBESTRIKE = "svg[aria-label=GlobeStrike]" export const GLOBE = "svg[aria-label=Globe]" diff --git a/packages/builder/src/components/deploy/DeployModal.svelte b/packages/builder/src/components/deploy/DeployModal.svelte index 0d9bfb7539..ed2687579e 100644 --- a/packages/builder/src/components/deploy/DeployModal.svelte +++ b/packages/builder/src/components/deploy/DeployModal.svelte @@ -101,7 +101,7 @@ confirmText="Done" cancelText="View App" onCancel={viewApp} - dataCy={"deploy-app-success-modal"} + dataCy="deploy-app-success-modal" >
-
appOverview(app)}> +
appOverview(app)}> {app.name} diff --git a/packages/builder/src/pages/builder/portal/overview/[application]/index.svelte b/packages/builder/src/pages/builder/portal/overview/[application]/index.svelte index 807110e03e..01d4095a3f 100644 --- a/packages/builder/src/pages/builder/portal/overview/[application]/index.svelte +++ b/packages/builder/src/pages/builder/portal/overview/[application]/index.svelte @@ -273,12 +273,6 @@ Export {#if isPublished} - unpublishApp(selectedApp)} - icon="GlobeRemove" - > - Unpublish - copyAppId(selectedApp)} icon="Copy"> Copy App ID @@ -305,6 +299,7 @@ app={selectedApp} deployments={latestDeployments} navigateTab={handleTabChange} + on:unpublish={e => unpublishApp(e.detail)} /> {#if false} diff --git a/packages/builder/src/pages/builder/portal/overview/_components/OverviewTab.svelte b/packages/builder/src/pages/builder/portal/overview/_components/OverviewTab.svelte index ae5189543c..7b7258cada 100644 --- a/packages/builder/src/pages/builder/portal/overview/_components/OverviewTab.svelte +++ b/packages/builder/src/pages/builder/portal/overview/_components/OverviewTab.svelte @@ -13,10 +13,12 @@ import clientPackage from "@budibase/client/package.json" import { processStringSync } from "@budibase/string-templates" import { users, auth } from "stores/portal" + import { createEventDispatcher } from "svelte" export let app export let deployments export let navigateTab + const dispatch = createEventDispatcher() const userInit = async () => { try { @@ -26,6 +28,10 @@ } } + const unpublishApp = () => { + dispatch("unpublish", app) + } + let userPromise = userInit() $: updateAvailable = clientPackage.version !== $store.version @@ -72,6 +78,9 @@ new Date(deployments[0].updatedAt).getTime(), } )} + {#if isPublished} + - Unpublish + {/if} {/if} {#if !deployments?.length} -