mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-31 20:19:05 +08:00
Fix conflicts and update localizations [SCI-6227] (#3733)
Co-authored-by: Anton <anton@scinote.net>
This commit is contained in:
parent
49ec3edb49
commit
7bcf7a7943
14 changed files with 131 additions and 39 deletions
|
@ -373,6 +373,23 @@ class RepositoriesController < ApplicationController
|
|||
}
|
||||
end
|
||||
|
||||
def repository_users
|
||||
users = User.where(id:
|
||||
Repository.first.repository_rows
|
||||
.joins(params[:archived_by] ? :archived_by : :created_by)
|
||||
.select('users.id').distinct)
|
||||
|
||||
render json: { users: users.map do |u|
|
||||
{
|
||||
label: u.full_name,
|
||||
value: u.id,
|
||||
params: {
|
||||
email: u.email, avatar_url: u.avatar_url('icon_small')
|
||||
}
|
||||
}
|
||||
end }
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def repostiory_import_actions
|
||||
|
|
|
@ -12,7 +12,8 @@ window.initRepositoryFilter = () => {
|
|||
{ id: 'row_id', name: 'ID', data_type: 'RepositoryTextValue' },
|
||||
{ id: 'row_name', name: 'Name', data_type: 'RepositoryTextValue' },
|
||||
{ id: 'added_on', name: 'Added on', data_type: 'RepositoryDateTimeValue' },
|
||||
{ id: 'added_by', name: 'Added by', data_type: 'RepositoryUserValue' }
|
||||
{ id: 'added_by', name: 'Added by', data_type: 'RepositoryUserValue' },
|
||||
{ id: 'archived_by', name: 'Archived by', data_type: 'RepositoryUserValue' }
|
||||
];
|
||||
const repositoryFilterContainer = new Vue({
|
||||
el: '#filterContainer',
|
||||
|
@ -67,7 +68,8 @@ window.initRepositoryFilter = () => {
|
|||
});
|
||||
|
||||
$.get($('#filterContainer').data('columns-url'), function(data) {
|
||||
repositoryFilterContainer.columns = data.response.concat(defaultColumns).sort((a, b) => a.name > b.name ? 1 : -1);
|
||||
let combinedColumns = data.response.concat(defaultColumns)
|
||||
repositoryFilterContainer.columns = combinedColumns.sort((a, b) => a.name > b.name ? 1 : -1);
|
||||
});
|
||||
|
||||
$('#filterContainer').on('click', (e) => {
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
import RepositoryListValue from 'vue/repository_filter/filters/repositoryListValue.vue'
|
||||
import RepositoryStatusValue from 'vue/repository_filter/filters/repositoryStatusValue.vue'
|
||||
import RepositoryChecklistValue from 'vue/repository_filter/filters/repositoryChecklistValue.vue'
|
||||
import RepositoryUserValue from 'vue/repository_filter/filters/repositoryUserValue.vue'
|
||||
import DropdownSelector from 'vue/shared/dropdown_selector.vue'
|
||||
|
||||
|
||||
|
@ -51,7 +52,9 @@
|
|||
RepositoryDateTimeValue,
|
||||
RepositoryListValue,
|
||||
RepositoryStatusValue,
|
||||
RepositoryChecklistValue
|
||||
RepositoryChecklistValue,
|
||||
RepositoryListValue,
|
||||
RepositoryUserValue
|
||||
},
|
||||
methods: {
|
||||
updateFilter(value) {
|
||||
|
|
|
@ -32,9 +32,9 @@
|
|||
data() {
|
||||
return {
|
||||
operators: [
|
||||
{ value: 'file_contains', label: this.i18n.t('repositories.show.repository_filter.filters.types.RepositoryAssetValue.operators.file_contains') },
|
||||
{ value: 'file_attached', label: this.i18n.t('repositories.show.repository_filter.filters.types.RepositoryAssetValue.operators.file_attached') },
|
||||
{ value: 'file_not_attached', label: this.i18n.t('repositories.show.repository_filter.filters.types.RepositoryAssetValue.operators.file_not_attached') }
|
||||
{ value: 'file_contains', label: this.i18n.t('repositories.show.repository_filter.filters.operators.file_contains') },
|
||||
{ value: 'file_attached', label: this.i18n.t('repositories.show.repository_filter.filters.operators.file_attached') },
|
||||
{ value: 'file_not_attached', label: this.i18n.t('repositories.show.repository_filter.filters.operators.file_not_attached') }
|
||||
],
|
||||
operator: 'file_contains',
|
||||
value: ''
|
||||
|
|
|
@ -32,9 +32,9 @@
|
|||
data() {
|
||||
return {
|
||||
operators: [
|
||||
{ value: 'any_of', label: this.i18n.t('repositories.show.repository_filter.filters.types.RepositoryChecklistValue.operators.any_of') },
|
||||
{ value: 'all_of', label: this.i18n.t('repositories.show.repository_filter.filters.types.RepositoryChecklistValue.operators.all_of') },
|
||||
{ value: 'none_of', label: this.i18n.t('repositories.show.repository_filter.filters.types.RepositoryChecklistValue.operators.none_of') }
|
||||
{ value: 'any_of', label: this.i18n.t('repositories.show.repository_filter.filters.operators.any_of') },
|
||||
{ value: 'all_of', label: this.i18n.t('repositories.show.repository_filter.filters.operators.all_of') },
|
||||
{ value: 'none_of', label: this.i18n.t('repositories.show.repository_filter.filters.operators.none_of') }
|
||||
],
|
||||
operator: 'any_of',
|
||||
value: []
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
data() {
|
||||
return {
|
||||
operators: [
|
||||
{ value: 'any_of', label: this.i18n.t('repositories.show.repository_filter.filters.types.RepositoryListValue.operators.any_of') },
|
||||
{ value: 'none_of', label: this.i18n.t('repositories.show.repository_filter.filters.types.RepositoryListValue.operators.none_of') }
|
||||
{ value: 'any_of', label: this.i18n.t('repositories.show.repository_filter.filters.operators.any_of') },
|
||||
{ value: 'none_of', label: this.i18n.t('repositories.show.repository_filter.filters.operators.none_of') }
|
||||
],
|
||||
operator: 'any_of',
|
||||
value: []
|
||||
|
|
|
@ -31,9 +31,9 @@
|
|||
data() {
|
||||
return {
|
||||
operators: [
|
||||
{ value: 'any_of', label: this.i18n.t('repositories.show.repository_filter.filters.types.RepositoryMyModuleValue.operators.any_of') },
|
||||
{ value: 'all_of', label: this.i18n.t('repositories.show.repository_filter.filters.types.RepositoryMyModuleValue.operators.all_of') },
|
||||
{ value: 'none_of', label: this.i18n.t('repositories.show.repository_filter.filters.types.RepositoryMyModuleValue.operators.none_of') }
|
||||
{ value: 'any_of', label: this.i18n.t('repositories.show.repository_filter.filters.operators.any_of') },
|
||||
{ value: 'all_of', label: this.i18n.t('repositories.show.repository_filter.filters.operators.all_of') },
|
||||
{ value: 'none_of', label: this.i18n.t('repositories.show.repository_filter.filters.operators.none_of') }
|
||||
],
|
||||
operator: 'any_of',
|
||||
value: []
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
data() {
|
||||
return {
|
||||
operators: [
|
||||
{ value: 'any_of', label: this.i18n.t('repositories.show.repository_filter.filters.types.RepositoryStatusValue.operators.any_of') },
|
||||
{ value: 'none_of', label: this.i18n.t('repositories.show.repository_filter.filters.types.RepositoryStatusValue.operators.none_of') }
|
||||
{ value: 'any_of', label: this.i18n.t('repositories.show.repository_filter.filters.operators.any_of') },
|
||||
{ value: 'none_of', label: this.i18n.t('repositories.show.repository_filter.filters.operators.none_of') }
|
||||
],
|
||||
operator: 'any_of',
|
||||
value: []
|
||||
|
|
|
@ -28,9 +28,9 @@
|
|||
data() {
|
||||
return {
|
||||
operators: [
|
||||
{ value: 'contains', label: this.i18n.t('repositories.show.repository_filter.filters.types.RepositoryTextValue.operators.contain') },
|
||||
{ value: 'doesnt_contain', label: this.i18n.t('repositories.show.repository_filter.filters.types.RepositoryTextValue.operators.not_contain') },
|
||||
{ value: 'empty', label: this.i18n.t('repositories.show.repository_filter.filters.types.RepositoryTextValue.operators.empty') }
|
||||
{ value: 'contains', label: this.i18n.t('repositories.show.repository_filter.filters.operators.contain') },
|
||||
{ value: 'doesnt_contain', label: this.i18n.t('repositories.show.repository_filter.filters.operators.not_contain') },
|
||||
{ value: 'empty', label: this.i18n.t('repositories.show.repository_filter.filters.operators.empty') }
|
||||
],
|
||||
operator: 'contains',
|
||||
value: ''
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
<template>
|
||||
<div class="filter-attributes">
|
||||
<DropdownSelector
|
||||
:disableSearch="true"
|
||||
:options="this.operators"
|
||||
:selectorId="`OperatorSelector${this.filter.id}`"
|
||||
@dropdown:changed="updateOperator"
|
||||
/>
|
||||
<div class="users-filter-dropdown">
|
||||
<DropdownSelector
|
||||
:optionClass="'checkbox-icon'"
|
||||
:dataCombineTags="true"
|
||||
:noEmptyOption="false"
|
||||
:singleSelect="false"
|
||||
:closeOnSelect="false"
|
||||
:optionLabel="renderOption"
|
||||
:options="this.users"
|
||||
:dataSelectMultipleName="this.i18n.t('repositories.show.repository_filter.filters.types.RepositoryUserValue.multiple_selected')"
|
||||
:dataSelectMultipleAllSelected="this.i18n.t('repositories.show.repository_filter.filters.types.RepositoryUserValue.all_selected')"
|
||||
:selectorId="`UserSelector${this.filter.id}`"
|
||||
:placeholder="this.i18n.t('repositories.show.repository_filter.filters.types.RepositoryUserValue.select_placeholder')"
|
||||
@dropdown:changed="updateValue"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import FilterMixin from 'vue/repository_filter/mixins/filter.js'
|
||||
import DropdownSelector from 'vue/shared/dropdown_selector.vue'
|
||||
export default {
|
||||
name: 'RepositoryUserValue',
|
||||
mixins: [FilterMixin],
|
||||
data() {
|
||||
return {
|
||||
operators: [
|
||||
{ value: 'any_of', label: this.i18n.t('repositories.show.repository_filter.filters.operators.any_of') },
|
||||
{ value: 'none_of', label: this.i18n.t('repositories.show.repository_filter.filters.operators.none_of') }
|
||||
],
|
||||
operator: 'any_of',
|
||||
value: '',
|
||||
users: []
|
||||
}
|
||||
},
|
||||
components: {
|
||||
DropdownSelector
|
||||
},
|
||||
mounted() {
|
||||
let params = {}
|
||||
if (this.filter.column.id === 'archived_by') params.archived_by = true
|
||||
$.get($('#filterContainer').data('users-url'), params, (data) => {
|
||||
this.users = data.users;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
updateValue(value) {
|
||||
this.value = value
|
||||
this.updateFilter();
|
||||
},
|
||||
renderOption(data) {
|
||||
return `<span class="user-filter-option" title="${data.label.trim()} | ${data.params.email}">
|
||||
<img class="item-avatar" src="${data.params.avatar_url}"/>
|
||||
${data.label}
|
||||
</span>`;
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
isBlank(){
|
||||
return this.operator == 'any_of' && !this.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -8,7 +8,7 @@
|
|||
:data-placeholder="placeholder"
|
||||
>
|
||||
<optgroup v-if="groupSelector" v-for="group in this.options" :label="group.label">
|
||||
<option v-for="option in group.options" :key="option.label" :value="option.value">
|
||||
<option v-for="option in group.options" :key="option.label" :value="option.value" :data-params="JSON.stringify(option.params)">
|
||||
{{ option.label }}
|
||||
</option>
|
||||
</optgroup>
|
||||
|
@ -17,7 +17,8 @@
|
|||
:key="option.label"
|
||||
:value="option.value"
|
||||
:selected="option.value == selectedValue"
|
||||
:data-selected="option.value == selectedValue">
|
||||
:data-selected="option.value == selectedValue"
|
||||
:data-params="JSON.stringify(option.params)">
|
||||
{{ option.label }}
|
||||
</option>
|
||||
</select>
|
||||
|
@ -78,12 +79,16 @@
|
|||
type: String,
|
||||
default: ''
|
||||
},
|
||||
optionLabel: {
|
||||
type: Function
|
||||
},
|
||||
onChange: Function
|
||||
|
||||
},
|
||||
mounted: function() {
|
||||
dropdownSelector.init(`#${this.selectorId}`, {
|
||||
optionClass: this.optionClass,
|
||||
optionLabel: this.optionLabel,
|
||||
noEmptyOption: this.noEmptyOption,
|
||||
singleSelect: this.singleSelect,
|
||||
closeOnSelect: this.closeOnSelect,
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
id="filterContainer"
|
||||
data-columns-url="<%= describe_all_repository_repository_columns_path(@repository) %>"
|
||||
data-my-modules-url="<%= assigned_my_modules_repository_path(@repository) %>"
|
||||
data-users-url="<%= repository_users_repository_path(@repository) %>"
|
||||
data-datatable-id="#repository-table-<%= @repository.id %>"
|
||||
data-date-format="<%= current_user.date_format.gsub(/\%/, '').upcase %>"
|
||||
>
|
||||
|
|
|
@ -1414,6 +1414,10 @@ en:
|
|||
this_month: "This month"
|
||||
this_year: "This year"
|
||||
last_year: "Last year"
|
||||
empty: "Is empty"
|
||||
any_of: "Any of"
|
||||
all_of: "All of"
|
||||
none_of: "None of"
|
||||
types:
|
||||
RepositoryAssetValue:
|
||||
operators:
|
||||
|
@ -1422,42 +1426,28 @@ en:
|
|||
file_not_attached: "File is not attached"
|
||||
RepositoryTextValue:
|
||||
input_placeholder: "Enter %{name}"
|
||||
operators:
|
||||
contain: "Contains"
|
||||
not_contain: "Doesn't contain"
|
||||
empty: "Is empty"
|
||||
RepositoryNumberValue:
|
||||
input_placeholder: "Enter %{name}"
|
||||
RepositoryMyModuleValue:
|
||||
select_placeholder: "Select task"
|
||||
multiple_selected: "tasks selected"
|
||||
all_selected: "All tasks selected"
|
||||
operators:
|
||||
any_of: "Any of"
|
||||
all_of: "All of"
|
||||
none_of: "None of"
|
||||
RepositoryListValue:
|
||||
select_placeholder: "Select %{name}"
|
||||
multiple_selected: "items selected"
|
||||
all_selected: "All items selected"
|
||||
operators:
|
||||
any_of: "Any of"
|
||||
none_of: "None of"
|
||||
RepositoryStatusValue:
|
||||
select_placeholder: "Select %{name}"
|
||||
multiple_selected: "items selected"
|
||||
all_selected: "All items selected"
|
||||
operators:
|
||||
any_of: "Any of"
|
||||
none_of: "None of"
|
||||
RepositoryChecklistValue:
|
||||
select_placeholder: "Select %{name}"
|
||||
multiple_selected: "items selected"
|
||||
all_selected: "All items selected"
|
||||
operators:
|
||||
any_of: "Any of"
|
||||
all_of: "All of"
|
||||
none_of: "None of"
|
||||
RepositoryUserValue:
|
||||
select_placeholder: "Select user"
|
||||
multiple_selected: "users selected"
|
||||
all_selected: "All users selected"
|
||||
|
||||
bmt_search:
|
||||
bmt_filter: "Biomolecule filter"
|
||||
|
|
|
@ -549,6 +549,7 @@ Rails.application.routes.draw do
|
|||
defaults: { format: 'json' }
|
||||
member do
|
||||
get :assigned_my_modules
|
||||
get :repository_users
|
||||
get :load_table
|
||||
end
|
||||
# Save repository table state
|
||||
|
|
Loading…
Reference in a new issue