From 75f743700120a80f8510e24a420033c279f941f6 Mon Sep 17 00:00:00 2001 From: Anton Date: Mon, 11 Dec 2023 09:18:22 +0100 Subject: [PATCH] Fix markup --- app/controllers/experiments_controller.rb | 21 +- app/javascript/vue/experiments/list.vue | 77 ++++- .../vue/experiments/modals/description.vue | 35 +++ .../vue/experiments/modals/duplicate.vue | 68 +++++ .../vue/experiments/modals/move.vue | 69 +++++ .../experiments/renderers/completed_tasks.vue | 2 +- .../vue/experiments/renderers/description.vue | 2 +- .../label_template/insert_field_dropdown.vue | 176 ++++++------ app/javascript/vue/label_template/table.vue | 108 +++++--- app/javascript/vue/projects/card.vue | 29 +- app/javascript/vue/projects/list.vue | 190 ++++++++----- app/javascript/vue/projects/modals/edit.vue | 28 +- .../vue/projects/modals/edit_folder.vue | 30 +- app/javascript/vue/projects/modals/move.vue | 74 ++--- .../vue/projects/modals/move_tree.vue | 14 +- app/javascript/vue/projects/modals/new.vue | 29 +- .../vue/projects/modals/new_folder.vue | 30 +- .../vue/projects/renderers/users.vue | 26 +- .../vue/shared/datatable/action_toolbar.vue | 93 ++++--- .../shared/datatable/mixins/card_selector.js | 15 +- .../vue/shared/datatable/pagination.vue | 11 +- .../shared/datatable/row_menu_renderer.vue | 47 ++-- app/javascript/vue/shared/datatable/table.vue | 107 +++---- .../vue/shared/datatable/tableHeader.js | 3 +- .../vue/shared/datatable/toolbar.vue | 50 ++-- .../vue/shared/date_time_picker.vue | 262 +++++++++--------- app/javascript/vue/shared/select_dropdown.vue | 152 +++++----- .../lists/experiment_serializer.rb | 12 +- app/services/toolbars/experiments_service.rb | 25 +- config/locales/en.yml | 3 +- config/routes.rb | 2 + 31 files changed, 1093 insertions(+), 697 deletions(-) create mode 100644 app/javascript/vue/experiments/modals/description.vue create mode 100644 app/javascript/vue/experiments/modals/duplicate.vue create mode 100644 app/javascript/vue/experiments/modals/move.vue diff --git a/app/controllers/experiments_controller.rb b/app/controllers/experiments_controller.rb index 0781d2552..b0f086394 100644 --- a/app/controllers/experiments_controller.rb +++ b/app/controllers/experiments_controller.rb @@ -267,6 +267,18 @@ class ExperimentsController < ApplicationController } end + def projects_to_clone + projects = @experiment.project.team.projects.active + .with_user_permission(current_user, ProjectPermissions::EXPERIMENTS_CREATE) + .map { |p| [p.id, p.name] } + render json: { data: projects }, status: :ok + end + + def projects_to_move + projects = @experiment.movable_projects(current_user).map { |p| [p.id, p.name] } + render json: { data: projects }, status: :ok + end + # POST: clone_experiment(id) def clone project = current_team.projects.find(move_experiment_param) @@ -279,11 +291,10 @@ class ExperimentsController < ApplicationController if service.succeed? flash[:success] = t('experiments.clone.success_flash', experiment: @experiment.name) - redirect_to canvas_experiment_path(service.cloned_experiment) + render json: { url: canvas_experiment_path(service.cloned_experiment) } else - flash[:error] = t('experiments.clone.error_flash', - experiment: @experiment.name) - redirect_to experiments_path(project_id: @experiment.project) + render json: { message: t('experiments.clone.error_flash', + experiment: @experiment.name) }, status: :unprocessable_entity end end @@ -534,7 +545,7 @@ class ExperimentsController < ApplicationController actions: Toolbars::ExperimentsService.new( current_user, - experiment_ids: params[:experiment_ids].split(',') + experiment_ids: JSON.parse(params[:items]).map { |i| i['id'] } ).actions } end diff --git a/app/javascript/vue/experiments/list.vue b/app/javascript/vue/experiments/list.vue index 31c7255d9..21c609b0d 100644 --- a/app/javascript/vue/experiments/list.vue +++ b/app/javascript/vue/experiments/list.vue @@ -13,22 +13,58 @@ :filters="filters" :viewRenders="viewRenders" @tableReloaded="reloadingTable = false" + @archive="archive" + @restore="restore" + @showDescription="showDescription" + @duplicate="duplicate" + @move="move" > + + + + + diff --git a/app/javascript/vue/experiments/modals/description.vue b/app/javascript/vue/experiments/modals/description.vue new file mode 100644 index 000000000..0a88a6603 --- /dev/null +++ b/app/javascript/vue/experiments/modals/description.vue @@ -0,0 +1,35 @@ + + + diff --git a/app/javascript/vue/experiments/modals/duplicate.vue b/app/javascript/vue/experiments/modals/duplicate.vue new file mode 100644 index 000000000..63334804f --- /dev/null +++ b/app/javascript/vue/experiments/modals/duplicate.vue @@ -0,0 +1,68 @@ + + + diff --git a/app/javascript/vue/experiments/modals/move.vue b/app/javascript/vue/experiments/modals/move.vue new file mode 100644 index 000000000..f6c0158cb --- /dev/null +++ b/app/javascript/vue/experiments/modals/move.vue @@ -0,0 +1,69 @@ + + + diff --git a/app/javascript/vue/experiments/renderers/completed_tasks.vue b/app/javascript/vue/experiments/renderers/completed_tasks.vue index 67723c179..9ef8de555 100644 --- a/app/javascript/vue/experiments/renderers/completed_tasks.vue +++ b/app/javascript/vue/experiments/renderers/completed_tasks.vue @@ -6,7 +6,7 @@ all: params.data.total_tasks }) }}
-
+
diff --git a/app/javascript/vue/experiments/renderers/description.vue b/app/javascript/vue/experiments/renderers/description.vue index b7cc52509..3a22664d5 100644 --- a/app/javascript/vue/experiments/renderers/description.vue +++ b/app/javascript/vue/experiments/renderers/description.vue @@ -25,7 +25,7 @@ export default { }, methods: { showMore() { - + this.params.dtComponent.$emit('showDescription', null, [this.params.data]); }, }, }; diff --git a/app/javascript/vue/label_template/insert_field_dropdown.vue b/app/javascript/vue/label_template/insert_field_dropdown.vue index 4d54048fa..ad3c9a360 100644 --- a/app/javascript/vue/label_template/insert_field_dropdown.vue +++ b/app/javascript/vue/label_template/insert_field_dropdown.vue @@ -1,6 +1,7 @@ diff --git a/app/javascript/vue/label_template/table.vue b/app/javascript/vue/label_template/table.vue index ccf14d683..ab2c09f31 100644 --- a/app/javascript/vue/label_template/table.vue +++ b/app/javascript/vue/label_template/table.vue @@ -24,51 +24,83 @@ diff --git a/app/javascript/vue/projects/card.vue b/app/javascript/vue/projects/card.vue index dc3b5b23c..81e2c6dca 100644 --- a/app/javascript/vue/projects/card.vue +++ b/app/javascript/vue/projects/card.vue @@ -12,7 +12,9 @@
{{ params.code }}
- + {{ params.name }}
@@ -24,8 +26,9 @@ {{ params.archived_on }} {{ i18n.t('projects.index.card.visibility') }} - {{ params.hidden ? i18n.t('projects.index.hidden') : i18n.t('projects.index.visible') }} - + + {{ params.hidden ? i18n.t('projects.index.hidden') : i18n.t('projects.index.visible') }} + {{ i18n.t('projects.index.card.users') }}
@@ -45,7 +48,9 @@
- + {{ params.name }} @@ -57,20 +62,20 @@ diff --git a/app/javascript/vue/projects/list.vue b/app/javascript/vue/projects/list.vue index d72cdd253..01ef1cfc8 100644 --- a/app/javascript/vue/projects/list.vue +++ b/app/javascript/vue/projects/list.vue @@ -27,7 +27,8 @@ - + - - - - - - + + + + + + diff --git a/app/javascript/vue/projects/modals/edit.vue b/app/javascript/vue/projects/modals/edit.vue index 69c1e9cf7..ddd19c3b5 100644 --- a/app/javascript/vue/projects/modals/edit.vue +++ b/app/javascript/vue/projects/modals/edit.vue @@ -3,7 +3,9 @@ @@ -31,7 +37,7 @@ export default { data() { return { opendedFolders: {}, - } + }; }, -} +}; diff --git a/app/javascript/vue/projects/modals/new.vue b/app/javascript/vue/projects/modals/new.vue index 68bbc386a..334d2d460 100644 --- a/app/javascript/vue/projects/modals/new.vue +++ b/app/javascript/vue/projects/modals/new.vue @@ -3,7 +3,9 @@