Fix various issues with Inventories [SCI-10014] (#6979)

- Show added-by column by default.
- Show stock column in view mode if stock is disabled.
- Prevent column name wrapping in column manage modal.
This commit is contained in:
Soufiane 2024-01-26 15:24:17 +01:00 committed by GitHub
parent a719ceb247
commit 7f30547182
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 19 additions and 2 deletions

View file

@ -686,6 +686,11 @@ var RepositoryDatatable = (function(global) {
targets: 5, targets: 5,
class: 'added-on', class: 'added-on',
visible: true visible: true
},{
// Added by column
targets: 6,
class: 'added-by',
visible: true
}, { }, {
targets: '_all', targets: '_all',
render: function(data) { render: function(data) {
@ -776,8 +781,8 @@ var RepositoryDatatable = (function(global) {
var state = localStorage.getItem(`datatables_repositories_state/${repositoryId}/${viewType}`); var state = localStorage.getItem(`datatables_repositories_state/${repositoryId}/${viewType}`);
json.state.start = state !== null ? JSON.parse(state).start : 0; json.state.start = state !== null ? JSON.parse(state).start : 0;
if (json.state.columns[6]) json.state.columns[6].visible = archived;
if (json.state.columns[7]) json.state.columns[7].visible = archived; if (json.state.columns[7]) json.state.columns[7].visible = archived;
if (json.state.columns[8]) json.state.columns[8].visible = archived;
if (json.state.search) delete json.state.search; if (json.state.search) delete json.state.search;
if (json.state.ColSizes && json.state.ColSizes.length > 0) { if (json.state.ColSizes && json.state.ColSizes.length > 0) {

View file

@ -228,7 +228,7 @@ var RepositoryColumns = (function() {
var maxLength = $(TABLE_ID).data('max-dropdown-length'); var maxLength = $(TABLE_ID).data('max-dropdown-length');
if ($.trim(name).length > maxLength) { if ($.trim(name).length > maxLength) {
return `<div class="modal-tooltip"> return `<div class="modal-tooltip">
${truncateLongString(name, maxLength)} <span>${truncateLongString(name, maxLength)}</span>
<span class="modal-tooltiptext">${name}</span> <span class="modal-tooltiptext">${name}</span>
</div>`; </div>`;
} }

View file

@ -108,6 +108,12 @@
z-index: 99999999; z-index: 99999999;
} }
.modal-tooltip > span:first-child {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.col-list-el { .col-list-el {
align-items: center; align-items: center;
background: $color-white; background: $color-white;
@ -120,6 +126,7 @@
.manage-controls { .manage-controls {
display: none; display: none;
white-space: nowrap;
} }
.text { .text {

View file

@ -52,6 +52,11 @@ module RepositoryDatatableHelper
serialize_repository_cell_value(cell, team, repository, reminders_enabled: reminders_enabled) serialize_repository_cell_value(cell, team, repository, reminders_enabled: reminders_enabled)
end end
if repository.repository_columns.stock_type.exists?
stock_cell = record.repository_cells.find { |cell| cell.value_type == 'RepositoryStockValue' }
row['stock'] = serialize_repository_cell_value(record.repository_stock_cell, team, repository) if stock_cell.present?
end
if has_stock_management if has_stock_management
stock_cell = record.repository_cells.find { |cell| cell.value_type == 'RepositoryStockValue' } stock_cell = record.repository_cells.find { |cell| cell.value_type == 'RepositoryStockValue' }