You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
maestro/app/classes/routine/RoutineExecutionResult.js

24 lines
594 B

const { Injectable } = require('flitter-di')
class RoutineExecutionResult extends Injectable {
steps = []
overall_state = 'pending' // pending | success | fail
constructor(steps = []) {
super()
this.steps = steps
}
get status() {
if ( this.steps.some(x => x.status === 'pending') ) return 'pending'
else if ( this.steps.some(x => x.status === 'fail') ) return 'fail'
else return 'success'
}
failures() {
return this.steps.filter(x => x.status === 'fail')
}
}
module.exports = exports = RoutineExecutionResult