diff --git a/app/assets/stylesheets/repository/filters.scss b/app/assets/stylesheets/repository/filters.scss index 4742a483e..bc8c53bd7 100644 --- a/app/assets/stylesheets/repository/filters.scss +++ b/app/assets/stylesheets/repository/filters.scss @@ -33,8 +33,7 @@ padding: .5em; .apply-button { - flex-grow: 1; - margin-left: .5em !important; + margin-left: auto !important; } .column-filters-element { diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 653cebc69..e6f268eda 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -7,6 +7,7 @@ class RepositoriesController < ApplicationController include IconsHelper include TeamsHelper include RepositoriesDatatableHelper + include MyModulesHelper before_action :switch_team_with_param, only: :show before_action :load_repository, except: %i(index create create_modal sidebar archive restore) @@ -360,6 +361,18 @@ class RepositoriesController < ApplicationController end end + def assigned_my_modules + my_modules = MyModule.joins(:repository_rows).where(repository_rows: { repository: @repository }) + .readable_by_user(current_user).distinct + render json: grouped_by_prj_exp(my_modules).map { |g| + { + label: "#{g[:project_name]} / #{g[:experiment_name]}", options: g[:tasks].map do |t| + { label: t.name, value: t.id } + end + } + } + end + private def repostiory_import_actions diff --git a/app/javascript/packs/vue/repository_filter.js b/app/javascript/packs/vue/repository_filter.js index 0ad4e1de6..17b12397a 100644 --- a/app/javascript/packs/vue/repository_filter.js +++ b/app/javascript/packs/vue/repository_filter.js @@ -11,7 +11,8 @@ window.initRepositoryFilter = () => { data: () => { return { filters: [], - columns: [] + columns: [], + my_modules: [] }; }, created() { @@ -27,6 +28,10 @@ window.initRepositoryFilter = () => { } }); + $.get($('#filterContainer').data('my-modules-url'), function(data) { + repositoryFilterContainer.my_modules = data; + }); + // Replace with remote endpoint repositoryFilterContainer.columns = [ { id: 'assigned', name: 'Assigned to task', data_type: 'RepositoryMyModuleValue' }, diff --git a/app/javascript/vue/repository_filter/container.vue b/app/javascript/vue/repository_filter/container.vue index a0e4cebb7..07ef88c2e 100644 --- a/app/javascript/vue/repository_filter/container.vue +++ b/app/javascript/vue/repository_filter/container.vue @@ -16,6 +16,7 @@ v-for="(filter, index) in filters" :key="filter.id" :filter.sync="filters[index]" + :my_modules.sync= "my_modules" @filter:update="updateFilter" @filter:delete="filters.splice(index, 1)" /> @@ -55,6 +56,7 @@ } }, props: { + my_modules: Array, container: Object, savedFilters: Array, columns: Array diff --git a/app/javascript/vue/repository_filter/filter.vue b/app/javascript/vue/repository_filter/filter.vue index 50d0d4577..7c572abee 100644 --- a/app/javascript/vue/repository_filter/filter.vue +++ b/app/javascript/vue/repository_filter/filter.vue @@ -6,6 +6,7 @@
@@ -23,6 +24,7 @@ import RepositoryAssetValue from 'vue/repository_filter/filters/repositoryAssetValue.vue' import RepositoryTextValue from 'vue/repository_filter/filters/repositoryTextValue.vue' import RepositoryNumberValue from 'vue/repository_filter/filters/repositoryNumberValue.vue' + import RepositoryMyModuleValue from 'vue/repository_filter/filters/repositoryMyModuleValue.vue' import DropdownSelector from 'vue/shared/dropdown_selector.vue' @@ -30,16 +32,17 @@ name: "FilterElement", props: { filter: Object, + my_modules: Array }, components: { DropdownSelector, RepositoryAssetValue, RepositoryTextValue, - RepositoryNumberValue + RepositoryNumberValue, + RepositoryMyModuleValue }, methods: { updateFilter(value) { - console.log(value); this.$emit('filter:update', value) } } diff --git a/app/javascript/vue/repository_filter/filters/repositoryMyModuleValue.vue b/app/javascript/vue/repository_filter/filters/repositoryMyModuleValue.vue new file mode 100644 index 000000000..d5db6ccfe --- /dev/null +++ b/app/javascript/vue/repository_filter/filters/repositoryMyModuleValue.vue @@ -0,0 +1,57 @@ + + + diff --git a/app/javascript/vue/repository_filter/mixins/filter.js b/app/javascript/vue/repository_filter/mixins/filter.js index 860d807aa..e46c80f32 100644 --- a/app/javascript/vue/repository_filter/mixins/filter.js +++ b/app/javascript/vue/repository_filter/mixins/filter.js @@ -1,6 +1,7 @@ export default { props: { - filter: Object + filter: Object, + my_modules: Array }, created() { this.operator = this.operator || this.filter.data.operator; diff --git a/app/javascript/vue/shared/dropdown_selector.vue b/app/javascript/vue/shared/dropdown_selector.vue index 37bb582ee..c83ac90e7 100644 --- a/app/javascript/vue/shared/dropdown_selector.vue +++ b/app/javascript/vue/shared/dropdown_selector.vue @@ -1,7 +1,18 @@