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(
|
bool get hasRemovableJobs => serverJobList.any(
|
||||||
(final job) =>
|
(final job) =>
|
||||||
job.status == JobStatusEnum.finished ||
|
job.status == JobStatusEnum.finished ||
|
||||||
|
|
|
@ -12,6 +12,7 @@ class ServerJob {
|
||||||
required this.description,
|
required this.description,
|
||||||
required this.status,
|
required this.status,
|
||||||
required this.uid,
|
required this.uid,
|
||||||
|
required this.typeId,
|
||||||
required this.updatedAt,
|
required this.updatedAt,
|
||||||
required this.createdAt,
|
required this.createdAt,
|
||||||
this.error,
|
this.error,
|
||||||
|
@ -33,12 +34,14 @@ class ServerJob {
|
||||||
status: JobStatusEnum.fromString(serverJob.status),
|
status: JobStatusEnum.fromString(serverJob.status),
|
||||||
statusText: serverJob.statusText,
|
statusText: serverJob.statusText,
|
||||||
uid: serverJob.uid,
|
uid: serverJob.uid,
|
||||||
|
typeId: serverJob.typeId,
|
||||||
updatedAt: serverJob.updatedAt,
|
updatedAt: serverJob.updatedAt,
|
||||||
);
|
);
|
||||||
final String name;
|
final String name;
|
||||||
final String description;
|
final String description;
|
||||||
final JobStatusEnum status;
|
final JobStatusEnum status;
|
||||||
final String uid;
|
final String uid;
|
||||||
|
final String typeId;
|
||||||
final DateTime updatedAt;
|
final DateTime updatedAt;
|
||||||
final DateTime createdAt;
|
final DateTime createdAt;
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ ServerJob _$ServerJobFromJson(Map<String, dynamic> json) => ServerJob(
|
||||||
description: json['description'] as String,
|
description: json['description'] as String,
|
||||||
status: $enumDecode(_$JobStatusEnumEnumMap, json['status']),
|
status: $enumDecode(_$JobStatusEnumEnumMap, json['status']),
|
||||||
uid: json['uid'] as String,
|
uid: json['uid'] as String,
|
||||||
|
typeId: json['typeId'] as String,
|
||||||
updatedAt: DateTime.parse(json['updatedAt'] as String),
|
updatedAt: DateTime.parse(json['updatedAt'] as String),
|
||||||
createdAt: DateTime.parse(json['createdAt'] as String),
|
createdAt: DateTime.parse(json['createdAt'] as String),
|
||||||
error: json['error'] as String?,
|
error: json['error'] as String?,
|
||||||
|
@ -27,6 +28,7 @@ Map<String, dynamic> _$ServerJobToJson(ServerJob instance) => <String, dynamic>{
|
||||||
'description': instance.description,
|
'description': instance.description,
|
||||||
'status': _$JobStatusEnumEnumMap[instance.status]!,
|
'status': _$JobStatusEnumEnumMap[instance.status]!,
|
||||||
'uid': instance.uid,
|
'uid': instance.uid,
|
||||||
|
'typeId': instance.typeId,
|
||||||
'updatedAt': instance.updatedAt.toIso8601String(),
|
'updatedAt': instance.updatedAt.toIso8601String(),
|
||||||
'createdAt': instance.createdAt.toIso8601String(),
|
'createdAt': instance.createdAt.toIso8601String(),
|
||||||
'error': instance.error,
|
'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';
|
import 'package:selfprivacy/ui/helpers/modals.dart';
|
||||||
|
|
||||||
class JobsContent extends StatelessWidget {
|
class JobsContent extends StatelessWidget {
|
||||||
const JobsContent({super.key});
|
const JobsContent({
|
||||||
|
required this.controller,
|
||||||
|
super.key,
|
||||||
|
});
|
||||||
|
|
||||||
|
final ScrollController controller;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(final BuildContext context) {
|
Widget build(final BuildContext context) {
|
||||||
|
@ -119,9 +124,10 @@ class JobsContent extends StatelessWidget {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
return ListView(
|
return ListView(
|
||||||
|
controller: controller,
|
||||||
padding: paddingH15V0,
|
padding: paddingH15V0,
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(height: 15),
|
const SizedBox(height: 16),
|
||||||
Center(
|
Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
'jobs.title'.tr(),
|
'jobs.title'.tr(),
|
||||||
|
|
|
@ -62,7 +62,16 @@ class _BrandFabState extends State<BrandFab>
|
||||||
// TODO: Make a hero animation to the screen
|
// TODO: Make a hero animation to the screen
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
context: context,
|
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,
|
isExtended: widget.extended,
|
||||||
|
|
|
@ -145,7 +145,16 @@ class _HeroSliverAppBarState extends State<HeroSliverAppBar> {
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
context: context,
|
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(
|
icon: Icon(
|
||||||
|
|
|
@ -177,7 +177,16 @@ class _ServicesMigrationPageState extends State<ServicesMigrationPage> {
|
||||||
context.router.popUntilRoot();
|
context.router.popUntilRoot();
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
context: context,
|
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