From 20784abd0d34a202a39151e525e3d31c66705f21 Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Tue, 22 Jan 2013 19:00:07 +0100 Subject: [PATCH] SONAR-3692 Centralize the way widget property and settings property are generated --- .../org/sonar/plugins/core/CorePlugin.java | 772 +++++++++--------- .../plugins/core/widgets/TimelineWidget.java | 31 +- .../src/main/java/org/sonar/api/Property.java | 1 + .../org/sonar/api/web/WidgetProperty.java | 6 +- .../org/sonar/api/web/WidgetPropertyType.java | 9 +- .../WEB-INF/app/helpers/properties_helper.rb | 119 ++- .../app/helpers/rules_configuration_helper.rb | 4 +- .../app/helpers/widget_properties_helper.rb | 6 +- .../WEB-INF/app/models/property_type.rb | 2 +- .../dashboard/_widget_properties.html.erb | 8 +- .../app/views/settings/_properties.html.erb | 2 +- .../app/views/settings/_type_BOOLEAN.html.erb | 6 +- .../app/views/settings/_type_FLOAT.html.erb | 6 +- .../app/views/settings/_type_INTEGER.html.erb | 6 +- .../app/views/settings/_type_METRIC.html.erb | 2 +- .../views/settings/_type_PASSWORD.html.erb | 6 +- .../_type_REGULAR_EXPRESSION.html.erb | 6 +- .../_type_SINGLE_SELECT_LIST.html.erb | 8 +- .../app/views/settings/_type_STRING.html.erb | 6 +- .../app/views/settings/_type_TEXT.html.erb | 6 +- 20 files changed, 574 insertions(+), 438 deletions(-) diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java index 652ea938ff4..eb3f4b05d14 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java @@ -116,389 +116,429 @@ import org.sonar.plugins.core.widgets.reviews.UnplannedReviewsWidget; import java.util.List; @Properties({ - @Property( - key = CoreProperties.SERVER_BASE_URL, - defaultValue = CoreProperties.SERVER_BASE_URL_DEFAULT_VALUE, - name = "Server base URL", - description = "HTTP URL of this Sonar server, such as http://yourhost.yourdomain/sonar. This value is used i.e. to create links in emails.", - project = false, - global = true, - category = CoreProperties.CATEGORY_GENERAL), - @Property( - key = CoreProperties.LINKS_HOME_PAGE, - defaultValue = "", - name = "Project Home Page", - description = "HTTP URL of the home page of the project.", - project = false, - global = false, - category = CoreProperties.CATEGORY_GENERAL), - @Property( - key = CoreProperties.LINKS_CI, - defaultValue = "", - name = "CI server", - description = "HTTP URL of the continuous integration server.", - project = false, - global = false, - category = CoreProperties.CATEGORY_GENERAL), - @Property( - key = CoreProperties.LINKS_ISSUE_TRACKER, - defaultValue = "", - name = "Issue Tracker", - description = "HTTP URL of the issue tracker.", - project = false, - global = false, - category = CoreProperties.CATEGORY_GENERAL), - @Property( - key = CoreProperties.LINKS_SOURCES, - defaultValue = "", - name = "SCM server", - description = "HTTP URL of the server which hosts the sources of the project.", - project = false, - global = false, - category = CoreProperties.CATEGORY_GENERAL), - @Property( - key = CoreProperties.LINKS_SOURCES_DEV, - defaultValue = "", - name = "SCM connection for developers", - description = "HTTP URL used by developers to connect to the SCM server for the project.", - project = false, - global = false, - category = CoreProperties.CATEGORY_GENERAL), - @Property( - key = CoreProperties.PROJECT_LANGUAGE_PROPERTY, - defaultValue = Java.KEY, - name = "Default language", - description = "Default language of the source code to analyse.", - project = false, - global = true, - category = CoreProperties.CATEGORY_GENERAL), - @Property( - key = CoreProperties.GLOBAL_EXCLUSIONS_PROPERTY, - name = "Global source exclusions", - description = "Exclude sources from code analysis. Applies to every project. Cannot be overriden. Changes will be applied during next code analysis.", - multiValues = true, - category = CoreProperties.CATEGORY_EXCLUSIONS), - @Property( - key = CoreProperties.GLOBAL_TEST_EXCLUSIONS_PROPERTY, - name = "Global test exclusions", - description = "Exclude tests from code analysis. Applies to every project. Cannot be overriden. Changes will be applied during next code analysis.", - multiValues = true, - category = CoreProperties.CATEGORY_EXCLUSIONS, - defaultValue = CoreProperties.GLOBAL_TEST_EXCLUSIONS_DEFAULT), - @Property( - key = CoreProperties.PROJECT_EXCLUSIONS_PROPERTY, - name = "Exclusions", - description = "Exclude sources from code analysis. Changes will be applied during next code analysis.", - project = true, - global = true, - multiValues = true, - category = CoreProperties.CATEGORY_EXCLUSIONS), - @Property( - key = CoreProperties.PROJECT_TEST_EXCLUSIONS_PROPERTY, - name = "Test Exclusions", - description = "Exclude tests from code analysis. Changes will be applied during next code analysis.", - project = true, - global = true, - multiValues = true, - category = CoreProperties.CATEGORY_EXCLUSIONS), - @Property( - key = CoreProperties.CORE_IMPORT_SOURCES_PROPERTY, - defaultValue = "" + CoreProperties.CORE_IMPORT_SOURCES_DEFAULT_VALUE, - name = "Import sources", - description = "Set to false if sources should not be displayed, e.g. for security reasons.", - project = true, - module = true, - global = true, - category = CoreProperties.CATEGORY_SECURITY, - type = PropertyType.BOOLEAN), - @Property( - key = CoreProperties.CORE_TENDENCY_DEPTH_PROPERTY, - defaultValue = "" + CoreProperties.CORE_TENDENCY_DEPTH_DEFAULT_VALUE, - name = "Tendency period", - description = TendencyDecorator.PROP_DAYS_DESCRIPTION, - project = false, - global = true, - category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS, - type = PropertyType.INTEGER), - @Property( - key = CoreProperties.SKIP_TENDENCIES_PROPERTY, - defaultValue = "" + CoreProperties.SKIP_TENDENCIES_DEFAULT_VALUE, - name = "Skip tendencies", - description = "Skip calculation of measure tendencies", - project = true, - module = false, - global = true, - category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS, - type = PropertyType.BOOLEAN), - @Property( - key = CoreProperties.CORE_SKIPPED_MODULES_PROPERTY, - name = "Exclude modules", - description = "Maven artifact ids of modules to exclude.", - project = true, - global = false, - multiValues = true, - category = CoreProperties.CATEGORY_EXCLUSIONS), - @Property( - key = CoreProperties.CORE_FORCE_AUTHENTICATION_PROPERTY, - defaultValue = "" + CoreProperties.CORE_FORCE_AUTHENTICATION_DEFAULT_VALUE, - name = "Force user authentication", - description = "Forcing user authentication stops un-logged users to access Sonar.", - project = false, - global = true, - category = CoreProperties.CATEGORY_SECURITY, - type = PropertyType.BOOLEAN), - @Property( - key = CoreProperties.CORE_ALLOW_USERS_TO_SIGNUP_PROPERTY, - defaultValue = "" + CoreProperties.CORE_ALLOW_USERS_TO_SIGNUP_DEAULT_VALUE, - name = "Allow users to sign up online", - description = "Users can sign up online.", - project = false, - global = true, - category = CoreProperties.CATEGORY_SECURITY, - type = PropertyType.BOOLEAN), - @Property( - key = CoreProperties.CORE_DEFAULT_GROUP, - defaultValue = CoreProperties.CORE_DEFAULT_GROUP_DEFAULT_VALUE, - name = "Default user group", - description = "Any new users will automatically join this group.", - project = false, - global = true, - category = CoreProperties.CATEGORY_SECURITY), - @Property( - key = CoreProperties.CORE_VIOLATION_LOCALE_PROPERTY, - defaultValue = "en", - name = "Locale used for violation messages", - description = "Locale to be used when generating violation messages. It's up to each rule engine to support this global internationalization property", - project = true, - global = true, - category = CoreProperties.CATEGORY_L10N), - @Property( - key = "sonar.timemachine.period1", - name = "Period 1", - description = "Period used to compare measures and track new violations. Values are : " + - "

When specifying a number of days or a date, the snapshot selected for comparison is " + - " the first one available inside the corresponding time range.

" + - "

Changing this property only takes effect after subsequent project inspections.

", - project = false, - global = true, - defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_1, - category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS), - @Property( - key = "sonar.timemachine.period2", - name = "Period 2", - description = "See the property 'Period 1'", - project = false, - global = true, - defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_2, - category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS), - @Property( - key = "sonar.timemachine.period3", - name = "Period 3", - description = "See the property 'Period 1'", - project = false, - global = true, - defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_3, - category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS), - @Property( - key = "sonar.timemachine.period4", - name = "Period 4", - description = "Period used to compare measures and track new violations. This property is specific to the project. Values are : " + - "

" + - "

When specifying a number of days or a date, the snapshot selected for comparison is the first one available inside the corresponding time range.

" + - "

Changing this property only takes effect after subsequent project inspections.

", - project = true, - global = false, - defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_4, - category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS), - @Property( - key = "sonar.timemachine.period5", - name = "Period 5", - description = "See the property 'Period 4'", - project = true, - global = false, - defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_5, - category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS), - @Property( - key = CoreProperties.DRY_RUN, - defaultValue = "false", - name = "Dry Run", - type = PropertyType.BOOLEAN, - global = false, project = false, - category = CoreProperties.CATEGORY_GENERAL), - @Property( - key = CoreProperties.DRY_RUN_INCLUDE_PLUGINS, - name = "Plugins accepted for dry run", - defaultValue = CoreProperties.DRY_RUN_INCLUDE_PLUGINS_DEFAULT_VALUE, - global = true, project = false, - category = CoreProperties.CATEGORY_GENERAL), - @Property( - key = CoreProperties.DRY_RUN_EXCLUDE_PLUGINS, - name = "Plugins excluded for dry run", - global = true, project = false, - defaultValue = CoreProperties.DRY_RUN_EXCLUDE_PLUGINS_DEFAULT_VALUE, - category = CoreProperties.CATEGORY_GENERAL), - @Property( - key = "sonar.dryRun.export.path", - defaultValue = "dryRun.json", - name = "Dry Run Results Export File", - type = PropertyType.STRING, - global = false, project = false), + @Property( + key = CoreProperties.SERVER_BASE_URL, + defaultValue = CoreProperties.SERVER_BASE_URL_DEFAULT_VALUE, + name = "Server base URL", + description = "HTTP URL of this Sonar server, such as http://yourhost.yourdomain/sonar. This value is used i.e. to create links in emails.", + project = false, + global = true, + category = CoreProperties.CATEGORY_GENERAL), + @Property( + key = "sonar.test", + defaultValue = "complexity", + name = "Metric", + project = true, + global = true, + category = CoreProperties.CATEGORY_GENERAL, + type = PropertyType.METRIC), + @Property( + key = "sonar.testmetric", + name = "Metric", + project = true, + global = true, + category = CoreProperties.CATEGORY_GENERAL, + type = PropertyType.METRIC), + @Property( + key = "sonar.test2", + name = "Single", + defaultValue = "2", + project = true, + global = true, + category = CoreProperties.CATEGORY_GENERAL, + type = PropertyType.SINGLE_SELECT_LIST, + options = {"1", "2", "3"}), + @Property( + key = "sonar.testsinglelist", + name = "Single2", + project = true, + global = true, + category = CoreProperties.CATEGORY_GENERAL, + type = PropertyType.SINGLE_SELECT_LIST, + options = {"1", "2", "3"}), + @Property( + key = "sonar.test3", + name = "Password", + project = true, + global = true, + category = CoreProperties.CATEGORY_GENERAL, + type = PropertyType.PASSWORD, + options = {"1", "2", "3"}), + @Property( + key = CoreProperties.LINKS_HOME_PAGE, + defaultValue = "", + name = "Project Home Page", + description = "HTTP URL of the home page of the project.", + project = false, + global = false, + category = CoreProperties.CATEGORY_GENERAL), + @Property( + key = CoreProperties.LINKS_CI, + defaultValue = "", + name = "CI server", + description = "HTTP URL of the continuous integration server.", + project = false, + global = false, + category = CoreProperties.CATEGORY_GENERAL), + @Property( + key = CoreProperties.LINKS_ISSUE_TRACKER, + defaultValue = "", + name = "Issue Tracker", + description = "HTTP URL of the issue tracker.", + project = false, + global = false, + category = CoreProperties.CATEGORY_GENERAL), + @Property( + key = CoreProperties.LINKS_SOURCES, + defaultValue = "", + name = "SCM server", + description = "HTTP URL of the server which hosts the sources of the project.", + project = false, + global = false, + category = CoreProperties.CATEGORY_GENERAL), + @Property( + key = CoreProperties.LINKS_SOURCES_DEV, + defaultValue = "", + name = "SCM connection for developers", + description = "HTTP URL used by developers to connect to the SCM server for the project.", + project = false, + global = false, + category = CoreProperties.CATEGORY_GENERAL), + @Property( + key = CoreProperties.PROJECT_LANGUAGE_PROPERTY, + defaultValue = Java.KEY, + name = "Default language", + description = "Default language of the source code to analyse.", + project = false, + global = true, + category = CoreProperties.CATEGORY_GENERAL), + @Property( + key = CoreProperties.GLOBAL_EXCLUSIONS_PROPERTY, + name = "Global source exclusions", + description = "Exclude sources from code analysis. Applies to every project. Cannot be overriden. Changes will be applied during next code analysis.", + multiValues = true, + category = CoreProperties.CATEGORY_EXCLUSIONS), + @Property( + key = CoreProperties.GLOBAL_TEST_EXCLUSIONS_PROPERTY, + name = "Global test exclusions", + description = "Exclude tests from code analysis. Applies to every project. Cannot be overriden. Changes will be applied during next code analysis.", + multiValues = true, + category = CoreProperties.CATEGORY_EXCLUSIONS, + defaultValue = CoreProperties.GLOBAL_TEST_EXCLUSIONS_DEFAULT), + @Property( + key = CoreProperties.PROJECT_EXCLUSIONS_PROPERTY, + name = "Exclusions", + description = "Exclude sources from code analysis. Changes will be applied during next code analysis.", + project = true, + global = true, + multiValues = true, + category = CoreProperties.CATEGORY_EXCLUSIONS), + @Property( + key = CoreProperties.PROJECT_TEST_EXCLUSIONS_PROPERTY, + name = "Test Exclusions", + description = "Exclude tests from code analysis. Changes will be applied during next code analysis.", + project = true, + global = true, + multiValues = true, + category = CoreProperties.CATEGORY_EXCLUSIONS), + @Property( + key = CoreProperties.CORE_IMPORT_SOURCES_PROPERTY, + defaultValue = "" + CoreProperties.CORE_IMPORT_SOURCES_DEFAULT_VALUE, + name = "Import sources", + description = "Set to false if sources should not be displayed, e.g. for security reasons.", + project = true, + module = true, + global = true, + category = CoreProperties.CATEGORY_SECURITY, + type = PropertyType.BOOLEAN), + @Property( + key = CoreProperties.CORE_TENDENCY_DEPTH_PROPERTY, + defaultValue = "" + CoreProperties.CORE_TENDENCY_DEPTH_DEFAULT_VALUE, + name = "Tendency period", + description = TendencyDecorator.PROP_DAYS_DESCRIPTION, + project = false, + global = true, + category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS, + type = PropertyType.INTEGER), + @Property( + key = CoreProperties.SKIP_TENDENCIES_PROPERTY, + defaultValue = "" + CoreProperties.SKIP_TENDENCIES_DEFAULT_VALUE, + name = "Skip tendencies", + description = "Skip calculation of measure tendencies", + project = true, + module = false, + global = true, + category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS, + type = PropertyType.BOOLEAN), + @Property( + key = CoreProperties.CORE_SKIPPED_MODULES_PROPERTY, + name = "Exclude modules", + description = "Maven artifact ids of modules to exclude.", + project = true, + global = false, + multiValues = true, + category = CoreProperties.CATEGORY_EXCLUSIONS), + @Property( + key = CoreProperties.CORE_FORCE_AUTHENTICATION_PROPERTY, + defaultValue = "" + CoreProperties.CORE_FORCE_AUTHENTICATION_DEFAULT_VALUE, + name = "Force user authentication", + description = "Forcing user authentication stops un-logged users to access Sonar.", + project = false, + global = true, + category = CoreProperties.CATEGORY_SECURITY, + type = PropertyType.BOOLEAN), + @Property( + key = CoreProperties.CORE_ALLOW_USERS_TO_SIGNUP_PROPERTY, + defaultValue = "" + CoreProperties.CORE_ALLOW_USERS_TO_SIGNUP_DEAULT_VALUE, + name = "Allow users to sign up online", + description = "Users can sign up online.", + project = false, + global = true, + category = CoreProperties.CATEGORY_SECURITY, + type = PropertyType.BOOLEAN), + @Property( + key = CoreProperties.CORE_DEFAULT_GROUP, + defaultValue = CoreProperties.CORE_DEFAULT_GROUP_DEFAULT_VALUE, + name = "Default user group", + description = "Any new users will automatically join this group.", + project = false, + global = true, + category = CoreProperties.CATEGORY_SECURITY), + @Property( + key = CoreProperties.CORE_VIOLATION_LOCALE_PROPERTY, + defaultValue = "en", + name = "Locale used for violation messages", + description = "Locale to be used when generating violation messages. It's up to each rule engine to support this global internationalization property", + project = true, + global = true, + category = CoreProperties.CATEGORY_L10N), + @Property( + key = "sonar.timemachine.period1", + name = "Period 1", + description = "Period used to compare measures and track new violations. Values are :

" + + "

When specifying a number of days or a date, the snapshot selected for comparison is " + + " the first one available inside the corresponding time range.

" + + "

Changing this property only takes effect after subsequent project inspections.

", + project = false, + global = true, + defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_1, + category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS), + @Property( + key = "sonar.timemachine.period2", + name = "Period 2", + description = "See the property 'Period 1'", + project = false, + global = true, + defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_2, + category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS), + @Property( + key = "sonar.timemachine.period3", + name = "Period 3", + description = "See the property 'Period 1'", + project = false, + global = true, + defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_3, + category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS), + @Property( + key = "sonar.timemachine.period4", + name = "Period 4", + description = "Period used to compare measures and track new violations. This property is specific to the project. Values are : " + + "

" + + "

When specifying a number of days or a date, the snapshot selected for comparison is the first one available inside the corresponding time range.

" + + "

Changing this property only takes effect after subsequent project inspections.

", + project = true, + global = false, + defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_4, + category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS), + @Property( + key = "sonar.timemachine.period5", + name = "Period 5", + description = "See the property 'Period 4'", + project = true, + global = false, + defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_5, + category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS), + @Property( + key = CoreProperties.DRY_RUN, + defaultValue = "false", + name = "Dry Run", + type = PropertyType.BOOLEAN, + global = false, project = false, + category = CoreProperties.CATEGORY_GENERAL), + @Property( + key = CoreProperties.DRY_RUN_INCLUDE_PLUGINS, + name = "Plugins accepted for dry run", + defaultValue = CoreProperties.DRY_RUN_INCLUDE_PLUGINS_DEFAULT_VALUE, + global = true, project = false, + category = CoreProperties.CATEGORY_GENERAL), + @Property( + key = CoreProperties.DRY_RUN_EXCLUDE_PLUGINS, + name = "Plugins excluded for dry run", + global = true, project = false, + defaultValue = CoreProperties.DRY_RUN_EXCLUDE_PLUGINS_DEFAULT_VALUE, + category = CoreProperties.CATEGORY_GENERAL), + @Property( + key = "sonar.dryRun.export.path", + defaultValue = "dryRun.json", + name = "Dry Run Results Export File", + type = PropertyType.STRING, + global = false, project = false), - // SERVER-SIDE TECHNICAL PROPERTIES + // SERVER-SIDE TECHNICAL PROPERTIES - @Property( - key = "sonar.security.realm", - name = "Security Realm", - project = false, - global = false - ), - @Property( - key = "sonar.security.savePassword", - name = "Save external password", - project = false, - global = false - ), - @Property( - key = "sonar.authenticator.downcase", - name = "Downcase login", - description = "Downcase login during user authentication, typically for Active Directory", - project = false, - global = false, - defaultValue = "false", - type = PropertyType.BOOLEAN), - @Property( - key = CoreProperties.CORE_AUTHENTICATOR_CREATE_USERS, - name = "Create user accounts", - description = "Create accounts when authenticating users via an external system", - project = false, - global = false, - defaultValue = "true", - type = PropertyType.BOOLEAN), - @Property( - key = CoreProperties.CORE_AUTHENTICATOR_IGNORE_STARTUP_FAILURE, - name = "Ignore failures during authenticator startup", - defaultValue = "false", - project = false, - global = false, - type = PropertyType.BOOLEAN) + @Property( + key = "sonar.security.realm", + name = "Security Realm", + project = false, + global = false + ), + @Property( + key = "sonar.security.savePassword", + name = "Save external password", + project = false, + global = false + ), + @Property( + key = "sonar.authenticator.downcase", + name = "Downcase login", + description = "Downcase login during user authentication, typically for Active Directory", + project = false, + global = false, + defaultValue = "false", + type = PropertyType.BOOLEAN), + @Property( + key = CoreProperties.CORE_AUTHENTICATOR_CREATE_USERS, + name = "Create user accounts", + description = "Create accounts when authenticating users via an external system", + project = false, + global = false, + defaultValue = "true", + type = PropertyType.BOOLEAN), + @Property( + key = CoreProperties.CORE_AUTHENTICATOR_IGNORE_STARTUP_FAILURE, + name = "Ignore failures during authenticator startup", + defaultValue = "false", + project = false, + global = false, + type = PropertyType.BOOLEAN) }) public final class CorePlugin extends SonarPlugin { @SuppressWarnings("unchecked") public List getExtensions() { return ImmutableList.of( - DefaultResourceTypes.class, - UserManagedMetrics.class, - ProjectFileSystemLogger.class, - Periods.class, + DefaultResourceTypes.class, + UserManagedMetrics.class, + ProjectFileSystemLogger.class, + Periods.class, - // maven - MavenInitializer.class, + // maven + MavenInitializer.class, - // languages - Java.class, + // languages + Java.class, - // pages - Lcom4Viewer.class, - TestsViewer.class, + // pages + Lcom4Viewer.class, + TestsViewer.class, - // measure filters - ProjectFilter.class, - MyFavouritesFilter.class, + // measure filters + ProjectFilter.class, + MyFavouritesFilter.class, - // widgets - AlertsWidget.class, - CoverageWidget.class, - ItCoverageWidget.class, - CommentsDuplicationsWidget.class, - DescriptionWidget.class, - ComplexityWidget.class, - RulesWidget.class, - SizeWidget.class, - EventsWidget.class, - CustomMeasuresWidget.class, - TimelineWidget.class, - TimeMachineWidget.class, - HotspotMetricWidget.class, - HotspotMostViolatedResourcesWidget.class, - HotspotMostViolatedRulesWidget.class, - MyReviewsWidget.class, - ProjectReviewsWidget.class, - FalsePositiveReviewsWidget.class, - ReviewsPerDeveloperWidget.class, - PlannedReviewsWidget.class, - UnplannedReviewsWidget.class, - ActionPlansWidget.class, - ReviewsMetricsWidget.class, - TreemapWidget.class, - MeasureFilterListWidget.class, - MeasureFilterTreemapWidget.class, - WelcomeWidget.class, + // widgets + AlertsWidget.class, + CoverageWidget.class, + ItCoverageWidget.class, + CommentsDuplicationsWidget.class, + DescriptionWidget.class, + ComplexityWidget.class, + RulesWidget.class, + SizeWidget.class, + EventsWidget.class, + CustomMeasuresWidget.class, + TimelineWidget.class, + TimeMachineWidget.class, + HotspotMetricWidget.class, + HotspotMostViolatedResourcesWidget.class, + HotspotMostViolatedRulesWidget.class, + MyReviewsWidget.class, + ProjectReviewsWidget.class, + FalsePositiveReviewsWidget.class, + ReviewsPerDeveloperWidget.class, + PlannedReviewsWidget.class, + UnplannedReviewsWidget.class, + ActionPlansWidget.class, + ReviewsMetricsWidget.class, + TreemapWidget.class, + MeasureFilterListWidget.class, + MeasureFilterTreemapWidget.class, + WelcomeWidget.class, - // dashboards - ProjectDefaultDashboard.class, - ProjectHotspotDashboard.class, - ProjectReviewsDashboard.class, - ProjectTimeMachineDashboard.class, - GlobalDefaultDashboard.class, + // dashboards + ProjectDefaultDashboard.class, + ProjectHotspotDashboard.class, + ProjectReviewsDashboard.class, + ProjectTimeMachineDashboard.class, + GlobalDefaultDashboard.class, - // chart - XradarChart.class, - DistributionBarChart.class, - DistributionAreaChart.class, + // chart + XradarChart.class, + DistributionBarChart.class, + DistributionAreaChart.class, - // colorizers - JavaColorizerFormat.class, + // colorizers + JavaColorizerFormat.class, - // batch - ProfileSensor.class, - ProfileEventsSensor.class, - ProjectLinksSensor.class, - UnitTestDecorator.class, - VersionEventsSensor.class, - CheckAlertThresholds.class, - GenerateAlertEvents.class, - ViolationsDecorator.class, - WeightedViolationsDecorator.class, - ViolationsDensityDecorator.class, - LineCoverageDecorator.class, - CoverageDecorator.class, - BranchCoverageDecorator.class, - ItLineCoverageDecorator.class, - ItCoverageDecorator.class, - ItBranchCoverageDecorator.class, - OverallLineCoverageDecorator.class, - OverallCoverageDecorator.class, - OverallBranchCoverageDecorator.class, - ApplyProjectRolesDecorator.class, - ExcludedResourceFilter.class, - CommentDensityDecorator.class, - NoSonarFilter.class, - DirectoriesDecorator.class, - FilesDecorator.class, - ReviewNotifications.class, - ReviewWorkflowDecorator.class, - ReferenceAnalysis.class, - ManualMeasureDecorator.class, - ManualViolationInjector.class, - ViolationSeverityUpdater.class, - IndexProjectPostJob.class, - ReviewsMeasuresDecorator.class, + // batch + ProfileSensor.class, + ProfileEventsSensor.class, + ProjectLinksSensor.class, + UnitTestDecorator.class, + VersionEventsSensor.class, + CheckAlertThresholds.class, + GenerateAlertEvents.class, + ViolationsDecorator.class, + WeightedViolationsDecorator.class, + ViolationsDensityDecorator.class, + LineCoverageDecorator.class, + CoverageDecorator.class, + BranchCoverageDecorator.class, + ItLineCoverageDecorator.class, + ItCoverageDecorator.class, + ItBranchCoverageDecorator.class, + OverallLineCoverageDecorator.class, + OverallCoverageDecorator.class, + OverallBranchCoverageDecorator.class, + ApplyProjectRolesDecorator.class, + ExcludedResourceFilter.class, + CommentDensityDecorator.class, + NoSonarFilter.class, + DirectoriesDecorator.class, + FilesDecorator.class, + ReviewNotifications.class, + ReviewWorkflowDecorator.class, + ReferenceAnalysis.class, + ManualMeasureDecorator.class, + ManualViolationInjector.class, + ViolationSeverityUpdater.class, + IndexProjectPostJob.class, + ReviewsMeasuresDecorator.class, - // time machine - TendencyDecorator.class, - VariationDecorator.class, - ViolationTrackingDecorator.class, - ViolationPersisterDecorator.class, - NewViolationsDecorator.class, - TimeMachineConfigurationPersister.class, - NewCoverageFileAnalyzer.class, - NewItCoverageFileAnalyzer.class, - NewOverallCoverageFileAnalyzer.class, - NewCoverageAggregator.class); + // time machine + TendencyDecorator.class, + VariationDecorator.class, + ViolationTrackingDecorator.class, + ViolationPersisterDecorator.class, + NewViolationsDecorator.class, + TimeMachineConfigurationPersister.class, + NewCoverageFileAnalyzer.class, + NewItCoverageFileAnalyzer.class, + NewOverallCoverageFileAnalyzer.class, + NewCoverageAggregator.class); } } diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TimelineWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TimelineWidget.java index 25d19a9f740..930e5b02dfb 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TimelineWidget.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TimelineWidget.java @@ -26,12 +26,31 @@ import org.sonar.api.web.WidgetPropertyType; @WidgetCategory("History") @WidgetProperties({ - @WidgetProperty(key = "chartTitle", type = WidgetPropertyType.STRING), - @WidgetProperty(key = "metric1", type = WidgetPropertyType.METRIC, defaultValue = "ncloc", options = {WidgetConstants.FILTER_OUT_NEW_METRICS}), - @WidgetProperty(key = "metric2", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}), - @WidgetProperty(key = "metric3", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}), - @WidgetProperty(key = "hideEvents", type = WidgetPropertyType.BOOLEAN), - @WidgetProperty(key = "chartHeight", type = WidgetPropertyType.INTEGER, defaultValue = "80") + @WidgetProperty(key = "chartTitle", type = WidgetPropertyType.STRING, description = "chartTitle description"), + @WidgetProperty(key = "metric1", type = WidgetPropertyType.METRIC, defaultValue = "ncloc", options = {WidgetConstants.FILTER_OUT_NEW_METRICS}, description = "metric1 description"), + @WidgetProperty(key = "metric2", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}, description = "metric2 description"), + @WidgetProperty(key = "metric3", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}, description = "metric3 description"), + @WidgetProperty(key = "hideEvents", type = WidgetPropertyType.BOOLEAN, description = "hideEvents description"), + @WidgetProperty(key = "hideEvents2", type = WidgetPropertyType.BOOLEAN, description = "hideEvents description", defaultValue = "true"), + @WidgetProperty(key = "chartHeight", type = WidgetPropertyType.INTEGER, defaultValue = "80", description = "chartHeight description"), + + @WidgetProperty(key = "text", type = WidgetPropertyType.TEXT, description = "text description"), + @WidgetProperty(key = "password", type = WidgetPropertyType.PASSWORD, description = "password description", defaultValue = "123"), + @WidgetProperty(key = "password2", type = WidgetPropertyType.PASSWORD, description = "password2 description"), + @WidgetProperty(key = "float", type = WidgetPropertyType.FLOAT, description = "float description"), + @WidgetProperty(key = "regex", type = WidgetPropertyType.REGULAR_EXPRESSION, description = "regex description"), + @WidgetProperty(key = "filter", type = WidgetPropertyType.FILTER, description = "filter description"), + @WidgetProperty( + key = "list", + defaultValue = "2", + type = WidgetPropertyType.SINGLE_SELECT_LIST, + options = {"1", "2", "3"}, + description = "list description"), + @WidgetProperty( + key = "list2", + type = WidgetPropertyType.SINGLE_SELECT_LIST, + options = {"1", "2", "3"}, + description = "list2 description") }) public class TimelineWidget extends CoreWidget { public TimelineWidget() { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/Property.java b/sonar-plugin-api/src/main/java/org/sonar/api/Property.java index 4802b6fe251..8d3a370ad15 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/Property.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/Property.java @@ -89,6 +89,7 @@ public @interface Property { * Options for *_LIST types * * @since 3.0 Options for property of type PropertyType.SINGLE_SELECT_LIST + * For example {"property_1", "property_3", "property_3"}). * * @since 3.3 Options for property of type PropertyType.METRIC. * If no option is specified, any metric will match. diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/web/WidgetProperty.java b/sonar-plugin-api/src/main/java/org/sonar/api/web/WidgetProperty.java index 90fe3ea39fe..f646a7822f9 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/web/WidgetProperty.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/web/WidgetProperty.java @@ -39,7 +39,7 @@ public @interface WidgetProperty { boolean optional() default true; /** - * Options for property of type WidgetPropertyType.METRIC. + * @since 3.3 Options for property of type WidgetPropertyType.METRIC. * * If no option is specified, any metric will match. * If options are specified, all must match for the metric to be displayed. @@ -48,7 +48,9 @@ public @interface WidgetProperty { * For example type:INT,FLOAT will match any metric of type INT or FLOAT. * For example type:NUMERIC will match any metric of numerictype. * - * @since 3.3 + * @since 3.5 Options for property of type WidgetPropertyType.SINGLE_SELECT_LIST + * For example {"property_1", "property_3", "property_3"}). + * */ String[] options() default {}; } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/web/WidgetPropertyType.java b/sonar-plugin-api/src/main/java/org/sonar/api/web/WidgetPropertyType.java index edff6ee319f..2b64edfd085 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/web/WidgetPropertyType.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/web/WidgetPropertyType.java @@ -73,5 +73,12 @@ public enum WidgetPropertyType { * * @since 3.2 */ - REGULAR_EXPRESSION + REGULAR_EXPRESSION, + + /** + * Single select list with a list of options + * + * @since 3.5 + */ + SINGLE_SELECT_LIST } diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/properties_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/properties_helper.rb index 2524b27bf20..9a3a2ff7a34 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/properties_helper.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/properties_helper.rb @@ -19,45 +19,88 @@ # module PropertiesHelper - # html_options support : - # :html_id - the id of the generated HTML element - # - def property_input_field(key, type, value, options, html_options = {}) - if type==PropertyType::TYPE_STRING - text_field_tag key, value, {:size => 25}.update(html_options) - - elsif type==PropertyType::TYPE_TEXT - text_area_tag key, value, {:rows => '6', :style => 'width: 100%'}.update(html_options) - - elsif type==PropertyType::TYPE_PASSWORD - password_field_tag key, value, {:size => 25}.update(html_options) - - elsif type==PropertyType::TYPE_BOOLEAN - (hidden_field_tag key, 'false', html_options) + (check_box_tag key, 'true', value=='true', html_options) - - elsif type==PropertyType::TYPE_INTEGER - text_field_tag key, value, {:size => 10}.update(html_options) - - elsif type==PropertyType::TYPE_FLOAT - text_field_tag key, value, {:size => 10}.update(html_options) - - elsif type==PropertyType::TYPE_METRIC - metric_select_tag key, metrics_filtered_by(options), {:selected_key => value, :allow_empty => true}.update(html_options) + SCREEN_SETTINGS = 'SETTINGS' + SCREEN_WIDGET = 'WIDGET' + SCREEN_RULES = 'RULES' - elsif type==PropertyType::TYPE_REGULAR_EXPRESSION - text_field_tag key, value, {:size => 25}.update(html_options) - - elsif type==PropertyType::TYPE_FILTER - user_filters = options_id(value, current_user.measure_filters) - shared_filters = options_id(value, MeasureFilter.find(:all, :conditions => ['(user_id<>? or user_id is null) and shared=?', current_user.id, true]).sort_by(&:name)) - - filters_combo = select_tag key, option_group('My Filters', user_filters) + option_group('Shared Filters', shared_filters), html_options - filter_link = link_to message('widget.filter.edit'), {:controller => 'measures', :action => 'manage'}, :class => 'link-action' - - "#{filters_combo} #{filter_link}" - - else - hidden_field_tag key, html_options + # + # screen is SETTINGS, WIDGET or RULES + # ==== Options + # * :id - html id to use if the name should not be used + # * :size + # * :values - list of values for metric and single select list + # * :default - default value + # * :disabled + # * :extra_values + # + def property_input_field(name, type, value, screen, options = {}) + + html_options = {:id => options[:id] || name} + html_options[:disabled] = 'disabled' if options[:disabled] + + case type + + when PropertyType::TYPE_STRING + text_field_tag name, value, {:size => options[:size] || 25}.update(html_options) + + when PropertyType::TYPE_TEXT + cols = options[:size] || nil + html_class = options[:size].nil? ? ' width100' : '' + text_area_tag name, value, {:class => html_class, :rows => '5', :cols => cols}.update(html_options) + + when PropertyType::TYPE_PASSWORD + password_field_tag name, value, {:size => options[:size] || 25}.update(html_options) + + when PropertyType::TYPE_BOOLEAN + if options[:default] + select_options = "" + select_options += "" + select_options += "" + select_tag name, select_options, html_options + else + (hidden_field_tag name, 'false', html_options) + (check_box_tag name, 'true', value=='true', html_options) + end + + when PropertyType::TYPE_INTEGER + size = options[:size] || 10 + text_field_tag name, value, {:size => size}.update(html_options) + + when PropertyType::TYPE_FLOAT + size = options[:size] || 10 + text_field_tag name, value, {:size => size}.update(html_options) + + when PropertyType::TYPE_METRIC + metric_select_tag name, metrics_filtered_by(options[:values]), {:html_id => options[:id], :selected_key => value, :allow_empty => true, + :placeholder => !options[:default].blank? ? message('default') : nil} + + when PropertyType::TYPE_REGULAR_EXPRESSION + size = options[:size] || 25 + text_field_tag name, value, {:size => size}.update(html_options) + + when PropertyType::TYPE_FILTER + user_filters = options_id(value, current_user.measure_filters) + shared_filters = options_id(value, MeasureFilter.find(:all, :conditions => ['(user_id<>? or user_id is null) and shared=?', current_user.id, true]).sort_by(&:name)) + + filters_combo = select_tag name, option_group('My Filters', user_filters) + option_group('Shared Filters', shared_filters), html_options + filter_link = link_to message('widget.filter.edit'), {:controller => 'measures', :action => 'manage'}, :class => 'link-action' + + "#{filters_combo} #{filter_link}" + + when PropertyType::TYPE_SINGLE_SELECT_LIST + default_value = options[:default].blank? ? '' : message('default') + select_options = "" + options[:values].each do |option| + if screen == SCREEN_WIDGET + message = message("widget.#{options[:extra_values][:key]}.option.#{name}.#{option}.name", :default => option) + else + message = option_name(options[:extra_values][:property], options[:extra_values][:field], option) + end + select_options += "" + end + select_tag name, select_options, html_options + + else + hidden_field_tag id, html_options end end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/rules_configuration_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/rules_configuration_helper.rb index 8f797bcd9fd..3ec0ee1aafd 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/rules_configuration_helper.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/rules_configuration_helper.rb @@ -49,8 +49,8 @@ module RulesConfigurationHelper def param_value_input(parameter, value, options = {}) type=type_with_compatibility(parameter.param_type) - - property_input_field 'value', type, value, nil, {:id => parameter.id}.update(options) + name = options[:name] || 'value' + property_input_field name, type, value, 'WIDGET', {:id => parameter.id, :size => options[:size] }.update(options) end def is_set(type) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/widget_properties_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/widget_properties_helper.rb index a6e161cecdb..53dd397cbfd 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/widget_properties_helper.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/widget_properties_helper.rb @@ -21,8 +21,10 @@ module WidgetPropertiesHelper include PropertiesHelper def property_value_field(definition, value, widget) - property_input_field definition.key, definition.type.name, value.nil? ? definition.defaultValue : value, definition.options, - {:html_id => "prop-#{widget.id}-#{widget.key.parameterize}-#{definition.key.parameterize}"} + id = definition.type.name != PropertyType::TYPE_METRIC ? definition.key : "prop-#{widget.id}-#{widget.key.parameterize}-#{definition.key.parameterize}" + options = {:values => definition.options, :id => id, :default => definition.defaultValue} + options[:extra_values] = {:key => widget.key} if definition.type.name == PropertyType::TYPE_SINGLE_SELECT_LIST + property_input_field definition.key, definition.type.name, value, 'WIDGET', options end end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/property_type.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/property_type.rb index 8fcb9f06da3..0ef74a897b8 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/property_type.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/property_type.rb @@ -24,7 +24,7 @@ class PropertyType TYPE_BOOLEAN = 'BOOLEAN' TYPE_INTEGER = 'INTEGER' TYPE_FLOAT = 'FLOAT' - #TYPE_SINGLE_SELECT_LIST = 'SINGLE_SELECT_LIST' + TYPE_SINGLE_SELECT_LIST = 'SINGLE_SELECT_LIST' TYPE_METRIC = 'METRIC' TYPE_LICENSE = 'LICENSE' TYPE_REGULAR_EXPRESSION = 'REGULAR_EXPRESSION' diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_widget_properties.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_widget_properties.html.erb index c903a8b2c8a..93fcc8f30ab 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_widget_properties.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_widget_properties.html.erb @@ -32,7 +32,13 @@ property_description = message("widget." + widget.key + ".param." + property_def.key(), :default => '') property_description = message("widget." + widget.key + ".property." + property_def.key() + ".desc", :default => property_def.description()) unless property_description != '' -%> - <%= property_description -%> + + <% unless property_description.blank? -%> +

<%= property_description -%>
+ <% end %> + <% unless property_def.defaultValue.blank? -%> +
<%= message('default') %>:: <%= property_def.type.name == PropertyType::TYPE_PASSWORD ? '********' : h(property_def.defaultValue) -%>
+ <% end -%> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_properties.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_properties.html.erb index fed0c43bc2b..f18db1161ff 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_properties.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_properties.html.erb @@ -44,7 +44,7 @@ <% default_prop_value = (@resource ? Property.value(property.key, nil, property.defaultValue) : property.defaultValue) -%> <% unless default_prop_value.blank? -%> -
Default: <%= property.type.to_s=='PASSWORD' ? '********' : h(default_prop_value) -%>
+
<%= message('default') %>: <%= property.type.to_s=='PASSWORD' ? '********' : h(default_prop_value) -%>
<% end -%> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_BOOLEAN.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_BOOLEAN.html.erb index 117cf3b9127..f465d0577e5 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_BOOLEAN.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_BOOLEAN.html.erb @@ -1,5 +1 @@ - \ No newline at end of file +<%= property_input_field(id, PropertyType::TYPE_BOOLEAN, value, PropertiesHelper::SCREEN_SETTINGS, {:id => id, :default => message('default')}) %> \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_FLOAT.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_FLOAT.html.erb index 80bad336880..01ea42e3c20 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_FLOAT.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_FLOAT.html.erb @@ -1 +1,5 @@ - \ No newline at end of file +<% + options = {:id => id} + options[:size] = (defined? size) ? size : 50 +%> +<%= property_input_field(id, PropertyType::TYPE_FLOAT, value, PropertiesHelper::SCREEN_SETTINGS, options) %> \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_INTEGER.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_INTEGER.html.erb index ea7d4d7d8e7..077ff457a3b 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_INTEGER.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_INTEGER.html.erb @@ -1 +1,5 @@ - \ No newline at end of file +<% + options = {:id => id} + options[:size] = (defined? size) ? size : 50 +%> +<%= property_input_field(id, PropertyType::TYPE_INTEGER, value, PropertiesHelper::SCREEN_SETTINGS, options) %> \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_METRIC.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_METRIC.html.erb index d06c87e3272..2ac1183619b 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_METRIC.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_METRIC.html.erb @@ -1,5 +1,5 @@ \ No newline at end of file +<% + options = {:id => id} + options[:size] = (defined? size) ? size : 50 +%> +<%= property_input_field(id, PropertyType::TYPE_PASSWORD, value, PropertiesHelper::SCREEN_SETTINGS, options) %> \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_REGULAR_EXPRESSION.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_REGULAR_EXPRESSION.html.erb index 80bad336880..26ef0412fa8 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_REGULAR_EXPRESSION.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_REGULAR_EXPRESSION.html.erb @@ -1 +1,5 @@ - \ No newline at end of file +<% + options = {:id => id} + options[:size] = (defined? size) ? size : 50 +%> +<%= property_input_field(id, PropertyType::TYPE_REGULAR_EXPRESSION, value, PropertiesHelper::SCREEN_SETTINGS, options) %> \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_SINGLE_SELECT_LIST.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_SINGLE_SELECT_LIST.html.erb index 2737ec732fc..9dbeac7a2b5 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_SINGLE_SELECT_LIST.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_SINGLE_SELECT_LIST.html.erb @@ -1,6 +1,2 @@ - \ No newline at end of file +<%= property_input_field(name, PropertyType::TYPE_SINGLE_SELECT_LIST, value, PropertiesHelper::SCREEN_SETTINGS, + {:id => id, :default => property.defaultValue, :values => property.options, :extra_values => {:property => property, :field => field}}) %> \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_STRING.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_STRING.html.erb index 80bad336880..903eb0b119f 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_STRING.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_STRING.html.erb @@ -1 +1,5 @@ - \ No newline at end of file +<% + options = {:id => id} + options[:size] = (defined? size) ? size : 50 +%> +<%= property_input_field(id, PropertyType::TYPE_STRING, value, PropertiesHelper::SCREEN_SETTINGS, options) %> \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_TEXT.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_TEXT.html.erb index 414175775dc..d3e59483f86 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_TEXT.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_TEXT.html.erb @@ -1 +1,5 @@ - \ No newline at end of file +<% + options = {:id => id} + options[:cols] = (defined? size) ? size : 50 +%> +<%= property_input_field(id, PropertyType::TYPE_TEXT, value, PropertiesHelper::SCREEN_SETTINGS, {:id => id, :cols => (defined? size) ? size : nil}) %> -- 2.39.5