feat(boards): limit new sort setting to columns that include due tasks specifically

This commit is contained in:
Johannes Millan 2025-10-14 18:55:50 +02:00
parent 67d7a9c962
commit 2e49ea5cef
2 changed files with 23 additions and 15 deletions

View file

@ -179,7 +179,10 @@ export class BoardPanelComponent {
const merged = [...orderedTasks, ...nonOrderedTasks].filter((t) => !!t);
// mode: 'off' | 'asc' (earliest first) | 'desc' (latest first)
const mode = panelCfg.sortByDue || 'off';
const mode =
(panelCfg.scheduledState === BoardPanelCfgScheduledState.Scheduled &&
panelCfg.sortByDue) ||
'off';
if (mode !== 'off') {
const getDueTs = (task: TaskCopy): number | null => {
// prefer dueWithTime (timestamp), then dueDay (ISO-like date string)

View file

@ -9,6 +9,7 @@ import {
import { nanoid } from 'nanoid';
import { T } from '../../t.const';
import { DEFAULT_PANEL_CFG } from './boards.const';
import { FormlyFieldConfig } from '@ngx-formly/core/lib/models/fieldconfig';
const getNewPanel = (): BoardPanelCfg => ({
...DEFAULT_PANEL_CFG,
@ -126,6 +127,24 @@ export const BOARDS_FORM: LimitedFormlyFieldConfig<BoardCfg>[] = [
],
},
},
{
key: 'sortByDue',
type: 'radio',
expressions: {
hide: (fCfg: FormlyFieldConfig) =>
fCfg.model.scheduledState !== BoardPanelCfgScheduledState.Scheduled,
},
props: {
label: 'Sort by due date',
required: true,
defaultValue: 'off',
options: [
{ value: 'off', label: 'Off' },
{ value: 'asc', label: 'Ascending (soonest first)' },
{ value: 'desc', label: 'Descending (furthest first)' },
],
},
},
{
key: 'backlogState',
type: 'radio',
@ -169,20 +188,6 @@ export const BOARDS_FORM: LimitedFormlyFieldConfig<BoardCfg>[] = [
defaultValue: false,
},
},
{
key: 'sortByDue',
type: 'radio',
props: {
label: 'Sort by due date',
required: true,
defaultValue: 'off',
options: [
{ value: 'off', label: 'Off' },
{ value: 'asc', label: 'Ascending (soonest first)' },
{ value: 'desc', label: 'Descending (furthest first)' },
],
},
},
],
},
},