Improve code [SCI-10292]

This commit is contained in:
wandji20 2024-02-29 13:18:58 +01:00
parent b59392b932
commit 53039ba5ee
4 changed files with 6 additions and 7 deletions

View file

@ -240,9 +240,9 @@ export default {
duplicate(_e, experiment) {
[this.duplicateModalObject] = experiment;
},
move(_e, rows) {
move(event, rows) {
[this.moveModalObject] = rows;
this.moveModalObject.experimentIds = rows.map((exp) => exp.id);
this.moveModalObject.movePath = event.path;
},
edit(_e, experiment) {
[this.editModalObject] = experiment;

View file

@ -54,9 +54,8 @@ export default {
methods: {
async submit() {
this.disableSubmit = true;
await axios.post(this.experiment.urls.move, {
project_id: this.targetProject,
ids: this.experiment.experimentIds
await axios.post(this.experiment.movePath, {
project_id: this.targetProject
}).then((response) => {
this.$emit('move');
window.location.replace(response.data.path);

View file

@ -69,7 +69,6 @@ module Lists
actions: actions_toolbar_experiments_path(items: [{ id: object.id }].to_json),
projects_to_clone: projects_to_clone_experiment_path(object),
projects_to_move: projects_to_move_experiment_path(object),
move: move_experiments_path,
clone: clone_experiment_path(object),
update: experiment_path(object),
show_access: access_permissions_experiment_path(object),

View file

@ -87,7 +87,8 @@ module Toolbars
name: 'move',
label: I18n.t('experiments.toolbar.move_button'),
icon: 'sn-icon sn-icon-move',
type: :emit
type: :emit,
path: move_experiments_path(ids: @experiments.pluck(:id))
}
end