diff options
4 files changed, 95 insertions, 29 deletions
diff --git a/server/sonar-web/src/main/hbs/coding-rules/coding-rules-rule-details.hbs b/server/sonar-web/src/main/hbs/coding-rules/coding-rules-rule-details.hbs index c4eca54f63d..f889780e6c6 100644 --- a/server/sonar-web/src/main/hbs/coding-rules/coding-rules-rule-details.hbs +++ b/server/sonar-web/src/main/hbs/coding-rules/coding-rules-rule-details.hbs @@ -10,7 +10,7 @@ {{else}} <button class="js-edit-custom" id="coding-rules-detail-custom-rule-change">{{t 'edit'}}</button> {{/if}} - <button class="js-delete" id="coding-rules-detail-rule-delete" class="button-red">{{t 'delete'}}</button> + <button class="button-red js-delete" id="coding-rules-detail-rule-delete" class="button-red">{{t 'delete'}}</button> </div> </div> {{/if}} diff --git a/server/sonar-web/src/main/js/coding-rules/rule-details-view.js b/server/sonar-web/src/main/js/coding-rules/rule-details-view.js index 433acd69bf5..2f608db03a3 100644 --- a/server/sonar-web/src/main/js/coding-rules/rule-details-view.js +++ b/server/sonar-web/src/main/js/coding-rules/rule-details-view.js @@ -66,6 +66,7 @@ define([ if (this.model.get('isTemplate')) { this.fetchCustomRules(); } + this.listenTo(this.options.app.state, 'change:selectedIndex', this.select); }, onRender: function () { @@ -129,12 +130,10 @@ define([ var that = this; key('up', 'details', function () { that.options.app.controller.selectPrev(); - that.options.app.controller.showDetailsForSelected(); return false; }); key('down', 'details', function () { that.options.app.controller.selectNext(); - that.options.app.controller.showDetailsForSelected(); return false; }); key('left, backspace', 'details', function () { @@ -177,6 +176,12 @@ define([ }); }, + select: function () { + var selected = this.options.app.state.get('selectedIndex'), + selectedRule = this.options.app.list.at(selected); + this.options.app.controller.showDetails(selectedRule); + }, + serializeData: function () { var isManual = this.model.get('isManual'), isCustom = this.model.has('templateKey'), diff --git a/server/sonar-web/src/main/js/nav/global-navbar-view.js b/server/sonar-web/src/main/js/nav/global-navbar-view.js index 6103084b73c..64b199752a1 100644 --- a/server/sonar-web/src/main/js/nav/global-navbar-view.js +++ b/server/sonar-web/src/main/js/nav/global-navbar-view.js @@ -83,9 +83,9 @@ define([ userName: window.SS.userName, isUserAdmin: window.SS.isUserAdmin, - canManageGlobalDashboards: window.SS.user != null, - canManageIssueFilters: window.SS.user != null, - canManageMeasureFilters: window.SS.user != null + canManageGlobalDashboards: !!window.SS.user, + canManageIssueFilters: !!window.SS.user, + canManageMeasureFilters: !!window.SS.user }); } }); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/Logger.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/Logger.java index 93d25ffd89f..9c8244bc1bb 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/Logger.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/Logger.java @@ -23,7 +23,7 @@ import javax.annotation.Nullable; /** * SonarQube plugins are not coupled with external logging libraries like SLF4J or Logback. - * <p/> + * <p></p> * Example: * <pre> * public class MyClass { @@ -35,13 +35,13 @@ import javax.annotation.Nullable; * } * } * </pre> - * <p/> + * <p></p> * Message arguments are defined with <code>{}</code>, but not with {@link java.util.Formatter} syntax. * - * <p/> + * <p></p> * INFO, WARN and ERROR levels are always enabled. They can't be disabled by users. * DEBUG and TRACE levels are enabled on demand with the property <code>sonar.log.level</code>. - * <p/> + * <p></p> * See {@link org.sonar.api.utils.log.LogTester} for testing facilities. * @since 5.1 */ @@ -50,7 +50,9 @@ public interface Logger { boolean isTraceEnabled(); /** - * Logs a TRACE message. TRACE messages must + * Logs a TRACE message. + * <p></p> + * TRACE messages must * be valuable for diagnosing production problems. They must not be used for development debugging. * They can significantly slow down performances. The standard use-case is logging of * SQL and Elasticsearch requests. @@ -58,17 +60,39 @@ public interface Logger { void trace(String msg); /** - * @see #trace(String) + * Logs an TRACE parameterized message according to the specified format and argument. Example: + * <code>trace("Value is {}", value)</code> + * <p></p> + * TRACE messages must + * be valuable for diagnosing production problems. They must not be used for development debugging. + * They can significantly slow down performances. The standard use-case is logging of + * SQL and Elasticsearch requests. */ void trace(String pattern, @Nullable Object arg); /** - * @see #trace(String) + * Logs an TRACE parameterized message according to the specified format and arguments. Example: + * <code>trace("Values are {} and {}", value1, value2)</code> + * <p></p> + * TRACE messages must + * be valuable for diagnosing production problems. They must not be used for development debugging. + * They can significantly slow down performances. The standard use-case is logging of + * SQL and Elasticsearch requests. */ void trace(String msg, @Nullable Object arg1, @Nullable Object arg2); /** - * @see #trace(String) + * Logs an TRACE parameterized message according to the specified format and arguments. Example: + * <code>trace("Values are {} and {}", value1, value2)</code> + * <p></p> + * TRACE messages must + * be valuable for diagnosing production problems. They must not be used for development debugging. + * They can significantly slow down performances. The standard use-case is logging of + * SQL and Elasticsearch requests. + * <p></p> + * This variant incurs the hidden cost of creating an Object[] before invoking the method. + * The variants taking one and two arguments exist solely in order to avoid this hidden cost. See + * {@link #trace(String, Object)} and {@link #trace(String, Object, Object)} */ void trace(String msg, Object... args); @@ -81,17 +105,33 @@ public interface Logger { void debug(String msg); /** - * @see #debug(String) + * Logs an DEBUG parameterized message according to the specified format and argument. Example: + * <code>debug("Value is {}", value)</code> + * <p></p> + * Debug messages must + * be valuable for diagnosing production problems. They must not be used for development debugging. */ void debug(String pattern, @Nullable Object arg); /** - * @see #debug(String) + * Logs an DEBUG parameterized message according to the specified format and arguments. Example: + * <code>debug("Values are {} and {}", value1, value2)</code> + * <p></p> + * Debug messages must + * be valuable for diagnosing production problems. They must not be used for development debugging. */ void debug(String msg, @Nullable Object arg1, @Nullable Object arg2); /** - * @see #debug(String) + * Logs an DEBUG parameterized message according to the specified format and arguments. Example: + * <code>debug("Values are {}, {} and {}", value1, value2, value3)</code> + * <p></p> + * Debug messages must + * be valuable for diagnosing production problems. They must not be used for development debugging. + * * <p></p> + * This variant incurs the hidden cost of creating an Object[] before invoking the method. + * The variants taking one and two arguments exist solely in order to avoid this hidden cost. See + * {@link #debug(String, Object)} and {@link #debug(String, Object, Object)} */ void debug(String msg, Object... args); @@ -101,17 +141,24 @@ public interface Logger { void info(String msg); /** - * @see #info(String) + * Logs an INFO parameterized message according to the specified format and argument. Example: + * <code>info("Value is {}", value)</code> */ void info(String msg, @Nullable Object arg); /** - * @see #info(String) + * Logs an INFO parameterized message according to the specified format and arguments. Example: + * <code>info("Values are {} and {}", value1, value2)</code> */ void info(String msg, @Nullable Object arg1, @Nullable Object arg2); /** - * @see #info(String) + * Logs an INFO parameterized message according to the specified format and arguments. Example: + * <code>info("Values are {}, {} and {}", value1, value2, value3)</code> + * <p></p> + * This variant incurs the hidden cost of creating an Object[] before invoking the method. + * The variants taking one and two arguments exist solely in order to avoid this hidden cost. See + * {@link #info(String, Object)} and {@link #info(String, Object, Object)} */ void info(String msg, Object... args); @@ -121,17 +168,24 @@ public interface Logger { void warn(String msg); /** - * @see #warn(String) + * Logs a WARN parameterized message according to the specified format and argument. Example: + * <code>warn("Value is {}", value)</code> */ void warn(String msg, @Nullable Object arg); /** - * @see #warn(String) + * Logs a WARN parameterized message according to the specified format and arguments. Example: + * <code>warn("Values are {} and {}", value1, value2)</code> */ void warn(String msg, @Nullable Object arg1, @Nullable Object arg2); /** - * @see #warn(String) + * Logs a WARN parameterized message according to the specified format and arguments. Example: + * <code>warn("Values are {}, {} and {}", value1, value2, value3)</code> + * <p></p> + * This variant incurs the hidden cost of creating an Object[] before invoking the method. + * The variants taking one and two arguments exist solely in order to avoid this hidden cost. See + * {@link #warn(String, Object)} and {@link #warn(String, Object, Object)} */ void warn(String msg, Object... args); @@ -141,22 +195,29 @@ public interface Logger { void error(String msg); /** - * @see #error(String) + * Logs an ERROR parameterized message according to the specified format and argument. Example: + * <code>error("Value is {}", value)</code> */ void error(String msg, @Nullable Object arg); /** - * @see #error(String) + * Logs a ERROR parameterized message according to the specified format and arguments. Example: + * <code>error("Values are {} and {}", value1, value2)</code> */ void error(String msg, @Nullable Object arg1, @Nullable Object arg2); /** - * @see #error(String) + * Logs a ERROR parameterized message according to the specified format and arguments. Example: + * <code>error("Values are {}, {} and {}", value1, value2, value3)</code> + * <p></p> + * This variant incurs the hidden cost of creating an Object[] before invoking the method. + * The variants taking one and two arguments exist solely in order to avoid this hidden cost. See + * {@link #error(String, Object)} and {@link #error(String, Object, Object)} */ void error(String msg, Object... args); /** - * @see #error(String) + * Logs an exception at the ERROR level with an accompanying message. */ void error(String msg, Throwable thrown); @@ -164,10 +225,10 @@ public interface Logger { * Attempt to change logger level. Return true if it succeeded, false if * the underlying logging facility does not allow to change level at * runtime. - * <p/> + * <p></p> * This method must not be used to enable DEBUG or TRACE logs in tests. Use * {@link org.sonar.api.utils.log.LogTester#setLevel(LoggerLevel)} instead. - * <p/> + * <p></p> * The standard use-case is to customize logging of embedded 3rd-party * libraries. */ |