mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-10 17:36:33 +08:00
Pre-select current project when duplicating experiment [SCI-10420] (#7256)
This commit is contained in:
parent
a6dc688776
commit
0632d90b3f
3 changed files with 15 additions and 3 deletions
|
@ -15,6 +15,8 @@
|
|||
<SelectDropdown :optionsUrl="experiment.urls.projects_to_clone"
|
||||
:value="targetProject"
|
||||
:searchable="true"
|
||||
:labelRenderer="optionRenderer"
|
||||
:optionRenderer="optionRenderer"
|
||||
@change="changeProject" />
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
@ -30,7 +32,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
/* global HelperModule */
|
||||
/* global I18n HelperModule */
|
||||
|
||||
import SelectDropdown from '../../shared/select_dropdown.vue';
|
||||
import axios from '../../../packs/custom_axios.js';
|
||||
|
@ -45,6 +47,9 @@ export default {
|
|||
components: {
|
||||
SelectDropdown,
|
||||
},
|
||||
mounted() {
|
||||
this.targetProject = this.experiment.project_id;
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
targetProject: null,
|
||||
|
@ -66,6 +71,13 @@ export default {
|
|||
changeProject(project) {
|
||||
this.targetProject = project;
|
||||
},
|
||||
optionRenderer(option) {
|
||||
if (option[0] === this.experiment.project_id) {
|
||||
return `${option[1]} ${I18n.t('experiments.clone.current_project')}`;
|
||||
}
|
||||
|
||||
return option[1];
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -26,7 +26,7 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
shouldTruncateText() {
|
||||
return this.params.data.description.length > 80;
|
||||
return this.params.data.description?.length > 80;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -9,7 +9,7 @@ module Lists
|
|||
|
||||
attributes :name, :code, :created_at, :updated_at, :workflow_img, :description, :completed_tasks,
|
||||
:total_tasks, :archived_on, :urls, :sa_description, :default_public_user_role_id, :team,
|
||||
:top_level_assignable, :hidden, :archived
|
||||
:top_level_assignable, :hidden, :archived, :project_id
|
||||
|
||||
def created_at
|
||||
I18n.l(object.created_at, format: :full_date)
|
||||
|
|
Loading…
Reference in a new issue