Skip to content

Commit

Permalink
adjust breadcrumb and allow to traversal
Browse files Browse the repository at this point in the history
  • Loading branch information
mam10eks committed Oct 3, 2024
1 parent 0a65543 commit 204917e
Show file tree
Hide file tree
Showing 6 changed files with 209 additions and 15 deletions.
85 changes: 85 additions & 0 deletions application/src/tira_app/data/HybridDatabase.py
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,91 @@ def get_count_of_team_submissions(self, task_id):
ret += [{"team": team, "reviewed": 0, "to_review": 0, "total": 0, "link": link_to_discourse_team(team)}]
return ret

def all_runs(self):
prepared_statement = """SELECT
tira_run.run_id, tira_run.task_id, tira_run.input_dataset_id,
tira_software.software_id, tira_software.vm_id, tira_dockersoftware.docker_software_id,
tira_dockersoftware.vm_id, tira_dockersoftware.display_name,
tira_upload.id, tira_upload.vm_id, tira_upload.display_name,
tira_run_review.published, tira_run_review.blinded
FROM
tira_run as evaluation_run
INNER JOIN
tira_run as tira_run ON evaluation_run.input_run_id = tira_run.run_id
LEFT JOIN
tira_upload ON tira_run.upload_id = tira_upload.id
LEFT JOIN
tira_software ON tira_run.software_id = tira_software.id
LEFT JOIN
tira_dockersoftware ON tira_run.docker_software_id = tira_dockersoftware.docker_software_id
LEFT JOIN
tira_review as tira_run_review ON evaluation_run.run_id = tira_run_review.run_id
LEFT JOIN
tira_softwareclone AS software_clone ON
tira_dockersoftware.docker_software_id = software_clone.docker_software_id
LEFT JOIN
tira_softwareclone AS upload_clone ON tira_run.upload_id = upload_clone.upload_id
ORDER BY
tira_run.run_id ASC;
"""
ret = {}
for (
run_id,
task_id,
dataset_id,
software_id,
software_vm,
docker_id,
docker_vm,
docker_title,
upload_id,
upload_vm,
upload_title,
published,
blinded,
) in self.execute_raw_sql_statement(prepared_statement, []):
vm = None
title = None
if software_vm is not None:
assert docker_vm is None and upload_vm is None
vm = software_vm
title = software_id
t = "VM"
if docker_vm is not None:
assert software_vm is None and upload_vm is None
vm = docker_vm
title = docker_title
t = "Docker"
if upload_vm is not None:
assert software_vm is None and docker_id is None
vm = upload_vm
title = upload_title
t = "Upload"

if vm is None:
continue
assert vm is not None and title is not None

if vm not in ret:
ret[vm] = {}
if title not in ret[vm]:
ret[vm][title] = {}

if run_id in ret[vm][title]:
blinded = ret[vm][title][run_id]["blinded"] and blinded
published = ret[vm][title][run_id]["published"] or published

ret[vm][title][run_id] = {
"type": t,
"published": published,
"blinded": blinded,
"task": task_id,
"dataset": dataset_id,
}

return ret

def runs(self, task_id, dataset_id, vm_id, software_id):
prepared_statement = """
SELECT
Expand Down
40 changes: 32 additions & 8 deletions application/src/tira_app/endpoints/v1/_systems.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,40 @@
from django.http import HttpRequest, JsonResponse
from django.urls import path

from ...model import DockerSoftware
from ...tira_model import model


def public_submissions(request: HttpRequest) -> JsonResponse:
ret = [
{"team": "team-1", "name": "foo1", "type": "Docker", "tasks": ["ir-benchmarks", "reneuir"]},
{"team": "team-1", "name": "foo2", "type": "Docker", "tasks": ["ir-benchmarks", "reneuir"]},
{"team": "team-1", "name": "foo3", "type": "Docker", "tasks": ["ir-benchmarks", "reneuir"]},
{"team": "team-2", "name": "foo2", "type": "Run", "tasks": ["ir-benchmarks", "reneuir"]},
{"team": "team-3", "name": "foo2", "type": "VM", "tasks": ["ir-benchmarks", "reneuir"]},
]
all_runs = model.all_runs()
ret = []

for vm in all_runs:
for title in all_runs[vm]:
blinded = True
public = False
run_type = []
tasks = set()
for run in all_runs[vm][title].values():
run_type += [run["type"]]
blinded = run["blinded"] and blinded
public = run["published"] or public
tasks.add(str(run["task"]))

if public:
ret += [{"team": vm, "name": title, "type": run_type[0], "tasks": sorted([i for i in tasks])}]

return JsonResponse(ret, safe=False)


endpoints = [path("", public_submissions)]
def software_details(request: HttpRequest, user_id: str, software: str) -> JsonResponse:
ret = []
for i in DockerSoftware.objects.filter(vm_id=user_id, display_name=software):
if not i.public_image_name:
continue
ret += [{"PublicDockerImage": i.public_image_name, "Command": i.command}]

return JsonResponse({"DockerImage": "dasda", "tbd": ret}, safe=False)


endpoints = [path("", public_submissions), path("<str:user_id>/<str:software>", software_details)]
41 changes: 41 additions & 0 deletions frontend/src/SystemDetails.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<template>
<tira-breadcrumb />
<h3 class="text-h3 py-5">System Details</h3>
{{ system_details }}
<h3 class="text-h3 py-5">Public Submissions</h3>
We only show submissions of {{ team }}/{{ system }} that have at least one positively validated and published submission for the software.
</template>

<script lang="ts">
import { inject } from 'vue'
import { get, reportError, fetchUserInfo, type UserInfo } from './utils';
import { Loading, TiraBreadcrumb } from './components'
export default {
name: "systems",
components: { Loading, TiraBreadcrumb },
data() {
return {
userinfo: { role: 'guest', organizer_teams: [] } as UserInfo,
system_details: undefined,
team: undefined as undefined | string,
system: undefined as undefined | string,
}
},
methods: {
logData(toLog: any) {
console.log(toLog)
}
},
beforeMount() {
this.team = this.$route.params.team
this.system = this.$route.params.system
fetchUserInfo().then((result) => { this.$data.userinfo = result })
get(inject("REST base URL") + '/v1/systems/' + this.team + '/' + this.system).then((result) => { this.$data.system_details = result})
}
}
</script>

32 changes: 29 additions & 3 deletions frontend/src/Systems.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<template>
<tira-breadcrumb />

<h3 class="text-h3 py-5">Published Systems</h3>
<h3 class="text-h3 py-5" v-if="team === undefined">Published Systems</h3>
<h3 class="text-h3 py-5" v-if="team !== undefined">Published Systems by {{ team }}</h3>
We show systems that have at least one positively validated and published submission.
<div class="py-5"></div>
<v-skeleton-loader type="card" v-if="systems === undefined"/>
Expand All @@ -16,6 +17,20 @@

<v-data-table :headers="headers" :items="systems" :itemsPerPage="10" :search="query" density="compact" fixed-footer>

<template #item.team="{ item }">
<a :href="'/systems/' + item.team" style="text-decoration: none !important;">{{ item.team }}</a>
</template>

<template #item.name="{ item }">
<a :href="'/systems/' + item.team + '/' + item.name " style="text-decoration: none !important;">{{ item.name }}</a>
</template>

<template #item.tasks="{ item }">
<span v-for="task in item.tasks">
<a :href="'/task-overview/' + task" style="text-decoration: none !important;">{{ task }}</a>
</span>
</template>

</v-data-table>
</div>
</template>
Expand All @@ -32,11 +47,12 @@
data() {
return {
userinfo: { role: 'guest', organizer_teams: [] } as UserInfo,
team: undefined as undefined | string,
query: undefined,
systems: undefined,
headers: [
{ title: 'System', key: 'name' },
{ title: 'Team', value: 'team' },
{ title: 'System', key: 'name' },
{ title: 'Type', value: 'type' },
{ title: 'Tasks', key: 'tasks' },
],
Expand All @@ -49,9 +65,19 @@
},
beforeMount() {
this.query = this.$route.query.query
if (this.$route.params.team) {
this.team = this.$route.params.team
}
get(inject("REST base URL") + '/v1/systems/')
.then(
(result) => { this.logData(result); this.$data.systems = result}
(result) => {
if (this.team) {
result = result.filter(i => i.team.toLowerCase() == this.team?.toLowerCase())
}
this.$data.systems = result
}
)
.catch(reportError("Problem While Loading the Overview of the Systems.", "This might be a short-term hiccup, please try again. We got the following error: "))
fetchUserInfo().then((result) => { this.$data.userinfo = result })
Expand Down
23 changes: 19 additions & 4 deletions frontend/src/components/TiraBreadcrumb.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,26 @@ export default {
name: "tira-breadcrumb",
computed: {
items() {
var ret = [{title: 'TIRA', disabled: false, href: '/'}, {title: 'Tasks', disabled: false, href: '/tasks'}]
let task = extractTaskFromCurrentUrl()
var ret = [{title: 'TIRA', disabled: false, href: '/'}]
if (task) {
ret.push({title: task, disabled: false, href: '/task-overview/' + task})
if (this.$route.path.startsWith('/datasets')) {
ret.push({title: 'Datasets', disabled: false, href: '/datasets'})
} else if (this.$route.path.startsWith('/systems')) {
ret.push({title: 'Systems', disabled: false, href: '/systems'})
if (this.$route.params.team) {
ret.push({title: this.$route.params.team, disabled: false, href: '/systems/' + this.$route.params.team})
if (this.$route.params.system) {
ret.push({title: this.$route.params.system, disabled: false, href: '/systems/' + this.$route.params.team + '/' + this.$route.params.system})
}
}
} else {
ret.push({title: 'Tasks', disabled: false, href: '/tasks'})
let task = extractTaskFromCurrentUrl()
if (task) {
ret.push({title: task, disabled: false, href: '/task-overview/' + task})
}
}
return ret;
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import Tasks from './Tasks.vue'
import Tirex from './Tirex.vue'
import Datasets from './Datasets.vue'
import Systems from './Systems.vue'
import SystemDetails from './SystemDetails.vue'
import TaskOverview from './TaskOverview.vue'
import RunUpload from './RunUpload.vue'
import tiraConf from './tira.conf'
Expand All @@ -36,6 +37,8 @@ export default function register_app() {
{ path: '/tasks', component: Tasks },
{ path: '/datasets', component: Datasets },
{ path: '/systems', component: Systems },
{ path: '/systems/:team?', component: Systems },
{ path: '/systems/:team/:system', component: SystemDetails },
{ path: '/task-overview/:task_id?/:dataset_id?', component: TaskOverview },
{ path: '/task/:task_id?/:dataset_id?', component: TaskOverview },
{ path: '/submit/:task/user/:user/:submission_type?/:selected_step?', name: 'submission', component: RunUpload },
Expand Down

0 comments on commit 204917e

Please sign in to comment.