1
0
Fork 0
mirror of synced 2024-08-09 15:17:57 +12:00

Merge pull request #6179 from mslourens/move_unpublish_action

6161 - move the unpublish link
This commit is contained in:
Martin McKeaveney 2022-06-05 15:30:36 +01:00 committed by GitHub
commit 582d8cd950
6 changed files with 26 additions and 24 deletions

View file

@ -1,4 +1,5 @@
import filterTests from "../support/filterTests" import filterTests from "../support/filterTests"
import { APP_TABLE_APP_NAME, DEPLOY_SUCCESS_MODAL } from "../support/interact";
const interact = require('../support/interact') const interact = require('../support/interact')
filterTests(['all'], () => { filterTests(['all'], () => {
@ -20,10 +21,9 @@ filterTests(['all'], () => {
cy.get(interact.APP_TABLE_ROW_ACTION).eq(0) cy.get(interact.APP_TABLE_ROW_ACTION).eq(0)
.within(() => { .within(() => {
cy.get(interact.SPECTRUM_BUTTON_TEMPLATE).contains("Preview")
cy.get(interact.SPECTRUM_BUTTON_TEMPLATE).contains("Edit").click({ force: true }) 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_NAV_GLOBESTRIKE).should("exist")
cy.get(interact.DEPLOYMENT_TOP_GLOBE).should("not.exist") cy.get(interact.DEPLOYMENT_TOP_GLOBE).should("not.exist")
}) })
@ -39,7 +39,7 @@ filterTests(['all'], () => {
}); });
//Verify that the app url is presented correctly to the user //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") .should("be.visible")
.within(() => { .within(() => {
let appUrl = Cypress.config().baseUrl + '/app/cypress-tests' let appUrl = Cypress.config().baseUrl + '/app/cypress-tests'
@ -63,7 +63,7 @@ filterTests(['all'], () => {
}) })
cy.get(interact.DEPLOYMENT_TOP_GLOBE).should("exist").click({ force: true }) cy.get(interact.DEPLOYMENT_TOP_GLOBE).should("exist").click({ force: true })
cy.get(interact.PUBLISH_POPOVER_MENU).should("be.visible") cy.get(interact.PUBLISH_POPOVER_MENU).should("be.visible")
.within(() => { .within(() => {
cy.get(interact.PUBLISH_POPOVER_ACTION).should("exist") cy.get(interact.PUBLISH_POPOVER_ACTION).should("exist")
@ -72,9 +72,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 //Assuming the previous test app exists and is published
cy.visit(`${Cypress.config().baseUrl}/builder`) cy.visit(`${Cypress.config().baseUrl}/builder`)
cy.get(interact.APP_TABLE_STATUS).eq(0) cy.get(interact.APP_TABLE_STATUS).eq(0)
@ -85,17 +85,11 @@ filterTests(['all'], () => {
cy.get(interact.APP_TABLE_ROW_ACTION).eq(0) cy.get(interact.APP_TABLE_ROW_ACTION).eq(0)
.within(() => { .within(() => {
cy.get(interact.SPECTRUM_BUTTON).contains("View app") cy.get(interact.SPECTRUM_BUTTON).contains("View")
cy.get(interact.SPECTRUM_BUTTON).contains("Edit").click({ force: true }) cy.get(interact.APP_TABLE_APP_NAME).click({ force: true })
}) })
//The published status cy.get(interact.SPECTRUM_LINK).contains('Unpublish').click();
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.UNPUBLISH_MODAL).should("be.visible") cy.get(interact.UNPUBLISH_MODAL).should("be.visible")
.within(() => { .within(() => {

View file

@ -26,6 +26,7 @@ export const SPECTRUM_POPOVER = ".spectrum-Popover"
export const OPTION_SOURCE_PROP_CONROL = '[data-cy="optionsSource-prop-control' export const OPTION_SOURCE_PROP_CONROL = '[data-cy="optionsSource-prop-control'
export const APP_TABLE_STATUS = ".appTable .app-status" export const APP_TABLE_STATUS = ".appTable .app-status"
export const APP_TABLE_ROW_ACTION = ".appTable .app-row-actions" 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 = export const DEPLOYMENT_TOP_NAV_GLOBESTRIKE =
".deployment-top-nav svg[aria-label=GlobeStrike]" ".deployment-top-nav svg[aria-label=GlobeStrike]"
export const DEPLOYMENT_TOP_GLOBE = ".deployment-top-nav svg[aria-label=Globe]" 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_ACTION = '[data-cy="publish-popover-action"]'
export const PUBLISH_POPOVER_MESSAGE = ".publish-popover-message" export const PUBLISH_POPOVER_MESSAGE = ".publish-popover-message"
export const SPECTRUM_BUTTON = ".spectrum-Button" export const SPECTRUM_BUTTON = ".spectrum-Button"
export const SPECTRUM_LINK = ".spectrum-Link"
export const TOPRIGHTNAV_BUTTON_SPECTRUM = ".toprightnav button.spectrum-Button" export const TOPRIGHTNAV_BUTTON_SPECTRUM = ".toprightnav button.spectrum-Button"
//createComponents //createComponents
export const SETTINGS = "[data-cy=Settings]" export const SETTINGS = "[data-cy=Settings]"
export const SETTINGS_INPUT = "[data-cy=setting-text] input" export const SETTINGS_INPUT = "[data-cy=setting-text] input"
export const DESIGN = "[data-cy=Design]" 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 DATA_CY_DATASOURCE = "[data-cy=setting-dataSource]"
export const DROPDOWN_CONTAINER = ".dropdown-container" export const DROPDOWN_CONTAINER = ".dropdown-container"
export const SPECTRUM_PICKER = ".spectrum-Picker" export const SPECTRUM_PICKER = ".spectrum-Picker"
@ -53,6 +55,8 @@ export const NAV_ITEMS_CONTAINER = ".nav-items-container"
//publishWorkFlow //publishWorkFlow
export const DEPLOY_APP_MODAL = ".spectrum-Modal [data-cy=deploy-app-modal]" 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 DEPLOY_APP_URL_INPUT = "[data-cy=deployed-app-url] input"
export const GLOBESTRIKE = "svg[aria-label=GlobeStrike]" export const GLOBESTRIKE = "svg[aria-label=GlobeStrike]"
export const GLOBE = "svg[aria-label=Globe]" export const GLOBE = "svg[aria-label=Globe]"

View file

@ -101,7 +101,7 @@
confirmText="Done" confirmText="Done"
cancelText="View App" cancelText="View App"
onCancel={viewApp} onCancel={viewApp}
dataCy={"deploy-app-success-modal"} dataCy="deploy-app-success-modal"
> >
<div slot="header" class="app-published-header"> <div slot="header" class="app-published-header">
<svg <svg

View file

@ -20,7 +20,7 @@
<div class="app-icon" style="color: {app.icon?.color || ''}"> <div class="app-icon" style="color: {app.icon?.color || ''}">
<Icon size="XL" name={app.icon?.name || "Apps"} /> <Icon size="XL" name={app.icon?.name || "Apps"} />
</div> </div>
<div class="name" on:click={() => appOverview(app)}> <div class="name" data-cy="app-name-link" on:click={() => appOverview(app)}>
<Heading size="XS"> <Heading size="XS">
{app.name} {app.name}
</Heading> </Heading>

View file

@ -273,12 +273,6 @@
Export Export
</MenuItem> </MenuItem>
{#if isPublished} {#if isPublished}
<MenuItem
on:click={() => unpublishApp(selectedApp)}
icon="GlobeRemove"
>
Unpublish
</MenuItem>
<MenuItem on:click={() => copyAppId(selectedApp)} icon="Copy"> <MenuItem on:click={() => copyAppId(selectedApp)} icon="Copy">
Copy App ID Copy App ID
</MenuItem> </MenuItem>
@ -305,6 +299,7 @@
app={selectedApp} app={selectedApp}
deployments={latestDeployments} deployments={latestDeployments}
navigateTab={handleTabChange} navigateTab={handleTabChange}
on:unpublish={e => unpublishApp(e.detail)}
/> />
</Tab> </Tab>
{#if false} {#if false}

View file

@ -13,10 +13,12 @@
import clientPackage from "@budibase/client/package.json" import clientPackage from "@budibase/client/package.json"
import { processStringSync } from "@budibase/string-templates" import { processStringSync } from "@budibase/string-templates"
import { users, auth } from "stores/portal" import { users, auth } from "stores/portal"
import { createEventDispatcher } from "svelte"
export let app export let app
export let deployments export let deployments
export let navigateTab export let navigateTab
const dispatch = createEventDispatcher()
const userInit = async () => { const userInit = async () => {
try { try {
@ -26,6 +28,10 @@
} }
} }
const unpublishApp = () => {
dispatch("unpublish", app)
}
let userPromise = userInit() let userPromise = userInit()
$: updateAvailable = clientPackage.version !== $store.version $: updateAvailable = clientPackage.version !== $store.version
@ -72,6 +78,9 @@
new Date(deployments[0].updatedAt).getTime(), new Date(deployments[0].updatedAt).getTime(),
} }
)} )}
{#if isPublished}
- <Link on:click={unpublishApp}>Unpublish</Link>
{/if}
{/if} {/if}
{#if !deployments?.length} {#if !deployments?.length}
- -