mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-11-08 07:21:03 +08:00
Merge branch 'develop' into features/custom-docx-reports
This commit is contained in:
commit
d8c3d9a129
11 changed files with 75 additions and 44 deletions
|
|
@ -497,9 +497,9 @@ GEM
|
|||
omniauth-rails_csrf_protection (1.0.1)
|
||||
actionpack (>= 4.2)
|
||||
omniauth (~> 2.0)
|
||||
omniauth-saml (2.1.1)
|
||||
omniauth-saml (2.1.2)
|
||||
omniauth (~> 2.1)
|
||||
ruby-saml (>= 1.17)
|
||||
ruby-saml (~> 1.17)
|
||||
omniauth_openid_connect (0.7.1)
|
||||
omniauth (>= 1.9, < 3)
|
||||
openid_connect (~> 2.2)
|
||||
|
|
|
|||
|
|
@ -16,14 +16,14 @@
|
|||
>
|
||||
</select-dropdown>
|
||||
</div>
|
||||
<div v-else-if="computedArrOfItemObjects && computedArrOfItemObjects.length > 0"
|
||||
<div v-else-if="colVal && colVal.length > 0"
|
||||
class="text-sn-dark-grey font-inter text-sm font-normal leading-5 w-[370px] overflow-x-auto flex flex-wrap gap-1">
|
||||
<span v-for="(checklistItem, index) in computedArrOfItemObjects"
|
||||
<span v-for="(checklistItem, index) in colVal"
|
||||
:key="index"
|
||||
:id="`checklist-item-${index}`"
|
||||
class="flex w-fit break-words">
|
||||
{{
|
||||
index + 1 === computedArrOfItemObjects.length
|
||||
index + 1 === colVal.length
|
||||
? checklistItem?.label
|
||||
: `${checklistItem?.label} |`
|
||||
}}
|
||||
|
|
@ -66,18 +66,6 @@ export default {
|
|||
this.selectedChecklistItemsIds = this.colVal.map((item) => String(item.value));
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
computedArrOfItemObjects() {
|
||||
const arrOfItemObjects = this.selectedChecklistItemsIds.map((id) => {
|
||||
const matchingItem = this.availableChecklistItems.find((item) => item[0] === id);
|
||||
return {
|
||||
id: matchingItem ? matchingItem[0] : null,
|
||||
label: matchingItem ? matchingItem[1] : null
|
||||
};
|
||||
});
|
||||
return arrOfItemObjects;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
fetchChecklistItems() {
|
||||
this.isLoading = true;
|
||||
|
|
|
|||
|
|
@ -517,7 +517,7 @@ export default {
|
|||
this.totalPage = response.data.meta.total_pages;
|
||||
this.totalEntries = response.data.meta.total_count;
|
||||
}
|
||||
this.$emit('tableReloaded', this.rowData);
|
||||
this.$emit('tableReloaded', this.rowData, { filtered: this.searchValue.length > 0 });
|
||||
this.dataLoading = false;
|
||||
this.restoreSelection();
|
||||
|
||||
|
|
|
|||
|
|
@ -34,13 +34,13 @@
|
|||
:selectedPosition="assignToPosition"
|
||||
:selectedRow="rowIdToMove"
|
||||
:cellId="cellIdToUnassign"
|
||||
@close="openAssignModal = false; this.reloadingTable = true"
|
||||
@close="openAssignModal = false; resetTableSearch(); this.reloadingTable = true"
|
||||
></AssignModal>
|
||||
<ImportModal
|
||||
v-if="openImportModal"
|
||||
:containerId="containerId"
|
||||
@close="openImportModal = false"
|
||||
@reloadTable="reloadingTable = true"
|
||||
@reloadTable="resetTableSearch(); reloadingTable = true"
|
||||
></ImportModal>
|
||||
<ConfirmationModal
|
||||
:title="i18n.t('storage_locations.show.unassign_modal.title')"
|
||||
|
|
@ -187,9 +187,14 @@ export default {
|
|||
updateTable() {
|
||||
this.reloadingTable = true;
|
||||
},
|
||||
handleTableReload(items) {
|
||||
handleTableReload(items, params) {
|
||||
this.reloadingTable = false;
|
||||
this.assignedItems = items;
|
||||
if (!params.filtered) {
|
||||
this.assignedItems = items;
|
||||
}
|
||||
},
|
||||
resetTableSearch() {
|
||||
this.$refs.table.searchValue = '';
|
||||
},
|
||||
selectRow(row) {
|
||||
if (this.$refs.table.selectedRows.includes(row)) {
|
||||
|
|
@ -231,7 +236,9 @@ export default {
|
|||
const ok = await this.$refs.unassignStorageLocationModal.show();
|
||||
if (ok) {
|
||||
axios.post(event.path).then(() => {
|
||||
this.resetTableSearch();
|
||||
this.reloadingTable = true;
|
||||
|
||||
}).catch((error) => {
|
||||
HelperModule.flashAlertMsg(error.response.data.error, 'danger');
|
||||
});
|
||||
|
|
|
|||
|
|
@ -183,6 +183,9 @@ export default {
|
|||
}
|
||||
},
|
||||
saveLocation() {
|
||||
// Smart annotation fix
|
||||
this.object.description = $(this.$refs.description).val();
|
||||
|
||||
if (this.object.code) {
|
||||
axios.put(this.object.urls.update, this.object)
|
||||
.then(() => {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
<template>
|
||||
<div v-html="params.data.sa_description"></div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'DescriptionRenderer',
|
||||
props: {
|
||||
params: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
@ -53,6 +53,7 @@ import EditModal from './modals/new_edit.vue';
|
|||
import MoveModal from './modals/move.vue';
|
||||
import ConfirmationModal from '../shared/confirmation_modal.vue';
|
||||
import ShareObjectModal from '../shared/share_modal.vue';
|
||||
import DescriptionRenderer from './renderers/description.vue';
|
||||
|
||||
export default {
|
||||
name: 'RepositoriesTable',
|
||||
|
|
@ -61,7 +62,8 @@ export default {
|
|||
EditModal,
|
||||
MoveModal,
|
||||
ConfirmationModal,
|
||||
ShareObjectModal
|
||||
ShareObjectModal,
|
||||
DescriptionRenderer
|
||||
},
|
||||
props: {
|
||||
dataSource: {
|
||||
|
|
@ -136,9 +138,11 @@ export default {
|
|||
sortable: true
|
||||
},
|
||||
{
|
||||
field: 'description',
|
||||
field: 'sa_description',
|
||||
headerName: this.i18n.t('storage_locations.index.table.description'),
|
||||
sortable: false
|
||||
sortable: false,
|
||||
notSelectable: true,
|
||||
cellRenderer: 'DescriptionRenderer'
|
||||
}];
|
||||
|
||||
return columns;
|
||||
|
|
|
|||
|
|
@ -27,21 +27,23 @@ module Shareable
|
|||
end
|
||||
|
||||
scope :viewable_by_user, lambda { |user, teams = user.current_team|
|
||||
readable = readable_by_user(user).left_outer_joins(:team_shared_objects)
|
||||
readable
|
||||
.where(team: teams)
|
||||
.or(model.where(team_shared_objects: { team: teams }))
|
||||
.or(model.where(if column_names.include?('permission_level')
|
||||
{
|
||||
permission_level: [
|
||||
Extends::SHARED_OBJECTS_PERMISSION_LEVELS[:shared_read],
|
||||
Extends::SHARED_OBJECTS_PERMISSION_LEVELS[:shared_write]
|
||||
]
|
||||
}
|
||||
else
|
||||
{}
|
||||
end).where.not(team: teams))
|
||||
.distinct
|
||||
readable_ids = readable_by_user(user).pluck(:id)
|
||||
shared_with_team_ids = joins(:team_shared_objects, :team).where(team_shared_objects: { team: teams }).pluck(:id)
|
||||
globally_shared_ids =
|
||||
if column_names.include?('permission_level')
|
||||
joins(:team).where(
|
||||
{
|
||||
permission_level: [
|
||||
Extends::SHARED_OBJECTS_PERMISSION_LEVELS[:shared_read],
|
||||
Extends::SHARED_OBJECTS_PERMISSION_LEVELS[:shared_write]
|
||||
]
|
||||
}
|
||||
).pluck(:id)
|
||||
else
|
||||
none.pluck(:id)
|
||||
end
|
||||
|
||||
where(id: (readable_ids + shared_with_team_ids + globally_shared_ids).uniq)
|
||||
}
|
||||
rescue ActiveRecord::NoDatabaseError,
|
||||
ActiveRecord::ConnectionNotEstablished,
|
||||
|
|
|
|||
|
|
@ -4,9 +4,11 @@ module Lists
|
|||
class StorageLocationSerializer < ActiveModel::Serializer
|
||||
include Rails.application.routes.url_helpers
|
||||
include ShareableSerializer
|
||||
include ApplicationHelper
|
||||
include ActionView::Helpers::TextHelper
|
||||
|
||||
attributes :id, :code, :name, :container, :description, :owned_by, :created_by,
|
||||
:created_on, :urls, :metadata, :file_name, :sub_location_count, :is_empty
|
||||
:created_on, :urls, :metadata, :file_name, :sub_location_count, :is_empty, :sa_description
|
||||
|
||||
def owned_by
|
||||
object['team_name']
|
||||
|
|
@ -16,6 +18,14 @@ module Lists
|
|||
object.empty?
|
||||
end
|
||||
|
||||
def sa_description
|
||||
@user = scope[:user] || @instance_options[:user]
|
||||
custom_auto_link(object.description,
|
||||
simple_format: false,
|
||||
tags: %w(img),
|
||||
team: object.team)
|
||||
end
|
||||
|
||||
def metadata
|
||||
{
|
||||
display_type: object.metadata['display_type'],
|
||||
|
|
|
|||
|
|
@ -12,7 +12,9 @@ module Lists
|
|||
@records = StorageLocationRepositoryRow.includes(:repository_row).where(storage_location_id: @storage_location_id)
|
||||
end
|
||||
|
||||
def filter_records; end
|
||||
def filter_records
|
||||
@records = @records.joins(:repository_row).where('LOWER(repository_rows.name) ILIKE ?', "%#{@params[:search].downcase}%") if @params[:search].present?
|
||||
end
|
||||
|
||||
def sort_records
|
||||
return unless @params[:order]
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ module Lists
|
|||
@records = @records.where(parent_id: @parent_id)
|
||||
end
|
||||
|
||||
@records = @records.where('LOWER(name) ILIKE ?', "%#{@filters[:query].downcase}%") if @filters[:query].present?
|
||||
@records = @records.where('LOWER(name) ILIKE ?', "%#{@params[:search].downcase}%") if @params[:search].present?
|
||||
@records = @records.where('LOWER(storage_locations.name) ILIKE ?', "%#{@filters[:query].downcase}%") if @filters[:query].present?
|
||||
@records = @records.where('LOWER(storage_locations.name) ILIKE ?', "%#{@params[:search].downcase}%") if @params[:search].present?
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue