From 7fdbc7309888dc9f81d4926dc646945ff8989d5a Mon Sep 17 00:00:00 2001 From: Anton Date: Fri, 24 Nov 2023 11:08:28 +0100 Subject: [PATCH] Replace project table [SCI-9680] --- app/controllers/projects_controller.rb | 2 +- app/javascript/vue/projects/list.vue | 43 ++++++++++++++- .../vue/projects/renderers/users.vue | 4 +- app/javascript/vue/shared/datatable/table.vue | 40 ++++++++++++-- .../vue/shared/datatable/toolbar.vue | 53 +++++++++++++++++-- .../vue/shared/filters/filter_dropdown.vue | 2 +- .../shared/filters/inputs/checkbox_filter.vue | 20 +++++-- .../filters/inputs/date_range_filter.vue | 7 ++- .../vue/shared/filters/inputs/text_filter.vue | 7 ++- app/javascript/vue/shared/menu_dropdown.vue | 2 +- app/models/user_assignment.rb | 1 - .../lists/project_and_folder_serializer.rb | 5 +- app/services/lists/projects_service.rb | 40 +++++++------- app/views/projects/index.html.erb | 7 ++- 14 files changed, 185 insertions(+), 48 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 52ffbcedd..1c7577314 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -393,7 +393,7 @@ class ProjectsController < ApplicationController actions: Toolbars::ProjectsService.new( current_user, - items: JSON.parse(params[:items]), + items: JSON.parse(params[:items]) ).actions } end diff --git a/app/javascript/vue/projects/list.vue b/app/javascript/vue/projects/list.vue index 0f583ca11..e85f66b7c 100644 --- a/app/javascript/vue/projects/list.vue +++ b/app/javascript/vue/projects/list.vue @@ -7,6 +7,10 @@ :toolbarActions="toolbarActions" :actionsUrl="actionsUrl" :withRowMenu="true" + :activePageUrl="activePageUrl" + :archivedPageUrl="archivedPageUrl" + :currentViewMode="currentViewMode" + :filters="filters" @tableReloaded="reloadingTable = false" /> @@ -38,6 +42,16 @@ export default { }, createFolderUrl: { type: String, + }, + activePageUrl: { + type: String, + }, + archivedPageUrl: { + type: String, + }, + currentViewMode: { + type: String, + required: true } }, data() { @@ -79,13 +93,40 @@ export default { left: left, right: [] } + }, + filters() { + let filters = [{ + key: 'query', + type: 'Text' + }, + { + key: 'created_at', + type: 'DateRange', + label: this.i18n.t("filters_modal.created_on.label"), + }] + + if (this.currentViewMode === 'archived') { + filters.push({ + key: 'archived_at', + type: 'DateRange', + label: this.i18n.t("filters_modal.archived_on.label"), + }) + } + + filters.push({ + key: 'folder_search', + type: 'Checkbox', + label: this.i18n.t("projects.index.filters_modal.folders.label"), + }) + + return filters } }, methods: { nameRenderer(params) { let showUrl = params.data.urls.show; return ` - ${params.data.folder ? 'sn-icon mini sn-icon-mini-folder-left' : ''} + ${params.data.folder ? '' : ''} ${params.data.name} ` }, diff --git a/app/javascript/vue/projects/renderers/users.vue b/app/javascript/vue/projects/renderers/users.vue index ccef45228..97ea94408 100644 --- a/app/javascript/vue/projects/renderers/users.vue +++ b/app/javascript/vue/projects/renderers/users.vue @@ -1,9 +1,9 @@