Checkin, fairly stable

This commit is contained in:
Rich Lott / Artful Robot 2025-03-26 13:29:55 +00:00
parent f88fb5f10e
commit eb6542857b
5 changed files with 161 additions and 119 deletions

View file

@ -47,6 +47,7 @@
}
// Ensure we have the minimum of what we need.
if (!catDefs.find(c => c.search_type === 'default')) {
console.log("Adding default category as was missing");
// There's no default one.
catDefs.push(Object.assign({}, blankDefn, {
execution_order: catDefs.length,
@ -67,8 +68,11 @@
ctrl[orderField] = catDefs.slice();
ctrl[orderField].sort((a, b) => {
// console.log({orderField, aST: a.search_type, bST: b.search_type, aOrd:a[orderField], bOrd:b[orderField], aLab:a.label, bLab:b.label});
if (a.search_type === 'default' && b.search_type !== 'default') return 1;
if (b.search_type === 'default' && a.search_type !== 'default') return -1;
if (orderField === 'execution_order') {
// Enforce default at end for assignment order
if (a.search_type === 'default' && b.search_type !== 'default') return 1;
if (b.search_type === 'default' && a.search_type !== 'default') return -1;
}
if (a[orderField] > b[orderField]) return 1;
if (a[orderField] < b[orderField]) return -1;
if (a.label < b.label) return 1;
@ -162,6 +166,16 @@
ctrl.view = 'list';
}
ctrl.canMoveBelow = function(row, idx) {
// Only show move buttons when moving.
if (ctrl.moveIdx === null) return false;
if (ctrl.uxOrderField === 'execution_order') {
// The default MUST be the last item in execution_order.
if (row.search_type === 'default') return false;
}
return (idx + 1 < ctrl.moveIdx || idx > ctrl.moveIdx);
};
/**
* Move a category within the currently selected order.
*/