File tree Expand file tree Collapse file tree 2 files changed +5
-26
lines changed Expand file tree Collapse file tree 2 files changed +5
-26
lines changed Original file line number Diff line number Diff line change @@ -79,9 +79,9 @@ type ViewJob struct {
79
79
}
80
80
81
81
type ViewJobStep struct {
82
- Summary string `json:"summary"`
83
- Duration float64 `json:"duration"`
84
- Status string `json:"status"`
82
+ Summary string `json:"summary"`
83
+ Duration string `json:"duration"`
84
+ Status string `json:"status"`
85
85
}
86
86
87
87
type ViewStepLog struct {
@@ -154,7 +154,7 @@ func ViewPost(ctx *context_module.Context) {
154
154
for i , v := range steps {
155
155
resp .StateData .CurrentJobSteps [i ] = ViewJobStep {
156
156
Summary : v .Name ,
157
- Duration : float64 ( v .Duration () / time .Second ),
157
+ Duration : v .Duration (). Round ( time .Second ). String ( ),
158
158
Status : v .Status .String (),
159
159
}
160
160
}
Original file line number Diff line number Diff line change 51
51
<SvgIcon name =" octicon-x-circle-fill" class =" red mr-3 " v-else />
52
52
53
53
<span class =" step-summary-msg" >{{ jobStep.summary }}</span >
54
- <span class =" step-summary-dur" >{{ formatDuration( jobStep.duration) }}</span >
54
+ <span class =" step-summary-dur" >{{ jobStep.duration }}</span >
55
55
</div >
56
56
57
57
<!-- the log elements could be a lot, do not use v-if to destroy/reconstruct the DOM -->
@@ -162,27 +162,6 @@ const sfc = {
162
162
});
163
163
},
164
164
165
- formatDuration (d ) {
166
- d = Math .round (d);
167
- const unitValues = [60 , 60 , 24 ];
168
- const unitNames = [' s' , ' m' , ' h' , ' d' ];
169
- const parts = [];
170
- for (let i = 0 ; i < unitValues .length ; i++ ) {
171
- parts[i] = d % unitValues[i];
172
- d = Math .floor (d / unitValues[i]);
173
- }
174
- parts .push (d);
175
- let res = ' ' , resCount = 0 ;
176
- for (let i = parts .length - 1 ; i >= 0 && resCount < 2 ; i-- ) {
177
- if (parts[i] > 0 ) {
178
- res += ` ${ parts[i] + unitNames[i]} ` ;
179
- resCount++ ;
180
- }
181
- }
182
- if (! res) return ' 0s' ;
183
- return res .substring (0 , res .length - 1 );
184
- },
185
-
186
165
createLogLine (line ) {
187
166
const div = document .createElement (' div' );
188
167
div .classList .add (' job-log-line' );
You can’t perform that action at this time.
0 commit comments