feat: add completed state for jobs widget #421
|
@ -584,6 +584,7 @@
|
||||||
"title": "Jobs list",
|
"title": "Jobs list",
|
||||||
"start": "Start",
|
"start": "Start",
|
||||||
"empty": "No jobs",
|
"empty": "No jobs",
|
||||||
|
"completed": "Jobs completed",
|
||||||
"create_user": "Create user",
|
"create_user": "Create user",
|
||||||
"delete_user": "Delete user",
|
"delete_user": "Delete user",
|
||||||
"service_turn_off": "Turn off",
|
"service_turn_off": "Turn off",
|
||||||
|
@ -633,4 +634,4 @@
|
||||||
"reset_onboarding_description": "Reset onboarding switch to show onboarding screen again",
|
"reset_onboarding_description": "Reset onboarding switch to show onboarding screen again",
|
||||||
"cubit_statuses": "Cubit loading statuses"
|
"cubit_statuses": "Cubit loading statuses"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -92,7 +92,7 @@ class JobsCubit extends Cubit<JobsState> {
|
||||||
await api.apply();
|
await api.apply();
|
||||||
await servicesCubit.load();
|
await servicesCubit.load();
|
||||||
|
|
||||||
emit(JobsStateEmpty());
|
emit(JobsCompleted());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,8 @@ class JobsStateLoading extends JobsState {}
|
||||||
|
|
||||||
class JobsStateEmpty extends JobsState {}
|
class JobsStateEmpty extends JobsState {}
|
||||||
|
|
||||||
|
class JobsCompleted extends JobsState {}
|
||||||
|
|
||||||
class JobsStateWithJobs extends JobsState {
|
class JobsStateWithJobs extends JobsState {
|
||||||
JobsStateWithJobs(this.clientJobList);
|
JobsStateWithJobs(this.clientJobList);
|
||||||
final List<ClientJob> clientJobList;
|
final List<ClientJob> clientJobList;
|
||||||
|
|
|
@ -32,16 +32,38 @@ class JobsContent extends StatelessWidget {
|
||||||
late List<Widget> widgets;
|
late List<Widget> widgets;
|
||||||
final ServerInstallationState installationState =
|
final ServerInstallationState installationState =
|
||||||
context.read<ServerInstallationCubit>().state;
|
context.read<ServerInstallationCubit>().state;
|
||||||
if (state is JobsStateEmpty) {
|
if (state is JobsStateEmpty || state is JobsCompleted) {
|
||||||
widgets = [
|
if (state is JobsStateEmpty) {
|
||||||
const SizedBox(height: 80),
|
widgets = [
|
||||||
Center(
|
const SizedBox(height: 80),
|
||||||
child: Text(
|
Center(
|
||||||
'jobs.empty'.tr(),
|
child: Text(
|
||||||
style: Theme.of(context).textTheme.bodyLarge,
|
'jobs.empty'.tr(),
|
||||||
|
style: Theme.of(context).textTheme.bodyLarge,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
];
|
||||||
];
|
} else {
|
||||||
|
widgets = [
|
||||||
|
const SizedBox(height: 80),
|
||||||
|
Center(
|
||||||
|
child: Icon(
|
||||||
|
Icons.check,
|
||||||
|
size: 60.0,
|
||||||
|
color: Theme.of(context).colorScheme.onSurface,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 32),
|
||||||
|
Center(
|
||||||
|
child: Text(
|
||||||
|
'jobs.completed'.tr(),
|
||||||
|
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||||
|
color: Theme.of(context).colorScheme.onSurface,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
if (installationState is ServerInstallationFinished) {
|
if (installationState is ServerInstallationFinished) {
|
||||||
widgets = [
|
widgets = [
|
||||||
|
|
Loading…
Reference in New Issue