24 lines
594 B
JavaScript
24 lines
594 B
JavaScript
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
|