summaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2019-08-09 16:12:39 +0000
committerGerrit Code Review <review@openstack.org>2019-08-09 16:12:39 +0000
commita2018c599a364f316a682da64c775d390b054acd (patch)
treede186f005531d58a4601273aef502b6138d273f9 /web
parentdaf21fc0b100c725dda2042855ef75cdeee789d6 (diff)
parentdadba8d5ec79f20bfd42ee31f4136b3410d7fe17 (diff)
downloadzuul-a2018c599a364f316a682da64c775d390b054acd.tar.gz
Merge "Refactor task result detection"
Diffstat (limited to 'web')
-rw-r--r--web/src/containers/build/Console.jsx48
1 files changed, 22 insertions, 26 deletions
diff --git a/web/src/containers/build/Console.jsx b/web/src/containers/build/Console.jsx
index bcf7a0f75..c2c1495c2 100644
--- a/web/src/containers/build/Console.jsx
+++ b/web/src/containers/build/Console.jsx
@@ -23,19 +23,10 @@ import {
Modal,
} from 'patternfly-react'
-import { didTaskFail } from '../../actions/build'
-
const INTERESTING_KEYS = ['msg', 'stdout', 'stderr']
-function hostTaskStats (state, host) {
- if (didTaskFail(host)) { state.failed += 1}
- else if (host.changed) { state.changed += 1}
- else if (host.skip_reason) { state.skipped += 1}
- else { state.ok += 1}
-}
-
function hasInterestingKeys (obj, keys) {
let ret = false
@@ -189,10 +180,10 @@ class HostTask extends React.Component {
state = {
showModal: false,
- failed: 0,
- changed: 0,
- skipped: 0,
- ok: 0
+ failed: false,
+ changed: false,
+ skipped: false,
+ ok: false
}
open = () => {
@@ -206,9 +197,17 @@ class HostTask extends React.Component {
constructor (props) {
super(props)
- const { host, taskPath, displayPath } = this.props
+ const { host, task, taskPath, displayPath, errorIds } = this.props
- hostTaskStats(this.state, host)
+ if (errorIds.has(task.task.id)) {
+ this.state.failed = true
+ } else if (host.changed) {
+ this.state.changed = true
+ } else if (host.skip_reason) {
+ this.state.skipped = true
+ } else {
+ this.state.ok = true
+ }
if (taskPathMatches(taskPath, displayPath))
this.state.showModal = true
@@ -218,25 +217,22 @@ class HostTask extends React.Component {
const { hostname, task, host, taskPath, errorIds } = this.props
const ai = []
- if (this.state.skipped) {
+ if (this.state.failed) {
ai.push(
- <ListView.InfoItem key="skipped" title="Click for details">
- <span className="task-skipped" onClick={this.open}>SKIPPED</span>
+ <ListView.InfoItem key="failed" title="Click for details">
+ <span className="task-failed" onClick={this.open}>FAILED</span>
</ListView.InfoItem>)
- }
- if (this.state.changed) {
+ } else if (this.state.changed) {
ai.push(
<ListView.InfoItem key="changed" title="Click for details">
<span className="task-changed" onClick={this.open}>CHANGED</span>
</ListView.InfoItem>)
- }
- if (this.state.failed) {
+ } else if (this.state.skipped) {
ai.push(
- <ListView.InfoItem key="failed" title="Click for details">
- <span className="task-failed" onClick={this.open}>FAILED</span>
+ <ListView.InfoItem key="skipped" title="Click for details">
+ <span className="task-skipped" onClick={this.open}>SKIPPED</span>
</ListView.InfoItem>)
- }
- if (this.state.ok) {
+ } else if (this.state.ok) {
ai.push(
<ListView.InfoItem key="ok" title="Click for details">
<span className="task-ok" onClick={this.open}>OK</span>