From c42def0f7fbc8ebcf9877a66eada38e3e30fd277 Mon Sep 17 00:00:00 2001 From: Viktor Egorov Date: Mon, 4 Mar 2024 08:01:13 +0100 Subject: [PATCH] Sort global config and repository config the same way MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a new option to configuration entry binding to improve sorting and sorts global and repository configuration likewise. Pushed-by: Viktor Egorov Pushed-by: Rene Pfeuffer Co-authored-by: René Pfeuffer Co-authored-by: vegorov --- gradle/changelog/impove_sorting.yaml | 2 ++ scm-plugins/scm-hg-plugin/src/main/js/index.ts | 2 +- scm-ui/ui-components/src/config/ConfigurationBinder.tsx | 8 ++++---- 3 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 gradle/changelog/impove_sorting.yaml diff --git a/gradle/changelog/impove_sorting.yaml b/gradle/changelog/impove_sorting.yaml new file mode 100644 index 0000000000..9d4b25ca76 --- /dev/null +++ b/gradle/changelog/impove_sorting.yaml @@ -0,0 +1,2 @@ +- type: fixed + description: Sort global config and repository config the same way diff --git a/scm-plugins/scm-hg-plugin/src/main/js/index.ts b/scm-plugins/scm-hg-plugin/src/main/js/index.ts index 2a3b56c1f4..4a947134cb 100644 --- a/scm-plugins/scm-hg-plugin/src/main/js/index.ts +++ b/scm-plugins/scm-hg-plugin/src/main/js/index.ts @@ -54,4 +54,4 @@ binder.bind("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"); diff --git a/scm-ui/ui-components/src/config/ConfigurationBinder.tsx b/scm-ui/ui-components/src/config/ConfigurationBinder.tsx index c3231cf9e4..1aa2c80d29 100644 --- a/scm-ui/ui-components/src/config/ConfigurationBinder.tsx +++ b/scm-ui/ui-components/src/config/ConfigurationBinder.tsx @@ -64,7 +64,7 @@ class ConfigurationBinder { return {Component}; } - 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) => {