Make repo selection by arch easier

* Select only repos of default arch initially
* Select all repos of the architecture when selecting a different arch
This commit is contained in:
Martchus 2023-11-08 13:39:06 +01:00
parent 6016ff7658
commit 5bcd0dee6e
1 changed files with 18 additions and 7 deletions

View File

@ -5,7 +5,7 @@ import * as CustomRendering from './customrendering.js';
import * as GenericRendering from './genericrendering.js';
import * as Utils from './utils.js';
const status = {repoNames: undefined};
const status = {repoNames: undefined, defaultArch: 'x86_64'};
export function queryGlobalStatus(additionalParams)
{
@ -115,17 +115,28 @@ function handleGlobalStatusUpdate(ajaxRequest)
const filterOpt = document.createElement('option');
filterOpt.id = filterOptId;
filterOpt.text = dbInfo.arch;
filterOpt.defaultSelected = dbInfo.arch === status.defaultArch;
filterSel.add(filterOpt);
filterSel.onchange = function() {
const filterVal = !filterSel.selectedIndex ? undefined : filterSel.value;
Array.from(selection.options).forEach(function(option) {
option.style.display = !filterVal || filterVal === option.dataset.arch ? 'block' : 'none';
});
};
}
});
});
// make arch filters actually do something
repoSelections.forEach(function (selection) {
const filterSel = document.getElementById(selection.id + '-arch-filter');
if (!filterSel) {
return;
}
filterSel.onchange = function() {
const filterVal = !filterSel.selectedIndex ? undefined : filterSel.value;
Array.from(selection.options).forEach(function(option) {
option.selected = filterVal ? (filterVal === option.dataset.arch) : (!option.dataset.arch);
option.style.display = !filterVal || filterVal === option.dataset.arch ? 'block' : 'none';
});
};
filterSel.onchange();
});
// update lists of build action states, results and types
const globalInfo = window.globalInfo = {};
const actions = responseJson.actions;