mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-01-23 01:06:44 +00:00
feat(jobs): Update the model and modal sheets
This commit is contained in:
parent
e1e4779c51
commit
62e906d1a4
|
@ -21,6 +21,11 @@ class ServerJobsState extends ServerInstallationDependendState {
|
|||
}
|
||||
}
|
||||
|
||||
List<ServerJob> get backupJobList => serverJobList.where(
|
||||
// The backup jobs has the format of 'service.<service_id>.backup'
|
||||
(final job) => job.typeId.contains('backup'),
|
||||
).toList();
|
||||
|
||||
bool get hasRemovableJobs => serverJobList.any(
|
||||
(final job) =>
|
||||
job.status == JobStatusEnum.finished ||
|
||||
|
|
|
@ -12,6 +12,7 @@ class ServerJob {
|
|||
required this.description,
|
||||
required this.status,
|
||||
required this.uid,
|
||||
required this.typeId,
|
||||
required this.updatedAt,
|
||||
required this.createdAt,
|
||||
this.error,
|
||||
|
@ -33,12 +34,14 @@ class ServerJob {
|
|||
status: JobStatusEnum.fromString(serverJob.status),
|
||||
statusText: serverJob.statusText,
|
||||
uid: serverJob.uid,
|
||||
typeId: serverJob.typeId,
|
||||
updatedAt: serverJob.updatedAt,
|
||||
);
|
||||
final String name;
|
||||
final String description;
|
||||
final JobStatusEnum status;
|
||||
final String uid;
|
||||
final String typeId;
|
||||
final DateTime updatedAt;
|
||||
final DateTime createdAt;
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ ServerJob _$ServerJobFromJson(Map<String, dynamic> json) => ServerJob(
|
|||
description: json['description'] as String,
|
||||
status: $enumDecode(_$JobStatusEnumEnumMap, json['status']),
|
||||
uid: json['uid'] as String,
|
||||
typeId: json['typeId'] as String,
|
||||
updatedAt: DateTime.parse(json['updatedAt'] as String),
|
||||
createdAt: DateTime.parse(json['createdAt'] as String),
|
||||
error: json['error'] as String?,
|
||||
|
@ -27,6 +28,7 @@ Map<String, dynamic> _$ServerJobToJson(ServerJob instance) => <String, dynamic>{
|
|||
'description': instance.description,
|
||||
'status': _$JobStatusEnumEnumMap[instance.status]!,
|
||||
'uid': instance.uid,
|
||||
'typeId': instance.typeId,
|
||||
'updatedAt': instance.updatedAt.toIso8601String(),
|
||||
'createdAt': instance.createdAt.toIso8601String(),
|
||||
'error': instance.error,
|
||||
|
|
|
@ -12,7 +12,12 @@ import 'package:selfprivacy/ui/components/jobs_content/server_job_card.dart';
|
|||
import 'package:selfprivacy/ui/helpers/modals.dart';
|
||||
|
||||
class JobsContent extends StatelessWidget {
|
||||
const JobsContent({super.key});
|
||||
const JobsContent({
|
||||
required this.controller,
|
||||
super.key,
|
||||
});
|
||||
|
||||
final ScrollController controller;
|
||||
|
||||
@override
|
||||
Widget build(final BuildContext context) {
|
||||
|
@ -119,9 +124,10 @@ class JobsContent extends StatelessWidget {
|
|||
];
|
||||
}
|
||||
return ListView(
|
||||
controller: controller,
|
||||
padding: paddingH15V0,
|
||||
children: [
|
||||
const SizedBox(height: 15),
|
||||
const SizedBox(height: 16),
|
||||
Center(
|
||||
child: Text(
|
||||
'jobs.title'.tr(),
|
||||
|
|
|
@ -62,7 +62,16 @@ class _BrandFabState extends State<BrandFab>
|
|||
// TODO: Make a hero animation to the screen
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
builder: (final BuildContext context) => const JobsContent(),
|
||||
useRootNavigator: true,
|
||||
isScrollControlled: true,
|
||||
builder: (final BuildContext context) => DraggableScrollableSheet(
|
||||
expand: false,
|
||||
maxChildSize: 0.9,
|
||||
minChildSize: 0.4,
|
||||
initialChildSize: 0.6,
|
||||
builder: (final context, final scrollController) =>
|
||||
JobsContent(controller: scrollController),
|
||||
),
|
||||
);
|
||||
},
|
||||
isExtended: widget.extended,
|
||||
|
|
|
@ -145,7 +145,16 @@ class _HeroSliverAppBarState extends State<HeroSliverAppBar> {
|
|||
onPressed: () {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
builder: (final BuildContext context) => const JobsContent(),
|
||||
useRootNavigator: true,
|
||||
isScrollControlled: true,
|
||||
builder: (final BuildContext context) => DraggableScrollableSheet(
|
||||
expand: false,
|
||||
maxChildSize: 0.9,
|
||||
minChildSize: 0.4,
|
||||
initialChildSize: 0.6,
|
||||
builder: (final context, final scrollController) =>
|
||||
JobsContent(controller: scrollController),
|
||||
),
|
||||
);
|
||||
},
|
||||
icon: Icon(
|
||||
|
|
|
@ -177,7 +177,16 @@ class _ServicesMigrationPageState extends State<ServicesMigrationPage> {
|
|||
context.router.popUntilRoot();
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
builder: (final BuildContext context) => const JobsContent(),
|
||||
useRootNavigator: true,
|
||||
isScrollControlled: true,
|
||||
builder: (final BuildContext context) => DraggableScrollableSheet(
|
||||
expand: false,
|
||||
maxChildSize: 0.9,
|
||||
minChildSize: 0.4,
|
||||
initialChildSize: 0.6,
|
||||
builder: (final context, final scrollController) =>
|
||||
JobsContent(controller: scrollController),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue