mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-15 00:06:10 +08:00
Merge pull request #7847 from aignatov-bio/ai-sci-11033-add-missing-interactions-storage-location-table
Fix interactions for box locations [SCI-11033]
This commit is contained in:
commit
173fdda28a
9 changed files with 63 additions and 20 deletions
|
@ -127,7 +127,7 @@ export default {
|
||||||
field: 'position_formatted',
|
field: 'position_formatted',
|
||||||
headerName: this.i18n.t('storage_locations.show.table.position'),
|
headerName: this.i18n.t('storage_locations.show.table.position'),
|
||||||
sortable: true,
|
sortable: true,
|
||||||
notSelectable: true
|
cellClass: 'text-sn-blue cursor-pointer'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'reminders',
|
field: 'reminders',
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
v-model="object.name"
|
v-model="object.name"
|
||||||
:placeholder="i18n.t(`storage_locations.index.edit_modal.name_placeholder`)"
|
:placeholder="i18n.t(`storage_locations.index.edit_modal.name_placeholder_${editModalMode}`)"
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<span v-if="this.errors.name" class="text-sn-coral text-xs">{{ this.errors.name }}</span>
|
<span v-if="this.errors.name" class="text-sn-coral text-xs">{{ this.errors.name }}</span>
|
||||||
|
|
|
@ -116,12 +116,7 @@ export default {
|
||||||
sortable: true
|
sortable: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'items',
|
field: 'shared_label',
|
||||||
headerName: this.i18n.t('storage_locations.index.table.items'),
|
|
||||||
sortable: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'shared',
|
|
||||||
headerName: this.i18n.t('storage_locations.index.table.shared'),
|
headerName: this.i18n.t('storage_locations.index.table.shared'),
|
||||||
sortable: true
|
sortable: true
|
||||||
},
|
},
|
||||||
|
@ -135,6 +130,11 @@ export default {
|
||||||
headerName: this.i18n.t('storage_locations.index.table.created_on'),
|
headerName: this.i18n.t('storage_locations.index.table.created_on'),
|
||||||
sortable: true
|
sortable: true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
field: 'created_by',
|
||||||
|
headerName: this.i18n.t('storage_locations.index.table.created_by'),
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
field: 'description',
|
field: 'description',
|
||||||
headerName: this.i18n.t('storage_locations.index.table.description'),
|
headerName: this.i18n.t('storage_locations.index.table.description'),
|
||||||
|
|
|
@ -41,16 +41,14 @@
|
||||||
</div>
|
</div>
|
||||||
<table v-if="notificationsSettings">
|
<table v-if="notificationsSettings">
|
||||||
<template v-for="(_subGroups, group) in notificationsGroups" :key="group">
|
<template v-for="(_subGroups, group) in notificationsGroups" :key="group">
|
||||||
<div class="contents">
|
<tr>
|
||||||
<tr>
|
<td colspan=3 class="pt-6"><h3>{{ i18n.t(`notifications.groups.${group}`) }}</h3></td>
|
||||||
<td colspan=3 class="pt-6"><h3>{{ i18n.t(`notifications.groups.${group}`) }}</h3></td>
|
</tr>
|
||||||
</tr>
|
<tr>
|
||||||
<tr>
|
<td></td>
|
||||||
<td></td>
|
<td class="p-2.5 text-base w-32">{{ i18n.t('notifications.in_app') }}</td>
|
||||||
<td class="p-2.5 text-base w-32">{{ i18n.t('notifications.in_app') }}</td>
|
<td class="p-2.5 text-base w-32">{{ i18n.t('notifications.email') }}</td>
|
||||||
<td class="p-2.5 text-base w-32">{{ i18n.t('notifications.email') }}</td>
|
</tr>
|
||||||
</tr>
|
|
||||||
</div>
|
|
||||||
<template v-for="(_notifications, subGroup, i) in notificationsGroups[group]" :key="subGroup">
|
<template v-for="(_notifications, subGroup, i) in notificationsGroups[group]" :key="subGroup">
|
||||||
<tr v-if="subGroup !== 'always_on'"
|
<tr v-if="subGroup !== 'always_on'"
|
||||||
class="text-base border-transparent border-b-sn-super-light-grey border-solid"
|
class="text-base border-transparent border-b-sn-super-light-grey border-solid"
|
||||||
|
|
|
@ -36,6 +36,8 @@ module Lists
|
||||||
end
|
end
|
||||||
|
|
||||||
def sub_location_count
|
def sub_location_count
|
||||||
|
return '/' if @object.container
|
||||||
|
|
||||||
if object.respond_to?(:sub_location_count)
|
if object.respond_to?(:sub_location_count)
|
||||||
object.sub_location_count
|
object.sub_location_count
|
||||||
else
|
else
|
||||||
|
|
|
@ -15,6 +15,7 @@ module Lists
|
||||||
StorageLocation.joins('LEFT JOIN storage_locations AS sub_locations ' \
|
StorageLocation.joins('LEFT JOIN storage_locations AS sub_locations ' \
|
||||||
'ON storage_locations.id = sub_locations.parent_id')
|
'ON storage_locations.id = sub_locations.parent_id')
|
||||||
.viewable_by_user(@user, @team)
|
.viewable_by_user(@user, @team)
|
||||||
|
.select(shared_sql_select)
|
||||||
.select('storage_locations.*, COUNT(sub_locations.id) AS sub_location_count')
|
.select('storage_locations.*, COUNT(sub_locations.id) AS sub_location_count')
|
||||||
.group(:id)
|
.group(:id)
|
||||||
end
|
end
|
||||||
|
@ -32,5 +33,43 @@ module Lists
|
||||||
@records = @records.where('LOWER(name) ILIKE ?', "%#{@filters[:query].downcase}%") if @filters[:query].present?
|
@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(name) ILIKE ?', "%#{@params[:search].downcase}%") if @params[:search].present?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def shared_sql_select
|
||||||
|
shared_write_value = TeamSharedObject.permission_levels['shared_write']
|
||||||
|
team_id = @user.current_team.id
|
||||||
|
|
||||||
|
case_statement = <<-SQL.squish
|
||||||
|
CASE
|
||||||
|
WHEN EXISTS (
|
||||||
|
SELECT 1 FROM team_shared_objects
|
||||||
|
WHERE team_shared_objects.shared_object_id = storage_locations.id
|
||||||
|
AND team_shared_objects.shared_object_type = 'StorageLocation'
|
||||||
|
) THEN 1
|
||||||
|
WHEN EXISTS (
|
||||||
|
SELECT 1 FROM team_shared_objects
|
||||||
|
WHERE team_shared_objects.shared_object_id = storage_locations.id
|
||||||
|
AND team_shared_objects.shared_object_type = 'StorageLocation'
|
||||||
|
AND team_shared_objects.team_id = :team_id
|
||||||
|
) THEN
|
||||||
|
CASE
|
||||||
|
WHEN EXISTS (
|
||||||
|
SELECT 1 FROM team_shared_objects
|
||||||
|
WHERE team_shared_objects.shared_object_id = storage_locations.id
|
||||||
|
AND team_shared_objects.shared_object_type = 'StorageLocation'
|
||||||
|
AND team_shared_objects.permission_level = :shared_write_value
|
||||||
|
AND team_shared_objects.team_id = :team_id
|
||||||
|
) THEN 2
|
||||||
|
ELSE 3
|
||||||
|
END
|
||||||
|
ELSE 4
|
||||||
|
END as shared
|
||||||
|
SQL
|
||||||
|
|
||||||
|
ActiveRecord::Base.sanitize_sql_array(
|
||||||
|
[case_statement, { team_id: team_id , shared_write_value: shared_write_value }]
|
||||||
|
)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -85,7 +85,7 @@ module StorageLocations
|
||||||
column_letter = position[0]
|
column_letter = position[0]
|
||||||
row_number = position[1]
|
row_number = position[1]
|
||||||
|
|
||||||
[column_letter.ord - 64, row_number]
|
[column_letter.ord - 64, row_number.to_i]
|
||||||
end
|
end
|
||||||
|
|
||||||
def convert_position_number_to_letter(item)
|
def convert_position_number_to_letter(item)
|
||||||
|
|
|
@ -691,6 +691,8 @@ class Extends
|
||||||
ReportTemplates_archived_state
|
ReportTemplates_archived_state
|
||||||
Repositories_active_state
|
Repositories_active_state
|
||||||
Repositories_archived_state
|
Repositories_archived_state
|
||||||
|
StorageLocationsTable_active_state
|
||||||
|
StorageLocationsContainer_active_state
|
||||||
task_step_states
|
task_step_states
|
||||||
results_order
|
results_order
|
||||||
repository_export_file_type
|
repository_export_file_type
|
||||||
|
|
|
@ -2730,6 +2730,7 @@ en:
|
||||||
shared: "Shared"
|
shared: "Shared"
|
||||||
owned_by: "Owned by"
|
owned_by: "Owned by"
|
||||||
created_on: "Created on"
|
created_on: "Created on"
|
||||||
|
created_by: "Created by"
|
||||||
description: "Description"
|
description: "Description"
|
||||||
filters_modal:
|
filters_modal:
|
||||||
search_tree: "Look inside locations"
|
search_tree: "Look inside locations"
|
||||||
|
@ -2747,7 +2748,8 @@ en:
|
||||||
drag_and_drop_supporting_text: ".png or .jpg file"
|
drag_and_drop_supporting_text: ".png or .jpg file"
|
||||||
warning_box_not_empty: "Box dimensions can be updated only when the box is empty."
|
warning_box_not_empty: "Box dimensions can be updated only when the box is empty."
|
||||||
description_label: "Description"
|
description_label: "Description"
|
||||||
name_placeholder: "Big freezer"
|
name_placeholder_location: "Big freezer"
|
||||||
|
name_placeholder_container: "Box 1"
|
||||||
description_placeholder: "Keep everyone on the same page. You can also use smart annotations."
|
description_placeholder: "Keep everyone on the same page. You can also use smart annotations."
|
||||||
dimensions_label: "Dimensions (rows x columns)"
|
dimensions_label: "Dimensions (rows x columns)"
|
||||||
no_grid: "No grid"
|
no_grid: "No grid"
|
||||||
|
|
Loading…
Add table
Reference in a new issue