Adding UI for displaying when the CRON job has been stopped and alert the user to next steps.
This commit is contained in:
parent
caaf5dc3c9
commit
cfde86a996
|
@ -32,7 +32,8 @@
|
||||||
if (!results) {
|
if (!results) {
|
||||||
return {}
|
return {}
|
||||||
}
|
}
|
||||||
if (results.outputs?.status?.toLowerCase() === "stopped") {
|
const lcStatus = results.outputs?.status?.toLowerCase()
|
||||||
|
if (lcStatus === "stopped" || lcStatus === "stopped_error") {
|
||||||
return { yellow: true, message: "Stopped" }
|
return { yellow: true, message: "Stopped" }
|
||||||
} else if (results.outputs?.success || isTrigger) {
|
} else if (results.outputs?.success || isTrigger) {
|
||||||
return { positive: true, message: "Success" }
|
return { positive: true, message: "Success" }
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script>
|
<script>
|
||||||
import { Layout, Icon, ActionButton } from "@budibase/bbui"
|
import { Layout, Icon, ActionButton, InlineAlert } from "@budibase/bbui"
|
||||||
import StatusRenderer from "./StatusRenderer.svelte"
|
import StatusRenderer from "./StatusRenderer.svelte"
|
||||||
import DateTimeRenderer from "components/common/renderers/DateTimeRenderer.svelte"
|
import DateTimeRenderer from "components/common/renderers/DateTimeRenderer.svelte"
|
||||||
import TestDisplay from "components/automation/AutomationBuilder/TestDisplay.svelte"
|
import TestDisplay from "components/automation/AutomationBuilder/TestDisplay.svelte"
|
||||||
|
@ -9,6 +9,7 @@
|
||||||
export let history
|
export let history
|
||||||
export let appId
|
export let appId
|
||||||
export let close
|
export let close
|
||||||
|
const STOPPED_ERROR = "stopped_error"
|
||||||
|
|
||||||
$: exists = $automationStore.automations?.find(
|
$: exists = $automationStore.automations?.find(
|
||||||
auto => auto._id === history?.automationId
|
auto => auto._id === history?.automationId
|
||||||
|
@ -32,6 +33,15 @@
|
||||||
<Icon name="JourneyVoyager" />
|
<Icon name="JourneyVoyager" />
|
||||||
<div>{history.automationName}</div>
|
<div>{history.automationName}</div>
|
||||||
</div>
|
</div>
|
||||||
|
{#if history.status === STOPPED_ERROR}
|
||||||
|
<div class="cron-error">
|
||||||
|
<InlineAlert
|
||||||
|
type="error"
|
||||||
|
header="CRON automation disabled"
|
||||||
|
message="Fix the error and re-publish your app to re-activate."
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
<div>
|
<div>
|
||||||
{#if exists}
|
{#if exists}
|
||||||
<ActionButton
|
<ActionButton
|
||||||
|
@ -87,4 +97,10 @@
|
||||||
grid-template-columns: 1fr auto;
|
grid-template-columns: 1fr auto;
|
||||||
gap: var(--spacing-s);
|
gap: var(--spacing-s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.cron-error {
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
export let value
|
export let value
|
||||||
|
|
||||||
$: isError = !value || value.toLowerCase() === "error"
|
$: isError = !value || value.toLowerCase() === "error"
|
||||||
$: isStopped = value?.toLowerCase() === "stopped"
|
$: isStoppedError = value?.toLowerCase() === "stopped_error"
|
||||||
|
$: isStopped = value?.toLowerCase() === "stopped" || isStoppedError
|
||||||
$: status = getStatus(isError, isStopped)
|
$: status = getStatus(isError, isStopped)
|
||||||
|
|
||||||
function getStatus(error, stopped) {
|
function getStatus(error, stopped) {
|
||||||
|
|
|
@ -144,7 +144,15 @@ class Orchestrator {
|
||||||
`CRON disabled due to errors - ${this._appId}/${this._automation._id}`
|
`CRON disabled due to errors - ${this._appId}/${this._automation._id}`
|
||||||
)
|
)
|
||||||
await disableCron(this._repeat?.jobId, this._repeat?.jobKey)
|
await disableCron(this._repeat?.jobId, this._repeat?.jobKey)
|
||||||
this.updateExecutionOutput(trigger.id, trigger.stepId, {}, STOPPED_STATUS)
|
this.updateExecutionOutput(
|
||||||
|
trigger.id,
|
||||||
|
trigger.stepId,
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
status: AutomationStatus.STOPPED_ERROR,
|
||||||
|
success: false,
|
||||||
|
}
|
||||||
|
)
|
||||||
await storeLog(automation, this.executionOutput)
|
await storeLog(automation, this.executionOutput)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -183,8 +191,20 @@ class Orchestrator {
|
||||||
|
|
||||||
updateExecutionOutput(id: string, stepId: string, inputs: any, outputs: any) {
|
updateExecutionOutput(id: string, stepId: string, inputs: any, outputs: any) {
|
||||||
const stepObj = { id, stepId, inputs, outputs }
|
const stepObj = { id, stepId, inputs, outputs }
|
||||||
|
// replacing trigger when disabling CRON
|
||||||
|
if (
|
||||||
|
stepId === CRON_STEP_ID &&
|
||||||
|
outputs.status === AutomationStatus.STOPPED_ERROR
|
||||||
|
) {
|
||||||
|
this.executionOutput.trigger = stepObj
|
||||||
|
this.executionOutput.steps = [stepObj]
|
||||||
|
return
|
||||||
|
}
|
||||||
// first entry is always the trigger (constructor)
|
// first entry is always the trigger (constructor)
|
||||||
if (this.executionOutput.steps.length === 0) {
|
if (
|
||||||
|
this.executionOutput.steps.length === 0 ||
|
||||||
|
this.executionOutput.trigger.id === id
|
||||||
|
) {
|
||||||
this.executionOutput.trigger = stepObj
|
this.executionOutput.trigger = stepObj
|
||||||
}
|
}
|
||||||
this.executionOutput.steps.push(stepObj)
|
this.executionOutput.steps.push(stepObj)
|
||||||
|
|
|
@ -31,6 +31,7 @@ export enum AutomationStatus {
|
||||||
SUCCESS = "success",
|
SUCCESS = "success",
|
||||||
ERROR = "error",
|
ERROR = "error",
|
||||||
STOPPED = "stopped",
|
STOPPED = "stopped",
|
||||||
|
STOPPED_ERROR = "stopped_error",
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AutomationResults {
|
export interface AutomationResults {
|
||||||
|
|
Loading…
Reference in New Issue