Skip to content

Commit

Permalink
improve TiraMenu
Browse files Browse the repository at this point in the history
  • Loading branch information
mam10eks committed Dec 3, 2024
1 parent a0845fd commit b90a230
Show file tree
Hide file tree
Showing 7 changed files with 172 additions and 112 deletions.
79 changes: 67 additions & 12 deletions frontend/src/ClaimSubmission.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,26 @@
<p v-if="userinfo.role === 'guest'">
Please <a href='/login'>login</a> to claim ownership.
</p>
<div v-if="userinfo.role !== 'guest'">
<div v-if="userinfo.role !== 'guest' && vm_id !== undefined">
<v-divider/>
<h3 class="my-1">Public Access to the Data and Submissions</h3>
<p>You can make the data public so that users can download the data and submissions, e.g., after the shared task is finished or for participants to verify their software.</p>
<h3 class="my-1">Please Describe Your Run</h3>
<p>We need a description of your submission, specifically on the approach that produced the run:</p>

<v-radio-group v-model="new_software">
<v-radio label="This dataset is public (users can access the data and published submissions)" value="false"></v-radio>
<v-radio label="This dataset is confidential (only organizers can access the data and submissions)" value="true"></v-radio>
<v-radio label="I have submitted a run from the approach before (I.e., the approach is already described in TIRA)" value="false"></v-radio>
<v-radio label="I have not yet submitted a run from the approach (I.e., the approach has not yet a description in TIRA)" value="true"></v-radio>
</v-radio-group>
<v-btn>Claim Ownersip</v-btn>

<v-form ref="form">
<div v-if="new_software !== undefined && ('' + new_software) == 'true'">
<v-text-field v-model="display_name" label="Name" counter="30" required="True" :rules="[title_rule]"/>
<v-textarea v-model="description" label="Description" counter="500" :rules="[description_rule]"/>
<v-text-field v-model="paper_link" label="Link your Paper"/>
</div>
<v-autocomplete v-if="new_software !== undefined && ('' + new_software) == 'false'" clearable auto-select-first label="Choose approach &hellip;" prepend-inner-icon="mdi-magnify"
:items="upload_groups" item-title="display_name" item-value="id" variant="underlined" v-model="selected_upload_group" :rules="[select_rule]"/>
</v-form>
<v-btn :disabled="new_software === undefined" @click="submitForm()">Claim Ownersip</v-btn>
<div class="py-2"></div>
<v-divider/>
<!--<h3 class="my-1">Inspect Submission</h3>
Expand All @@ -62,7 +72,7 @@
<script lang="ts">
import { inject } from 'vue'
import { get, chatNoirUrl, irDatasetsUrls, type UserInfo, type DatasetInfo, type ClaimSubmissionInfo } from './utils';
import { get, post, vm_id, inject_response, chatNoirUrl, irDatasetsUrls, type UserInfo, type DatasetInfo, type ClaimSubmissionInfo, type UploadGroupInfo } from './utils';
import { Loading, TiraBreadcrumb } from './components'
import RunPage from './tirex/RunPage.vue'
Expand All @@ -77,10 +87,23 @@ export default {
submissionToClaim: undefined as ClaimSubmissionInfo | undefined,
error: false,
rest_url: inject("REST base URL"),
new_software: false,
new_software: undefined,
vm: undefined,
user_vms_for_task: [] as string[],
additional_vms: undefined,
user_id: undefined,
task: undefined,
upload_groups: [] as UploadGroupInfo[],
selected_upload_group: undefined,
display_name: '' as string,
description: '' as string,
paper_link: '' as string,
}
},
methods: {
title_rule(v: any) {if (v && v.length < 30 && v.length > 0) return true; return 'Please enter a name for your approach'},
select_rule(v: any) {if (v) return true; return 'Please select an approach'},
description_rule(v: any) {if (v && v.length < 500 && v.length > 0) return true; return 'Please enter a description for your approach (less than 500 characters)'},
loadData() {
this.dataset = undefined
this.submissionToClaim = undefined
Expand All @@ -91,12 +114,38 @@ export default {
.then((i) => {this.submissionToClaim = i as ClaimSubmissionInfo})
.then(() => {
if (this.submissionToClaim && this.submissionToClaim.dataset_id) {
get(this.rest_url + '/v1/datasets/view/' + this.submissionToClaim.dataset_id).then((i) => this.dataset = i as DatasetInfo)
}
}).catch(() => { this.error = true })
get(this.rest_url + '/v1/datasets/view/' + this.submissionToClaim.dataset_id).then((i) => {
get(this.rest_url + '/api/task/' + i.default_task)
.then(inject_response(this, { 'loading': false }, true))
.then(() => {
this.dataset = i as DatasetInfo
if (this.vm_id) {
get(this.rest_url + '/api/submissions-for-task/tira-tutorial/' + this.vm_id + '/upload')
.then((uploads) => {
this.upload_groups = uploads['context']['all_uploadgroups']
})
}
})
})
}
}).catch(() => { this.error = true })
},
async submitForm() {
const form = this.$refs.form as any
const { valid } = await form.validate()
if (valid) {
let params : Record<string, string> = {}
if (this.new_software !== undefined && ('' + this.new_software) == 'true') {
params['display_name'] = this.display_name + ''
params['description'] = this.description + ''
params['paper_link'] = this.paper_link + ''
} else {
params['upload_group'] = this.selected_upload_group + ''
}
post(this.rest_url + `/v1/anonymous/claim/` + this.vm_id + '/' + this.uuid, params, this.userinfo)
}
}
},
computed: {
link_chatnoir() { return chatNoirUrl(this.dataset) },
link_ir_datasets() {
Expand All @@ -108,6 +157,12 @@ export default {
return undefined
}
},
vm_id() {
return vm_id(this.vm_ids, this.vm, this.user_vms_for_task, this.additional_vms, this.user_id, this.task)
},
vm_ids() {
return this.user_vms_for_task.length > 1 ? this.user_vms_for_task : null;
},
},
beforeMount() {
this.uuid = this.$route.params.uuid as string
Expand Down
19 changes: 15 additions & 4 deletions frontend/src/TaskOverview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ export default {
user_vms_for_task: [],
datasets: [{ 'dataset_id': 'loading...', 'id': 'loading...', 'display_name': 'loading...', 'default_task': undefined }] as DatasetInfo[],
tab: "test",
archive_url: inject("Archived base URL"),
production_url: inject("REST base URL"),
url: inject("Archived base URL"),
}
},
computed: {
Expand Down Expand Up @@ -157,10 +160,18 @@ export default {
}
},
beforeMount() {
get(inject("Archived base URL") + '/api/task/' + this.task_id, false)
.then(inject_response(this, { 'loading': false }, true))
.then(this.updateDataset)
.catch(reportError("Problem While Loading the Details of the Task " + this.task_id, "This might be a short-term hiccup, please try again. We got the following error: "))
get(this.archive_url + '/api/task-list').then(task_list => {
for (let task of task_list['context']['task_list']) {
if (task && task['featured'] && task['task_id'] && this.task_id == task['task_id']) {
this.url = this.production_url
}
}
get(this.url + '/api/task/' + this.task_id)
.then(inject_response(this, { 'loading': false }, true))
.then(this.updateDataset)
.catch(reportError("Problem While Loading the Details of the Task " + this.task_id, "This might be a short-term hiccup, please try again. We got the following error: "))
}).catch(reportError("Problem While Loading the Details of the Task " + this.task_id, "This might be a short-term hiccup, please try again. We got the following error: "))
},
watch: {
selectedDataset(old_value, new_value) { this.newDatasetSelected() },
Expand Down
13 changes: 2 additions & 11 deletions frontend/src/components/SubmitButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

<script lang="ts">
import RegisterForm from "./RegisterForm.vue"
import { vm_id } from "@/utils";
export default {
name: "submit-button",
Expand All @@ -29,17 +30,7 @@ export default {
components: {RegisterForm},
computed: {
vm_id() {
if (!this.vm_ids && this.vm) {
return this.vm
} else if (this.user_vms_for_task && this.user_vms_for_task.length == 1) {
return this.user_vms_for_task[0]
} else if(this.additional_vms && this.additional_vms.length > 0 && this.additional_vms[0]) {
return this.additional_vms[0]
} else if (!this.vm_ids && this.user_id && !this.task.require_groups && !this.task.restrict_groups) {
return this.user_id + '-default'
}
return null;
return vm_id(this.vm_ids, this.vm, this.user_vms_for_task, this.additional_vms, this.user_id, this.task)
},
vm_ids() {
return this.user_vms_for_task.length > 1 ? this.user_vms_for_task : null;
Expand Down
131 changes: 56 additions & 75 deletions frontend/src/components/TiraMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,39 @@
<img id="site-logo" src="https://assets.tira.io/tira-icons/tira-banner-120x360-dark.png" alt="TIRA" style="height: 2.667em">
</a>
</v-col>

<v-col class="text-right">
<v-btn icon>
<v-icon>mdi-menu</v-icon>
</v-btn>
<v-menu>
<template v-slot:activator="{ props }">
<v-btn v-bind="props" class="text-red">
<v-icon>mdi-menu</v-icon>Archive
</v-btn>
</template>
<v-card min-width="300">
<v-list>
<v-list-item href="https://archive.tira.io" prepend-avatar="https://webis.de/weimar/people/img/silhouette-female.jpg" subtitle="Read only archive of TIRA." title="archive.tira.io">
<template v-slot:append>
<v-btn class="text-red" icon="mdi-database" variant="text"/>
</template>
</v-list-item>
</v-list>

<v-divider></v-divider>
<p style="max-width: 400px;" class="pa-2">
You are at <a href="https://archive.tira.io">archive.tira.io</a> which hosts a read-only archive of previous shared tasks. Visit <a href="https://www.tira.io">www.tira.io</a> to make submissions.
</p>

<v-card-actions>
<v-spacer/>
<v-btn variant="text">Cancel</v-btn>
<v-btn color="primary" v-if="userinfo.role !== 'guest'" variant="text" @click="logout">Logout</v-btn>
<v-btn color="primary" v-if="userinfo.role === 'guest'" variant="text" href="https://www.tira.io/login" target="_blank">Login</v-btn>
</v-card-actions>
</v-card>
</v-menu>
</v-col>
</v-row>

</v-container>

<v-container style="max-width: 1110px;" class="d-none d-md-block">
Expand All @@ -26,81 +51,37 @@
</v-col>

<v-col class="text-right">
<v-btn>
API
</v-btn>
<v-btn>
Forum
</v-btn>
<v-btn icon>
<v-icon>mdi-menu</v-icon>
</v-btn>

<v-menu v-if="userinfo !== undefined">
<v-btn href="https://pypi.org/project/tira/">API</v-btn>
<v-btn href="https://www.tira.io/categories">Forum</v-btn>
<v-menu>
<template v-slot:activator="{ props }">
<v-btn icon v-bind="props">
<img width="48" height="48" src="https://webis.de/weimar/people/img/silhouette-female.jpg" style="border-radius: 50%;">
<v-btn v-bind="props" class="text-red">
<v-icon>mdi-menu</v-icon>Archive
</v-btn>
</template>

<v-card min-width="300">
<v-list>
<v-list-item href="foo"
prepend-avatar="https://webis.de/weimar/people/img/silhouette-female.jpg"
subtitle="Short description..."
:title="userinfo.context.user_id"
>
<template v-slot:append>
<v-btn
:class="'text-red'"
icon="mdi-heart"
variant="text"
></v-btn>
</template>
</v-list-item>
</v-list>

<v-divider></v-divider>


<v-list>
<v-list-item>
<a href="/foo">{{ userinfo.organizer_teams.length }} Teams</a>
</v-list-item>

<v-list-item>
Role: <a href="/foo">{{ userinfo.role }}</a>
</v-list-item>
</v-list>

<v-card min-width="300">
<v-list>
<v-list-item href="https://archive.tira.io" prepend-avatar="https://webis.de/weimar/people/img/silhouette-female.jpg" subtitle="Read only archive of TIRA." title="archive.tira.io">
<template v-slot:append>
<v-btn class="text-red" icon="mdi-database" variant="text"/>
</template>
</v-list-item>
</v-list>

<v-divider></v-divider>

<v-list>
<v-list-item>
<v-switch
color="purple"
label="Enable messages"
hide-details
></v-switch>
</v-list-item>

<v-list-item>
<v-switch
color="purple"
label="Enable hints"
hide-details
></v-switch>
</v-list-item>
</v-list>

<v-card-actions>
<v-spacer></v-spacer>
<v-btn variant="text">Cancel</v-btn>
<v-btn color="primary" v-if="userinfo.role !== 'guest'" variant="text" @click="logout">Logout</v-btn>
<v-btn color="primary" v-if="userinfo.role === 'guest'" variant="text" href="https://www.tira.io/login" target="_blank">Login</v-btn>
</v-card-actions>
</v-card>
<v-divider></v-divider>

<p style="max-width: 400px;" class="pa-2">
You are at <a href="https://archive.tira.io">archive.tira.io</a> which hosts a read-only archive of previous shared tasks. Visit <a href="https://www.tira.io">www.tira.io</a> to make submissions.
</p>

<v-card-actions>
<v-spacer/>
<v-btn variant="text">Cancel</v-btn>
<v-btn color="primary" v-if="userinfo.role !== 'guest'" variant="text" @click="logout">Logout</v-btn>
<v-btn color="primary" v-if="userinfo.role === 'guest'" variant="text" href="https://www.tira.io/login" target="_blank">Login</v-btn>
</v-card-actions>
</v-card>
</v-menu>
</v-col>
</v-row>
Expand Down
7 changes: 4 additions & 3 deletions frontend/src/submission-components/EditSubmissionDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ export default {
showModal: false, loading: true, submit_in_progress: false,
task_id: extractTaskFromCurrentUrl(), display_name: 'loading ...',
description: 'loading ...', paper_link: 'loading...',
ir_re_ranker: false, ir_re_ranking_input: false
ir_re_ranker: false, ir_re_ranking_input: false,
rest_url: inject("REST base URL")
}
},
computed: {
Expand All @@ -56,10 +57,10 @@ export default {
this.loading = true
let url = null
if (this.type === 'docker') {
url = inject("REST base URL")+'/api/docker-softwares-details/' + this.user_id + '/' + this.id
url = this.rest_url + '/api/docker-softwares-details/' + this.user_id + '/' + this.id
}
if (this.type === 'upload') {
url = inject("REST base URL")+`/api/upload-group-details/${this.task_id}/${this.user_id}/${this.id}`
url = this.rest_url + `/api/upload-group-details/${this.task_id}/${this.user_id}/${this.id}`
}
get(url)
Expand Down
Loading

0 comments on commit b90a230

Please sign in to comment.