Schedule send

This commit is contained in:
Hillel Coren 2023-03-22 13:58:46 +02:00
parent 94b70a2509
commit cdd81fe56d
4 changed files with 7 additions and 4 deletions

View File

@ -47,8 +47,8 @@ abstract class ScheduleItemResponse
}
class ScheduleFields {
static const String name = 'name';
static const String template = 'template';
static const String nextRun = 'next_run';
}
abstract class ScheduleEntity extends Object
@ -137,6 +137,9 @@ abstract class ScheduleEntity extends Object
case ScheduleFields.template:
response = scheduleA.template.compareTo(scheduleB.template);
break;
case ScheduleFields.nextRun:
response = scheduleA.nextRun.compareTo(scheduleB.nextRun);
break;
default:
print('## ERROR: sort by schedule.$sortField is not implemented');

View File

@ -33,7 +33,7 @@ List<String> dropdownSchedulesSelector(
list.sort((scheduleAId, scheduleBId) {
final scheduleA = scheduleMap[scheduleAId];
final scheduleB = scheduleMap[scheduleBId];
return scheduleA.compareTo(scheduleB, ScheduleFields.name, true);
return scheduleA.compareTo(scheduleB, ScheduleFields.template, true);
});
return list;

View File

@ -54,7 +54,7 @@ abstract class ScheduleUIState extends Object
implements Built<ScheduleUIState, ScheduleUIStateBuilder> {
factory ScheduleUIState(PrefStateSortField sortField) {
return _$ScheduleUIState._(
listUIState: ListUIState(sortField?.field ?? ScheduleFields.name,
listUIState: ListUIState(sortField?.field ?? ScheduleFields.template,
sortAscending: sortField?.ascending),
editing: ScheduleEntity(),
selectedId: '',

View File

@ -63,8 +63,8 @@ class ScheduleScreen extends StatelessWidget {
store.dispatch(SortSchedules(value));
},
sortFields: [
ScheduleFields.name,
ScheduleFields.template,
ScheduleFields.nextRun,
],
onSelectedState: (EntityState state, value) {
store.dispatch(FilterSchedulesByState(state));