Skip to content

Commit

Permalink
8693wuh25: Add project links to metrics home screen
Browse files Browse the repository at this point in the history
  • Loading branch information
tomolopolis committed Mar 29, 2024
1 parent c454d35 commit 3318cf0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion webapp/api/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ def serialize_task(task, state):
return {
'report_id': task.id,
'report_name_generated': task.verbose_name,
'projects': task.verbose_name.split('-')[1].split(','),
'projects': task.verbose_name.split('-')[1].split('_'),
'created_user': task.creator.username,
'create_time': task.run_at.strftime(dt_fmt),
'status': state
Expand Down
2 changes: 1 addition & 1 deletion webapp/frontend/src/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default new Router({
mode: 'history',
routes: [
{
path: '/train-annotations/:projectId/:docId',
path: '/train-annotations/:projectId/:docId?',
name: 'train-annotations',
component: TrainAnnotations,
props: true,
Expand Down
22 changes: 18 additions & 4 deletions webapp/frontend/src/views/MetricsHome.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
:select-mode="'single'"
@row-selected="loadMetrics">
<template #cell(projects)="data">
<div v-html="data.value"></div>
<v-runtime-template :template="data.value"></v-runtime-template>
</template>

<template #cell(status)="data">
Expand Down Expand Up @@ -48,12 +48,13 @@
</template>

<script>
import VRuntimeTemplate from 'v-runtime-template'
import LoadingOverlay from '@/components/common/LoadingOverlay.vue'
import Modal from '@/components/common/Modal.vue'
export default {
name: "MetricsHome",
components: {Modal, LoadingOverlay },
components: {Modal, LoadingOverlay, VRuntimeTemplate,},
props: {
},
data () {
Expand Down Expand Up @@ -89,7 +90,7 @@ export default {
return item
})
this.fetchProjects()
setTimeout(this.pollReportStatus, 10000)
setTimeout(this.pollReportStatus, 5000)
})
},
fetchProjects () {
Expand Down Expand Up @@ -124,7 +125,10 @@ export default {
let outEl = ''
value.forEach(i => {
if (this.projects[i]) {
outEl += `<router-link to="train-annotations/${i}/">${this.projects[i].name}</router-link>`
outEl += `
<div>
<router-link :to="{ name: 'train-annotations', params: { projectId: '${i}' }}">${this.projects[i].name}</router-link>
</div>`
} else {
outEl += `<div>${i}</div>`
}
Expand All @@ -147,4 +151,14 @@ export default {
.status-icon {
padding-left: 3px;
}
.project-links {
color: #005EB8;
&:hover {
color: #fff;
border-bottom: 1px solid #fff;
}
}
</style>

0 comments on commit 3318cf0

Please sign in to comment.