Merge pull request #2278 from EstebX/wrong-time-during-a-failed-deployment

fix: wrong time during a failed deployment
This commit is contained in:
Andras Bacsai 2024-05-31 12:57:37 +02:00 committed by GitHub
commit 82c5497a06
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -93,10 +93,11 @@
<div> <div>
@if ($deployment->status !== 'in_progress') @if ($deployment->status !== 'in_progress')
Finished <span x-text="measure_since_started()">0s</span> in Finished <span x-text="measure_since_started()">0s</span> in
<span class="font-bold" x-text="measure_finished_time()">0s</span>
@else @else
Running for Running for
@endif @endif
<span class="font-bold" x-text="measure_finished_time()">0s</span> <span class="font-bold" x-text="measure_since_started()">0s</span>
</div> </div>
</div> </div>
</div> </div>
@ -134,6 +135,26 @@
this.finished_time = seconds + 's'; this.finished_time = seconds + 's';
} }
}, },
measure_finished_time() {
if (this.finished_time > 2000) {
return 0;
} else {
return this.finished_time;
}
},
measure_since_started() {
return dayjs.utc(created_at).fromNow();
}
if (status === 'in_progress') {
timers[uuid] = setInterval(() => {
this.finished_time = dayjs().diff(dayjs.utc(created_at),
'second') + 's'
}, 1000);
} else {
let seconds = dayjs.utc(updated_at).diff(dayjs.utc(created_at), 'second')
this.finished_time = seconds + 's';
}
},
measure_finished_time() { measure_finished_time() {
return this.finished_time; return this.finished_time;
}, },