mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-12-17 14:19:05 +08:00
Merge pull request #7650 from aignatov-bio/ai-sci-8865-small-fix-for-task-creation
Fix select dropdown changes [SCI-8865]
This commit is contained in:
commit
eeaf073ced
3 changed files with 28 additions and 2 deletions
|
|
@ -17,6 +17,7 @@
|
||||||
:optionsUrl="projectsUrl"
|
:optionsUrl="projectsUrl"
|
||||||
:searchable="true"
|
:searchable="true"
|
||||||
:value="selectedProject"
|
:value="selectedProject"
|
||||||
|
:optionRenderer="newProjectRenderer"
|
||||||
@change="changeProject"
|
@change="changeProject"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -44,6 +45,7 @@
|
||||||
:disabled="!(selectedProject != null && selectedProject >= 0)"
|
:disabled="!(selectedProject != null && selectedProject >= 0)"
|
||||||
:searchable="true"
|
:searchable="true"
|
||||||
:value="selectedExperiment"
|
:value="selectedExperiment"
|
||||||
|
:optionRenderer="newExperimentRenderer"
|
||||||
@change="changeExperiment"
|
@change="changeExperiment"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -157,6 +159,18 @@ export default {
|
||||||
this.selectedExperiment = value;
|
this.selectedExperiment = value;
|
||||||
this.newExperimentName = label;
|
this.newExperimentName = label;
|
||||||
},
|
},
|
||||||
|
newProjectRenderer(option) {
|
||||||
|
if (option[0] > 0) {
|
||||||
|
return option[1];
|
||||||
|
}
|
||||||
|
return this.i18n.t('dashboard.create_task_modal.new_project', { name: option[1] });
|
||||||
|
},
|
||||||
|
newExperimentRenderer(option) {
|
||||||
|
if (option[0] > 0) {
|
||||||
|
return option[1];
|
||||||
|
}
|
||||||
|
return this.i18n.t('dashboard.create_task_modal.new_experiment', { name: option[1] });
|
||||||
|
},
|
||||||
closeModal() {
|
closeModal() {
|
||||||
$('#create-task-modal').modal('hide');
|
$('#create-task-modal').modal('hide');
|
||||||
this.taskName = '';
|
this.taskName = '';
|
||||||
|
|
|
||||||
|
|
@ -273,10 +273,15 @@ export default {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
urlParams() {
|
urlParams: {
|
||||||
|
handler(oldVal, newVal) {
|
||||||
|
if (!this.compareObjects(oldVal, newVal)) {
|
||||||
this.fetchOptions();
|
this.fetchOptions();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
deep: true
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
renderLabel(option) {
|
renderLabel(option) {
|
||||||
if (!option) return false;
|
if (!option) return false;
|
||||||
|
|
@ -384,6 +389,11 @@ export default {
|
||||||
if (this.$refs.options) {
|
if (this.$refs.options) {
|
||||||
this.$refs.options[this.focusedOption]?.scrollIntoView({ block: 'nearest' });
|
this.$refs.options[this.focusedOption]?.scrollIntoView({ block: 'nearest' });
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
compareObjects(o1, o2) {
|
||||||
|
const normalizedObj1 = Object.fromEntries(Object.entries(o1).sort(([k1], [k2]) => k1.localeCompare(k2)));
|
||||||
|
const normalizedObj2 = Object.fromEntries(Object.entries(o2).sort(([k1], [k2]) => k1.localeCompare(k2)));
|
||||||
|
return JSON.stringify(normalizedObj1) === JSON.stringify(normalizedObj2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,8 @@ en:
|
||||||
filter_create_new: "Create"
|
filter_create_new: "Create"
|
||||||
cancel: "Cancel"
|
cancel: "Cancel"
|
||||||
create: "Create"
|
create: "Create"
|
||||||
|
new_project: "New \"%{name}\" Project"
|
||||||
|
new_experiment: "New \"%{name}\" Experiment"
|
||||||
recent_work:
|
recent_work:
|
||||||
title: "Recent work"
|
title: "Recent work"
|
||||||
no_results:
|
no_results:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue