Pre-select current project when duplicating experiment [SCI-10420] (#7256)

This commit is contained in:
wandji 2024-03-14 10:17:56 +01:00 committed by GitHub
parent a6dc688776
commit 0632d90b3f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 3 deletions

View file

@ -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>

View file

@ -26,7 +26,7 @@ export default {
},
computed: {
shouldTruncateText() {
return this.params.data.description.length > 80;
return this.params.data.description?.length > 80;
}
},
methods: {

View file

@ -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)