Adds "refresh" button for stock test table

This commit is contained in:
Oliver 2022-02-17 13:46:11 +11:00
parent 578c161d4f
commit 6199223636
2 changed files with 26 additions and 9 deletions

View File

@ -1232,7 +1232,30 @@ function formatDate(row) {
*/ */
function loadStockTestResultsTable(table, options) { function loadStockTestResultsTable(table, options) {
// Setup filters for the table
var filterTarget = options.filterTarget || '#filter-list-stocktests';
var filterKey = options.filterKey || options.name || 'stocktests';
var filters = loadTableFilters(filterKey);
var params = {
part: options.part,
};
var original = {};
for (var k in params) {
original[k] = params[k];
filters[k] = params[k];
}
setupFilterList(filterKey, table, filterTarget);
function makeButtons(row, grouped) { function makeButtons(row, grouped) {
// Helper function for rendering buttons
var html = `<div class='btn-group float-right' role='group'>`; var html = `<div class='btn-group float-right' role='group'>`;
if (row.requires_attachment == false && row.requires_value == false && !row.result) { if (row.requires_attachment == false && row.requires_value == false && !row.result) {
@ -1268,9 +1291,8 @@ function loadStockTestResultsTable(table, options) {
formatNoMatches: function() { formatNoMatches: function() {
return '{% trans "No test results found" %}'; return '{% trans "No test results found" %}';
}, },
queryParams: { queryParams: filters,
part: options.part, original: original,
},
onPostBody: function() { onPostBody: function() {
table.treegrid({ table.treegrid({
treeColumn: 0, treeColumn: 0,

View File

@ -265,12 +265,7 @@ function getAvailableTableFilters(tableKey) {
// Filters for the 'stock test' table // Filters for the 'stock test' table
if (tableKey == 'stocktests') { if (tableKey == 'stocktests') {
return { return {};
result: {
type: 'bool',
title: '{% trans "Test result" %}',
},
};
} }
// Filters for the 'part test template' table // Filters for the 'part test template' table