feat(services): Sort the services by their status

Done by changing the indexes of ServiceStatus enum and sorting by it.
pull/157/head
Inex Code 2022-12-31 08:08:25 +03:00
parent 5f311ee907
commit bbb1d55b64
2 changed files with 8 additions and 7 deletions

View File

@ -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) {

View File

@ -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(