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) {
// 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) {
// Helper function for rendering buttons
var html = `<div class='btn-group float-right' role='group'>`;
if (row.requires_attachment == false && row.requires_value == false && !row.result) {
@ -1268,9 +1291,8 @@ function loadStockTestResultsTable(table, options) {
formatNoMatches: function() {
return '{% trans "No test results found" %}';
},
queryParams: {
part: options.part,
},
queryParams: filters,
original: original,
onPostBody: function() {
table.treegrid({
treeColumn: 0,

View File

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