From 69b8f6f3a3ad0b84129824fd269b33740cad7b60 Mon Sep 17 00:00:00 2001 From: naumov Date: Wed, 20 Nov 2024 16:48:05 +0100 Subject: [PATCH] CB-5960 sort features --- webapp/packages/core-root/src/FeaturesResource.ts | 12 +++++++++++- .../Form/ServerConfigurationFeaturesForm.tsx | 8 ++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/webapp/packages/core-root/src/FeaturesResource.ts b/webapp/packages/core-root/src/FeaturesResource.ts index e9e95e34ad..ea7396fa72 100644 --- a/webapp/packages/core-root/src/FeaturesResource.ts +++ b/webapp/packages/core-root/src/FeaturesResource.ts @@ -5,7 +5,7 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ -import { makeObservable, observable } from 'mobx'; +import { computed, makeObservable, observable } from 'mobx'; import { injectable } from '@cloudbeaver/core-di'; import { CachedDataResource } from '@cloudbeaver/core-resource'; @@ -19,6 +19,11 @@ export type ApplicationFeature = WebFeatureSet; @injectable() export class FeaturesResource extends CachedDataResource { private baseFeatures: string[]; + + get features(): ApplicationFeature[] { + return this.data.slice().sort(sortFeature); + } + constructor( private readonly graphQLService: GraphQLService, permissionsResource: SessionPermissionsResource, @@ -30,6 +35,7 @@ export class FeaturesResource extends CachedDataResource { makeObservable(this, { baseFeatures: observable, + features: computed, }); } @@ -47,3 +53,7 @@ export class FeaturesResource extends CachedDataResource { return features; } } + +export function sortFeature(a: ApplicationFeature, b: ApplicationFeature): number { + return a.label.localeCompare(b.label); +} diff --git a/webapp/packages/plugin-administration/src/ConfigurationWizard/ServerConfiguration/Form/ServerConfigurationFeaturesForm.tsx b/webapp/packages/plugin-administration/src/ConfigurationWizard/ServerConfiguration/Form/ServerConfigurationFeaturesForm.tsx index cbbf133b2f..ad626b9b47 100644 --- a/webapp/packages/plugin-administration/src/ConfigurationWizard/ServerConfiguration/Form/ServerConfigurationFeaturesForm.tsx +++ b/webapp/packages/plugin-administration/src/ConfigurationWizard/ServerConfiguration/Form/ServerConfigurationFeaturesForm.tsx @@ -21,24 +21,24 @@ export const ServerConfigurationFeaturesForm: PlaceholderComponent {translate('administration_configuration_wizard_configuration_services_group')} - {features.data.map(feature => ( + {featuresResource.resource.features.map(feature => (