Merge pull request #2131 from mslourens/automation_live_toggle
convert automation icons into toggle
This commit is contained in:
commit
1f65952ddf
|
@ -6,6 +6,7 @@
|
||||||
export let id = null
|
export let id = null
|
||||||
export let text = null
|
export let text = null
|
||||||
export let disabled = false
|
export let disabled = false
|
||||||
|
export let dataCy = null
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
const onChange = event => {
|
const onChange = event => {
|
||||||
|
@ -15,6 +16,7 @@
|
||||||
|
|
||||||
<div class="spectrum-Switch spectrum-Switch--emphasized">
|
<div class="spectrum-Switch spectrum-Switch--emphasized">
|
||||||
<input
|
<input
|
||||||
|
data-cy={dataCy}
|
||||||
checked={value}
|
checked={value}
|
||||||
{disabled}
|
{disabled}
|
||||||
on:change={onChange}
|
on:change={onChange}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
export let text = null
|
export let text = null
|
||||||
export let disabled = false
|
export let disabled = false
|
||||||
export let error = null
|
export let error = null
|
||||||
|
export let dataCy = null
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
const onChange = e => {
|
const onChange = e => {
|
||||||
|
@ -18,5 +19,5 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Field {label} {labelPosition} {error}>
|
<Field {label} {labelPosition} {error}>
|
||||||
<Switch {error} {disabled} {text} {value} on:change={onChange} />
|
<Switch {dataCy} {error} {disabled} {text} {value} on:change={onChange} />
|
||||||
</Field>
|
</Field>
|
||||||
|
|
|
@ -29,10 +29,10 @@ context("Create a automation", () => {
|
||||||
cy.get(".setup").within(() => {
|
cy.get(".setup").within(() => {
|
||||||
cy.get(".spectrum-Picker-label").click()
|
cy.get(".spectrum-Picker-label").click()
|
||||||
cy.contains("dog").click()
|
cy.contains("dog").click()
|
||||||
cy.get("input")
|
cy.get(".spectrum-Textfield-input")
|
||||||
.first()
|
.first()
|
||||||
.type("goodboy")
|
.type("goodboy")
|
||||||
cy.get("input")
|
cy.get(".spectrum-Textfield-input")
|
||||||
.eq(1)
|
.eq(1)
|
||||||
.type("11")
|
.type("11")
|
||||||
})
|
})
|
||||||
|
@ -41,7 +41,7 @@ context("Create a automation", () => {
|
||||||
cy.contains("Save Automation").click()
|
cy.contains("Save Automation").click()
|
||||||
|
|
||||||
// Activate Automation
|
// Activate Automation
|
||||||
cy.get("[aria-label=PlayCircle]").click()
|
cy.get("[data-cy=activate-automation]").click()
|
||||||
})
|
})
|
||||||
|
|
||||||
it("should add row when a new row is added", () => {
|
it("should add row when a new row is added", () => {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script>
|
<script>
|
||||||
import { automationStore } from "builderStore"
|
import { automationStore } from "builderStore"
|
||||||
import { database } from "stores/backend"
|
import { database } from "stores/backend"
|
||||||
import { notifications, Icon, Button, Modal, Heading } from "@budibase/bbui"
|
import { notifications, Button, Modal, Heading, Toggle } from "@budibase/bbui"
|
||||||
import AutomationBlockSetup from "./AutomationBlockSetup.svelte"
|
import AutomationBlockSetup from "./AutomationBlockSetup.svelte"
|
||||||
import CreateWebookModal from "../Shared/CreateWebhookModal.svelte"
|
import CreateWebookModal from "../Shared/CreateWebhookModal.svelte"
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
$: automationLive = automation?.live
|
$: automationLive = automation?.live
|
||||||
|
|
||||||
function setAutomationLive(live) {
|
function setAutomationLive(live) {
|
||||||
if (automation.live === live) {
|
if (automationLive === live) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
automation.live = live
|
automation.live = live
|
||||||
|
@ -48,20 +48,11 @@
|
||||||
|
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<Heading size="S">Setup</Heading>
|
<Heading size="S">Setup</Heading>
|
||||||
<Icon
|
<Toggle
|
||||||
l
|
value={automationLive}
|
||||||
disabled={!automationLive}
|
on:change={() => setAutomationLive(!automationLive)}
|
||||||
hoverable={automationLive}
|
dataCy="activate-automation"
|
||||||
name="PauseCircle"
|
text="Live"
|
||||||
on:click={() => setAutomationLive(false)}
|
|
||||||
/>
|
|
||||||
<Icon
|
|
||||||
l
|
|
||||||
name="PlayCircle"
|
|
||||||
disabled={automationLive}
|
|
||||||
hoverable={!automationLive}
|
|
||||||
data-cy="activate-automation"
|
|
||||||
on:click={() => setAutomationLive(true)}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{#if $automationStore.selectedBlock}
|
{#if $automationStore.selectedBlock}
|
||||||
|
|
Loading…
Reference in New Issue