| OLD | NEW |
| 1 // Copyright 2015 The LUCI Authors. All rights reserved. | 1 // Copyright 2015 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 //go:generate stringer -type=Status,ComponentType | 5 //go:generate stringer -type=Status,ComponentType |
| 6 | 6 |
| 7 package resp | 7 package resp |
| 8 | 8 |
| 9 import ( | 9 import ( |
| 10 "encoding/json" | 10 "encoding/json" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 132 |
| 133 // DependencyFailure if the component has finished incompletely due to a
failure in a | 133 // DependencyFailure if the component has finished incompletely due to a
failure in a |
| 134 // dependency. | 134 // dependency. |
| 135 DependencyFailure // 100 Amber | 135 DependencyFailure // 100 Amber |
| 136 | 136 |
| 137 // WaitingDependency if the component has finished or paused execution d
ue to an | 137 // WaitingDependency if the component has finished or paused execution d
ue to an |
| 138 // incomplete dep. | 138 // incomplete dep. |
| 139 WaitingDependency // 100 Brown | 139 WaitingDependency // 100 Brown |
| 140 ) | 140 ) |
| 141 | 141 |
| 142 // Terminal returns true if the step status won't change. |
| 143 func (s Status) Terminal() bool { |
| 144 switch s { |
| 145 case Success, Failure, InfraFailure, Warning, DependencyFailure: |
| 146 return true |
| 147 default: |
| 148 return false |
| 149 } |
| 150 } |
| 151 |
| 142 // MarshalJSON renders enums into String rather than an int when marshalling. | 152 // MarshalJSON renders enums into String rather than an int when marshalling. |
| 143 func (s Status) MarshalJSON() ([]byte, error) { | 153 func (s Status) MarshalJSON() ([]byte, error) { |
| 144 return json.Marshal(s.String()) | 154 return json.Marshal(s.String()) |
| 145 } | 155 } |
| 146 | 156 |
| 147 // ComponentType is the type of build component. | 157 // ComponentType is the type of build component. |
| 148 type ComponentType int | 158 type ComponentType int |
| 149 | 159 |
| 150 const ( | 160 const ( |
| 151 // Recipe corresponds to a full recipe run. Dependencies are recipes. | 161 // Recipe corresponds to a full recipe run. Dependencies are recipes. |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 | 257 |
| 248 // An icon for the link. Not compatible with label. Rendered as <img> | 258 // An icon for the link. Not compatible with label. Rendered as <img> |
| 249 Img string | 259 Img string |
| 250 | 260 |
| 251 // The destination for the link, stuck in a <a href> tag. | 261 // The destination for the link, stuck in a <a href> tag. |
| 252 URL string | 262 URL string |
| 253 | 263 |
| 254 // Alt text for the image, only supported with img. | 264 // Alt text for the image, only supported with img. |
| 255 Alt string | 265 Alt string |
| 256 } | 266 } |
| OLD | NEW |