mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-01-11 18:39:45 +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 {
|
enum ServiceStatus {
|
||||||
|
failed,
|
||||||
|
reloading,
|
||||||
activating,
|
activating,
|
||||||
active,
|
active,
|
||||||
deactivating,
|
deactivating,
|
||||||
failed,
|
|
||||||
inactive,
|
inactive,
|
||||||
off,
|
off;
|
||||||
reloading;
|
|
||||||
|
|
||||||
factory ServiceStatus.fromGraphQL(final Enum$ServiceStatusEnum graphQL) {
|
factory ServiceStatus.fromGraphQL(final Enum$ServiceStatusEnum graphQL) {
|
||||||
switch (graphQL) {
|
switch (graphQL) {
|
||||||
|
|
|
@ -41,6 +41,10 @@ class _ServicesPageState extends State<ServicesPage> {
|
||||||
final isReady = context.watch<ServerInstallationCubit>().state
|
final isReady = context.watch<ServerInstallationCubit>().state
|
||||||
is ServerInstallationFinished;
|
is ServerInstallationFinished;
|
||||||
|
|
||||||
|
final services = [...context.watch<ServicesCubit>().state.services];
|
||||||
|
services
|
||||||
|
.sort((final a, final b) => a.status.index.compareTo(b.status.index));
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: PreferredSize(
|
appBar: PreferredSize(
|
||||||
preferredSize: const Size.fromHeight(52),
|
preferredSize: const Size.fromHeight(52),
|
||||||
|
@ -58,10 +62,7 @@ class _ServicesPageState extends State<ServicesPage> {
|
||||||
BrandText.body1('basis.services_title'.tr()),
|
BrandText.body1('basis.services_title'.tr()),
|
||||||
const SizedBox(height: 24),
|
const SizedBox(height: 24),
|
||||||
if (!isReady) ...[const NotReadyCard(), const SizedBox(height: 24)],
|
if (!isReady) ...[const NotReadyCard(), const SizedBox(height: 24)],
|
||||||
...context
|
...services
|
||||||
.read<ServicesCubit>()
|
|
||||||
.state
|
|
||||||
.services
|
|
||||||
.map(
|
.map(
|
||||||
(final service) => Padding(
|
(final service) => Padding(
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
|
|
Loading…
Reference in a new issue