Merge pull request #7633 from aignatov-bio/ai-sci-8865-fix-experiment-selection-for-new-task-modal

Fix experiment selection for new task modal [SCI-8865]
This commit is contained in:
aignatov-bio 2024-06-06 14:07:34 +02:00 committed by GitHub
commit 0bf43be8c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 3 deletions

View file

@ -49,10 +49,10 @@
</div> </div>
<hr class="my-6"> <hr class="my-6">
<div class="flex items-center justify-end gap-4"> <div class="flex items-center justify-end gap-4">
<button class="btn btn-light" @click="$emit('close')"> <button class="btn btn-light" @click="closeModal">
{{ i18n.t("dashboard.create_task_modal.cancel") }} {{ i18n.t("dashboard.create_task_modal.cancel") }}
</button> </button>
<button class="btn btn-primary" @click="createMyModule" :disabled="!validTaskName || !validExperiment || !validProject"> <button class="btn btn-primary" @click="createMyModule" :disabled="!validTaskName || !validExperiment || !validProject || creatingTask">
{{ i18n.t("dashboard.create_task_modal.create") }} {{ i18n.t("dashboard.create_task_modal.create") }}
</button> </button>
</div> </div>
@ -116,11 +116,16 @@ export default {
userRoles: [], userRoles: [],
taskName: '', taskName: '',
publicProject: false, publicProject: false,
defaultRole: null defaultRole: null,
creatingTask: false
}; };
}, },
methods: { methods: {
createMyModule() { createMyModule() {
if (this.creatingTask) return;
this.creatingTask = true;
axios.post(this.createUrl, { axios.post(this.createUrl, {
my_module: { my_module: {
name: this.taskName name: this.taskName
@ -137,6 +142,7 @@ export default {
} }
}) })
.then((response) => { .then((response) => {
this.creatingTask = false;
window.location.href = response.data.my_module_path; window.location.href = response.data.my_module_path;
}); });
}, },
@ -151,6 +157,14 @@ export default {
this.selectedExperiment = value; this.selectedExperiment = value;
this.newExperimentName = label; this.newExperimentName = label;
}, },
closeModal() {
$('#create-task-modal').modal('hide');
this.taskName = '';
this.selectedProject = null;
this.newProjectName = '';
this.selectedExperiment = null;
this.newExperimentName = '';
},
fetchUserRoles() { fetchUserRoles() {
axios.get(this.rolesUrl) axios.get(this.rolesUrl)
.then((response) => { .then((response) => {

View file

@ -272,6 +272,9 @@ export default {
this.$refs.search?.focus(); this.$refs.search?.focus();
}); });
} }
},
urlParams() {
this.fetchOptions();
} }
}, },
methods: { methods: {