From: Stas Vilchik Date: Mon, 9 Nov 2015 15:07:28 +0000 (+0100) Subject: SONAR-6918 fix display of internal WS X-Git-Tag: 5.3-RC1~356 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b115df733b619d9d5ebc1cdb783e06da48f14a59;p=sonarqube.git SONAR-6918 fix display of internal WS --- diff --git a/server/sonar-web/src/main/js/apps/api-documentation/action-view.js b/server/sonar-web/src/main/js/apps/api-documentation/action-view.js index 8ac7ec60f96..b96ca7e0c07 100644 --- a/server/sonar-web/src/main/js/apps/api-documentation/action-view.js +++ b/server/sonar-web/src/main/js/apps/api-documentation/action-view.js @@ -16,7 +16,7 @@ export default Marionette.ItemView.extend({ }, initialize: function () { - this.listenTo(this.options.state, 'change:query', this.toggleHidden); + this.listenTo(this.options.state, 'change', this.toggleHidden); }, onRender: function () { @@ -47,6 +47,6 @@ export default Marionette.ItemView.extend({ toggleHidden: function () { var test = this.model.get('path') + '/' + this.model.get('key'); - this.$el.toggleClass('hidden', !this.options.state.match(test)); + this.$el.toggleClass('hidden', !this.options.state.match(test, this.model.get('internal'))); } }); diff --git a/server/sonar-web/src/main/js/apps/api-documentation/app.js b/server/sonar-web/src/main/js/apps/api-documentation/app.js index f345685e8da..ac3f28c00cf 100644 --- a/server/sonar-web/src/main/js/apps/api-documentation/app.js +++ b/server/sonar-web/src/main/js/apps/api-documentation/app.js @@ -16,9 +16,10 @@ var App = new Marionette.Application(), // State this.state = new Backbone.Model({ internal: false }); - this.state.match = function (test) { + this.state.match = function (test, internal) { var pattern = new RegExp(this.get('query'), 'i'); - return test.search(pattern) !== -1; + var internalCheck = !this.get('internal') && internal; + return test.search(pattern) !== -1 && !internalCheck; }; // Layout diff --git a/server/sonar-web/src/main/js/apps/api-documentation/controller.js b/server/sonar-web/src/main/js/apps/api-documentation/controller.js index 1d668e2d46f..4b75c7138df 100644 --- a/server/sonar-web/src/main/js/apps/api-documentation/controller.js +++ b/server/sonar-web/src/main/js/apps/api-documentation/controller.js @@ -62,7 +62,13 @@ export default Marionette.Controller.extend({ this.options.app.layout.headerRegion.show(new HeaderView({ model: item })); if (opts.action != null) { - actionsView.scrollToAction(opts.action); + var model = actions.findWhere({ key: opts.action }); + if (model) { + if (model.get('internal')) { + this.options.state.set({ internal: true }); + } + actionsView.scrollToAction(opts.action); + } } else { actionsView.scrollToTop(); } diff --git a/server/sonar-web/src/main/js/apps/api-documentation/item-view.js b/server/sonar-web/src/main/js/apps/api-documentation/item-view.js index 6a8c1143b17..c8435bae324 100644 --- a/server/sonar-web/src/main/js/apps/api-documentation/item-view.js +++ b/server/sonar-web/src/main/js/apps/api-documentation/item-view.js @@ -25,7 +25,7 @@ export default Marionette.ItemView.extend({ var match = this.options.state.match(this.model.get('path')) || _.some(this.model.get('actions'), function (action) { var test = action.path + '/' + action.key; - return that.options.state.match(test); + return that.options.state.match(test, action.internal); }); var showInternal = this.options.state.get('internal'),