mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-01-11 10:29:39 +00:00
feat(services): Sort the services by their status
Done by changing the indexes of ServiceStatus enum and sorting by it.
This commit is contained in:
parent
5f311ee907
commit
bbb1d55b64
|
@ -105,13 +105,13 @@ class ServiceStorageUsage {
|
|||
}
|
||||
|
||||
enum ServiceStatus {
|
||||
failed,
|
||||
reloading,
|
||||
activating,
|
||||
active,
|
||||
deactivating,
|
||||
failed,
|
||||
inactive,
|
||||
off,
|
||||
reloading;
|
||||
off;
|
||||
|
||||
factory ServiceStatus.fromGraphQL(final Enum$ServiceStatusEnum graphQL) {
|
||||
switch (graphQL) {
|
||||
|
|
|
@ -41,6 +41,10 @@ class _ServicesPageState extends State<ServicesPage> {
|
|||
final isReady = context.watch<ServerInstallationCubit>().state
|
||||
is ServerInstallationFinished;
|
||||
|
||||
final services = [...context.watch<ServicesCubit>().state.services];
|
||||
services
|
||||
.sort((final a, final b) => a.status.index.compareTo(b.status.index));
|
||||
|
||||
return Scaffold(
|
||||
appBar: PreferredSize(
|
||||
preferredSize: const Size.fromHeight(52),
|
||||
|
@ -58,10 +62,7 @@ class _ServicesPageState extends State<ServicesPage> {
|
|||
BrandText.body1('basis.services_title'.tr()),
|
||||
const SizedBox(height: 24),
|
||||
if (!isReady) ...[const NotReadyCard(), const SizedBox(height: 24)],
|
||||
...context
|
||||
.read<ServicesCubit>()
|
||||
.state
|
||||
.services
|
||||
...services
|
||||
.map(
|
||||
(final service) => Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
|
|
Loading…
Reference in a new issue