Fix sanity checks issues [SCI-10095]

This commit is contained in:
Anton 2024-02-07 12:23:21 +01:00
parent ae56294670
commit 29fd71c76a
5 changed files with 30 additions and 14 deletions

View file

@ -130,7 +130,8 @@ export default {
},
{
field: 'nr_of_rows',
headerName: this.i18n.t('libraries.index.table.number_of_items')
headerName: this.i18n.t('libraries.index.table.number_of_items'),
sortable: true
},
{
field: 'shared_label',

View file

@ -50,6 +50,8 @@
@columnResized="saveTableState"
@columnMoved="saveTableState"
@bodyScroll="handleScroll"
@columnPinned="handlePin"
@columnVisible="handleVisibility"
@rowSelected="setSelectedRows"
@cellClicked="clickCell"
:CheckboxSelectionCallback="withCheckboxes"
@ -300,6 +302,18 @@ export default {
this.loadData();
}
},
handlePin(event) {
if (event.pinned === 'right') {
this.columnApi.setColumnPinned(event.column.colId, null);
}
this.saveTableState();
},
handleVisibility(event) {
if (!event.visible && event.source !== 'api') {
this.columnApi.setColumnVisible(event.column.colId, true);
}
this.saveTableState();
},
fetchAndApplyTableState() {
axios
.get(this.userSettingsUrl, {
@ -327,6 +341,8 @@ export default {
state: this.tableState.columnsState,
applyOrder: true
});
} else {
this.saveTableState();
}
setTimeout(() => {
this.initializing = false;
@ -484,19 +500,15 @@ export default {
},
hideColumn(column) {
this.columnApi.setColumnVisible(column.field, false);
this.saveTableState();
},
showColumn(column) {
this.columnApi.setColumnVisible(column.field, true);
this.saveTableState();
},
pinColumn(column) {
this.columnApi.setColumnPinned(column.field, 'left');
this.saveTableState();
},
unPinColumn(column) {
this.columnApi.setColumnPinned(column.field, null);
this.saveTableState();
},
reorderColumns(columns) {
this.columnApi.moveColumns(columns, 1);

View file

@ -19,7 +19,7 @@
<i class="sn-icon sn-icon-close"></i>
</button>
</div>
<div class="max-h-[400px] p-3.5 pt-0">
<div class="max-h-[40vh] px-3.5 overflow-y-auto">
<div v-for="filter in filters" :key="filter.key">
<Component
:is="`${filter.type}Filter`"
@ -28,7 +28,7 @@
@update="updateFilter" />
</div>
</div>
<div class="p-3.5 pt-0.5 flex items-center justify-end gap-4">
<div class="p-3.5 flex items-center justify-end gap-4">
<div @click.prevent="clearFilters" class="btn btn-secondary">
{{ i18n.t('filters_modal.clear_btn') }}
</div>

View file

@ -10,7 +10,7 @@ module Lists
:urls, :shared_read, :shared_write, :shareable_write
def nr_of_rows
object.repository_rows.count
object[:row_count]
end
def shared

View file

@ -13,12 +13,14 @@ module Lists
'LEFT OUTER JOIN users AS archivers ' \
'ON repositories.archived_by_id = archivers.id'
)
.includes(:repository_rows)
.joins(:repository_rows)
.joins(:team)
.select('repositories.* AS repositories')
.select('teams.name AS team_name')
.select('creators.full_name AS created_by_user')
.select('archivers.full_name AS archived_by_user')
.select('repositories.*')
.select('MAX(teams.name) AS team_name')
.select('COUNT(repository_rows.*) AS row_count')
.select('MAX(creators.full_name) AS created_by_user')
.select('MAX(archivers.full_name) AS archived_by_user')
.group('repositories.id')
view_mode = @params[:view_mode] || 'active'
@ -47,7 +49,8 @@ module Lists
created_by: 'creators.full_name',
created_at: 'repositories.created_at',
archived_on: 'repositories.archived_on',
archived_by: 'archivers.full_name'
archived_by: 'archivers.full_name',
nr_of_rows: 'row_count'
}
end
end