Skip to content
Snippets Groups Projects
Commit ffe72e3f authored by Valentin Rigal's avatar Valentin Rigal Committed by Erwan Rouchet
Browse files

Support optional git references

parent 7cc4a796
No related branches found
No related tags found
1 merge request!1567Support optional git references
......@@ -108,7 +108,7 @@ export default {
.map(transcriptionEntity => this.workerVersions[transcriptionEntity.worker_version_id])
// Ignore worker versions that were not yet loaded
.filter(version => version)
.map(version => ([`version-${version.id}`, `${version.worker.name} ${version.revision.hash.substring(0, 8)}`]))
.map(version => ([`version-${version.id}`, `${version.worker.name} ${version.revision ? version.revision.hash.substring(0, 8) : 'version ' + version.version}`]))
)),
[1, 0]
)
......
......@@ -36,6 +36,7 @@
v-for="v in orderedFilters"
:key="v.id"
:value="v.id"
:title="v.name"
>
{{ truncateShort(`${v.name}`) }}
({{ v.treeCount }}/{{ flatTree.length - 1 }})
......@@ -192,7 +193,14 @@ export default {
obj[elt.worker_run.id] = { name: elt.worker_run.summary, treeCount: (obj[elt.worker_run.id]?.treeCount || 0) + 1 }
} else if (elt.worker_version_id && this.workerVersions[elt.worker_version_id]) {
const versionDetails = this.workerVersions[elt.worker_version_id]
obj[elt.worker_version_id] = { name: versionDetails.worker.name + ' ' + versionDetails.revision.hash.substring(0, 8), treeCount: (obj[elt.worker_version_id]?.treeCount || 0) + 1 }
obj[elt.worker_version_id] = {
name: versionDetails.worker.name + ' ' + (
versionDetails.revision
? versionDetails.revision.hash.substring(0, 8)
: 'version ' + versionDetails.version
),
treeCount: (obj[elt.worker_version_id]?.treeCount || 0) + 1
}
}
return obj
}, {})
......
......@@ -17,16 +17,17 @@
<tbody>
<tr>
<td class="label">Author</td>
<td>{{ version.revision.author }}</td>
<td>{{ version.revision?.author || '' }}</td>
</tr>
<tr>
<td class="label">Created</td>
<td>{{ createdDate }}</td>
</tr>
<tr>
<tr v-if="hasRevision">
<td class="label">Commit</td>
<td>
<a
v-if="version.revision"
:href="version.revision.commit_url"
target="_blank"
class="is-uid"
......@@ -34,8 +35,13 @@
>
{{ shortHash }}
</a>
<span v-else></span>
</td>
</tr>
<tr v-else>
<td class="label">Version</td>
<td>{{ version.version }}</td>
</tr>
<tr>
<td class="label">Type</td>
<td>{{ version.worker.type }}</td>
......@@ -161,17 +167,20 @@ export default {
if (!confs) return
return confs[this.configurationId]
},
hasRevision () {
return this.version && this.version.revision
},
refsCount () {
if (!this.version) return
if (!this.hasRevision) return
return this.version.revision.refs.length
},
shortHash () {
if (!this.version) return
if (!this.hasRevision) return
return this.version.revision.hash && this.version.revision.hash.substring(0, 8)
},
createdDate () {
if (!this.version) return
return ago(new Date(this.version.revision.created))
return ago(new Date(this.version.created))
},
displayIcon () {
return this.withIcon || this.hasDropdownTitle || this.hasOutsideTitle
......
......@@ -4,16 +4,17 @@
<ItemId :item-id="version.id" />
</td>
<td class="shrink">
<a :href="version.revision.commit_url" target="_blank">
<a v-if="version.revision" :href="version.revision.commit_url" target="_blank">
<samp>{{ version.revision.hash.substring(0,8) }}</samp>
</a>
<span v-else></span>
</td>
<td>{{ version.revision.message }}</td>
<td>{{ version.revision.author }}</td>
<td>{{ created(version.revision.created) }}</td>
<td>{{ version?.revision?.message || '' }}</td>
<td>{{ version?.revision?.author || '' }}</td>
<td>{{ created(version.created) }}</td>
<td class="shrink">
<span
v-for="ref in version.revision.refs"
v-for="ref in version?.revision?.refs || []"
:key="ref.name"
class="tag mr-3"
:class="refClass(ref.type)"
......
......@@ -11,11 +11,14 @@
</router-link>
<br />
<small>
<a :href="workerVersion.revision.commit_url" target="_blank">
<samp>{{ workerVersion.revision.hash.substr(0, 8) }}</samp>
</a>
{{ truncateLong(workerVersion.revision.message) }}
&middot; {{ workerVersion.revision.author }}
<template v-if="workerVersion.revision">
<a :href="workerVersion.revision.commit_url" target="_blank">
<samp>{{ workerVersion.revision.hash.substr(0, 8) }}</samp>
</a>
{{ truncateLong(workerVersion?.revision?.message || '') }}
&middot; {{ workerVersion?.revision?.author || '' }}
</template>
<template v-else>Version {{ workerVersion.version }}</template>
</small>
</template>
......
......@@ -223,7 +223,7 @@ export default defineComponent({
}
},
versionCreatedDate () {
if (this.workerRun) return ago(new Date(this.workerRun.worker_version.revision.created))
if (this.workerRun) return ago(new Date(this.workerRun.worker_version.created))
return ''
}
},
......
......@@ -29,11 +29,11 @@ interface WorkerVersionConfiguration {
export type WorkerVersion = {
id: UUID
configuration: WorkerVersionConfiguration
revision: RevisionWithRefs
docker_image_name: string | null
gpu_usage: WorkerVersionGPUUsage
model_usage: boolean
worker: WorkerLight
created: string
} & ({
state: WorkerVersionState
docker_image: UUID | null
......@@ -42,4 +42,10 @@ export type WorkerVersion = {
state: WorkerVersionState.Available
docker_image: UUID
docker_image_iid: string
})
\ No newline at end of file
}) & ({
revision: null
version: number
} | {
revision: RevisionWithRefs
version: null
})
......@@ -115,7 +115,7 @@ export default defineComponent({
},
createdDate () {
if (!this.version) return
return ago(new Date(this.version.revision.created))
return ago(new Date(this.version.created))
}
},
methods: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment