Skip to content

Commit

Permalink
feat: display elapsed and creation time
Browse files Browse the repository at this point in the history
  • Loading branch information
jiegec committed Mar 14, 2024
1 parent 38187f0 commit be9735c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"ansi_up": "^6.0.2",
"axios": "^1.6.7",
"core-js": "^3.34.0",
"javascript-time-ago": "^2.5.9",
"pretty-bytes": "^6.1.1",
"roboto-fontface": "*",
"vue": "^3.3.0",
Expand Down
21 changes: 20 additions & 1 deletion frontend/src/pages/jobs/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,19 @@
>
Created
</v-chip>
<div
class="d-flex align-center">
<v-icon size="x-small" style="margin-right: 5px;">mdi:mdi-clock-outline</v-icon>
<!-- https://stackoverflow.com/a/1322771/2148614 -->
{{ new Date((item as Job).elapsed_secs * 1000).toISOString().substring(11, 19) }}
</div>
<div class="d-flex align-center">
<v-icon size="x-small" style="margin-right: 5px;">mdi:mdi-calendar</v-icon>
{{ new TimeAgo('en-US').format(new Date((item as Job).creation_time)) }}
<v-tooltip activator="parent" location="bottom">
{{ new Date((item as Job).creation_time) }}
</v-tooltip>
</div>
</template>
<template #item.job="{ item }">
<router-link :to="{ path: `/jobs/${(item as Job).id}` }">
Expand Down Expand Up @@ -111,6 +124,10 @@
<script lang="ts">
import axios from 'axios';
import { hostname } from '@/common';
import TimeAgo from 'javascript-time-ago'
import en from 'javascript-time-ago/locale/en'
TimeAgo.addDefaultLocale(en)
interface LoadItemsOpts {
page: number;
Expand All @@ -126,11 +143,13 @@
arch: string;
git_branch: string;
git_sha: string;
elapsed_secs: number;
creation_time: string;
}
export default {
data: () => ({
itemsPerPage: 10,
itemsPerPage: 25,
headers: [
{ title: 'Status', key: 'status', sortable: false },
{ title: 'Job', key: 'job', sortable: false },
Expand Down
12 changes: 12 additions & 0 deletions frontend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1758,6 +1758,13 @@ isexe@^2.0.0:
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==

javascript-time-ago@^2.5.9:
version "2.5.9"
resolved "https://registry.yarnpkg.com/javascript-time-ago/-/javascript-time-ago-2.5.9.tgz#3c5d8012cd493d764c6b26a0ffe6e8b20afcf1fe"
integrity sha512-pQ8mNco/9g9TqWXWWjP0EWl6i/lAQScOyEeXy5AB+f7MfLSdgyV9BJhiOD1zrIac/lrxPYOWNbyl/IW8CW5n0A==
dependencies:
relative-time-format "^1.1.6"

js-yaml@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602"
Expand Down Expand Up @@ -2166,6 +2173,11 @@ regexpp@^3.0.0:
resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2"
integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==

relative-time-format@^1.1.6:
version "1.1.6"
resolved "https://registry.yarnpkg.com/relative-time-format/-/relative-time-format-1.1.6.tgz#724a5fbc3794b8e0471b6b61419af2ce699eb9f1"
integrity sha512-aCv3juQw4hT1/P/OrVltKWLlp15eW1GRcwP1XdxHrPdZE9MtgqFpegjnTjLhi2m2WI9MT/hQQtE+tjEWG1hgkQ==

resolve-from@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6"
Expand Down

0 comments on commit be9735c

Please sign in to comment.