Sort global config and repository config the same way

Adds a new option to configuration entry binding to improve sorting
and sorts global and repository configuration likewise.

Pushed-by: Viktor Egorov<viktor.egorov-extern@cloudogu.com>
Pushed-by: Rene Pfeuffer<rene.pfeuffer@cloudogu.com>
Co-authored-by: René Pfeuffer<rene.pfeuffer@cloudogu.com>
Co-authored-by: vegorov<viktor.egorov@triology.de>
This commit is contained in:
Viktor Egorov
2024-03-04 08:01:13 +01:00
parent e966323602
commit c42def0f7f
3 changed files with 7 additions and 5 deletions

View File

@@ -0,0 +1,2 @@
- type: fixed
description: Sort global config and repository config the same way

View File

@@ -54,4 +54,4 @@ binder.bind<extensionPoints.RepoConfigRoute>("repo-config.route", HgRepositoryCo
// bind global configuration
cfgBinder.bindGlobal("/hg", "scm-hg-plugin.config.link", "hgConfig", HgGlobalConfiguration);
cfgBinder.bindGlobal("/hg", "scm-hg-plugin.config.link", "hgConfig", HgGlobalConfiguration, "mercurial");

View File

@@ -64,7 +64,7 @@ class ConfigurationBinder {
return <Route path={urls.escapeUrlForRoute(path)}>{Component}</Route>;
}
bindGlobal(to: string, labelI18nKey: string, linkName: string, ConfigurationComponent: any) {
bindGlobal(to: string, labelI18nKey: string, linkName: string, ConfigurationComponent: any, sortKey?: string) {
// create predicate based on the link name of the index resource
// if the linkname is not available, the navigation link and the route are not bound to the extension points
const configPredicate = (props: any) => {
@@ -77,7 +77,7 @@ class ConfigurationBinder {
});
// bind navigation link to extension point
binder.bind("admin.setting", ConfigNavLink, configPredicate, labelI18nKey);
binder.bind("admin.setting", ConfigNavLink, configPredicate, sortKey ?? linkName);
// route for global configuration, passes the link from the index resource to component
const ConfigRoute = ({ url, links, ...additionalProps }: GlobalRouteProps) => {
@@ -145,7 +145,7 @@ class ConfigurationBinder {
binder.bind("repository.route", RepoRoute, repoPredicate);
}
bindRepositorySetting(to: string, labelI18nKey: string, linkName: string, RepositoryComponent: any) {
bindRepositorySetting(to: string, labelI18nKey: string, linkName: string, RepositoryComponent: any, sortKey?: string) {
// create predicate based on the link name of the current repository route
// if the linkname is not available, the navigation link and the route are not bound to the extension points
const repoPredicate = (props: any) => {
@@ -158,7 +158,7 @@ class ConfigurationBinder {
});
// bind navigation link to extension point
binder.bind("repository.setting", RepoNavLink, repoPredicate);
binder.bind("repository.setting", RepoNavLink, repoPredicate, sortKey ?? linkName);
// route for global configuration, passes the current repository to component
const RepoRoute = ({ url, repository, ...additionalProps }: RepositoryRouteProps) => {