--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import { getJSON } from '../helpers/request';
+
+export function fetchWebApi (showInternal = true) {
+ const url = '/api/webservices/list';
+ const data = { 'include_internals': showInternal };
+
+ return getJSON(url, data).then(r => r.webServices.map(domain => {
+ const internal = !domain.actions.find(action => !action.internal);
+
+ return { ...domain, internal };
+ }));
+}
+
+export function fetchResponseExample (domain, action) {
+ const url = '/api/webservices/response_example';
+ const data = { controller: domain, action };
+
+ return getJSON(url, data);
+}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import $ from 'jquery';
-import Marionette from 'backbone.marionette';
-import Template from './templates/api-documentation-action.hbs';
-
-export default Marionette.ItemView.extend({
- className: 'panel panel-vertical',
- template: Template,
-
- modelEvents: {
- 'change': 'render'
- },
-
- events: {
- 'click .js-show-response-example': 'onShowResponseExampleClick',
- 'click .js-hide-response-example': 'onHideResponseExampleClick'
- },
-
- initialize () {
- this.listenTo(this.options.state, 'change', this.toggleHidden);
- },
-
- onRender () {
- this.$el.attr('data-web-service', this.model.get('path'));
- this.$el.attr('data-action', this.model.get('key'));
- this.toggleHidden();
- this.$('[data-toggle="tooltip"]').tooltip({ container: 'body', placement: 'bottom' });
- },
-
- onShowResponseExampleClick (e) {
- e.preventDefault();
- this.fetchResponse();
- },
-
- onHideResponseExampleClick (e) {
- e.preventDefault();
- this.model.unset('responseExample');
- },
-
- fetchResponse () {
- const url = '/api/webservices/response_example';
- const options = { controller: this.model.get('path'), action: this.model.get('key') };
- return $.get(url, options).done(r => {
- this.model.set({ responseExample: r.example });
- });
- },
-
- toggleHidden () {
- const test = this.model.get('path') + '/' + this.model.get('key');
- this.$el.toggleClass('hidden', !this.options.state.match(test, this.model.get('internal')));
- }
-});
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import $ from 'jquery';
-import Marionette from 'backbone.marionette';
-import ActionView from './action-view';
-
-export default Marionette.CollectionView.extend({
- childView: ActionView,
-
- childViewOptions () {
- return {
- state: this.options.state
- };
- },
-
- scrollToTop () {
- let parent = this.$el.scrollParent();
- if (parent.is(document)) {
- parent = $(window);
- }
- parent.scrollTop(0);
- },
-
- scrollToAction (action) {
- const model = this.collection.findWhere({ key: action });
- if (model != null) {
- const view = this.children.findByModel(model);
- if (view != null) {
- this.scrollToView(view);
- }
- }
- },
-
- scrollToView (view) {
- const elOffset = view.el.getBoundingClientRect();
- if (elOffset != null) {
- const scrollTop = elOffset.top - 70;
- window.scrollTo(0, scrollTop);
- }
- }
-});
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import $ from 'jquery';
-import Backbone from 'backbone';
-import Marionette from 'backbone.marionette';
-import Router from './router';
-import Controller from './controller';
-import Layout from './layout';
-import List from './list';
-import ListView from './list-view';
-import FiltersView from './filters-view';
-import SearchView from './search-view';
-
-const App = new Marionette.Application();
-const init = function () {
- const options = window.sonarqube;
-
- // State
- this.state = new Backbone.Model({ internal: false });
- this.state.match = function (test, internal) {
- const pattern = new RegExp(this.get('query'), 'i');
- const internalCheck = !this.get('internal') && internal;
- return test.search(pattern) !== -1 && !internalCheck;
- };
-
- // Layout
- this.layout = new Layout({ el: options.el });
- this.layout.render();
- $('#footer').addClass('search-navigator-footer');
-
- // Web Services List
- this.list = new List();
-
- // Controller
- this.controller = new Controller({
- app: this,
- state: this.state
- });
-
- // List View
- this.listView = new ListView({
- collection: this.list,
- state: this.state
- });
- this.layout.resultsRegion.show(this.listView);
-
- // Filters View
- this.filtersView = new FiltersView({
- collection: this.list,
- state: this.state
- });
- this.layout.actionsRegion.show(this.filtersView);
-
- // Search View
- this.searchView = new SearchView({
- state: this.state
- });
- this.layout.searchRegion.show(this.searchView);
-
- // Router
- this.router = new Router({ app: this });
- Backbone.history.start({
- pushState: true,
- root: options.urlRoot
- });
-};
-
-App.on('start', function (options) {
- init.call(App, options);
-});
-
-window.sonarqube.appStarted.then(options => App.start(options));
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import _ from 'underscore';
-import Backbone from 'backbone';
-import Marionette from 'backbone.marionette';
-import ActionsView from './actions-view';
-import HeaderView from './header-view';
-
-export default Marionette.Controller.extend({
- initialize (options) {
- this.list = options.app.list;
- this.listenTo(this.list, 'select', this.onItemSelect);
- },
-
- show (path) {
- const that = this;
- this.fetchList().done(function () {
- if (path) {
- const item = that.list.findWhere({ path });
- if (item != null) {
- that.showWebService(path);
- } else {
- that.showAction(path);
- }
- }
- });
- },
-
- showWebService (path) {
- const item = this.list.findWhere({ path });
- if (item != null) {
- item.trigger('select', item);
- }
- },
-
- showAction (path) {
- const webService = this.list.find(function (item) {
- return path.indexOf(item.get('path')) === 0;
- });
- if (webService != null) {
- const action = path.substr(webService.get('path').length + 1);
- webService.trigger('select', webService, { trigger: false, action });
- }
- },
-
- onItemSelect (item, options) {
- const path = item.get('path');
- const opts = _.defaults(options || {}, { trigger: true });
- if (opts.trigger) {
- this.options.app.router.navigate(path);
- }
- this.options.app.listView.highlight(path);
-
- if (item.get('internal')) {
- this.options.state.set({ internal: true });
- }
-
- const actions = new Backbone.Collection(item.get('actions'));
- const actionsView = new ActionsView({
- collection: actions,
- state: this.options.state
- });
- this.options.app.layout.detailsRegion.show(actionsView);
- this.options.app.layout.headerRegion.show(new HeaderView({ model: item }));
-
- if (opts.action != null) {
- const 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();
- }
- },
-
- fetchList () {
- return this.list.fetch({ data: { 'include_internals': true } });
- }
-});
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import _ from 'underscore';
-import Marionette from 'backbone.marionette';
-import Template from './templates/api-documentation-filters.hbs';
-
-export default Marionette.ItemView.extend({
- template: Template,
-
- events: {
- 'change .js-toggle-internal': 'toggleInternal'
- },
-
- initialize () {
- this.listenTo(this.options.state, 'change:internal', this.render);
- },
-
- toggleInternal () {
- this.options.state.set({ internal: !this.options.state.get('internal') });
- },
-
- serializeData () {
- return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
- state: this.options.state.toJSON()
- });
- }
-});
-
-
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import Marionette from 'backbone.marionette';
-import Template from './templates/api-documentation-header.hbs';
-
-export default Marionette.ItemView.extend({
- template: Template,
-
- modelEvents: {
- 'change': 'render'
- }
-});
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import _ from 'underscore';
-import Marionette from 'backbone.marionette';
-import Template from './templates/api-documentation-web-service.hbs';
-
-export default Marionette.ItemView.extend({
- tagName: 'a',
- className: 'list-group-item',
- template: Template,
-
- modelEvents: {
- 'change': 'render'
- },
-
- events: {
- 'click': 'onClick'
- },
-
- initialize () {
- this.listenTo(this.options.state, 'change:query', this.toggleHidden);
- this.listenTo(this.options.state, 'change:internal', this.toggleHidden);
- },
-
- shouldBeHidden () {
- const that = this;
- const match = this.options.state.match(this.model.get('path')) ||
- _.some(this.model.get('actions'), function (action) {
- const test = action.path + '/' + action.key;
- return that.options.state.match(test, action.internal);
- });
-
- const showInternal = this.options.state.get('internal');
- const hideMe = this.model.get('internal') && !showInternal;
- return !match || hideMe;
- },
-
- onRender () {
- this.$el.attr('data-path', this.model.get('path'));
- this.$el.toggleClass('active', this.options.highlighted);
- this.toggleHidden();
- this.$('[data-toggle="tooltip"]').tooltip({ container: 'body', placement: 'right' });
- },
-
- onClick (e) {
- e.preventDefault();
- this.model.trigger('select', this.model);
- },
-
- toggleHidden () {
- this.$el.toggleClass('hidden', this.shouldBeHidden());
- }
-});
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import Marionette from 'backbone.marionette';
-import Template from './templates/api-documentation-layout.hbs';
-
-export default Marionette.LayoutView.extend({
- template: Template,
-
- regions: {
- headerRegion: '.search-navigator-workspace-header',
- actionsRegion: '.search-navigator-filters',
- searchRegion: '.api-documentation-search',
- resultsRegion: '.api-documentation-results',
- detailsRegion: '.search-navigator-workspace-details'
- },
-
- onRender () {
- const navigator = this.$('.search-navigator');
- navigator.addClass('sticky search-navigator-extended-view');
- const top = navigator.offset().top;
- this.$('.search-navigator-workspace-header').css({ top });
- this.$('.search-navigator-side').css({ top }).isolatedScroll();
- }
-});
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import Marionette from 'backbone.marionette';
-import ItemView from './item-view';
-
-export default Marionette.CollectionView.extend({
- className: 'list-group',
- childView: ItemView,
-
- childViewOptions (model) {
- return {
- collectionView: this,
- highlighted: model.get('path') === this.highlighted,
- state: this.options.state
- };
- },
-
- highlight (path) {
- this.highlighted = path;
- this.render();
- }
-});
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import _ from 'underscore';
-import Backbone from 'backbone';
-
-export default Backbone.Collection.extend({
- url: '/api/webservices/list',
- comparator: 'path',
-
- parse (r) {
- return r.webServices.map(function (webService) {
- const internal = _.every(webService.actions, function (action) {
- return action.internal;
- });
- const actions = webService.actions.map(function (action) {
- return _.extend(action, { path: webService.path });
- });
- return _.extend(webService, {
- internal,
- actions
- });
- });
- }
-});
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import Backbone from 'backbone';
-
-export default Backbone.Router.extend({
- routes: {
- '*path': 'show'
- },
-
- initialize (options) {
- this.app = options.app;
- },
-
- show (path) {
- this.app.controller.show(path);
- }
-});
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import _ from 'underscore';
-import Marionette from 'backbone.marionette';
-import Template from './templates/api-documentation-search.hbs';
-
-export default Marionette.ItemView.extend({
- template: Template,
-
- ui: {
- input: '.search-box-input'
- },
-
- events: {
- 'keyup @ui.input': 'onChange',
- 'search @ui.input': 'onChange'
- },
-
- initialize () {
- this.query = '';
- this.debouncedFilter = _.debounce(this.filter, 250);
- },
-
- onChange () {
- const query = this.ui.input.val();
- if (query === this.query) {
- return;
- }
- this.query = this.ui.input.val();
- this.debouncedFilter(query);
- },
-
- filter (query) {
- this.options.state.set({ query });
- }
-});
+++ /dev/null
-<header class="page-header">
- <h3 class="page-title big">{{#if post}}POST{{else}}GET{{/if}} {{this.path}}/{{key}}</h3>
-
- <div class="page-actions">
- {{#if internal}}
- <span class="spacer-right">
- <span class="badge" data-toggle="tooltip" title="{{t 'api_documentation.internal_tooltip'}}">internal</span>
- </span>
- {{/if}}
- {{#if deprecatedSince}}
- <span class="spacer-right">
- <span class="badge badge-danger" data-toggle="tooltip"
- title="{{t 'api_documentation.deprecation_tooltip'}}">Deprecated since {{deprecatedSince}}</span>
- </span>
- {{/if}}
- {{#if since}}
- <span class="spacer-right">
- <span class="note">Since {{since}}</span>
- </span>
- {{/if}}
-
- <a class="js-permalink icon-link" href="{{link '/api_documentation/' this.path '/' key}}" target="_blank"></a>
- </div>
-</header>
-
-<div class="markdown">{{{description}}}</div>
-
-{{#if params}}
- <h4 class="spacer-top little-spacer-bottom">Parameters</h4>
- <table class="width-100 data zebra">
- {{#each params}}
- <tr>
- <td style="width: 10em;">
- <code>{{key}}</code>
- <div class="note">{{#if required}}required{{else}}optional{{/if}}</div>
- {{#if since}}
- <div class="note">since {{since}}</div>
- {{/if}}
- {{#if deprecatedSince}}
- <span class="badge badge-danger little-spacer-top" data-toggle="tooltip"
- title="{{t 'api_documentation.deprecation_tooltip'}}">deprecated since {{deprecatedSince}}</span>
- {{/if}}
- </td>
- <td>
- <div class="markdown">{{{description}}}</div>
-
- {{#if possibleValues}}
- <p class="little-spacer-top">
- <strong>Possible values:</strong>
- </p>
- <ul class="list-styled">
- {{#each possibleValues}}
- <li class="little-spacer-top"><code>{{this}}</code></li>
- {{/each}}
- </ul>
- {{/if}}
-
- {{#if defaultValue}}
- <p class="little-spacer-top">
- <strong>Default value:</strong> <code>{{defaultValue}}</code>
- </p>
- {{/if}}
-
- {{#if exampleValue}}
- <p class="little-spacer-top">
- <strong>Example value:</strong> <code>{{exampleValue}}</code>
- </p>
- {{/if}}
- </td>
- </tr>
- {{/each}}
- </table>
-{{/if}}
-
-{{#if hasResponseExample}}
- <h4 class="spacer-top">
- Example Response
- {{#if responseExample}}
- <a class="js-hide-response-example little-spacer-left" href="#">Hide</a>
- {{else}}
- <a class="js-show-response-example little-spacer-left" href="#">Show</a>
- {{/if}}
- </h4>
-
- {{#if responseExample}}
- <div class="little-spacer-top">
- <pre style="white-space: pre-wrap;">{{responseExample}}</pre>
- </div>
- {{/if}}
-{{/if}}
+++ /dev/null
-<h1 class="page-title">Web Service API</h1>
-
-<div class="page-actions">
- <input class="js-toggle-internal" type="checkbox" id="api-documentation-show-internal" {{#if state.internal}}checked{{/if}}>
- <label for="api-documentation-show-internal">Show Internal</label>
-</div>
+++ /dev/null
-<h2 class="search-navigator-header-component">{{this.path}}</h2>
+++ /dev/null
-<div class="search-navigator sticky">
- <div class="search-navigator-side search-navigator-side-light">
- <div class="search-navigator-filters"></div>
- <div class="api-documentation-search"></div>
- <div class="api-documentation-results panel"></div>
- </div>
-
- <div class="search-navigator-workspace">
- <div class="search-navigator-workspace-header"></div>
- <div class="search-navigator-workspace-details"></div>
- </div>
-</div>
+++ /dev/null
-<form id="api-documentation-search-form" class="search-box">
- <span id="api-documentation-search-submit" class="search-box-submit button-clean"><i class="icon-search"></i></span>
- <input id="api-documentation-search-query" class="search-box-input" type="search" name="q" placeholder="Search" maxlength="100">
-</form>
+++ /dev/null
-<h3 class="list-group-item-heading">
- {{this.path}}
- {{#if internal}}
- <span class="badge" data-toggle="tooltip" title="{{t 'api_documentation.internal_tooltip'}}">internal</span>
- {{/if}}
-</h3>
-<p class="list-group-item-text">{{{description}}}</p>
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import React from 'react';
+import { render } from 'react-dom';
+import { Router, Route, Redirect, useRouterHistory } from 'react-router';
+import { createHistory } from 'history';
+
+import WebApiApp from './components/WebApiApp';
+import './styles/web-api.css';
+
+window.sonarqube.appStarted.then(options => {
+ const el = document.querySelector(options.el);
+
+ const history = useRouterHistory(createHistory)({
+ basename: window.sonarqube.urlRoot
+ });
+
+ render((
+ <Router history={history}>
+ <Redirect from="/index" to="/"/>
+ <Route path="/**" component={WebApiApp}/>
+ </Router>
+ ), el);
+});
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import React from 'react';
+import { Link } from 'react-router';
+
+import { getActionKey } from '../utils';
+import Params from './Params';
+import ResponseExample from './ResponseExample';
+import DeprecatedBadge from './DeprecatedBadge';
+import InternalBadge from './InternalBadge';
+
+export default class Action extends React.Component {
+ state = {
+ showParams: false,
+ showResponse: false
+ };
+
+ handleShowParamsClick (e) {
+ e.preventDefault();
+ this.refs.toggleParameters.blur();
+ this.setState({ showParams: !this.state.showParams });
+ }
+
+ handleShowResponseClick (e) {
+ e.preventDefault();
+ this.refs.toggleResponse.blur();
+ this.setState({ showResponse: !this.state.showResponse });
+ }
+
+ render () {
+ const { action, domain } = this.props;
+ const { showParams, showResponse } = this.state;
+ const verb = action.post ? 'POST' : 'GET';
+ const actionKey = getActionKey(domain.path, action.key);
+
+ return (
+ <div id={actionKey} className="web-api-action">
+ <header className="web-api-action-header">
+ <Link
+ to={{ pathname: '/' + actionKey }}
+ className="spacer-right icon-link"/>
+
+ <h3 className="web-api-action-title">
+ {verb} {actionKey}
+ </h3>
+
+ {action.internal && (
+ <span className="spacer-left">
+ <InternalBadge/>
+ </span>
+ )}
+
+ {action.since && (
+ <span className="spacer-left badge">since {action.since}</span>
+ )}
+
+ {action.deprecatedSince && (
+ <span className="spacer-left">
+ <DeprecatedBadge since={action.deprecatedSince}/>
+ </span>
+ )}
+ </header>
+
+ <div
+ className="web-api-action-description markdown"
+ dangerouslySetInnerHTML={{ __html: action.description }}/>
+
+ {(action.params || action.hasResponseExample) && (
+ <ul className="web-api-action-actions list-inline">
+ {action.params && (
+ <li>
+ <a
+ ref="toggleParameters"
+ onClick={this.handleShowParamsClick.bind(this)}
+ href="#">
+ {showParams ? 'Hide Parameters' : 'Show Parameters'}
+ </a>
+ </li>
+ )}
+
+ {action.hasResponseExample && (
+ <li>
+ <a
+ ref="toggleResponse"
+ onClick={this.handleShowResponseClick.bind(this)}
+ href="#">
+ {showResponse ? 'Hide Response Example' : 'Show Response Example'}
+ </a>
+ </li>
+ )}
+ </ul>
+ )}
+
+ {showParams && action.params && <Params params={action.params}/>}
+
+ {showResponse && action.hasResponseExample && <ResponseExample domain={domain} action={action}/>}
+ </div>
+ );
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import React from 'react';
+
+import { translate } from '../../../helpers/l10n';
+
+export default function DeprecatedBadge ({ since }) {
+ const label = since ? `deprecated since ${since}` : 'deprecated';
+
+ return (
+ <span
+ className="badge badge-warning"
+ title={translate('api_documentation.deprecation_tooltip')}>
+ {label}
+ </span>
+ );
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import React from 'react';
+
+import Action from './Action';
+import InternalBadge from './InternalBadge';
+import { getActionKey } from '../utils';
+
+export default function Domain ({ domain, showInternal, showOnlyDeprecated, searchQuery }) {
+ const filteredActions = domain.actions
+ .filter(action => {
+ return showInternal || !action.internal;
+ })
+ .filter(action => {
+ return !showOnlyDeprecated || (showOnlyDeprecated && action.deprecatedSince);
+ })
+ .filter(action => {
+ const actionKey = getActionKey(domain.path, action.key);
+ return actionKey.indexOf(searchQuery) !== -1;
+ });
+
+ return (
+ <div className="web-api-domain">
+ <header className="web-api-domain-header">
+ <h2 className="web-api-domain-title">{domain.path}</h2>
+
+ {domain.internal && (
+ <span className="spacer-left">
+ <InternalBadge/>
+ </span>
+ )}
+ </header>
+
+ {domain.description && (
+ <p className="web-api-domain-description">{domain.description}</p>
+ )}
+
+ <div className="web-api-domain-actions">
+ {filteredActions.map(action => (
+ <Action
+ key={getActionKey(domain.path, action.key)}
+ action={action}
+ domain={domain}
+ location={location}/>
+ ))}
+ </div>
+ </div>
+ );
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import React from 'react';
+
+import { translate } from '../../../helpers/l10n';
+
+export default function InternalBadge () {
+ return (
+ <span
+ className="badge badge-danger"
+ title={translate('api_documentation.internal_tooltip')}>
+ internal
+ </span>
+ );
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import React from 'react';
+import { Link } from 'react-router';
+import classNames from 'classnames';
+
+import InternalBadge from './InternalBadge';
+import { getActionKey } from '../utils';
+
+export default function Menu ({ domains, showInternal, showOnlyDeprecated, searchQuery, splat }) {
+ const filteredDomains = (domains || [])
+ .map(domain => {
+ const filteredActions = domain.actions
+ .filter(action => {
+ return showInternal || !action.internal;
+ })
+ .filter(action => {
+ return !showOnlyDeprecated || (showOnlyDeprecated && action.deprecatedSince);
+ })
+ .filter(action => {
+ const actionKey = getActionKey(domain.path, action.key);
+ return actionKey.indexOf(searchQuery) !== -1;
+ });
+ return { ...domain, filteredActions };
+ })
+ .filter(domain => domain.filteredActions.length);
+
+
+ return (
+ <div className="api-documentation-results panel">
+ <div className="list-group">
+ {filteredDomains.map(domain => (
+ <Link
+ key={domain.path}
+ className={classNames('list-group-item', { 'active': splat.indexOf(domain.path) === 0 })}
+ to={domain.path}>
+ <h3 className="list-group-item-heading">
+ {domain.path}
+ {domain.internal && (
+ <InternalBadge/>
+ )}
+ </h3>
+ <p className="list-group-item-text">
+ {domain.description}
+ </p>
+ </Link>
+ ))}
+ </div>
+ </div>
+ );
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import React from 'react';
+
+export default function Params ({ params }) {
+ return (
+ <div className="web-api-params">
+ <table>
+ <tbody>
+ {params.map(param => (
+ <tr key={param.key}>
+ <td style={{ width: 150 }}>
+ <code>{param.key}</code>
+
+ <div className="note little-spacer-top">
+ {param.required ? 'required' : 'optional'}
+ </div>
+
+ {param.since && (
+ <div className="note little-spacer-top">
+ since {param.since}
+ </div>
+ )}
+
+ {param.deprecatedSince && (
+ <div className="little-spacer-top">
+ <span className="badge badge-danger">
+ deprecated since {param.deprecatedSince}
+ </span>
+ </div>
+ )}
+ </td>
+
+ <td>
+ <div
+ className="markdown"
+ dangerouslySetInnerHTML={{ __html: param.description }}/>
+ </td>
+
+ <td style={{ width: 250 }}>
+ {param.possibleValues && (
+ <div>
+ <h4>Possible values</h4>
+ <ul className="list-styled">
+ {param.possibleValues.map(value => (
+ <li key={value} className="little-spacer-top">
+ <code>{value}</code>
+ </li>
+ ))}
+ </ul>
+ </div>
+ )}
+
+ {param.defaultValue && (
+ <div className="little-spacer-top">
+ <h4>Default value</h4>
+ <code>{param.defaultValue}</code>
+ </div>
+ )}
+
+ {param.exampleValue && (
+ <div className="little-spacer-top">
+ <h4>Example value</h4>
+ <code>{param.exampleValue}</code>
+ </div>
+ )}
+ </td>
+ </tr>
+ ))}
+ </tbody>
+ </table>
+ </div>
+ );
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import React from 'react';
+
+import { fetchResponseExample as fetchResponseExampleApi } from '../../../api/web-api';
+
+export default class ResponseExample extends React.Component {
+ state = {};
+
+ componentDidMount () {
+ this.mounted = true;
+ this.fetchResponseExample();
+ }
+
+ componentDidUpdate (nextProps) {
+ if (nextProps.action !== this.props.action) {
+ this.fetchResponseExample();
+ }
+ }
+
+ componentWillUnmount () {
+ this.mounted = false;
+ }
+
+ fetchResponseExample () {
+ const { domain, action } = this.props;
+ fetchResponseExampleApi(domain.path, action.key)
+ .then(responseExample => this.setState({ responseExample }));
+ }
+
+ render () {
+ const { responseExample } = this.state;
+
+ return (
+ <div className="web-api-response">
+ {responseExample && (
+ <pre style={{ whiteSpace: 'pre-wrap' }}>{responseExample.example}</pre>
+ )}
+ </div>
+ );
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import _ from 'underscore';
+import React from 'react';
+
+import DeprecatedBadge from './DeprecatedBadge';
+import InternalBadge from './InternalBadge';
+import Checkbox from '../../../components/shared/checkbox';
+
+export default class Search extends React.Component {
+ constructor (props) {
+ super(props);
+ this.state = { query: '' };
+ this.actuallySearch = _.debounce(this.actuallySearch.bind(this), 250);
+ }
+
+ handleSearch (e) {
+ const { value } = e.target;
+ this.setState({ query: value });
+ this.actuallySearch();
+ }
+
+ actuallySearch () {
+ const { onSearch } = this.props;
+ onSearch(this.state.query);
+ }
+
+ render () {
+ const { showInternal, showOnlyDeprecated, onToggleInternal, onToggleDeprecated } = this.props;
+
+ return (
+ <div className="web-api-search">
+ <div>
+ <i className="icon-search"/>
+ <input
+ className="spacer-left input-large"
+ type="search"
+ value={this.state.query}
+ placeholder="Search..."
+ onChange={this.handleSearch.bind(this)}/>
+ </div>
+
+ <div className="big-spacer-top">
+ <Checkbox
+ initiallyChecked={showInternal}
+ onCheck={onToggleInternal}/>
+ {' '}
+ <span
+ style={{ cursor: 'pointer' }}
+ onClick={onToggleInternal}>
+ <InternalBadge/>
+ </span>
+ </div>
+
+ <div className="spacer-top">
+ <Checkbox
+ initiallyChecked={showOnlyDeprecated}
+ onCheck={onToggleDeprecated}/>
+ {' '}
+ <span
+ style={{ cursor: 'pointer' }}
+ onClick={onToggleDeprecated}>
+ Only <DeprecatedBadge/>
+ </span>
+ </div>
+ </div>
+ );
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import React from 'react';
+import { Link } from 'react-router';
+
+import { fetchWebApi } from '../../../api/web-api';
+import Menu from './Menu';
+import Search from './Search';
+import Domain from './Domain';
+import { getActionKey } from '../utils';
+
+export default class WebApiApp extends React.Component {
+ state = {
+ domains: [],
+ searchQuery: '',
+ showInternal: false,
+ showOnlyDeprecated: false
+ };
+
+ componentDidMount () {
+ this.mounted = true;
+ this.scrollToAction = this.scrollToAction.bind(this);
+ this.fetchList();
+ document.getElementById('footer').classList.add('search-navigator-footer');
+ }
+
+ componentDidUpdate () {
+ this.toggleInternalInitially();
+ this.scrollToAction();
+ }
+
+ componentWillUnmount () {
+ this.mounted = false;
+ document.getElementById('footer').classList.delete('search-navigator-footer');
+ }
+
+ fetchList (cb) {
+ fetchWebApi().then(domains => {
+ if (this.mounted) {
+ this.setState({ domains }, cb);
+ }
+ });
+ }
+
+ scrollToAction () {
+ const { splat } = this.props.params;
+ this.scrollToElement(splat);
+ }
+
+ scrollToElement (id) {
+ const element = document.getElementById(id);
+
+ if (element) {
+ const rect = element.getBoundingClientRect();
+ const top = rect.top + window.pageYOffset - 20;
+
+ window.scrollTo(0, top);
+ } else {
+ window.scrollTo(0, 0);
+ }
+ }
+
+ toggleInternalInitially () {
+ const { splat } = this.props.params;
+ const { domains, showInternal } = this.state;
+
+ if (!showInternal) {
+ domains.forEach(domain => {
+ if (domain.path === splat && domain.internal) {
+ this.setState({ showInternal: true });
+ }
+ domain.actions.forEach(action => {
+ const actionKey = getActionKey(domain.path, action.key);
+ if (actionKey === splat && action.internal) {
+ this.setState({ showInternal: true });
+ }
+ });
+ });
+ }
+ }
+
+ handleSearch (searchQuery) {
+ this.setState({ searchQuery });
+ }
+
+ handleToggleInternal () {
+ const { splat } = this.props.params;
+ const { router } = this.context;
+ const { domains } = this.state;
+ const domain = domains.find(domain => splat.indexOf(domain.path) === 0);
+ const showInternal = !this.state.showInternal;
+
+ if (domain && domain.internal && !showInternal) {
+ router.push('/');
+ }
+
+ this.setState({ showInternal });
+ }
+
+ handleToggleDeprecated () {
+ this.setState({ showOnlyDeprecated: !this.state.showOnlyDeprecated });
+ }
+
+ render () {
+ const { splat } = this.props.params;
+ const { domains, showInternal, showOnlyDeprecated, searchQuery } = this.state;
+
+ const domain = domains.find(domain => splat.indexOf(domain.path) === 0);
+
+ return (
+ <div className="search-navigator sticky">
+ <div className="search-navigator-side search-navigator-side-light" style={{ top: 30 }}>
+ <div className="web-api-page-header">
+ <Link to="/">
+ <h1>Web API</h1>
+ </Link>
+ </div>
+
+ <Search
+ showInternal={showInternal}
+ showOnlyDeprecated={showOnlyDeprecated}
+ onSearch={this.handleSearch.bind(this)}
+ onToggleInternal={this.handleToggleInternal.bind(this)}
+ onToggleDeprecated={this.handleToggleDeprecated.bind(this)}/>
+
+ <Menu
+ domains={this.state.domains}
+ showInternal={showInternal}
+ showOnlyDeprecated={showOnlyDeprecated}
+ searchQuery={searchQuery}
+ splat={splat}/>
+ </div>
+
+ <div className="search-navigator-workspace">
+ {domain && (
+ <Domain
+ key={domain.path}
+ domain={domain}
+ showInternal={showInternal}
+ showOnlyDeprecated={showOnlyDeprecated}
+ searchQuery={searchQuery}/>
+ )}
+ </div>
+ </div>
+ );
+ }
+}
+
+WebApiApp.contextTypes = {
+ router: React.PropTypes.object.isRequired
+};
--- /dev/null
+.web-api-page-header {
+ margin: 10px 20px;
+}
+
+.web-api-search {
+ margin: 20px 10px 0;
+ padding: 0 10px 20px;
+ border-bottom: 1px solid #e6e6e6;
+}
+
+.web-api-search .icon-search {
+ color: #cdcdcd;
+}
+
+.web-api-domain {
+ padding: 10px 20px;
+}
+
+.web-api-domain-header,
+.web-api-action-header {
+ display: flex;
+ align-items: center;
+}
+
+.web-api-domain-title {
+ font-size: 18px;
+ font-weight: 400;
+}
+
+.web-api-domain-description {
+ margin-top: 10px;
+ line-height: 1.5;
+}
+
+.web-api-domain-actions {
+}
+
+.web-api-action {
+ padding-top: 30px;
+}
+
+.web-api-action-title {
+ font-weight: 500;
+}
+
+.web-api-action-description {
+ margin-top: 10px;
+}
+
+.web-api-action-actions {
+ margin-top: 10px;
+}
+
+.web-api-params,
+.web-api-response {
+ margin-top: 10px;
+}
+
+.web-api-params > table {
+ width: 100%;
+ table-layout: fixed;
+}
+
+.web-api-params td {
+ vertical-align: top;
+ padding: 8px 10px;
+ border-top: 1px solid #e6e6e6;
+}
+
+.web-api-params tr:first-child td {
+ border-top: none;
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+export function getActionKey (domain, action) {
+ return domain + '/' + action;
+}
<a href="http://www.sonarqube.org/documentation" target="sonar_doc">Documentation</a> -
<a href="http://www.sonarqube.org/support" target="support">Get Support</a> -
<a href="http://redirect.sonarsource.com/doc/plugin-library.html" target="plugins">Plugins</a> -
- <a href="{{link '/api_documentation'}}">Web Service API</a>
+ <a href="{{link '/web_api'}}">Web API</a>
</div>
<h2 class="spacer-top spacer-bottom">{{t 'shortcuts.modal_title'}}</h2>
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-@import (reference) "../mixins";
-@import (reference) "../variables";
-
-
-.api-documentation-search {
- padding: 10px;
-
- .search-box-input {
- background-color: @barBackgroundColor;
- }
-}
@import "pages/quality-gates";
@import "pages/maintenance";
@import "pages/login";
-@import "pages/api-documentation";
@import "pages/overview";
@import 'style';
+++ /dev/null
-#
-# SonarQube, open source software quality management tool.
-# Copyright (C) 2008-2014 SonarSource
-# mailto:contact AT sonarsource DOT com
-#
-# SonarQube is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 3 of the License, or (at your option) any later version.
-#
-# SonarQube is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-
-class ApiDocumentationController < ApplicationController
-
- # GET /api_documentation/index
- def index
-
- end
-
-end
--- /dev/null
+#
+# SonarQube, open source software quality management tool.
+# Copyright (C) 2008-2014 SonarSource
+# mailto:contact AT sonarsource DOT com
+#
+# SonarQube is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 3 of the License, or (at your option) any later version.
+#
+# SonarQube is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+
+class WebApiController < ApplicationController
+
+ def index
+
+ end
+
+end
<a href="http://www.sonarqube.org/documentation" target="sonar_doc">Documentation</a> -
<a href="http://www.sonarqube.org/support" target="support">Get Support</a> -
<a href="http://redirect.sonarsource.com/doc/plugin-library.html" target="plugins">Plugins</a> -
- <a href="/api_documentation">Web Service API</a>
+ <a href="/web_api">Web API</a>
</div>
<!--[if lte IE 8 ]><p class="spacer-top alert alert-danger">IE 8 is not supported. Some widgets may not be properly displayed. Please switch to a <a target="_blank" href="http://redirect.sonarsource.com/doc/requirements.html">supported version or another supported browser</a>.</p><!--<![endif]-->
</div>
--- /dev/null
+<% content_for :extra_script do %>
+ <script>
+ window.sonarqube.urlRoot = '/web_api';
+ </script>
+ <script src="/js/bundles/web-api.js?v=<%= sonar_version -%>"></script>
+<% end %>
map.connect 'charts/:action/:project_id/:metric_id', :controller => 'charts'
map.connect 'rules_configuration/:action/:language/:name/:plugin.:format', :controller => 'rules_configuration'
- map.connect 'api_documentation/*other', :controller => 'api_documentation', :action => 'index'
+ map.connect 'web_api/*other', :controller => 'web_api', :action => 'index'
map.connect 'quality_gates/*other', :controller => 'quality_gates', :action => 'index'
map.connect 'overview/*other', :controller => 'overview', :action => 'index'
map.connect 'account/update_notifications', :controller => 'account', :action => 'update_notifications'
'system': './src/main/js/apps/system/app.js',
'update-center': './src/main/js/apps/update-center/app.js',
'users': './src/main/js/apps/users/app.js',
+ 'web-api': './src/main/js/apps/web-api/app.js',
'widgets': './src/main/js/widgets/widgets.js'
},