aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-08-24 13:50:18 +0200
committerStas Vilchik <vilchiks@gmail.com>2015-08-26 10:12:03 +0200
commit223bcb955ba554be354f6b4b1ca0c1acb9431d66 (patch)
treec055f39d1cf688974d275877c5ff07490c32295f /server/sonar-web
parent4fa812ee4cb69d00e761b7887fdd30820d6748a9 (diff)
downloadsonarqube-223bcb955ba554be354f6b4b1ca0c1acb9431d66.tar.gz
sonarqube-223bcb955ba554be354f6b4b1ca0c1acb9431d66.zip
use the single web app
Diffstat (limited to 'server/sonar-web')
-rw-r--r--server/sonar-web/.eslintignore1
-rw-r--r--server/sonar-web/.eslintrc205
-rw-r--r--server/sonar-web/.jshintrc96
-rw-r--r--server/sonar-web/Gruntfile.coffee34
-rw-r--r--server/sonar-web/package.json2
-rw-r--r--server/sonar-web/src/main/js/api/navigation.jsx26
-rw-r--r--server/sonar-web/src/main/js/api/users.jsx13
-rw-r--r--server/sonar-web/src/main/js/apps/account/change-password-view.js8
-rw-r--r--server/sonar-web/src/main/js/apps/api-documentation/action-view.js22
-rw-r--r--server/sonar-web/src/main/js/apps/api-documentation/actions-view.js22
-rw-r--r--server/sonar-web/src/main/js/apps/api-documentation/app.js27
-rw-r--r--server/sonar-web/src/main/js/apps/api-documentation/controller.js23
-rw-r--r--server/sonar-web/src/main/js/apps/api-documentation/filters-view.js22
-rw-r--r--server/sonar-web/src/main/js/apps/api-documentation/header-view.js22
-rw-r--r--server/sonar-web/src/main/js/apps/api-documentation/item-view.js22
-rw-r--r--server/sonar-web/src/main/js/apps/api-documentation/layout.js23
-rw-r--r--server/sonar-web/src/main/js/apps/api-documentation/list-view.js22
-rw-r--r--server/sonar-web/src/main/js/apps/api-documentation/list.js23
-rw-r--r--server/sonar-web/src/main/js/apps/api-documentation/router.js23
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/app.js10
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/bulk-change-modal-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/facets/active-severity-facet.js2
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/facets/custom-values-facet.js10
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/facets/inheritance-facet.js4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/facets/language-facet.js2
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/facets/repository-facet.js2
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/facets/status-facet.js2
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/facets/tag-facet.js2
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/filters-view.js26
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/layout.js23
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/models/rule.js23
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/models/rules.js22
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule-details-view.js35
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-creation-view.js9
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-view.js29
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rules-view.js22
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule/manual-rule-creation-view.js2
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule/profile-activation-view.js33
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule/rule-description-view.js27
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule/rule-issues-view.js22
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule/rule-meta-view.js22
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule/rule-parameters-view.js22
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profile-view.js36
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profiles-view.js22
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/workspace-list-empty-view.js25
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/workspace-list-item-view.js29
-rw-r--r--server/sonar-web/src/main/js/apps/computation/app.js8
-rw-r--r--server/sonar-web/src/main/js/apps/computation/header-view.js3
-rw-r--r--server/sonar-web/src/main/js/apps/computation/layout.js3
-rw-r--r--server/sonar-web/src/main/js/apps/computation/list-footer-view.js3
-rw-r--r--server/sonar-web/src/main/js/apps/computation/list-item-view.js3
-rw-r--r--server/sonar-web/src/main/js/apps/computation/list-view.js3
-rw-r--r--server/sonar-web/src/main/js/apps/computation/report.js4
-rw-r--r--server/sonar-web/src/main/js/apps/computation/reports.js5
-rw-r--r--server/sonar-web/src/main/js/apps/computation/router.js4
-rw-r--r--server/sonar-web/src/main/js/apps/computation/search-view.js3
-rw-r--r--server/sonar-web/src/main/js/apps/custom-measures/app.js11
-rw-r--r--server/sonar-web/src/main/js/apps/custom-measures/custom-measure.js6
-rw-r--r--server/sonar-web/src/main/js/apps/custom-measures/custom-measures.js7
-rw-r--r--server/sonar-web/src/main/js/apps/custom-measures/delete-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/custom-measures/form-view.js10
-rw-r--r--server/sonar-web/src/main/js/apps/custom-measures/header-view.js3
-rw-r--r--server/sonar-web/src/main/js/apps/custom-measures/layout.js3
-rw-r--r--server/sonar-web/src/main/js/apps/custom-measures/list-footer-view.js5
-rw-r--r--server/sonar-web/src/main/js/apps/custom-measures/list-item-view.js3
-rw-r--r--server/sonar-web/src/main/js/apps/custom-measures/list-view.js3
-rw-r--r--server/sonar-web/src/main/js/apps/dashboard/app.jsx10
-rw-r--r--server/sonar-web/src/main/js/apps/drilldown/app.js28
-rw-r--r--server/sonar-web/src/main/js/apps/global-permissions/app.jsx6
-rw-r--r--server/sonar-web/src/main/js/apps/global-permissions/groups-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/global-permissions/users-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/groups/app.js7
-rw-r--r--server/sonar-web/src/main/js/apps/groups/delete-view.js8
-rw-r--r--server/sonar-web/src/main/js/apps/groups/form-view.js8
-rw-r--r--server/sonar-web/src/main/js/apps/groups/group.js6
-rw-r--r--server/sonar-web/src/main/js/apps/groups/groups.js7
-rw-r--r--server/sonar-web/src/main/js/apps/groups/header-view.js3
-rw-r--r--server/sonar-web/src/main/js/apps/groups/layout.js3
-rw-r--r--server/sonar-web/src/main/js/apps/groups/list-footer-view.js5
-rw-r--r--server/sonar-web/src/main/js/apps/groups/list-item-view.js3
-rw-r--r--server/sonar-web/src/main/js/apps/groups/list-view.js3
-rw-r--r--server/sonar-web/src/main/js/apps/groups/search-view.js3
-rw-r--r--server/sonar-web/src/main/js/apps/groups/users-view.js11
-rw-r--r--server/sonar-web/src/main/js/apps/issues/app-context.js26
-rw-r--r--server/sonar-web/src/main/js/apps/issues/app.js10
-rw-r--r--server/sonar-web/src/main/js/apps/issues/component-viewer/main.js2
-rw-r--r--server/sonar-web/src/main/js/apps/issues/controller.js3
-rw-r--r--server/sonar-web/src/main/js/apps/issues/facets/assignee-facet.js2
-rw-r--r--server/sonar-web/src/main/js/apps/issues/facets/author-facet.js8
-rw-r--r--server/sonar-web/src/main/js/apps/issues/facets/base-facet.js2
-rw-r--r--server/sonar-web/src/main/js/apps/issues/facets/custom-values-facet.js6
-rw-r--r--server/sonar-web/src/main/js/apps/issues/facets/language-facet.js8
-rw-r--r--server/sonar-web/src/main/js/apps/issues/facets/mode-facet.js4
-rw-r--r--server/sonar-web/src/main/js/apps/issues/facets/project-facet.js10
-rw-r--r--server/sonar-web/src/main/js/apps/issues/facets/reporter-facet.js2
-rw-r--r--server/sonar-web/src/main/js/apps/issues/facets/rule-facet.js8
-rw-r--r--server/sonar-web/src/main/js/apps/issues/facets/tag-facet.js6
-rw-r--r--server/sonar-web/src/main/js/apps/issues/filters-view.js3
-rw-r--r--server/sonar-web/src/main/js/apps/issues/issue-filter-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/issues/layout.js4
-rw-r--r--server/sonar-web/src/main/js/apps/issues/models/filter.js6
-rw-r--r--server/sonar-web/src/main/js/apps/issues/models/filters.js3
-rw-r--r--server/sonar-web/src/main/js/apps/issues/models/issue.js2
-rw-r--r--server/sonar-web/src/main/js/apps/issues/models/issues.js5
-rw-r--r--server/sonar-web/src/main/js/apps/issues/workspace-header-view.js6
-rw-r--r--server/sonar-web/src/main/js/apps/issues/workspace-home-view.js10
-rw-r--r--server/sonar-web/src/main/js/apps/issues/workspace-list-empty-view.js6
-rw-r--r--server/sonar-web/src/main/js/apps/main/app.jsx166
-rw-r--r--server/sonar-web/src/main/js/apps/maintenance/app.js4
-rw-r--r--server/sonar-web/src/main/js/apps/maintenance/main-view.js10
-rw-r--r--server/sonar-web/src/main/js/apps/markdown/app.js24
-rw-r--r--server/sonar-web/src/main/js/apps/markdown/markdown-help-view.js24
-rw-r--r--server/sonar-web/src/main/js/apps/measures/app.js3
-rw-r--r--server/sonar-web/src/main/js/apps/metrics/app.js5
-rw-r--r--server/sonar-web/src/main/js/apps/metrics/delete-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/metrics/form-view.js10
-rw-r--r--server/sonar-web/src/main/js/apps/metrics/header-view.js3
-rw-r--r--server/sonar-web/src/main/js/apps/metrics/layout.js3
-rw-r--r--server/sonar-web/src/main/js/apps/metrics/list-footer-view.js5
-rw-r--r--server/sonar-web/src/main/js/apps/metrics/list-item-view.js3
-rw-r--r--server/sonar-web/src/main/js/apps/metrics/list-view.js3
-rw-r--r--server/sonar-web/src/main/js/apps/metrics/metric.js6
-rw-r--r--server/sonar-web/src/main/js/apps/metrics/metrics.js7
-rw-r--r--server/sonar-web/src/main/js/apps/nav/app.jsx8
-rw-r--r--server/sonar-web/src/main/js/apps/nav/component/component-nav-menu.jsx4
-rw-r--r--server/sonar-web/src/main/js/apps/nav/component/component-nav.jsx42
-rw-r--r--server/sonar-web/src/main/js/apps/nav/global/global-nav-menu.jsx2
-rw-r--r--server/sonar-web/src/main/js/apps/nav/global/global-nav-user.jsx5
-rw-r--r--server/sonar-web/src/main/js/apps/nav/global/search-view.js39
-rw-r--r--server/sonar-web/src/main/js/apps/overview/app.jsx21
-rw-r--r--server/sonar-web/src/main/js/apps/project-permissions/app.jsx6
-rw-r--r--server/sonar-web/src/main/js/apps/project-permissions/groups-view.js8
-rw-r--r--server/sonar-web/src/main/js/apps/project-permissions/users-view.js9
-rw-r--r--server/sonar-web/src/main/js/apps/provisioning/app.js7
-rw-r--r--server/sonar-web/src/main/js/apps/provisioning/bulk-delete-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/provisioning/delete-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/provisioning/form-view.js8
-rw-r--r--server/sonar-web/src/main/js/apps/provisioning/header-view.js3
-rw-r--r--server/sonar-web/src/main/js/apps/provisioning/layout.js3
-rw-r--r--server/sonar-web/src/main/js/apps/provisioning/list-footer-view.js5
-rw-r--r--server/sonar-web/src/main/js/apps/provisioning/list-item-view.js3
-rw-r--r--server/sonar-web/src/main/js/apps/provisioning/list-view.js3
-rw-r--r--server/sonar-web/src/main/js/apps/provisioning/project.js6
-rw-r--r--server/sonar-web/src/main/js/apps/provisioning/projects.js7
-rw-r--r--server/sonar-web/src/main/js/apps/provisioning/search-view.js5
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/actions-view.js3
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/app.js6
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/condition.js6
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/conditions.js3
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/controller.js3
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/copy-view.js2
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/create-view.js2
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/details-view.js3
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/form-view.js3
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/gate-condition-view.js5
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/gate-conditions-delete-view.js3
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/gate-conditions-empty-view.js3
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/gate-conditions-view.js5
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/gate-projects-view.js22
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/gate-view.js3
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/gate.js6
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/gates-view.js3
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/gates.js5
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/header-view.js3
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/intro-view.js3
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/layout.js4
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/rename-view.js2
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/router.js4
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/actions-view.js22
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/app.js11
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/change-profile-parent-view.js22
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/controller.js22
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/helpers.js8
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/intro-view.js22
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/layout.js23
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/profile-changelog-view.js22
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/profile-comparison-view.js22
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/profile-details-view.js34
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/profile-header-view.js26
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/profile-view.js22
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/profile.js23
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/profiles-empty-view.js3
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/profiles-view.js22
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/profiles.js22
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/restore-built-in-profiles-view.js2
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/router.js23
-rw-r--r--server/sonar-web/src/main/js/apps/select-list/app.js11
-rw-r--r--server/sonar-web/src/main/js/apps/source-viewer/app.js15
-rw-r--r--server/sonar-web/src/main/js/apps/update-center/app.js10
-rw-r--r--server/sonar-web/src/main/js/apps/update-center/controller.js4
-rw-r--r--server/sonar-web/src/main/js/apps/update-center/footer-view.js5
-rw-r--r--server/sonar-web/src/main/js/apps/update-center/header-view.js5
-rw-r--r--server/sonar-web/src/main/js/apps/update-center/layout.js3
-rw-r--r--server/sonar-web/src/main/js/apps/update-center/list-item-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/update-center/list-view.js3
-rw-r--r--server/sonar-web/src/main/js/apps/update-center/plugin-changelog-view.js7
-rw-r--r--server/sonar-web/src/main/js/apps/update-center/plugin.js4
-rw-r--r--server/sonar-web/src/main/js/apps/update-center/plugins.js3
-rw-r--r--server/sonar-web/src/main/js/apps/update-center/router.js4
-rw-r--r--server/sonar-web/src/main/js/apps/update-center/search-view.js7
-rw-r--r--server/sonar-web/src/main/js/apps/users/app.js7
-rw-r--r--server/sonar-web/src/main/js/apps/users/change-password-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/users/deactivate-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/users/form-view.js10
-rw-r--r--server/sonar-web/src/main/js/apps/users/groups-view.js9
-rw-r--r--server/sonar-web/src/main/js/apps/users/header-view.js3
-rw-r--r--server/sonar-web/src/main/js/apps/users/layout.js3
-rw-r--r--server/sonar-web/src/main/js/apps/users/list-footer-view.js5
-rw-r--r--server/sonar-web/src/main/js/apps/users/list-item-view.js5
-rw-r--r--server/sonar-web/src/main/js/apps/users/list-view.js3
-rw-r--r--server/sonar-web/src/main/js/apps/users/search-view.js3
-rw-r--r--server/sonar-web/src/main/js/apps/users/user.js6
-rw-r--r--server/sonar-web/src/main/js/apps/users/users.js7
-rw-r--r--server/sonar-web/src/main/js/components/common/dialogs.js44
-rw-r--r--server/sonar-web/src/main/js/components/common/dialogs.jsx44
-rw-r--r--server/sonar-web/src/main/js/components/common/handlebars-extensions.js26
-rw-r--r--server/sonar-web/src/main/js/components/common/jquery-isolated-scroll.js33
-rw-r--r--server/sonar-web/src/main/js/components/common/jquery-isolated-scroll.jsx12
-rw-r--r--server/sonar-web/src/main/js/components/common/modals.js23
-rw-r--r--server/sonar-web/src/main/js/components/common/popup.js4
-rw-r--r--server/sonar-web/src/main/js/components/common/processes.js30
-rw-r--r--server/sonar-web/src/main/js/components/common/select-list.js23
-rw-r--r--server/sonar-web/src/main/js/components/common/selectable-collection-view.js4
-rw-r--r--server/sonar-web/src/main/js/components/issue/collections/action-plans.js6
-rw-r--r--server/sonar-web/src/main/js/components/issue/collections/issues.js5
-rw-r--r--server/sonar-web/src/main/js/components/issue/issue-view.js7
-rw-r--r--server/sonar-web/src/main/js/components/issue/manual-issue-view.js5
-rw-r--r--server/sonar-web/src/main/js/components/issue/models/changelog.js6
-rw-r--r--server/sonar-web/src/main/js/components/issue/models/issue.js8
-rw-r--r--server/sonar-web/src/main/js/components/issue/views/assign-form-view.js2
-rw-r--r--server/sonar-web/src/main/js/components/issue/views/plan-form-view.js2
-rw-r--r--server/sonar-web/src/main/js/components/issue/views/tags-form-view.js2
-rw-r--r--server/sonar-web/src/main/js/components/navigator/controller.js23
-rw-r--r--server/sonar-web/src/main/js/components/navigator/facets-view.js22
-rw-r--r--server/sonar-web/src/main/js/components/navigator/facets/base-facet.js23
-rw-r--r--server/sonar-web/src/main/js/components/navigator/filters/ajax-select-filters.js164
-rw-r--r--server/sonar-web/src/main/js/components/navigator/filters/base-filters.js81
-rw-r--r--server/sonar-web/src/main/js/components/navigator/filters/checkbox-filters.js37
-rw-r--r--server/sonar-web/src/main/js/components/navigator/filters/choice-filters.js141
-rw-r--r--server/sonar-web/src/main/js/components/navigator/filters/favorite-filters.js22
-rw-r--r--server/sonar-web/src/main/js/components/navigator/filters/filter-bar.js43
-rw-r--r--server/sonar-web/src/main/js/components/navigator/filters/metric-filters.js73
-rw-r--r--server/sonar-web/src/main/js/components/navigator/filters/more-criteria-filters.js53
-rw-r--r--server/sonar-web/src/main/js/components/navigator/filters/range-filters.js57
-rw-r--r--server/sonar-web/src/main/js/components/navigator/filters/string-filters.js45
-rw-r--r--server/sonar-web/src/main/js/components/navigator/models/facet.js23
-rw-r--r--server/sonar-web/src/main/js/components/navigator/models/facets.js22
-rw-r--r--server/sonar-web/src/main/js/components/navigator/models/state.js23
-rw-r--r--server/sonar-web/src/main/js/components/navigator/router.js23
-rw-r--r--server/sonar-web/src/main/js/components/navigator/workspace-header-view.js23
-rw-r--r--server/sonar-web/src/main/js/components/navigator/workspace-list-item-view.js23
-rw-r--r--server/sonar-web/src/main/js/components/navigator/workspace-list-view.js23
-rw-r--r--server/sonar-web/src/main/js/components/source-viewer/header.js5
-rw-r--r--server/sonar-web/src/main/js/components/source-viewer/main.js27
-rw-r--r--server/sonar-web/src/main/js/components/source-viewer/more-actions.js22
-rw-r--r--server/sonar-web/src/main/js/components/source-viewer/popups/coverage-popup.js1
-rw-r--r--server/sonar-web/src/main/js/components/source-viewer/popups/scm-popup.js1
-rw-r--r--server/sonar-web/src/main/js/components/source-viewer/source.js23
-rw-r--r--server/sonar-web/src/main/js/components/workspace/models/item.js23
-rw-r--r--server/sonar-web/src/main/js/components/workspace/models/items.js28
-rw-r--r--server/sonar-web/src/main/js/components/workspace/views/base-viewer-view.js25
-rw-r--r--server/sonar-web/src/main/js/components/workspace/views/item-view.js22
-rw-r--r--server/sonar-web/src/main/js/components/workspace/views/items-view.js22
-rw-r--r--server/sonar-web/src/main/js/components/workspace/views/rule-view.js22
-rw-r--r--server/sonar-web/src/main/js/components/workspace/views/viewer-header-view.js22
-rw-r--r--server/sonar-web/src/main/js/libs/application.js191
-rw-r--r--server/sonar-web/src/main/js/libs/csv.js27
-rw-r--r--server/sonar-web/src/main/js/libs/csv.jsx4
-rw-r--r--server/sonar-web/src/main/js/libs/inputs.js12
-rw-r--r--server/sonar-web/src/main/js/libs/recent-history.js75
-rw-r--r--server/sonar-web/src/main/js/libs/recent-history.jsx35
-rw-r--r--server/sonar-web/src/main/js/libs/select2-jquery-ui-fix.js2
-rw-r--r--server/sonar-web/src/main/js/libs/shim/jquery-shim.js3
-rw-r--r--server/sonar-web/src/main/js/libs/shim/underscore-shim.js3
-rw-r--r--server/sonar-web/src/main/js/libs/third-party/backbone-super.js111
-rw-r--r--server/sonar-web/src/main/js/libs/translate.js26
-rw-r--r--server/sonar-web/src/main/js/libs/widgets/bubble-chart.js25
-rw-r--r--server/sonar-web/src/main/js/libs/widgets/pie-chart.js22
-rw-r--r--server/sonar-web/src/main/js/libs/widgets/tag-cloud.js2
-rw-r--r--server/sonar-web/src/main/js/libs/widgets/timeline.js2
-rw-r--r--server/sonar-web/src/main/js/main.js22
-rw-r--r--server/sonar-web/src/main/js/widgets/issue-filter/widget.js33
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb7
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/account/index.html.erb8
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/api_documentation/index.html.erb7
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/coding_rules/index.html.erb7
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/component/index.html.erb20
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/component_issues/index.html.erb3
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/computation/index.html.erb7
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/custom_measures/index.html.erb7
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/configure.html.erb4
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/index.html.erb11
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/no_dashboard.html.erb7
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/drilldown/measures.html.erb8
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/groups/index.html.erb8
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/search.html.erb7
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_head.html.erb51
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar.html.erb29
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_nolayout.html.erb28
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_recent_history.html.erb9
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/application.html.erb1
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/maintenance/index.html.erb8
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/markdown/help.html.erb6
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/search.html.erb6
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/metrics/index.html.erb7
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/overview/index.html.erb9
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/permission_templates/index.html.erb4
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb7
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/project_roles/index.html.erb4
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/provisioning/index.html.erb7
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/quality_gates/index.html.erb7
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/roles/global.html.erb7
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/roles/projects.html.erb7
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/setup/index.html.erb8
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/updatecenter/index.html.erb7
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/users/index.html.erb7
-rw-r--r--server/sonar-web/src/test/json/component-navigation.json32
-rw-r--r--server/sonar-web/test/helpers/test-page.js10
-rw-r--r--server/sonar-web/test/intern.js10
-rw-r--r--server/sonar-web/test/medium/base.html67
-rw-r--r--server/sonar-web/test/medium/coding-rules.spec.js78
-rw-r--r--server/sonar-web/test/medium/computation.spec.js4
-rw-r--r--server/sonar-web/test/medium/custom-measures.spec.js16
-rw-r--r--server/sonar-web/test/medium/global-permissions.spec.js2
-rw-r--r--server/sonar-web/test/medium/issues.spec.js22
-rw-r--r--server/sonar-web/test/medium/project-permissions.spec.js2
-rw-r--r--server/sonar-web/test/medium/quality-profiles.spec.js87
-rw-r--r--server/sonar-web/test/medium/source-viewer.spec.js6
-rw-r--r--server/sonar-web/test/medium/test-main.js33
-rw-r--r--server/sonar-web/test/medium/update-center.spec.js32
-rw-r--r--server/sonar-web/test/medium/users.spec.js14
-rw-r--r--server/sonar-web/test/unit/csv.spec.js16
-rw-r--r--server/sonar-web/test/unit/recent-history.spec.js43
333 files changed, 2126 insertions, 3297 deletions
diff --git a/server/sonar-web/.eslintignore b/server/sonar-web/.eslintignore
new file mode 100644
index 00000000000..681af342526
--- /dev/null
+++ b/server/sonar-web/.eslintignore
@@ -0,0 +1 @@
+src/main/js/libs/third-party
diff --git a/server/sonar-web/.eslintrc b/server/sonar-web/.eslintrc
new file mode 100644
index 00000000000..00b2641ae48
--- /dev/null
+++ b/server/sonar-web/.eslintrc
@@ -0,0 +1,205 @@
+{
+ "env": {
+ "browser": true,
+ "es6": true
+ },
+ "ecmaFeatures": {
+ "modules": true,
+ "jsx": true
+ },
+
+ "rules": {
+ ////////// Possible Errors //////////
+
+ "comma-dangle": 0, // disallow trailing commas in object literals
+ "no-cond-assign": 2, // disallow assignment in conditional expressions
+ "no-console": 2, // disallow use of console (off by default in the node environment)
+ "no-constant-condition": 2, // disallow use of constant expressions in conditions
+ "no-control-regex": 0, // disallow control characters in regular expressions
+ "no-debugger": 2, // disallow use of debugger
+ "no-dupe-keys": 2, // disallow duplicate keys when creating object literals
+ "no-empty": 2, // disallow empty statements
+ "no-empty-class": 2, // disallow the use of empty character classes in regular expressions
+ "no-ex-assign": 2, // disallow assigning to the exception in a catch block
+ "no-extra-boolean-cast": 0, // disallow double-negation boolean casts in a boolean context
+ "no-extra-parens": 0, // disallow unnecessary parentheses (off by default)
+ "no-extra-semi": 2, // disallow unnecessary semicolons
+ "no-func-assign": 2, // disallow overwriting functions written as function declarations
+ "no-inner-declarations": 2, // disallow function or variable declarations in nested blocks
+ "no-invalid-regexp": 2, // disallow invalid regular expression strings in the RegExp constructor
+ "no-irregular-whitespace": 2, // disallow irregular whitespace outside of strings and comments
+ "no-negated-in-lhs": 2, // disallow negation of the left operand of an in expression
+ "no-obj-calls": 2, // disallow the use of object properties of the global object (Math and JSON) as functions
+ "no-regex-spaces": 2, // disallow multiple spaces in a regular expression literal
+ "no-reserved-keys": 2, // disallow reserved words being used as object literal keys (off by default)
+ "no-sparse-arrays": 2, // disallow sparse arrays
+ "no-unreachable": 2, // disallow unreachable statements after a return, throw, continue, or break statement
+ "use-isnan": 2, // disallow comparisons with the value NaN
+ "valid-jsdoc": 0, // Ensure JSDoc comments are valid (off by default)
+ "valid-typeof": 2, // Ensure that the results of typeof are compared against a valid string
+
+
+ ////////// Best Practices //////////
+
+ "block-scoped-var": 0, // treat var statements as if they were block scoped (off by default)
+ "complexity": 0, // specify the maximum cyclomatic complexity allowed in a program (off by default)
+ "consistent-return": 0, // require return statements to either always or never specify values
+ "curly": 2, // specify curly brace conventions for all control statements
+ "default-case": 1, // require default case in switch statements (off by default)
+ "dot-notation": 0, // encourages use of dot notation whenever possible
+ "eqeqeq": 2, // require the use of === and !==
+ "guard-for-in": 2, // make sure for-in loops have an if statement (off by default)
+ "no-alert": 1, // disallow the use of alert, confirm, and prompt
+ "no-caller": 2, // disallow use of arguments.caller or arguments.callee
+ "no-div-regex": 2, // disallow division operators explicitly at beginning of regular expression (off by default)
+ "no-else-return": 0, // disallow else after a return in an if (off by default)
+ "no-empty-label": 2, // disallow use of labels for anything other then loops and switches
+ "no-eq-null": 0, // disallow comparisons to null without a type-checking operator (off by default)
+ "no-eval": 2, // disallow use of eval()
+ "no-extend-native": 2, // disallow adding to native types
+ "no-extra-bind": 0, // disallow unnecessary function binding
+ "no-fallthrough": 2, // disallow fallthrough of case statements
+ "no-floating-decimal": 0, // disallow the use of leading or trailing decimal points in numeric literals (off by default)
+ "no-implied-eval": 2, // disallow use of eval()-like methods
+ "no-iterator": 2, // disallow usage of __iterator__ property
+ "no-labels": 2, // disallow use of labeled statements
+ "no-lone-blocks": 0, // disallow unnecessary nested blocks
+ "no-loop-func": 0, // disallow creation of functions within loops
+ "no-multi-spaces": 2, // disallow use of multiple spaces
+ "no-multi-str": 0, // disallow use of multiline strings
+ "no-native-reassign": 0, // disallow reassignments of native objects
+ "no-new": 0, // disallow use of new operator when not part of the assignment or comparison
+ "no-new-func": 2, // disallow use of new operator for Function object
+ "no-new-wrappers": 2, // disallows creating new instances of String, Number, and Boolean
+ "no-octal": 2, // disallow use of octal literals
+ "no-octal-escape": 2, // disallow use of octal escape sequences in string literals, such as var foo = "Copyright \251";
+ "no-process-env": 2, // disallow use of process.env (off by default)
+ "no-proto": 2, // disallow usage of __proto__ property
+ "no-redeclare": 2, // disallow declaring the same variable more then once
+ "no-return-assign": 2, // disallow use of assignment in return statement
+ "no-script-url": 2, // disallow use of javascript: urls.
+ "no-self-compare": 2, // disallow comparisons where both sides are exactly the same (off by default)
+ "no-sequences": 2, // disallow use of comma operator
+ "no-unused-expressions": 2, // disallow usage of expressions in statement position
+ "no-void": 1, // disallow use of void operator (off by default)
+ "no-warning-comments": 0, // disallow usage of configurable warning terms in comments, e.g. TODO or FIXME (off by default)
+ "no-with": 2, // disallow use of the with statement
+ "radix": 2, // require use of the second argument for parseInt() (off by default)
+ "vars-on-top": 0, // requires to declare all vars on top of their containing scope (off by default)
+ "wrap-iife": 0, // require immediate function invocation to be wrapped in parentheses (off by default)
+ "yoda": 0, // require or disallow Yoda conditions
+
+
+ ////////// Strict Mode //////////
+
+ "global-strict": 0, // (deprecated) require or disallow the "use strict" pragma in the global scope (off by default in the node environment)
+ "no-extra-strict": 0, // (deprecated) disallow unnecessary use of "use strict"; when already in strict mode
+ "strict": 0, // controls location of Use Strict Directives
+
+
+ ////////// Variables //////////
+
+ "no-catch-shadow": 2, // disallow the catch clause parameter name being the same as a variable in the outer scope (off by default in the node environment)
+ "no-delete-var": 0, // disallow deletion of variables
+ "no-label-var": 2, // disallow labels that share a name with a variable
+ "no-shadow": 1, // disallow declaration of variables already declared in the outer scope
+ "no-shadow-restricted-names": 1, // disallow shadowing of names such as arguments
+ "no-undef": 2, // disallow use of undeclared variables unless mentioned in a /*global */ block
+ "no-undef-init": 2, // disallow use of undefined when initializing variables
+ "no-undefined": 2, // disallow use of undefined variable (off by default)
+ "no-unused-vars": 2, // disallow declaration of variables that are not used in the code
+ "no-use-before-define": 0, // disallow use of variables before they are defined
+
+
+ ////////// Node.js //////////
+
+ "handle-callback-err": 0, // enforces error handling in callbacks (off by default) (on by default in the node environment)
+ "no-mixed-requires": 0, // disallow mixing regular variable and require declarations (off by default) (on by default in the node environment)
+ "no-new-require": 0, // disallow use of new operator with the require function (off by default) (on by default in the node environment)
+ "no-path-concat": 0, // disallow string concatenation with __dirname and __filename (off by default) (on by default in the node environment)
+ "no-process-exit": 0, // disallow process.exit() (on by default in the node environment)
+ "no-restricted-modules": 0, // restrict usage of specified node modules (off by default)
+ "no-sync": 0, // disallow use of synchronous methods (off by default)
+
+
+ ////////// Stylistic Issues //////////
+
+ "brace-style": 0, // enforce one true brace style (off by default)
+ "camelcase": 0, // require camel case names
+ "comma-spacing": 0, // enforce spacing before and after comma
+ "comma-style": 0, // enforce one true comma style (off by default)
+ "consistent-this": 0, // enforces consistent naming when capturing the current execution context (off by default)
+ "eol-last": 0, // enforce newline at the end of file, with no multiple empty lines
+ "func-names": 0, // require function expressions to have a name (off by default)
+ "func-style": 0, // enforces use of function declarations or expressions (off by default)
+ "key-spacing": 0, // enforces spacing between keys and values in object literal properties
+ "max-nested-callbacks": 0, // specify the maximum depth callbacks can be nested (off by default)
+ "new-cap": 0, // require a capital letter for constructors
+ "new-parens": 0, // disallow the omission of parentheses when invoking a constructor with no arguments
+ "no-array-constructor": 2, // disallow use of the Array constructor
+ "no-inline-comments": 0, // disallow comments inline after code (off by default)
+ "no-lonely-if": 0, // disallow if as the only statement in an else block (off by default)
+ "no-mixed-spaces-and-tabs": 2, // disallow mixed spaces and tabs for indentation
+ "no-multiple-empty-lines": 0, // disallow multiple empty lines (off by default)
+ "no-nested-ternary": 1, // disallow nested ternary expressions (off by default)
+ "no-new-object": 0, // disallow use of the Object constructor
+ "no-space-before-semi": 2, // disallow space before semicolon
+ "no-spaced-func": 0, // disallow space between function identifier and application
+ "no-ternary": 0, // disallow the use of ternary operators (off by default)
+ "no-trailing-spaces": 2, // disallow trailing whitespace at the end of lines
+ "no-underscore-dangle": 0, // disallow dangling underscores in identifiers
+ "no-wrap-func": 0, // disallow wrapping of non-IIFE statements in parens
+ "one-var": 0, // allow just one var statement per function (off by default)
+ "operator-assignment": 0, // require assignment operator shorthand where possible or prohibit it entirely (off by default)
+ "padded-blocks": 0, // enforce padding within blocks (off by default)
+ "quote-props": 0, // require quotes around object literal property names (off by default)
+ "quotes": [2, "single"], // specify whether double or single quotes should be used
+ "semi": 2, // require or disallow use of semicolons instead of ASI
+ "sort-vars": 0, // sort variables within the same declaration block (off by default)
+ "space-after-function-name": 0, // require a space after function names (off by default)
+ "space-after-keywords": 0, // require a space after certain keywords (off by default)
+ "space-before-blocks": 0, // require or disallow space before blocks (off by default)
+ "space-in-brackets": 0, // require or disallow spaces inside brackets (off by default)
+ "space-in-parens": 0, // require or disallow spaces inside parentheses (off by default)
+ "space-infix-ops": 0, // require spaces around operators
+ "space-return-throw-case": 2, // require a space after return, throw, and case
+ "space-unary-ops": 0, // Require or disallow spaces before/after unary operators (words on by default, nonwords off by default)
+ "spaced-line-comment": 0, // require or disallow a space immediately following the // in a line comment (off by default)
+ "wrap-regex": 0, // require regex literals to be wrapped in parentheses (off by default)
+
+
+ ////////// ECMAScript 6 //////////
+
+ "no-var": 0, // require let or const instead of var (off by default)
+ "generator-star": 0, // enforce the position of the * in generator functions (off by default)
+
+
+ ////////// Legacy //////////
+
+ "max-depth": 0, // specify the maximum depth that blocks can be nested (off by default)
+ "max-len": 0, // specify the maximum length of a line in your program (off by default)
+ "max-params": 0, // limits the number of parameters that can be used in the function declaration. (off by default)
+ "max-statements": 0, // specify the maximum number of statement allowed in a function (off by default)
+ "no-bitwise": 0, // disallow use of bitwise operators (off by default)
+ "no-plusplus": 0 // disallow use of unary operators, ++ and -- (off by default)
+ },
+
+ "globals": {
+ "define": true,
+ "require": true,
+ "jQuery": true,
+ "$": true,
+
+ "_": true,
+ "Templates": true,
+ "Handlebars": true,
+ "moment": true,
+ "numeral": true,
+ "key": true,
+ "d3": true,
+ "baseUrl": true
+ },
+ "plugins": [
+ "react"
+ ]
+}
diff --git a/server/sonar-web/.jshintrc b/server/sonar-web/.jshintrc
deleted file mode 100644
index 5b2eb1b387b..00000000000
--- a/server/sonar-web/.jshintrc
+++ /dev/null
@@ -1,96 +0,0 @@
-{
- "maxerr": 50,
-
- "bitwise": true,
- "camelcase": false,
- "curly": true,
- "eqeqeq": true,
- "forin": true,
- "freeze": true,
- "immed": false,
- "indent": 2,
- "latedef": false,
- "newcap": false,
- "noarg": true,
- "noempty": true,
- "nonbsp": true,
- "nonew": false,
- "plusplus": false,
- "quotmark": "single",
- "undef": true,
- "unused": false,
- "strict": false,
- "maxparams": false,
- "maxdepth": 4,
- "maxstatements": false,
- "maxcomplexity": false,
- "maxlen": 120,
-
- "asi": false,
- "boss": false,
- "debug": false,
- "eqnull": true,
- "esnext": false,
- "moz": false,
- "evil": false,
- "expr": false,
- "funcscope": false,
- "globalstrict": false,
- "iterator": false,
- "lastsemic": false,
- "laxbreak": false,
- "laxcomma": false,
- "loopfunc": false,
- "multistr": false,
- "noyield": false,
- "notypeof": false,
- "proto": false,
- "scripturl": false,
- "shadow": false,
- "sub": false,
- "supernew": false,
- "validthis": false,
-
- "browser": true,
- "browserify": false,
- "couch": false,
- "devel": true,
- "dojo": false,
- "jasmine": false,
- "jquery": true,
- "mocha": false,
- "mootools": false,
- "node": false,
- "nonstandard": false,
- "prototypejs": false,
- "qunit": false,
- "rhino": false,
- "shelljs": false,
- "worker": false,
- "wsh": false,
- "yui": false,
-
- "globals": {
- "jQuery": true,
- "$j": true,
- "_": true,
- "d3": true,
- "define": true,
- "require": true,
- "requirejs": true,
- "console": true,
- "baseUrl": true,
- "key": true,
- "Backbone": true,
- "Marionette": true,
- "Handlebars": true,
- "Templates": true,
- "t": true,
- "tp": true,
- "moment": true,
- "numeral": true,
- "openPopup": true,
- "dashboardParameters": true,
- "getTemplate": true
- }
-}
diff --git a/server/sonar-web/Gruntfile.coffee b/server/sonar-web/Gruntfile.coffee
index 240adc7e642..433ab2fbbe3 100644
--- a/server/sonar-web/Gruntfile.coffee
+++ b/server/sonar-web/Gruntfile.coffee
@@ -59,9 +59,6 @@ module.exports = (grunt) ->
'<%= BUILD_PATH %>/js/libs/third-party/d3.js'
'<%= BUILD_PATH %>/js/libs/third-party/latinize.js'
'<%= BUILD_PATH %>/js/libs/third-party/underscore.js'
- '<%= BUILD_PATH %>/js/libs/third-party/backbone.js'
- '<%= BUILD_PATH %>/js/libs/third-party/backbone-super.js'
- '<%= BUILD_PATH %>/js/libs/third-party/backbone.marionette.js'
'<%= BUILD_PATH %>/js/libs/third-party/handlebars.js'
'<%= BUILD_PATH %>/js/libs/third-party/select2.js'
'<%= BUILD_PATH %>/js/libs/third-party/keymaster.js'
@@ -89,15 +86,10 @@ module.exports = (grunt) ->
'<%= BUILD_PATH %>/js/libs/sortable.js'
'<%= BUILD_PATH %>/js/libs/inputs.js'
- '<%= BUILD_PATH %>/js/components/common/dialogs.js'
- '<%= BUILD_PATH %>/js/components/common/processes.js'
- '<%= BUILD_PATH %>/js/components/common/jquery-isolated-scroll.js'
'<%= BUILD_PATH %>/js/components/common/handlebars-extensions.js'
'<%= BUILD_PATH %>/js/libs/application.js'
- '<%= BUILD_PATH %>/js/libs/csv.js'
'<%= BUILD_PATH %>/js/libs/dashboard.js'
- '<%= BUILD_PATH %>/js/libs/recent-history.js'
'<%= BUILD_PATH %>/js/libs/third-party/require.js'
]
@@ -106,22 +98,35 @@ module.exports = (grunt) ->
options:
baseUrl: '<%= BUILD_PATH %>/js/'
preserveLicenseComments: false
+ optimize: 'none'
paths:
'react': 'libs/third-party/react-with-addons'
+ 'underscore': 'libs/shim/underscore-shim'
+ 'jquery': 'libs/shim/jquery-shim'
+ 'backbone': 'libs/third-party/backbone'
+ 'backbone.marionette': 'libs/third-party/backbone.marionette'
+
+ main: options:
+ name: 'main'
+ out: '<%= ASSETS_PATH %>/js/main.js'
issuesContext: options:
+ exclude: ['backbone', 'backbone.marionette']
name: 'apps/issues/app-context'
out: '<%= ASSETS_PATH %>/js/apps/issues/app-context.js'
selectList: options:
+ exclude: ['backbone', 'backbone.marionette']
name: 'components/common/select-list'
out: '<%= ASSETS_PATH %>/js/components/common/select-list.js'
app: options:
+ exclude: ['backbone', 'backbone.marionette']
name: 'apps/<%= grunt.option("app") %>/app'
out: '<%= ASSETS_PATH %>/js/apps/<%= grunt.option("app") %>/app.js'
widget: options:
+ exclude: ['backbone', 'backbone.marionette']
name: 'widgets/<%= grunt.option("widget") %>/widget'
out: '<%= ASSETS_PATH %>/js/widgets/<%= grunt.option("widget") %>/widget.js'
@@ -129,13 +134,13 @@ module.exports = (grunt) ->
concurrent:
build:
tasks: [
- 'uglify:build'
# apps
'build-app:account'
'build-app:api-documentation'
'build-app:coding-rules'
'build-app:computation'
'build-app:custom-measures'
+ 'build-app:dashboard'
'build-app:drilldown'
'build-app:global-permissions'
'build-app:groups'
@@ -158,6 +163,8 @@ module.exports = (grunt) ->
# other
'requirejs:issuesContext'
'requirejs:selectList'
+ # main
+ 'requirejs:main'
]
@@ -260,16 +267,17 @@ module.exports = (grunt) ->
expand: true, cwd: '<%= SOURCE_PATH %>/js', src: ['**/*.js'], dest: '<%= BUILD_PATH %>/js'
'assets-js':
src: '<%= BUILD_PATH %>/js/sonar.js', dest: '<%= ASSETS_PATH %>/js/sonar.js'
+ 'assets-libs-js':
+ expand: true, cwd: '<%= BUILD_PATH %>/js/libs', src: ['**/*.js'], dest: '<%= ASSETS_PATH %>/js/libs'
'assets-all-js':
expand: true, cwd: '<%= BUILD_PATH %>/js', src: ['**/*.js'], dest: '<%= ASSETS_PATH %>/js'
'assets-css':
src: '<%= BUILD_PATH %>/css/sonar.css', dest: '<%= ASSETS_PATH %>/css/sonar.css'
- uglify:
+ uglify_parallel:
build:
- src: '<%= ASSETS_PATH %>/js/sonar.js'
- dest: '<%= ASSETS_PATH %>/js/sonar.js'
+ expand: true, cwd: '<%= ASSETS_PATH %>/js', src: ['**/*.js'], dest: '<%= ASSETS_PATH %>/js'
replace:
@@ -339,7 +347,7 @@ module.exports = (grunt) ->
['copy:assets-css', 'copy:assets-all-js']
grunt.registerTask 'build-suffix',
- ['copy:assets-css', 'copy:assets-js', 'concurrent:build']
+ ['copy:assets-css', 'copy:assets-js', 'copy:assets-libs-js', 'concurrent:build', 'uglify_parallel:build']
grunt.registerTask 'test-suffix',
['intern:test', 'rename:lcov', 'replace:lcov']
diff --git a/server/sonar-web/package.json b/server/sonar-web/package.json
index f464079925c..3fb2d923e8e 100644
--- a/server/sonar-web/package.json
+++ b/server/sonar-web/package.json
@@ -12,10 +12,10 @@
"grunt-contrib-handlebars": "0.9.2",
"grunt-contrib-less": "1.0.1",
"grunt-contrib-requirejs": "0.4.4",
- "grunt-contrib-uglify": "0.9.1",
"grunt-contrib-watch": "0.6.1",
"grunt-rename": "^0.1.4",
"grunt-text-replace": "0.4.0",
+ "grunt-uglify-parallel": "0.0.1",
"intern": "^3.0.0-rc.1",
"jit-grunt": "0.9.1",
"sinon": "^1.15.4",
diff --git a/server/sonar-web/src/main/js/api/navigation.jsx b/server/sonar-web/src/main/js/api/navigation.jsx
new file mode 100644
index 00000000000..8204fc34c11
--- /dev/null
+++ b/server/sonar-web/src/main/js/api/navigation.jsx
@@ -0,0 +1,26 @@
+function _request(options) {
+ let $ = jQuery;
+ return $.ajax(options);
+}
+
+function _url(path) {
+ return window.baseUrl + path;
+}
+
+function _typeError(method, message) {
+ throw new TypeError(`navigation#${method}: ${message}`);
+}
+
+export function global() {
+ let url = _url('/api/navigation/global');
+ return _request({ type: 'GET', url });
+}
+
+export function component(componentKey) {
+ if (typeof componentKey !== 'string' || !componentKey.length) {
+ return _typeError('component', 'please provide componentKey');
+ }
+ let url = _url('/api/navigation/component');
+ let data = { componentKey };
+ return _request({ type: 'GET', url, data });
+}
diff --git a/server/sonar-web/src/main/js/api/users.jsx b/server/sonar-web/src/main/js/api/users.jsx
new file mode 100644
index 00000000000..66a5718dfcd
--- /dev/null
+++ b/server/sonar-web/src/main/js/api/users.jsx
@@ -0,0 +1,13 @@
+function _request(options) {
+ let $ = jQuery;
+ return $.ajax(options);
+}
+
+function _url(path) {
+ return window.baseUrl + path;
+}
+
+export function getCurrentUser() {
+ let url = _url('/api/users/current');
+ return _request({ type: 'GET', url });
+}
diff --git a/server/sonar-web/src/main/js/apps/account/change-password-view.js b/server/sonar-web/src/main/js/apps/account/change-password-view.js
index 86522a8dc40..f21ca4be2ce 100644
--- a/server/sonar-web/src/main/js/apps/account/change-password-view.js
+++ b/server/sonar-web/src/main/js/apps/account/change-password-view.js
@@ -8,12 +8,12 @@ define([
return ModalForm.extend({
template: Templates['account-change-password'],
- onFormSubmit: function (e) {
- this._super(e);
+ onFormSubmit: function () {
+ ModalForm.prototype.onFormSubmit.apply(this, arguments);
if (this.checkPasswords()) {
this.sendRequest();
} else {
- this.showErrors([{ msg: t('user.password_doesnt_match_confirmation') }]);
+ this.showErrors([{ msg: window.t('user.password_doesnt_match_confirmation') }]);
}
},
@@ -32,7 +32,7 @@ define([
};
var opts = {
type: 'POST',
- url: baseUrl + '/api/users/change_password',
+ url: window.baseUrl + '/api/users/change_password',
data: data,
statusCode: {
// do not show global error
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 6df5db30ee5..df6b6e6b345 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
@@ -1,25 +1,7 @@
-/*
- * 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.
- */
define([
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Marionette) {
var $ = jQuery;
diff --git a/server/sonar-web/src/main/js/apps/api-documentation/actions-view.js b/server/sonar-web/src/main/js/apps/api-documentation/actions-view.js
index 683485c101b..e98839b6428 100644
--- a/server/sonar-web/src/main/js/apps/api-documentation/actions-view.js
+++ b/server/sonar-web/src/main/js/apps/api-documentation/actions-view.js
@@ -1,25 +1,7 @@
-/*
- * 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.
- */
define([
+ 'backbone.marionette',
'./action-view'
-], function (ActionView) {
+], function (Marionette, ActionView) {
var $ = jQuery;
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 bc38d046613..7e211afe09e 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
@@ -1,30 +1,13 @@
-/*
- * 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.
- */
define([
+ 'backbone',
+ 'backbone.marionette',
'./router',
'./controller',
'./layout',
'./list',
'./list-view',
'./filters-view'
-], function (Router, Controller, Layout, List, ListView, FiltersView) {
+], function (Backbone, Marionette, Router, Controller, Layout, List, ListView, FiltersView) {
var $ = jQuery,
App = new Marionette.Application(),
@@ -69,9 +52,7 @@ define([
};
App.on('start', function (options) {
- window.requestMessages().done(function () {
- init.call(App, options);
- });
+ init.call(App, options);
});
return App;
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 69ae9413bac..0e33de26422 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
@@ -1,26 +1,9 @@
-/*
- * 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.
- */
define([
+ 'backbone',
+ 'backbone.marionette',
'./actions-view',
'./header-view'
-], function (ActionsView, HeaderView) {
+], function (Backbone, Marionette, ActionsView, HeaderView) {
return Marionette.Controller.extend({
diff --git a/server/sonar-web/src/main/js/apps/api-documentation/filters-view.js b/server/sonar-web/src/main/js/apps/api-documentation/filters-view.js
index 8465cfe9db3..525dfeb6030 100644
--- a/server/sonar-web/src/main/js/apps/api-documentation/filters-view.js
+++ b/server/sonar-web/src/main/js/apps/api-documentation/filters-view.js
@@ -1,25 +1,7 @@
-/*
- * 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.
- */
define([
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Marionette) {
return Marionette.ItemView.extend({
template: Templates['api-documentation-filters'],
diff --git a/server/sonar-web/src/main/js/apps/api-documentation/header-view.js b/server/sonar-web/src/main/js/apps/api-documentation/header-view.js
index 259fffae1c6..5a2a7641860 100644
--- a/server/sonar-web/src/main/js/apps/api-documentation/header-view.js
+++ b/server/sonar-web/src/main/js/apps/api-documentation/header-view.js
@@ -1,25 +1,7 @@
-/*
- * 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.
- */
define([
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Marionette) {
return Marionette.ItemView.extend({
template: Templates['api-documentation-header'],
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 2c88eb9e13f..79619bda267 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
@@ -1,25 +1,7 @@
-/*
- * 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.
- */
define([
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Marionette) {
return Marionette.ItemView.extend({
tagName: 'a',
diff --git a/server/sonar-web/src/main/js/apps/api-documentation/layout.js b/server/sonar-web/src/main/js/apps/api-documentation/layout.js
index 67b30bb34b0..6478b6471e9 100644
--- a/server/sonar-web/src/main/js/apps/api-documentation/layout.js
+++ b/server/sonar-web/src/main/js/apps/api-documentation/layout.js
@@ -1,25 +1,8 @@
-/*
- * 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.
- */
define([
+ 'backbone.marionette',
+ '../../components/common/jquery-isolated-scroll',
'./templates'
-], function () {
+], function (Marionette) {
return Marionette.LayoutView.extend({
template: Templates['api-documentation-layout'],
diff --git a/server/sonar-web/src/main/js/apps/api-documentation/list-view.js b/server/sonar-web/src/main/js/apps/api-documentation/list-view.js
index b90ba7f725a..b0b22a0ae50 100644
--- a/server/sonar-web/src/main/js/apps/api-documentation/list-view.js
+++ b/server/sonar-web/src/main/js/apps/api-documentation/list-view.js
@@ -1,25 +1,7 @@
-/*
- * 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.
- */
define([
+ 'backbone.marionette',
'./item-view'
-], function (ItemView) {
+], function (Marionette, ItemView) {
return Marionette.CollectionView.extend({
className: 'list-group',
diff --git a/server/sonar-web/src/main/js/apps/api-documentation/list.js b/server/sonar-web/src/main/js/apps/api-documentation/list.js
index 131b3352e8d..e525c84a818 100644
--- a/server/sonar-web/src/main/js/apps/api-documentation/list.js
+++ b/server/sonar-web/src/main/js/apps/api-documentation/list.js
@@ -1,23 +1,6 @@
-/*
- * 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.
- */
-define(function () {
+define([
+ 'backbone'
+], function (Backbone) {
return Backbone.Collection.extend({
url: baseUrl + '/api/webservices/list',
diff --git a/server/sonar-web/src/main/js/apps/api-documentation/router.js b/server/sonar-web/src/main/js/apps/api-documentation/router.js
index fee3493fb18..65f1c62a6fd 100644
--- a/server/sonar-web/src/main/js/apps/api-documentation/router.js
+++ b/server/sonar-web/src/main/js/apps/api-documentation/router.js
@@ -1,23 +1,6 @@
-/*
- * 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.
- */
-define(function () {
+define([
+ 'backbone'
+], function (Backbone) {
return Backbone.Router.extend({
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/app.js b/server/sonar-web/src/main/js/apps/coding-rules/app.js
index 61f5e97ddd2..67b18ef2b11 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/app.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/app.js
@@ -1,4 +1,6 @@
define([
+ 'backbone',
+ 'backbone.marionette',
'./models/state',
'./layout',
'./models/rules',
@@ -13,7 +15,9 @@ define([
'./facets-view',
'./filters-view'
],
- function (State,
+ function (Backbone,
+ Marionette,
+ State,
Layout,
Rules,
Facets,
@@ -71,7 +75,7 @@ define([
App.manualRepository = function () {
return {
key: 'manual',
- name: t('coding_rules.manual_rule'),
+ name: window.t('coding_rules.manual_rule'),
language: 'none'
};
};
@@ -104,7 +108,7 @@ define([
});
App.on('start', function (options) {
- $.when(window.requestMessages(), appXHR).done(function () {
+ $.when(appXHR).done(function () {
init.call(App, options);
});
});
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/bulk-change-modal-view.js b/server/sonar-web/src/main/js/apps/coding-rules/bulk-change-modal-view.js
index bdd2cbb5f34..d9bff5b021d 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/bulk-change-modal-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/bulk-change-modal-view.js
@@ -36,14 +36,14 @@ define([
showSuccessMessage: function (profile, succeeded) {
var profileBase = _.findWhere(this.options.app.qualityProfiles, { key: profile }),
profileName = profileBase != null ? profileBase.name : profile,
- message = tp('coding_rules.bulk_change.success', profileName, profileBase.language, succeeded);
+ message = window.tp('coding_rules.bulk_change.success', profileName, profileBase.language, succeeded);
this.ui.messagesContainer.append('<div class="alert alert-success">' + message + '</div>');
},
showWarnMessage: function (profile, succeeded, failed) {
var profileBase = _.findWhere(this.options.app.qualityProfiles, { key: profile }),
profileName = profileBase != null ? profileBase.name : profile,
- message = tp('coding_rules.bulk_change.warning', profileName, profileBase.language, succeeded, failed);
+ message = window.tp('coding_rules.bulk_change.warning', profileName, profileBase.language, succeeded, failed);
this.ui.messagesContainer.append('<div class="alert alert-warning">' + message + '</div>');
},
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/active-severity-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/active-severity-facet.js
index 6695943968d..7cabf7b44e2 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/facets/active-severity-facet.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/active-severity-facet.js
@@ -46,7 +46,7 @@ define([
forbid: function () {
BaseFacet.prototype.forbid.apply(this, arguments);
- this.$el.prop('title', t('coding_rules.filters.active_severity.inactive'));
+ this.$el.prop('title', window.t('coding_rules.filters.active_severity.inactive'));
},
allow: function () {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/custom-values-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/custom-values-facet.js
index 7aad57ad48c..b43aadb3ff1 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/facets/custom-values-facet.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/custom-values-facet.js
@@ -32,7 +32,7 @@ define([
},
getUrl: function () {
- return baseUrl;
+ return window.baseUrl;
},
onRender: function () {
@@ -42,17 +42,17 @@ define([
prepareSearch: function () {
this.$('.js-custom-value').select2({
- placeholder: t('search_verb'),
+ placeholder: window.t('search_verb'),
minimumInputLength: 1,
allowClear: false,
formatNoMatches: function () {
- return t('select2.noMatches');
+ return window.t('select2.noMatches');
},
formatSearching: function () {
- return t('select2.searching');
+ return window.t('select2.searching');
},
formatInputTooShort: function () {
- return tp('select2.tooShort', 1);
+ return window.tp('select2.tooShort', 1);
},
width: '100%',
ajax: this.prepareAjaxSearch()
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/inheritance-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/inheritance-facet.js
index 1a05fff7479..50bef351339 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/facets/inheritance-facet.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/inheritance-facet.js
@@ -51,7 +51,7 @@ define([
forbid: function () {
BaseFacet.prototype.forbid.apply(this, arguments);
- this.$el.prop('title', t('coding_rules.filters.inheritance.inactive'));
+ this.$el.prop('title', window.t('coding_rules.filters.inheritance.inactive'));
},
allow: function () {
@@ -63,7 +63,7 @@ define([
var values = ['NONE', 'INHERITED', 'OVERRIDES'];
return values.map(function (key) {
return {
- label: t('coding_rules.filters.inheritance', key.toLowerCase()),
+ label: window.t('coding_rules.filters.inheritance', key.toLowerCase()),
val: key
};
});
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/language-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/language-facet.js
index 478c589032c..1873599e3cd 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/facets/language-facet.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/language-facet.js
@@ -24,7 +24,7 @@ define([
return CustomValuesFacet.extend({
getUrl: function () {
- return baseUrl + '/api/languages/list';
+ return window.baseUrl + '/api/languages/list';
},
prepareAjaxSearch: function () {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/repository-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/repository-facet.js
index 08283dc5b18..ae064ba3b2a 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/facets/repository-facet.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/repository-facet.js
@@ -24,7 +24,7 @@ define([
return CustomValuesFacet.extend({
getUrl: function () {
- return baseUrl + '/api/rules/repositories';
+ return window.baseUrl + '/api/rules/repositories';
},
prepareAjaxSearch: function () {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/status-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/status-facet.js
index 96854e47564..2d2b6b654e8 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/facets/status-facet.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/status-facet.js
@@ -27,7 +27,7 @@ define([
getValues: function () {
var values = this.model.getValues();
var x = values.map(function (value) {
- return _.extend(value, { label: t('rules.status', value.val.toLowerCase()) });
+ return _.extend(value, { label: window.t('rules.status', value.val.toLowerCase()) });
});
return x;
},
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/tag-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/tag-facet.js
index 9a5b0f21570..3e6a064ef6c 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/facets/tag-facet.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/tag-facet.js
@@ -24,7 +24,7 @@ define([
return CustomValuesFacet.extend({
getUrl: function () {
- return baseUrl + '/api/rules/tags';
+ return window.baseUrl + '/api/rules/tags';
},
prepareAjaxSearch: function () {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/filters-view.js b/server/sonar-web/src/main/js/apps/coding-rules/filters-view.js
index 4626acd9d02..c7a289e9c29 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/filters-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/filters-view.js
@@ -1,26 +1,8 @@
-/*
- * 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.
- */
define([
+ 'backbone.marionette',
'./rule/manual-rule-creation-view',
'./templates'
-], function (ManualRuleCreationView) {
+], function (Marionette, ManualRuleCreationView) {
return Marionette.ItemView.extend({
template: Templates['coding-rules-filters'],
@@ -36,7 +18,9 @@ define([
},
serializeData: function () {
- return _.extend(this._super(), { canWrite: this.options.app.canWrite });
+ return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
+ canWrite: this.options.app.canWrite
+ });
}
});
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/layout.js b/server/sonar-web/src/main/js/apps/coding-rules/layout.js
index 34f66a61a2e..d2fff28e341 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/layout.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/layout.js
@@ -1,25 +1,8 @@
-/*
- * 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.
- */
define([
+ 'backbone.marionette',
+ '../../components/common/jquery-isolated-scroll',
'./templates'
-], function () {
+], function (Marionette) {
var $ = jQuery;
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/models/rule.js b/server/sonar-web/src/main/js/apps/coding-rules/models/rule.js
index 51993df4b98..fbc5ecdd8b0 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/models/rule.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/models/rule.js
@@ -1,23 +1,6 @@
-/*
- * 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.
- */
-define(function () {
+define([
+ 'backbone'
+], function (Backbone) {
return Backbone.Model.extend({
idAttribute: 'key',
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/models/rules.js b/server/sonar-web/src/main/js/apps/coding-rules/models/rules.js
index f1f83bcf1bd..39a833309e5 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/models/rules.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/models/rules.js
@@ -1,25 +1,7 @@
-/*
- * 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.
- */
define([
+ 'backbone',
'./rule'
-], function (Rule) {
+], function (Backbone, Rule) {
return Backbone.Collection.extend({
model: Rule,
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule-details-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule-details-view.js
index 05856342aa4..f1536004dff 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/rule-details-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/rule-details-view.js
@@ -1,23 +1,6 @@
-/*
- * 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.
- */
define([
+ 'backbone',
+ 'backbone.marionette',
'./models/rules',
'./rule/rule-meta-view',
'./rule/rule-description-view',
@@ -27,9 +10,12 @@ define([
'./rule/manual-rule-creation-view',
'./rule/custom-rule-creation-view',
'./rule/rule-issues-view',
+ '../../components/common/dialogs',
'./templates'
],
- function (Rules,
+ function (Backbone,
+ Marionette,
+ Rules,
MetaView,
DescView,
ParamView,
@@ -37,7 +23,8 @@ define([
CustomRulesView,
ManualRuleCreationView,
CustomRuleCreationView,
- IssuesView) {
+ IssuesView,
+ confirmDialog) {
var $ = jQuery;
@@ -163,9 +150,9 @@ define([
deleteRule: function () {
var that = this,
ruleType = this.model.has('templateKey') ? 'custom' : 'manual';
- window.confirmDialog({
- title: t('delete'),
- html: tp('coding_rules.delete.' + ruleType + '.confirm', this.model.get('name')),
+ confirmDialog({
+ title: window.t('delete'),
+ html: window.tp('coding_rules.delete.' + ruleType + '.confirm', this.model.get('name')),
yesHandler: function () {
var url = baseUrl + '/api/rules/delete',
options = { key: that.model.id };
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-creation-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-creation-view.js
index e15a1149e69..1ee49177642 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-creation-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-creation-view.js
@@ -19,8 +19,9 @@
*/
define([
'components/common/modal-form',
+ '../../../libs/csv',
'../templates'
-], function (ModalFormView) {
+], function (ModalFormView, csvEscape) {
var $ = jQuery;
@@ -128,7 +129,7 @@ define([
};
}).get();
options.params = params.map(function (param) {
- return param.key + '=' + window.csvEscape(param.value);
+ return param.key + '=' + csvEscape(param.value);
}).join(';');
this.sendRequest(action, options);
},
@@ -172,7 +173,7 @@ define([
}).fail(function (jqXHR) {
if (jqXHR.status === 409) {
that.existingRule = jqXHR.responseJSON.rule;
- that.showErrors([], [{ msg: t('coding_rules.reactivate.help') }]);
+ that.showErrors([], [{ msg: window.t('coding_rules.reactivate.help') }]);
that.ui.customRuleCreationCreate.addClass('hidden');
that.ui.customRuleCreationReactivate.removeClass('hidden');
} else {
@@ -194,7 +195,7 @@ define([
var statuses = ['READY', 'BETA', 'DEPRECATED'].map(function (status) {
return {
id: status,
- text: t('rules.status', status.toLowerCase())
+ text: window.t('rules.status', status.toLowerCase())
};
});
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-view.js
index e50b7c11005..5dc0c9ac732 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-view.js
@@ -1,25 +1,8 @@
-/*
- * 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.
- */
define([
+ 'backbone.marionette',
+ '../../../components/common/dialogs',
'../templates'
-], function () {
+], function (Marionette, confirmDialog) {
var $ = jQuery;
@@ -37,9 +20,9 @@ define([
deleteRule: function () {
var that = this;
- window.confirmDialog({
- title: t('delete'),
- html: t('are_you_sure'),
+ confirmDialog({
+ title: window.t('delete'),
+ html: window.t('are_you_sure'),
yesHandler: function () {
var url = baseUrl + '/api/rules/delete',
options = { key: that.model.id };
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rules-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rules-view.js
index 56ae2a95833..bd51911930d 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rules-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rules-view.js
@@ -1,27 +1,9 @@
-/*
- * 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.
- */
define([
+ 'backbone.marionette',
'./custom-rule-view',
'./custom-rule-creation-view',
'../templates'
-], function (CustomRuleView, CustomRuleCreationView) {
+], function (Marionette, CustomRuleView, CustomRuleCreationView) {
return Marionette.CompositeView.extend({
template: Templates['coding-rules-custom-rules'],
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/manual-rule-creation-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/manual-rule-creation-view.js
index 66617fc33ed..32c707f6c9a 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/rule/manual-rule-creation-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/manual-rule-creation-view.js
@@ -119,7 +119,7 @@ define([
}).fail(function (jqXHR) {
if (jqXHR.status === 409) {
that.existingRule = jqXHR.responseJSON.rule;
- that.showErrors([], [{ msg: t('coding_rules.reactivate.help') }]);
+ that.showErrors([], [{ msg: window.t('coding_rules.reactivate.help') }]);
that.ui.manualRuleCreationCreate.addClass('hidden');
that.ui.manualRuleCreationReactivate.removeClass('hidden');
} else {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/profile-activation-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/profile-activation-view.js
index 87296ca2e0f..663895b4823 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/rule/profile-activation-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/profile-activation-view.js
@@ -1,26 +1,9 @@
-/*
- * 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.
- */
define([
+ 'backbone',
'components/common/modal-form',
+ '../../../libs/csv',
'../templates'
-], function (ModalForm) {
+], function (Backbone, ModalForm, csvEscape) {
var $ = jQuery;
@@ -28,7 +11,7 @@ define([
template: Templates['coding-rules-profile-activation'],
ui: function () {
- return _.extend(this._super(), {
+ return _.extend(ModalForm.prototype.ui.apply(this, arguments), {
qualityProfileSelect: '#coding-rules-quality-profile-activation-select',
qualityProfileSeverity: '#coding-rules-quality-profile-activation-severity',
qualityProfileActivate: '#coding-rules-quality-profile-activation-activate',
@@ -37,13 +20,13 @@ define([
},
events: function () {
- return _.extend(this._super(), {
+ return _.extend(ModalForm.prototype.events.apply(this, arguments), {
'click @ui.qualityProfileActivate': 'activate'
});
},
onRender: function () {
- this._super();
+ ModalForm.prototype.onRender.apply(this, arguments);
this.ui.qualityProfileSelect.select2({
width: '250px',
@@ -82,7 +65,7 @@ define([
};
}).get(),
paramsHash = (params.map(function (param) {
- return param.key + '=' + window.csvEscape(param.value);
+ return param.key + '=' + csvEscape(param.value);
})).join(';');
if (this.model) {
@@ -146,7 +129,7 @@ define([
var availableProfiles = this.getAvailableQualityProfiles(this.options.rule.get('lang'));
- return _.extend(this._super(), {
+ return _.extend(ModalForm.prototype.serializeData.apply(this, arguments), {
change: this.model && this.model.has('severity'),
params: params,
qualityProfiles: availableProfiles,
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-description-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-description-view.js
index c84213c614d..cd36bb7d3d9 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-description-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-description-view.js
@@ -1,25 +1,8 @@
-/*
- * 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.
- */
define([
+ 'backbone.marionette',
+ '../../../components/common/dialogs',
'../templates'
-], function () {
+], function (Marionette, confirmDialog) {
return Marionette.ItemView.extend({
template: Templates['coding-rules-rule-description'],
@@ -80,8 +63,8 @@ define([
removeExtendedDescription: function () {
var that = this;
- window.confirmDialog({
- html: t('coding_rules.remove_extended_description.confirm'),
+ confirmDialog({
+ html: window.t('coding_rules.remove_extended_description.confirm'),
yesHandler: function () {
that.ui.extendDescriptionText.val('');
that.submitExtendDescription();
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-issues-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-issues-view.js
index ebbd0f62149..373c4a54a45 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-issues-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-issues-view.js
@@ -1,25 +1,7 @@
-/*
- * 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.
- */
define([
+ 'backbone.marionette',
'../templates'
-], function () {
+], function (Marionette) {
var $ = jQuery;
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-meta-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-meta-view.js
index d8565818c52..f31fbb7656e 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-meta-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-meta-view.js
@@ -1,26 +1,8 @@
-/*
- * 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.
- */
define([
+ 'backbone.marionette',
'./rule-filter-mixin',
'../templates'
-], function (RuleFilterMixin) {
+], function (Marionette, RuleFilterMixin) {
return Marionette.ItemView.extend(RuleFilterMixin).extend({
template: Templates['coding-rules-rule-meta'],
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-parameters-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-parameters-view.js
index 2e5a927621d..d49a6adcb21 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-parameters-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-parameters-view.js
@@ -1,25 +1,7 @@
-/*
- * 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.
- */
define([
+ 'backbone.marionette',
'../templates'
-], function () {
+], function (Marionette) {
return Marionette.ItemView.extend({
template: Templates['coding-rules-rule-parameters'],
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profile-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profile-view.js
index 42902e38c3c..5701de25f80 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profile-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profile-view.js
@@ -1,26 +1,10 @@
-/*
- * 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.
- */
define([
+ 'backbone',
+ 'backbone.marionette',
'./profile-activation-view',
+ '../../../components/common/dialogs',
'../templates'
-], function (ProfileActivationView) {
+], function (Backbone, Marionette, ProfileActivationView, confirmDialog) {
return Marionette.ItemView.extend({
tagName: 'tr',
@@ -65,9 +49,9 @@ define([
revert: function () {
var that = this,
ruleKey = this.options.rule.get('key');
- window.confirmDialog({
- title: t('coding_rules.revert_to_parent_definition'),
- html: tp('coding_rules.revert_to_parent_definition.confirm', this.getParent().name),
+ confirmDialog({
+ title: window.t('coding_rules.revert_to_parent_definition'),
+ html: window.tp('coding_rules.revert_to_parent_definition.confirm', this.getParent().name),
yesHandler: function () {
return jQuery.ajax({
type: 'POST',
@@ -87,9 +71,9 @@ define([
deactivate: function () {
var that = this,
ruleKey = this.options.rule.get('key');
- window.confirmDialog({
- title: t('coding_rules.deactivate'),
- html: tp('coding_rules.deactivate.confirm'),
+ confirmDialog({
+ title: window.t('coding_rules.deactivate'),
+ html: window.tp('coding_rules.deactivate.confirm'),
yesHandler: function () {
return jQuery.ajax({
type: 'POST',
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profiles-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profiles-view.js
index fc7662e5073..562f349939a 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profiles-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profiles-view.js
@@ -1,27 +1,9 @@
-/*
- * 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.
- */
define([
+ 'backbone.marionette',
'./rule-profile-view',
'./profile-activation-view',
'../templates'
-], function (ProfileView, ProfileActivationView) {
+], function (Marionette, ProfileView, ProfileActivationView) {
return Marionette.CompositeView.extend({
template: Templates['coding-rules-rule-profiles'],
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-empty-view.js b/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-empty-view.js
index 2aefada2578..20b4f0f4b3f 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-empty-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-empty-view.js
@@ -1,29 +1,12 @@
-/*
- * 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.
- */
-define(function () {
+define([
+ 'backbone.marionette'
+], function (Marionette) {
return Marionette.ItemView.extend({
className: 'search-navigator-no-results',
template: function () {
- return t('coding_rules.no_results');
+ return window.t('coding_rules.no_results');
}
});
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-item-view.js b/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-item-view.js
index 1041a326de9..f3c8de7de57 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-item-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-item-view.js
@@ -1,28 +1,11 @@
-/*
- * 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.
- */
define([
+ 'backbone',
'components/navigator/workspace-list-item-view',
'./rule/profile-activation-view',
+ '../../components/common/dialogs',
'./rule/rule-filter-mixin',
'./templates'
-], function (WorkspaceListItemView, ProfileActivationView, RuleFilterMixin) {
+], function (Backbone, WorkspaceListItemView, ProfileActivationView, confirmDialog, RuleFilterMixin) {
return WorkspaceListItemView.extend(RuleFilterMixin).extend({
className: 'coding-rule',
@@ -78,9 +61,9 @@ define([
var that = this,
ruleKey = this.model.get('key'),
activation = this.model.get('activation');
- window.confirmDialog({
- title: t('coding_rules.deactivate'),
- html: tp('coding_rules.deactivate.confirm'),
+ confirmDialog({
+ title: window.t('coding_rules.deactivate'),
+ html: window.tp('coding_rules.deactivate.confirm'),
yesHandler: function () {
return jQuery.ajax({
type: 'POST',
diff --git a/server/sonar-web/src/main/js/apps/computation/app.js b/server/sonar-web/src/main/js/apps/computation/app.js
index 43e64d86b5d..73ac19753ac 100644
--- a/server/sonar-web/src/main/js/apps/computation/app.js
+++ b/server/sonar-web/src/main/js/apps/computation/app.js
@@ -1,4 +1,6 @@
define([
+ 'backbone',
+ 'backbone.marionette',
'./router',
'./layout',
'./reports',
@@ -6,7 +8,7 @@ define([
'./search-view',
'./list-view',
'./list-footer-view'
-], function (Router, Layout, Reports, HeaderView, SearchView, ListView, ListFooterView) {
+], function (Backbone, Marionette, Router, Layout, Reports, HeaderView, SearchView, ListView, ListFooterView) {
var App = new Marionette.Application(),
init = function (options) {
@@ -47,9 +49,7 @@ define([
};
App.on('start', function (options) {
- window.requestMessages().done(function () {
- init.call(App, options);
- });
+ init.call(App, options);
});
return App;
diff --git a/server/sonar-web/src/main/js/apps/computation/header-view.js b/server/sonar-web/src/main/js/apps/computation/header-view.js
index 8e010c0eded..6a36a006cbb 100644
--- a/server/sonar-web/src/main/js/apps/computation/header-view.js
+++ b/server/sonar-web/src/main/js/apps/computation/header-view.js
@@ -1,6 +1,7 @@
define([
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Marionette) {
return Marionette.ItemView.extend({
template: Templates['computation-header']
diff --git a/server/sonar-web/src/main/js/apps/computation/layout.js b/server/sonar-web/src/main/js/apps/computation/layout.js
index 2e7edcd22bf..b8de14574a0 100644
--- a/server/sonar-web/src/main/js/apps/computation/layout.js
+++ b/server/sonar-web/src/main/js/apps/computation/layout.js
@@ -1,6 +1,7 @@
define([
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Marionette) {
return Marionette.LayoutView.extend({
template: Templates['computation-layout'],
diff --git a/server/sonar-web/src/main/js/apps/computation/list-footer-view.js b/server/sonar-web/src/main/js/apps/computation/list-footer-view.js
index 5034f25a3e8..c6f98d9238f 100644
--- a/server/sonar-web/src/main/js/apps/computation/list-footer-view.js
+++ b/server/sonar-web/src/main/js/apps/computation/list-footer-view.js
@@ -1,6 +1,7 @@
define([
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Marionette) {
return Marionette.ItemView.extend({
template: Templates['computation-list-footer'],
diff --git a/server/sonar-web/src/main/js/apps/computation/list-item-view.js b/server/sonar-web/src/main/js/apps/computation/list-item-view.js
index afcf2f15d3f..44e5e32dcaf 100644
--- a/server/sonar-web/src/main/js/apps/computation/list-item-view.js
+++ b/server/sonar-web/src/main/js/apps/computation/list-item-view.js
@@ -1,6 +1,7 @@
define([
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Marionette) {
return Marionette.ItemView.extend({
tagName: 'li',
diff --git a/server/sonar-web/src/main/js/apps/computation/list-view.js b/server/sonar-web/src/main/js/apps/computation/list-view.js
index 24878864d30..b56e64f951d 100644
--- a/server/sonar-web/src/main/js/apps/computation/list-view.js
+++ b/server/sonar-web/src/main/js/apps/computation/list-view.js
@@ -1,7 +1,8 @@
define([
+ 'backbone.marionette',
'./list-item-view',
'./templates'
-], function (ListItemView) {
+], function (Marionette, ListItemView) {
return Marionette.CollectionView.extend({
tagName: 'ul',
diff --git a/server/sonar-web/src/main/js/apps/computation/report.js b/server/sonar-web/src/main/js/apps/computation/report.js
index 2eac3f23e84..a1895bd4d3c 100644
--- a/server/sonar-web/src/main/js/apps/computation/report.js
+++ b/server/sonar-web/src/main/js/apps/computation/report.js
@@ -1,4 +1,6 @@
-define(function () {
+define([
+ 'backbone'
+], function (Backbone) {
return Backbone.Model.extend({
idAttribute: 'key',
diff --git a/server/sonar-web/src/main/js/apps/computation/reports.js b/server/sonar-web/src/main/js/apps/computation/reports.js
index 9c8144333bb..04b6eae2eaa 100644
--- a/server/sonar-web/src/main/js/apps/computation/reports.js
+++ b/server/sonar-web/src/main/js/apps/computation/reports.js
@@ -1,6 +1,7 @@
define([
+ 'backbone',
'./report'
-], function (Report) {
+], function (Backbone, Report) {
return Backbone.Collection.extend({
model: Report,
@@ -15,7 +16,7 @@ define([
fetch: function (options) {
var opts = _.defaults(options || {}, { q: this.q }, { q: 'history' });
- opts.url = baseUrl + '/api/computation/' + opts.q;
+ opts.url = window.baseUrl + '/api/computation/' + opts.q;
this.q = opts.q;
return Backbone.Collection.prototype.fetch.call(this, opts);
},
diff --git a/server/sonar-web/src/main/js/apps/computation/router.js b/server/sonar-web/src/main/js/apps/computation/router.js
index 6d874801cd3..611a685ea19 100644
--- a/server/sonar-web/src/main/js/apps/computation/router.js
+++ b/server/sonar-web/src/main/js/apps/computation/router.js
@@ -1,4 +1,6 @@
-define(function () {
+define([
+ 'backbone'
+], function (Backbone) {
return Backbone.Router.extend({
routes: {
diff --git a/server/sonar-web/src/main/js/apps/computation/search-view.js b/server/sonar-web/src/main/js/apps/computation/search-view.js
index 75ab65c4dad..68a0cb7dd34 100644
--- a/server/sonar-web/src/main/js/apps/computation/search-view.js
+++ b/server/sonar-web/src/main/js/apps/computation/search-view.js
@@ -1,6 +1,7 @@
define([
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Marionette) {
return Marionette.ItemView.extend({
template: Templates['computation-search'],
diff --git a/server/sonar-web/src/main/js/apps/custom-measures/app.js b/server/sonar-web/src/main/js/apps/custom-measures/app.js
index de6316fb658..ad941ec3f65 100644
--- a/server/sonar-web/src/main/js/apps/custom-measures/app.js
+++ b/server/sonar-web/src/main/js/apps/custom-measures/app.js
@@ -1,10 +1,11 @@
define([
+ 'backbone.marionette',
'./layout',
'./custom-measures',
'./header-view',
'./list-view',
'./list-footer-view'
-], function (Layout, CustomMeasures, HeaderView, ListView, ListFooterView) {
+], function (Marionette, Layout, CustomMeasures, HeaderView, ListView, ListFooterView) {
var App = new Marionette.Application(),
init = function (options) {
@@ -16,13 +17,13 @@ define([
// Collection
this.customMeasures = new CustomMeasures({
- projectId: options.projectId
+ projectId: options.component.uuid
});
// Header View
this.headerView = new HeaderView({
collection: this.customMeasures,
- projectId: options.projectId
+ projectId: options.component.uuid
});
this.layout.headerRegion.show(this.headerView);
@@ -43,9 +44,7 @@ define([
};
App.on('start', function (options) {
- window.requestMessages().done(function () {
- init.call(App, options);
- });
+ init.call(App, options);
});
return App;
diff --git a/server/sonar-web/src/main/js/apps/custom-measures/custom-measure.js b/server/sonar-web/src/main/js/apps/custom-measures/custom-measure.js
index fce8bf4fbdf..aaa8c2d1b66 100644
--- a/server/sonar-web/src/main/js/apps/custom-measures/custom-measure.js
+++ b/server/sonar-web/src/main/js/apps/custom-measures/custom-measure.js
@@ -1,10 +1,12 @@
-define(function () {
+define([
+ 'backbone'
+], function (Backbone) {
return Backbone.Model.extend({
idAttribute: 'id',
urlRoot: function () {
- return baseUrl + '/api/custom_measures';
+ return window.baseUrl + '/api/custom_measures';
},
sync: function (method, model, options) {
diff --git a/server/sonar-web/src/main/js/apps/custom-measures/custom-measures.js b/server/sonar-web/src/main/js/apps/custom-measures/custom-measures.js
index 2febc1ea652..ae23b352832 100644
--- a/server/sonar-web/src/main/js/apps/custom-measures/custom-measures.js
+++ b/server/sonar-web/src/main/js/apps/custom-measures/custom-measures.js
@@ -1,6 +1,7 @@
define([
+ 'backbone',
'./custom-measure'
-], function (CustomMeasure) {
+], function (Backbone, CustomMeasure) {
return Backbone.Collection.extend({
model: CustomMeasure,
@@ -10,7 +11,7 @@ define([
},
url: function () {
- return baseUrl + '/api/custom_measures/search';
+ return window.baseUrl + '/api/custom_measures/search';
},
parse: function (r) {
@@ -24,7 +25,7 @@ define([
var opts = _.defaults(options || {}, { data: {} });
this.q = opts.data.q;
opts.data.projectId = this.projectId;
- return this._super(opts);
+ return Backbone.Collection.prototype.fetch.call(this, opts);
},
fetchMore: function () {
diff --git a/server/sonar-web/src/main/js/apps/custom-measures/delete-view.js b/server/sonar-web/src/main/js/apps/custom-measures/delete-view.js
index 1838b83e044..b3092fd0343 100644
--- a/server/sonar-web/src/main/js/apps/custom-measures/delete-view.js
+++ b/server/sonar-web/src/main/js/apps/custom-measures/delete-view.js
@@ -6,8 +6,8 @@ define([
return ModalForm.extend({
template: Templates['custom-measures-delete'],
- onFormSubmit: function (e) {
- this._super(e);
+ onFormSubmit: function () {
+ ModalForm.prototype.onFormSubmit.apply(this, arguments);
this.sendRequest();
},
diff --git a/server/sonar-web/src/main/js/apps/custom-measures/form-view.js b/server/sonar-web/src/main/js/apps/custom-measures/form-view.js
index 30ed30082b9..15d9e405098 100644
--- a/server/sonar-web/src/main/js/apps/custom-measures/form-view.js
+++ b/server/sonar-web/src/main/js/apps/custom-measures/form-view.js
@@ -14,7 +14,7 @@ define([
},
onRender: function () {
- this._super();
+ ModalForm.prototype.onRender.apply(this, arguments);
this.$('[data-toggle="tooltip"]').tooltip({ container: 'body', placement: 'bottom' });
this.$('#create-custom-measure-metric').select2({
width: '250px',
@@ -23,12 +23,12 @@ define([
},
onDestroy: function () {
- this._super();
+ ModalForm.prototype.onDestroy.apply(this, arguments);
this.$('[data-toggle="tooltip"]').tooltip('destroy');
},
- onFormSubmit: function (e) {
- this._super(e);
+ onFormSubmit: function () {
+ ModalForm.prototype.onFormSubmit.apply(this, arguments);
this.sendRequest();
},
@@ -42,7 +42,7 @@ define([
serializeData: function () {
var metrics = this.getAvailableMetrics(),
isNew = !this.model;
- return _.extend(this._super(), {
+ return _.extend(ModalForm.prototype.serializeData.apply(this, arguments), {
metrics: metrics,
canCreateMetric: !isNew || (isNew && metrics.length > 0)
});
diff --git a/server/sonar-web/src/main/js/apps/custom-measures/header-view.js b/server/sonar-web/src/main/js/apps/custom-measures/header-view.js
index 8b22efcec5a..87bc3f1d628 100644
--- a/server/sonar-web/src/main/js/apps/custom-measures/header-view.js
+++ b/server/sonar-web/src/main/js/apps/custom-measures/header-view.js
@@ -1,7 +1,8 @@
define([
+ 'backbone.marionette',
'./create-view',
'./templates'
-], function (CreateView) {
+], function (Marionette, CreateView) {
return Marionette.ItemView.extend({
template: Templates['custom-measures-header'],
diff --git a/server/sonar-web/src/main/js/apps/custom-measures/layout.js b/server/sonar-web/src/main/js/apps/custom-measures/layout.js
index b4aa4ece791..bf72535e6dc 100644
--- a/server/sonar-web/src/main/js/apps/custom-measures/layout.js
+++ b/server/sonar-web/src/main/js/apps/custom-measures/layout.js
@@ -1,6 +1,7 @@
define([
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Marionette) {
return Marionette.LayoutView.extend({
template: Templates['custom-measures-layout'],
diff --git a/server/sonar-web/src/main/js/apps/custom-measures/list-footer-view.js b/server/sonar-web/src/main/js/apps/custom-measures/list-footer-view.js
index d66c27ad335..6ca83eb4990 100644
--- a/server/sonar-web/src/main/js/apps/custom-measures/list-footer-view.js
+++ b/server/sonar-web/src/main/js/apps/custom-measures/list-footer-view.js
@@ -1,6 +1,7 @@
define([
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Marionette) {
return Marionette.ItemView.extend({
template: Templates['custom-measures-list-footer'],
@@ -23,7 +24,7 @@ define([
},
serializeData: function () {
- return _.extend(this._super(), {
+ return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
total: this.collection.total,
count: this.collection.length,
more: this.collection.hasMore()
diff --git a/server/sonar-web/src/main/js/apps/custom-measures/list-item-view.js b/server/sonar-web/src/main/js/apps/custom-measures/list-item-view.js
index 97d9671eb17..b2da300354b 100644
--- a/server/sonar-web/src/main/js/apps/custom-measures/list-item-view.js
+++ b/server/sonar-web/src/main/js/apps/custom-measures/list-item-view.js
@@ -1,8 +1,9 @@
define([
+ 'backbone.marionette',
'./update-view',
'./delete-view',
'./templates'
-], function (UpdateView, DeleteView) {
+], function (Marionette, UpdateView, DeleteView) {
return Marionette.ItemView.extend({
tagName: 'li',
diff --git a/server/sonar-web/src/main/js/apps/custom-measures/list-view.js b/server/sonar-web/src/main/js/apps/custom-measures/list-view.js
index 24878864d30..b56e64f951d 100644
--- a/server/sonar-web/src/main/js/apps/custom-measures/list-view.js
+++ b/server/sonar-web/src/main/js/apps/custom-measures/list-view.js
@@ -1,7 +1,8 @@
define([
+ 'backbone.marionette',
'./list-item-view',
'./templates'
-], function (ListItemView) {
+], function (Marionette, ListItemView) {
return Marionette.CollectionView.extend({
tagName: 'ul',
diff --git a/server/sonar-web/src/main/js/apps/dashboard/app.jsx b/server/sonar-web/src/main/js/apps/dashboard/app.jsx
new file mode 100644
index 00000000000..98ae2f4691f
--- /dev/null
+++ b/server/sonar-web/src/main/js/apps/dashboard/app.jsx
@@ -0,0 +1,10 @@
+export default {
+ start(options) {
+ let widgets = window.widgets || [];
+ widgets.forEach(widget => {
+ require([`widgets/${widget.name}/widget`], Widget => {
+ new Widget(widget.options);
+ });
+ });
+ }
+};
diff --git a/server/sonar-web/src/main/js/apps/drilldown/app.js b/server/sonar-web/src/main/js/apps/drilldown/app.js
index e46612c1a13..b2f9cca9940 100644
--- a/server/sonar-web/src/main/js/apps/drilldown/app.js
+++ b/server/sonar-web/src/main/js/apps/drilldown/app.js
@@ -1,30 +1,12 @@
-/*
- * 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.
- */
define([
+ 'backbone.marionette',
'components/source-viewer/main'
-], function (SourceViewer) {
+], function (Marionette, SourceViewer) {
var $ = jQuery,
App = new Marionette.Application(),
init = function (options) {
- App.addRegions({ viewerRegion: options.el });
+ App.addRegions({ viewerRegion: '#source-viewer' });
$('.js-drilldown-link').on('click', function (e) {
e.preventDefault();
$(e.currentTarget).closest('table').find('.selected').removeClass('selected');
@@ -42,9 +24,7 @@ define([
};
App.on('start', function (options) {
- window.requestMessages().done(function () {
- init.call(App, options);
- });
+ init.call(App, options);
});
return App;
diff --git a/server/sonar-web/src/main/js/apps/global-permissions/app.jsx b/server/sonar-web/src/main/js/apps/global-permissions/app.jsx
index 28dc73b7f42..478924e9233 100644
--- a/server/sonar-web/src/main/js/apps/global-permissions/app.jsx
+++ b/server/sonar-web/src/main/js/apps/global-permissions/app.jsx
@@ -5,9 +5,7 @@ const $ = jQuery;
export default {
start(options) {
- window.requestMessages().done(() => {
- var el = document.querySelector(options.el);
- React.render(<Main/>, el);
- });
+ var el = document.querySelector(options.el);
+ React.render(<Main/>, el);
}
};
diff --git a/server/sonar-web/src/main/js/apps/global-permissions/groups-view.js b/server/sonar-web/src/main/js/apps/global-permissions/groups-view.js
index 5b25ec62db2..fbc0691ed6d 100644
--- a/server/sonar-web/src/main/js/apps/global-permissions/groups-view.js
+++ b/server/sonar-web/src/main/js/apps/global-permissions/groups-view.js
@@ -8,7 +8,7 @@ define([
template: Templates['global-permissions-groups'],
onRender: function () {
- this._super();
+ Modal.prototype.onRender.apply(this, arguments);
new window.SelectList({
el: this.$('#global-permissions-groups'),
width: '100%',
@@ -35,7 +35,7 @@ define([
onDestroy: function () {
this.options.refresh();
- this._super();
+ Modal.prototype.onDestroy.apply(this, arguments);
}
});
diff --git a/server/sonar-web/src/main/js/apps/global-permissions/users-view.js b/server/sonar-web/src/main/js/apps/global-permissions/users-view.js
index b5660c650da..1c0a0937038 100644
--- a/server/sonar-web/src/main/js/apps/global-permissions/users-view.js
+++ b/server/sonar-web/src/main/js/apps/global-permissions/users-view.js
@@ -8,7 +8,7 @@ define([
template: Templates['global-permissions-users'],
onRender: function () {
- this._super();
+ Modal.prototype.onRender.apply(this, arguments);
new window.SelectList({
el: this.$('#global-permissions-users'),
width: '100%',
@@ -35,7 +35,7 @@ define([
onDestroy: function () {
this.options.refresh();
- this._super();
+ Modal.prototype.onDestroy.apply(this, arguments);
}
});
diff --git a/server/sonar-web/src/main/js/apps/groups/app.js b/server/sonar-web/src/main/js/apps/groups/app.js
index 55c6dfef534..abd897234a5 100644
--- a/server/sonar-web/src/main/js/apps/groups/app.js
+++ b/server/sonar-web/src/main/js/apps/groups/app.js
@@ -1,11 +1,12 @@
define([
+ 'backbone.marionette',
'./layout',
'./groups',
'./header-view',
'./search-view',
'./list-view',
'./list-footer-view'
-], function (Layout, Groups, HeaderView, SearchView, ListView, ListFooterView) {
+], function (Marionette, Layout, Groups, HeaderView, SearchView, ListView, ListFooterView) {
var App = new Marionette.Application(),
init = function (options) {
@@ -37,9 +38,7 @@ define([
};
App.on('start', function (options) {
- window.requestMessages().done(function () {
- init.call(App, options);
- });
+ init.call(App, options);
});
return App;
diff --git a/server/sonar-web/src/main/js/apps/groups/delete-view.js b/server/sonar-web/src/main/js/apps/groups/delete-view.js
index 85b33a632b5..14c35a1873f 100644
--- a/server/sonar-web/src/main/js/apps/groups/delete-view.js
+++ b/server/sonar-web/src/main/js/apps/groups/delete-view.js
@@ -6,8 +6,8 @@ define([
return ModalForm.extend({
template: Templates['groups-delete'],
- onFormSubmit: function (e) {
- this._super(e);
+ onFormSubmit: function () {
+ ModalForm.prototype.onFormSubmit.apply(this, arguments);
this.sendRequest();
},
@@ -28,10 +28,10 @@ define([
});
},
- showErrors: function (errors, warnings) {
+ showErrors: function () {
this.$('.js-modal-text').addClass('hidden');
this.disableForm();
- this._super(errors, warnings);
+ ModalForm.prototype.showErrors.apply(this, arguments);
}
});
diff --git a/server/sonar-web/src/main/js/apps/groups/form-view.js b/server/sonar-web/src/main/js/apps/groups/form-view.js
index 7e3c26b98ee..29a654db85e 100644
--- a/server/sonar-web/src/main/js/apps/groups/form-view.js
+++ b/server/sonar-web/src/main/js/apps/groups/form-view.js
@@ -7,17 +7,17 @@ define([
template: Templates['groups-form'],
onRender: function () {
- this._super();
+ ModalForm.prototype.onRender.apply(this, arguments);
this.$('[data-toggle="tooltip"]').tooltip({ container: 'body', placement: 'bottom' });
},
onDestroy: function () {
- this._super();
+ ModalForm.prototype.onDestroy.apply(this, arguments);
this.$('[data-toggle="tooltip"]').tooltip('destroy');
},
- onFormSubmit: function (e) {
- this._super(e);
+ onFormSubmit: function () {
+ ModalForm.prototype.onFormSubmit.apply(this, arguments);
this.sendRequest();
}
});
diff --git a/server/sonar-web/src/main/js/apps/groups/group.js b/server/sonar-web/src/main/js/apps/groups/group.js
index aced6727b91..5d7807b51d2 100644
--- a/server/sonar-web/src/main/js/apps/groups/group.js
+++ b/server/sonar-web/src/main/js/apps/groups/group.js
@@ -1,8 +1,10 @@
-define(function () {
+define([
+ 'backbone'
+], function (Backbone) {
return Backbone.Model.extend({
urlRoot: function () {
- return baseUrl + '/api/usergroups';
+ return window.baseUrl + '/api/usergroups';
},
sync: function (method, model, options) {
diff --git a/server/sonar-web/src/main/js/apps/groups/groups.js b/server/sonar-web/src/main/js/apps/groups/groups.js
index dcfbb8c731b..46c46fe8078 100644
--- a/server/sonar-web/src/main/js/apps/groups/groups.js
+++ b/server/sonar-web/src/main/js/apps/groups/groups.js
@@ -1,12 +1,13 @@
define([
+ 'backbone',
'./group'
-], function (Group) {
+], function (Backbone, Group) {
return Backbone.Collection.extend({
model: Group,
url: function () {
- return baseUrl + '/api/usergroups/search';
+ return window.baseUrl + '/api/usergroups/search';
},
parse: function (r) {
@@ -19,7 +20,7 @@ define([
fetch: function (options) {
var d = (options && options.data) || {};
this.q = d.q;
- return this._super(options);
+ return Backbone.Collection.prototype.fetch.apply(this, arguments);
},
fetchMore: function () {
diff --git a/server/sonar-web/src/main/js/apps/groups/header-view.js b/server/sonar-web/src/main/js/apps/groups/header-view.js
index da6f7f60919..a60f0c51f34 100644
--- a/server/sonar-web/src/main/js/apps/groups/header-view.js
+++ b/server/sonar-web/src/main/js/apps/groups/header-view.js
@@ -1,7 +1,8 @@
define([
+ 'backbone.marionette',
'./create-view',
'./templates'
-], function (CreateView) {
+], function (Marionette, CreateView) {
return Marionette.ItemView.extend({
template: Templates['groups-header'],
diff --git a/server/sonar-web/src/main/js/apps/groups/layout.js b/server/sonar-web/src/main/js/apps/groups/layout.js
index 18f6c7738d1..e6cddd674ce 100644
--- a/server/sonar-web/src/main/js/apps/groups/layout.js
+++ b/server/sonar-web/src/main/js/apps/groups/layout.js
@@ -1,6 +1,7 @@
define([
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Marionette) {
return Marionette.LayoutView.extend({
template: Templates['groups-layout'],
diff --git a/server/sonar-web/src/main/js/apps/groups/list-footer-view.js b/server/sonar-web/src/main/js/apps/groups/list-footer-view.js
index 3c0fbe198c5..ee4467b3e87 100644
--- a/server/sonar-web/src/main/js/apps/groups/list-footer-view.js
+++ b/server/sonar-web/src/main/js/apps/groups/list-footer-view.js
@@ -1,6 +1,7 @@
define([
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Marionette) {
return Marionette.ItemView.extend({
template: Templates['groups-list-footer'],
@@ -23,7 +24,7 @@ define([
},
serializeData: function () {
- return _.extend(this._super(), {
+ return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
total: this.collection.total,
count: this.collection.length,
more: this.collection.hasMore()
diff --git a/server/sonar-web/src/main/js/apps/groups/list-item-view.js b/server/sonar-web/src/main/js/apps/groups/list-item-view.js
index 45ce8b9688a..20a24cf3bc0 100644
--- a/server/sonar-web/src/main/js/apps/groups/list-item-view.js
+++ b/server/sonar-web/src/main/js/apps/groups/list-item-view.js
@@ -1,9 +1,10 @@
define([
+ 'backbone.marionette',
'./update-view',
'./delete-view',
'./users-view',
'./templates'
-], function (UpdateView, DeleteView, UsersView) {
+], function (Marionette, UpdateView, DeleteView, UsersView) {
var $ = jQuery;
diff --git a/server/sonar-web/src/main/js/apps/groups/list-view.js b/server/sonar-web/src/main/js/apps/groups/list-view.js
index 24878864d30..b56e64f951d 100644
--- a/server/sonar-web/src/main/js/apps/groups/list-view.js
+++ b/server/sonar-web/src/main/js/apps/groups/list-view.js
@@ -1,7 +1,8 @@
define([
+ 'backbone.marionette',
'./list-item-view',
'./templates'
-], function (ListItemView) {
+], function (Marionette, ListItemView) {
return Marionette.CollectionView.extend({
tagName: 'ul',
diff --git a/server/sonar-web/src/main/js/apps/groups/search-view.js b/server/sonar-web/src/main/js/apps/groups/search-view.js
index 1540d7eb36e..efcd9247db8 100644
--- a/server/sonar-web/src/main/js/apps/groups/search-view.js
+++ b/server/sonar-web/src/main/js/apps/groups/search-view.js
@@ -1,6 +1,7 @@
define([
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Marionette) {
return Marionette.ItemView.extend({
template: Templates['groups-search'],
diff --git a/server/sonar-web/src/main/js/apps/groups/users-view.js b/server/sonar-web/src/main/js/apps/groups/users-view.js
index de5901fc5f1..5db80139c8b 100644
--- a/server/sonar-web/src/main/js/apps/groups/users-view.js
+++ b/server/sonar-web/src/main/js/apps/groups/users-view.js
@@ -8,7 +8,8 @@ define([
template: Templates['groups-users'],
onRender: function () {
- this._super();
+ Modal.prototype.onRender.apply(this, arguments);
+ //noinspection Eslint
new window.SelectList({
el: this.$('#groups-users'),
width: '100%',
@@ -18,9 +19,9 @@ define([
return item.name + '<br><span class="note">' + item.login + '</span>';
},
queryParam: 'q',
- searchUrl: baseUrl + '/api/usergroups/users?ps=100&id=' + this.model.id,
- selectUrl: baseUrl + '/api/usergroups/add_user',
- deselectUrl: baseUrl + '/api/usergroups/remove_user',
+ searchUrl: window.baseUrl + '/api/usergroups/users?ps=100&id=' + this.model.id,
+ selectUrl: window.baseUrl + '/api/usergroups/add_user',
+ deselectUrl: window.baseUrl + '/api/usergroups/remove_user',
extra: {
id: this.model.id
},
@@ -35,7 +36,7 @@ define([
onDestroy: function () {
this.model.collection.refresh();
- this._super();
+ Modal.prototype.onDestroy.apply(this, arguments);
}
});
diff --git a/server/sonar-web/src/main/js/apps/issues/app-context.js b/server/sonar-web/src/main/js/apps/issues/app-context.js
index 3d7db3aa2ef..63221207568 100644
--- a/server/sonar-web/src/main/js/apps/issues/app-context.js
+++ b/server/sonar-web/src/main/js/apps/issues/app-context.js
@@ -1,4 +1,6 @@
define([
+ 'backbone',
+ 'backbone.marionette',
'./models/state',
'./layout',
'./models/issues',
@@ -10,19 +12,19 @@ define([
'./workspace-header-view',
'./facets-view',
'./helpers/format-facet-value'
-], function (State, Layout, Issues, Facets, Filters, Controller, Router, WorkspaceListView, WorkspaceHeaderView,
- FacetsView) {
+], function (Backbone, Marionette, State, Layout, Issues, Facets, Filters, Controller, Router, WorkspaceListView,
+ WorkspaceHeaderView, FacetsView) {
var $ = jQuery,
App = new Marionette.Application(),
init = function (options) {
- this.config = options.config;
+ this.options = options;
this.state = new State({
isContext: true,
- contextQuery: { componentUuids: options.config.resource },
- contextComponentUuid: options.config.resource,
- contextComponentName: options.config.resourceName,
- contextComponentQualifier: options.config.resourceQualifier
+ contextQuery: { componentUuids: options.component.uuid },
+ contextComponentUuid: options.component.uuid,
+ contextComponentName: options.component.name,
+ contextComponentQualifier: options.component.qualifier
});
this.updateContextFacets();
this.list = new Issues();
@@ -62,7 +64,7 @@ define([
};
App.getContextQuery = function () {
- return { componentUuids: this.config.resource };
+ return { componentUuids: this.options.component.uuid };
};
App.getRestrictedFacets = function () {
@@ -81,15 +83,13 @@ define([
facetsFromServer = this.state.get('facetsFromServer');
return this.state.set({
facets: facets,
- allFacets: _.difference(allFacets, this.getRestrictedFacets()[this.config.resourceQualifier]),
- facetsFromServer: _.difference(facetsFromServer, this.getRestrictedFacets()[this.config.resourceQualifier])
+ allFacets: _.difference(allFacets, this.getRestrictedFacets()[this.options.component.qualifier]),
+ facetsFromServer: _.difference(facetsFromServer, this.getRestrictedFacets()[this.options.component.qualifier])
});
};
App.on('start', function (options) {
- $.when(window.requestMessages()).done(function () {
- init.call(App, options);
- });
+ init.call(App, options);
});
return App;
diff --git a/server/sonar-web/src/main/js/apps/issues/app.js b/server/sonar-web/src/main/js/apps/issues/app.js
index 12e5671c5c3..f07102efcf7 100644
--- a/server/sonar-web/src/main/js/apps/issues/app.js
+++ b/server/sonar-web/src/main/js/apps/issues/app.js
@@ -1,4 +1,6 @@
define([
+ 'backbone',
+ 'backbone.marionette',
'./models/state',
'./layout',
'./models/issues',
@@ -11,8 +13,8 @@ define([
'./facets-view',
'./filters-view',
'./helpers/format-facet-value'
-], function (State, Layout, Issues, Facets, Filters, Controller, Router, WorkspaceListView, WorkspaceHeaderView,
- FacetsView, FiltersView) {
+], function (Backbone, Marionette, State, Layout, Issues, Facets, Filters, Controller, Router, WorkspaceListView,
+ WorkspaceHeaderView, FacetsView, FiltersView) {
var $ = jQuery,
App = new Marionette.Application(),
@@ -61,9 +63,7 @@ define([
};
App.on('start', function (options) {
- $.when(window.requestMessages()).done(function () {
- init.call(App, options);
- });
+ init.call(App, options);
});
return App;
diff --git a/server/sonar-web/src/main/js/apps/issues/component-viewer/main.js b/server/sonar-web/src/main/js/apps/issues/component-viewer/main.js
index 8792113e213..43b60af89e9 100644
--- a/server/sonar-web/src/main/js/apps/issues/component-viewer/main.js
+++ b/server/sonar-web/src/main/js/apps/issues/component-viewer/main.js
@@ -36,7 +36,7 @@ define([
if (!selectedIssueView) {
return;
}
- return selectedIssueView.find('.js-issue-' + action).click();
+ selectedIssueView.find('.js-issue-' + action).click();
};
key('up', 'componentViewer', function () {
that.options.app.controller.selectPrev();
diff --git a/server/sonar-web/src/main/js/apps/issues/controller.js b/server/sonar-web/src/main/js/apps/issues/controller.js
index 16f5dc53c93..c0467e9b6a1 100644
--- a/server/sonar-web/src/main/js/apps/issues/controller.js
+++ b/server/sonar-web/src/main/js/apps/issues/controller.js
@@ -1,8 +1,9 @@
define([
+ 'backbone',
'components/navigator/controller',
'./component-viewer/main',
'./workspace-home-view'
-], function (Controller, ComponentViewer, HomeView) {
+], function (Backbone, Controller, ComponentViewer, HomeView) {
var $ = jQuery,
FIELDS = 'component,componentId,project,subProject,rule,status,resolution,author,reporter,assignee,debt,line,' +
diff --git a/server/sonar-web/src/main/js/apps/issues/facets/assignee-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/assignee-facet.js
index 3645b7215d6..26fa0f3899c 100644
--- a/server/sonar-web/src/main/js/apps/issues/facets/assignee-facet.js
+++ b/server/sonar-web/src/main/js/apps/issues/facets/assignee-facet.js
@@ -9,7 +9,7 @@ define([
template: Templates['issues-assignee-facet'],
getUrl: function () {
- return baseUrl + '/api/users/search';
+ return window.baseUrl + '/api/users/search';
},
prepareAjaxSearch: function () {
diff --git a/server/sonar-web/src/main/js/apps/issues/facets/author-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/author-facet.js
index ee987a3d067..7bf8f5e30de 100644
--- a/server/sonar-web/src/main/js/apps/issues/facets/author-facet.js
+++ b/server/sonar-web/src/main/js/apps/issues/facets/author-facet.js
@@ -4,7 +4,7 @@ define([
return CustomValuesFacet.extend({
getUrl: function () {
- return baseUrl + '/api/issues/authors';
+ return window.baseUrl + '/api/issues/authors';
},
prepareSearch: function () {
@@ -13,13 +13,13 @@ define([
minimumInputLength: 2,
allowClear: false,
formatNoMatches: function () {
- return t('select2.noMatches');
+ return window.t('select2.noMatches');
},
formatSearching: function () {
- return t('select2.searching');
+ return window.t('select2.searching');
},
formatInputTooShort: function () {
- return tp('select2.tooShort', 2);
+ return window.tp('select2.tooShort', 2);
},
width: '100%',
ajax: {
diff --git a/server/sonar-web/src/main/js/apps/issues/facets/base-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/base-facet.js
index 923e1d4e6d1..8cb5f444520 100644
--- a/server/sonar-web/src/main/js/apps/issues/facets/base-facet.js
+++ b/server/sonar-web/src/main/js/apps/issues/facets/base-facet.js
@@ -16,7 +16,7 @@ define([
},
serializeData: function () {
- return _.extend(this._super(), {
+ return _.extend(BaseFacet.prototype.serializeData.apply(this, arguments), {
state: this.options.app.state.toJSON()
});
}
diff --git a/server/sonar-web/src/main/js/apps/issues/facets/custom-values-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/custom-values-facet.js
index 11b3aebdd74..0b198e1853c 100644
--- a/server/sonar-web/src/main/js/apps/issues/facets/custom-values-facet.js
+++ b/server/sonar-web/src/main/js/apps/issues/facets/custom-values-facet.js
@@ -27,13 +27,13 @@ define([
minimumInputLength: 2,
allowClear: false,
formatNoMatches: function () {
- return t('select2.noMatches');
+ return window.t('select2.noMatches');
},
formatSearching: function () {
- return t('select2.searching');
+ return window.t('select2.searching');
},
formatInputTooShort: function () {
- return tp('select2.tooShort', 2);
+ return window.tp('select2.tooShort', 2);
},
width: '100%',
ajax: this.prepareAjaxSearch()
diff --git a/server/sonar-web/src/main/js/apps/issues/facets/language-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/language-facet.js
index 3418158fba4..f18c712d2f6 100644
--- a/server/sonar-web/src/main/js/apps/issues/facets/language-facet.js
+++ b/server/sonar-web/src/main/js/apps/issues/facets/language-facet.js
@@ -4,7 +4,7 @@ define([
return CustomValuesFacet.extend({
getUrl: function () {
- return baseUrl + '/api/languages/list';
+ return window.baseUrl + '/api/languages/list';
},
prepareSearch: function () {
@@ -13,13 +13,13 @@ define([
minimumInputLength: 2,
allowClear: false,
formatNoMatches: function () {
- return t('select2.noMatches');
+ return window.t('select2.noMatches');
},
formatSearching: function () {
- return t('select2.searching');
+ return window.t('select2.searching');
},
formatInputTooShort: function () {
- return tp('select2.tooShort', 2);
+ return window.tp('select2.tooShort', 2);
},
width: '100%',
ajax: {
diff --git a/server/sonar-web/src/main/js/apps/issues/facets/mode-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/mode-facet.js
index 454b4e96803..ac81b8c3b8d 100644
--- a/server/sonar-web/src/main/js/apps/issues/facets/mode-facet.js
+++ b/server/sonar-web/src/main/js/apps/issues/facets/mode-facet.js
@@ -16,7 +16,9 @@ define([
},
serializeData: function () {
- return _.extend(this._super(), { mode: this.options.app.state.getFacetMode() });
+ return _.extend(BaseFacet.prototype.serializeData.apply(this, arguments), {
+ mode: this.options.app.state.getFacetMode()
+ });
}
});
diff --git a/server/sonar-web/src/main/js/apps/issues/facets/project-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/project-facet.js
index 429d9e876c2..15e174ebf38 100644
--- a/server/sonar-web/src/main/js/apps/issues/facets/project-facet.js
+++ b/server/sonar-web/src/main/js/apps/issues/facets/project-facet.js
@@ -7,9 +7,9 @@ define([
getUrl: function () {
var q = this.options.app.state.get('contextComponentQualifier');
if (q === 'VW' || q === 'SVW') {
- return baseUrl + '/api/components/search';
+ return window.baseUrl + '/api/components/search';
} else {
- return baseUrl + '/api/resources/search?f=s2&q=TRK&display_uuid=true';
+ return window.baseUrl + '/api/resources/search?f=s2&q=TRK&display_uuid=true';
}
},
@@ -29,13 +29,13 @@ define([
minimumInputLength: 2,
allowClear: false,
formatNoMatches: function () {
- return t('select2.noMatches');
+ return window.t('select2.noMatches');
},
formatSearching: function () {
- return t('select2.searching');
+ return window.t('select2.searching');
},
formatInputTooShort: function () {
- return tp('select2.tooShort', 2);
+ return window.tp('select2.tooShort', 2);
},
width: '100%',
ajax: {
diff --git a/server/sonar-web/src/main/js/apps/issues/facets/reporter-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/reporter-facet.js
index 6340aefe04f..6bbb5c5e8ad 100644
--- a/server/sonar-web/src/main/js/apps/issues/facets/reporter-facet.js
+++ b/server/sonar-web/src/main/js/apps/issues/facets/reporter-facet.js
@@ -4,7 +4,7 @@ define([
return CustomValuesFacet.extend({
getUrl: function () {
- return baseUrl + '/api/users/search';
+ return window.baseUrl + '/api/users/search';
},
prepareAjaxSearch: function () {
diff --git a/server/sonar-web/src/main/js/apps/issues/facets/rule-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/rule-facet.js
index 569fcf6c7de..55002f35a9b 100644
--- a/server/sonar-web/src/main/js/apps/issues/facets/rule-facet.js
+++ b/server/sonar-web/src/main/js/apps/issues/facets/rule-facet.js
@@ -4,7 +4,7 @@ define([
return CustomValuesFacet.extend({
prepareSearch: function () {
- var url = baseUrl + '/api/rules/search?f=name,langName',
+ var url = window.baseUrl + '/api/rules/search?f=name,langName',
languages = this.options.app.state.get('query').languages;
if (languages != null) {
url += '&languages=' + languages;
@@ -14,13 +14,13 @@ define([
minimumInputLength: 2,
allowClear: false,
formatNoMatches: function () {
- return t('select2.noMatches');
+ return window.t('select2.noMatches');
},
formatSearching: function () {
- return t('select2.searching');
+ return window.t('select2.searching');
},
formatInputTooShort: function () {
- return tp('select2.tooShort', 2);
+ return window.tp('select2.tooShort', 2);
},
width: '100%',
ajax: {
diff --git a/server/sonar-web/src/main/js/apps/issues/facets/tag-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/tag-facet.js
index 96a0d85729e..9a70ea7a006 100644
--- a/server/sonar-web/src/main/js/apps/issues/facets/tag-facet.js
+++ b/server/sonar-web/src/main/js/apps/issues/facets/tag-facet.js
@@ -4,7 +4,7 @@ define([
return CustomValuesFacet.extend({
prepareSearch: function () {
- var url = baseUrl + '/api/issues/tags?ps=10',
+ var url = window.baseUrl + '/api/issues/tags?ps=10',
tags = this.options.app.state.get('query').tags;
if (tags != null) {
url += '&tags=' + tags;
@@ -14,10 +14,10 @@ define([
minimumInputLength: 0,
allowClear: false,
formatNoMatches: function () {
- return t('select2.noMatches');
+ return window.t('select2.noMatches');
},
formatSearching: function () {
- return t('select2.searching');
+ return window.t('select2.searching');
},
width: '100%',
ajax: {
diff --git a/server/sonar-web/src/main/js/apps/issues/filters-view.js b/server/sonar-web/src/main/js/apps/issues/filters-view.js
index 03813eff3c0..568402c3582 100644
--- a/server/sonar-web/src/main/js/apps/issues/filters-view.js
+++ b/server/sonar-web/src/main/js/apps/issues/filters-view.js
@@ -1,6 +1,7 @@
define([
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Marionette) {
var $ = jQuery;
diff --git a/server/sonar-web/src/main/js/apps/issues/issue-filter-view.js b/server/sonar-web/src/main/js/apps/issues/issue-filter-view.js
index 28a6a86e212..c448fb1f0de 100644
--- a/server/sonar-web/src/main/js/apps/issues/issue-filter-view.js
+++ b/server/sonar-web/src/main/js/apps/issues/issue-filter-view.js
@@ -12,11 +12,11 @@ define([
var property = $(e.currentTarget).data('property'),
value = $(e.currentTarget).data('value');
this.trigger('select', property, value);
- this._super(e);
+ ActionOptionsView.prototype.selectOption.apply(this, arguments);
},
serializeData: function () {
- return _.extend(this._super(), {
+ return _.extend(ActionOptionsView.prototype.serializeData.apply(this, arguments), {
s: this.model.get('severity')
});
}
diff --git a/server/sonar-web/src/main/js/apps/issues/layout.js b/server/sonar-web/src/main/js/apps/issues/layout.js
index 5dbbcaf1139..3edcb430d41 100644
--- a/server/sonar-web/src/main/js/apps/issues/layout.js
+++ b/server/sonar-web/src/main/js/apps/issues/layout.js
@@ -1,6 +1,8 @@
define([
+ 'backbone.marionette',
+ '../../components/common/jquery-isolated-scroll',
'./templates'
-], function () {
+], function (Marionette) {
var $ = jQuery;
return Marionette.LayoutView.extend({
diff --git a/server/sonar-web/src/main/js/apps/issues/models/filter.js b/server/sonar-web/src/main/js/apps/issues/models/filter.js
index aa31f8ab267..d1cbabc4d4a 100644
--- a/server/sonar-web/src/main/js/apps/issues/models/filter.js
+++ b/server/sonar-web/src/main/js/apps/issues/models/filter.js
@@ -1,8 +1,10 @@
-define(function () {
+define([
+ 'backbone'
+], function (Backbone) {
return Backbone.Model.extend({
url: function () {
- return baseUrl + '/api/issue_filters/show/' + this.id;
+ return window.baseUrl + '/api/issue_filters/show/' + this.id;
},
parse: function (r) {
diff --git a/server/sonar-web/src/main/js/apps/issues/models/filters.js b/server/sonar-web/src/main/js/apps/issues/models/filters.js
index bb66327e423..cde0286b159 100644
--- a/server/sonar-web/src/main/js/apps/issues/models/filters.js
+++ b/server/sonar-web/src/main/js/apps/issues/models/filters.js
@@ -1,6 +1,7 @@
define([
+ 'backbone',
'./filter'
-], function (Filter) {
+], function (Backbone, Filter) {
return Backbone.Collection.extend({
model: Filter
diff --git a/server/sonar-web/src/main/js/apps/issues/models/issue.js b/server/sonar-web/src/main/js/apps/issues/models/issue.js
index 6266434fa23..2a096b4db32 100644
--- a/server/sonar-web/src/main/js/apps/issues/models/issue.js
+++ b/server/sonar-web/src/main/js/apps/issues/models/issue.js
@@ -8,7 +8,7 @@ define([
keepFields.forEach(function (field) {
attrs[field] = this.get(field);
}.bind(this));
- return this._super(attrs, options);
+ Issue.prototype.reset.call(this, attrs, options);
}
});
diff --git a/server/sonar-web/src/main/js/apps/issues/models/issues.js b/server/sonar-web/src/main/js/apps/issues/models/issues.js
index aca2e2ac2bf..7f613e0adb7 100644
--- a/server/sonar-web/src/main/js/apps/issues/models/issues.js
+++ b/server/sonar-web/src/main/js/apps/issues/models/issues.js
@@ -1,12 +1,13 @@
define([
+ 'backbone',
'./issue'
-], function (Issue) {
+], function (Backbone, Issue) {
return Backbone.Collection.extend({
model: Issue,
url: function () {
- return baseUrl + '/api/issues/search';
+ return window.baseUrl + '/api/issues/search';
},
_injectRelational: function (issue, source, baseField, lookupField) {
diff --git a/server/sonar-web/src/main/js/apps/issues/workspace-header-view.js b/server/sonar-web/src/main/js/apps/issues/workspace-header-view.js
index 928b4b42c5f..5fc1867969e 100644
--- a/server/sonar-web/src/main/js/apps/issues/workspace-header-view.js
+++ b/server/sonar-web/src/main/js/apps/issues/workspace-header-view.js
@@ -24,7 +24,7 @@ define([
},
onDestroy: function () {
- this._super();
+ WorkspaceHeaderView.prototype.onDestroy.apply(this, arguments);
window.onBulkIssues = this._onBulkIssues;
},
@@ -51,7 +51,7 @@ define([
render: function () {
if (!this._suppressUpdate) {
- this._super();
+ WorkspaceHeaderView.prototype.render.apply(this, arguments);
}
},
@@ -105,7 +105,7 @@ define([
selectedCount = this.options.app.list.where({ selected: true }).length,
allSelected = issuesCount > 0 && issuesCount === selectedCount,
someSelected = !allSelected && selectedCount > 0;
- return _.extend(this._super(), {
+ return _.extend(WorkspaceHeaderView.prototype.serializeData.apply(this, arguments), {
selectedCount: selectedCount,
allSelected: allSelected,
someSelected: someSelected
diff --git a/server/sonar-web/src/main/js/apps/issues/workspace-home-view.js b/server/sonar-web/src/main/js/apps/issues/workspace-home-view.js
index 942e86e4ba7..c501d4af3cf 100644
--- a/server/sonar-web/src/main/js/apps/issues/workspace-home-view.js
+++ b/server/sonar-web/src/main/js/apps/issues/workspace-home-view.js
@@ -1,21 +1,23 @@
define([
+ 'backbone',
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Backbone, Marionette) {
var $ = jQuery;
Handlebars.registerHelper('issuesHomeLink', function (property, value) {
- return baseUrl + '/issues/search#resolved=false|createdInLast=1w|' +
+ return window.baseUrl + '/issues/search#resolved=false|createdInLast=1w|' +
property + '=' + (encodeURIComponent(value));
});
Handlebars.registerHelper('myIssuesHomeLink', function (property, value) {
- return baseUrl + '/issues/search#resolved=false|createdInLast=1w|assignees=__me__|' +
+ return window.baseUrl + '/issues/search#resolved=false|createdInLast=1w|assignees=__me__|' +
property + '=' + (encodeURIComponent(value));
});
Handlebars.registerHelper('issueFilterHomeLink', function (id) {
- return baseUrl + '/issues/search#id=' + id;
+ return window.baseUrl + '/issues/search#id=' + id;
});
return Marionette.ItemView.extend({
diff --git a/server/sonar-web/src/main/js/apps/issues/workspace-list-empty-view.js b/server/sonar-web/src/main/js/apps/issues/workspace-list-empty-view.js
index ada57f15a2d..4b85cce7b32 100644
--- a/server/sonar-web/src/main/js/apps/issues/workspace-list-empty-view.js
+++ b/server/sonar-web/src/main/js/apps/issues/workspace-list-empty-view.js
@@ -1,10 +1,12 @@
-define(function () {
+define([
+ 'backbone.marionette'
+], function (Marionette) {
return Marionette.ItemView.extend({
className: 'search-navigator-no-results',
template: function () {
- return t('issue_filter.no_issues');
+ return window.t('issue_filter.no_issues');
}
});
diff --git a/server/sonar-web/src/main/js/apps/main/app.jsx b/server/sonar-web/src/main/js/apps/main/app.jsx
new file mode 100644
index 00000000000..25c2d1dff30
--- /dev/null
+++ b/server/sonar-web/src/main/js/apps/main/app.jsx
@@ -0,0 +1,166 @@
+import $ from 'jquery';
+import {getCurrentUser} from '../../api/users';
+import {component} from '../../api/navigation';
+import NavApp from '../nav/app';
+
+const APP_URL_MAPPING = {
+ '': 'dashboard/app',
+ 'account': 'account/app',
+ 'api_documentation': 'api-documentation/app',
+ 'coding_rules': 'coding-rules/app',
+ 'component_issues': 'issues/app-context',
+ 'component': 'source-viewer/app',
+ 'computation': 'computation/app',
+ 'custom_measures': 'custom-measures/app',
+ 'dashboard': 'dashboard/app',
+ 'drilldown': 'drilldown/app',
+ 'groups': 'groups/app',
+ 'issues': 'issues/app',
+ 'maintenance': { name: 'maintenance/app', options: { setup: false } },
+ 'markdown': 'markdown/app',
+ 'measures': 'measures/app',
+ 'metrics': 'metrics/app',
+ 'overview': 'overview/app',
+ 'permission_templates': 'select-list/app',
+ 'profiles': 'quality-profiles/app',
+ 'project_roles': 'select-list/app',
+ 'provisioning': 'provisioning/app',
+ 'quality_gates': 'quality-gates/app',
+ 'roles/global': 'global-permissions/app',
+ 'roles/projects': 'project-permissions/app',
+ 'setup': { name: 'maintenance/app', options: { setup: true } },
+ 'updatecenter': 'update-center/app',
+ 'users': 'users/app'
+};
+
+
+class App {
+ constructor(options) {
+ this.user = null;
+ this.component = null;
+ this.options = options;
+ }
+
+ /**
+ * Start the Main App
+ */
+ start() {
+ App.initLanguage(this.options.lang);
+ $.when(
+ window.requestMessages(),
+ this.loadUserDetails(),
+ this.loadComponentDetails()
+ ).done(() => {
+ this.startNav();
+ this.startPageApp();
+ });
+ }
+
+
+ /**
+ * Start the Navigation App
+ */
+ startNav() {
+ NavApp.start(_.extend({}, this.options, { user: this.user }));
+ }
+
+
+ /**
+ * Start an App for the current page
+ */
+ startPageApp() {
+ let app = this.getApp();
+ app && this.startApp(app);
+ }
+
+
+ /**
+ * Start an App with a given name
+ * @param {object} app
+ */
+ startApp(app) {
+ let appScript = 'apps/' + app.name;
+ require([appScript], App => {
+ let appOptions = {
+ el: '#content',
+ component: this.options.component,
+ user: this.user,
+ urlRoot: app.urlRoot
+ };
+ _.extend(appOptions, app.options);
+ App.start(appOptions);
+ });
+ }
+
+
+ /**
+ * Initialize formatting libraries for a given language
+ * @param {string} lang
+ */
+ static initLanguage(lang) {
+ moment.lang(lang);
+ numeral.language(lang);
+ }
+
+
+ /**
+ * Get a part of a page URL representing a App name
+ * @returns {string}
+ */
+ static getAppPath() {
+ let path = window.location.pathname;
+ let relativePath = path.substr(window.baseUrl.length);
+ return relativePath.substr(1) + '/';
+ }
+
+
+ /**
+ * Try to get a App name for the current page
+ * @returns {null|object}
+ */
+ getApp() {
+ let appPath = App.getAppPath();
+ let matchedUrl = _.find(Object.keys(APP_URL_MAPPING), urlPrefix => {
+ let test = urlPrefix + '/';
+ return appPath.indexOf(test) === 0;
+ });
+ if (matchedUrl == null) {
+ return null;
+ }
+ let app = APP_URL_MAPPING[matchedUrl];
+ return {
+ name: typeof app === 'string' ? app : app.name,
+ options: typeof app === 'string' ? {} : app.options,
+ urlRoot: window.baseUrl + '/' + matchedUrl
+ };
+ }
+
+
+ /**
+ * Load current component details
+ * @returns {jqXHR}
+ */
+ loadComponentDetails() {
+ if (!this.options.componentKey) {
+ return $.Deferred().resolve().promise();
+ }
+ return component(this.options.componentKey).done(component => {
+ this.options.component = component;
+ this.options.component.qualifier = _.last(component.breadcrumbs).qualifier;
+ });
+ }
+
+
+ /**
+ * Load current user details
+ * @returns {jqXHR}
+ */
+ loadUserDetails() {
+ return getCurrentUser().done(user => {
+ this.user = user;
+ this.user.isAdmin = user.permissions.global.indexOf('admin') !== -1;
+ });
+ }
+}
+
+export default App;
diff --git a/server/sonar-web/src/main/js/apps/maintenance/app.js b/server/sonar-web/src/main/js/apps/maintenance/app.js
index cc7b016bef0..52fc0c26e1e 100644
--- a/server/sonar-web/src/main/js/apps/maintenance/app.js
+++ b/server/sonar-web/src/main/js/apps/maintenance/app.js
@@ -1,6 +1,8 @@
define([
+ 'backbone',
+ 'backbone.marionette',
'./main-view'
-], function (MainView) {
+], function (Backbone, Marionette, MainView) {
var App = new Marionette.Application();
diff --git a/server/sonar-web/src/main/js/apps/maintenance/main-view.js b/server/sonar-web/src/main/js/apps/maintenance/main-view.js
index 47b380973da..8f7d0eea860 100644
--- a/server/sonar-web/src/main/js/apps/maintenance/main-view.js
+++ b/server/sonar-web/src/main/js/apps/maintenance/main-view.js
@@ -1,6 +1,8 @@
define([
+ 'backbone',
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Backbone, Marionette) {
var $ = jQuery;
@@ -15,7 +17,7 @@ define([
var that = this;
this.requestOptions = {
type: 'GET',
- url: baseUrl + '/api/system/' + (this.options.setup ? 'db_migration_status' : 'status')
+ url: window.baseUrl + '/api/system/' + (this.options.setup ? 'db_migration_status' : 'status')
};
setInterval(function () {
that.refresh();
@@ -55,7 +57,9 @@ define([
},
serializeData: function () {
- return _.extend(this._super(), { setup: this.options.setup });
+ return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
+ setup: this.options.setup
+ });
}
});
diff --git a/server/sonar-web/src/main/js/apps/markdown/app.js b/server/sonar-web/src/main/js/apps/markdown/app.js
index 80215acba17..0941401c0ad 100644
--- a/server/sonar-web/src/main/js/apps/markdown/app.js
+++ b/server/sonar-web/src/main/js/apps/markdown/app.js
@@ -1,23 +1,7 @@
-/*
- * 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.
- */
-define(['./markdown-help-view'], function (MarkdownView) {
+define([
+ 'backbone.marionette',
+ './markdown-help-view'
+], function (Marionette, MarkdownView) {
var App = new Marionette.Application();
diff --git a/server/sonar-web/src/main/js/apps/markdown/markdown-help-view.js b/server/sonar-web/src/main/js/apps/markdown/markdown-help-view.js
index 050128861bd..68426edcb19 100644
--- a/server/sonar-web/src/main/js/apps/markdown/markdown-help-view.js
+++ b/server/sonar-web/src/main/js/apps/markdown/markdown-help-view.js
@@ -1,23 +1,7 @@
-/*
- * 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.
- */
-define(['./templates'], function () {
+define([
+ 'backbone.marionette',
+ './templates'
+], function (Marionette) {
return Marionette.ItemView.extend({
template: Templates['markdown-help']
diff --git a/server/sonar-web/src/main/js/apps/measures/app.js b/server/sonar-web/src/main/js/apps/measures/app.js
index d5f3110dbc5..ad43571ffec 100644
--- a/server/sonar-web/src/main/js/apps/measures/app.js
+++ b/server/sonar-web/src/main/js/apps/measures/app.js
@@ -18,6 +18,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
define([
+ 'backbone.marionette',
'./measures-filter-bar',
'components/navigator/filters/base-filters',
'components/navigator/filters/checkbox-filters',
@@ -28,7 +29,7 @@ define([
'components/navigator/filters/string-filters',
'components/navigator/filters/metric-filters'
],
- function (FilterBar, BaseFilters, CheckboxFilterView, ChoiceFilters, AjaxSelectFilters, FavoriteFilters,
+ function (Marionette, FilterBar, BaseFilters, CheckboxFilterView, ChoiceFilters, AjaxSelectFilters, FavoriteFilters,
RangeFilters, StringFilterView, MetricFilterView) {
var NavigatorApp = new Marionette.Application(),
diff --git a/server/sonar-web/src/main/js/apps/metrics/app.js b/server/sonar-web/src/main/js/apps/metrics/app.js
index 4e42d95a09d..832f72bcd02 100644
--- a/server/sonar-web/src/main/js/apps/metrics/app.js
+++ b/server/sonar-web/src/main/js/apps/metrics/app.js
@@ -1,10 +1,11 @@
define([
+ 'backbone.marionette',
'./layout',
'./metrics',
'./header-view',
'./list-view',
'./list-footer-view'
-], function (Layout, Metrics, HeaderView, ListView, ListFooterView) {
+], function (Marionette, Layout, Metrics, HeaderView, ListView, ListFooterView) {
var $ = jQuery,
App = new Marionette.Application(),
@@ -54,7 +55,7 @@ define([
};
App.on('start', function (options) {
- $.when(window.requestMessages(), App.requestDomains(), App.requestTypes()).done(function () {
+ $.when(App.requestDomains(), App.requestTypes()).done(function () {
init.call(App, options);
});
});
diff --git a/server/sonar-web/src/main/js/apps/metrics/delete-view.js b/server/sonar-web/src/main/js/apps/metrics/delete-view.js
index 8719b9fdb3a..2f8bd2a7222 100644
--- a/server/sonar-web/src/main/js/apps/metrics/delete-view.js
+++ b/server/sonar-web/src/main/js/apps/metrics/delete-view.js
@@ -6,8 +6,8 @@ define([
return ModalForm.extend({
template: Templates['metrics-delete'],
- onFormSubmit: function (e) {
- this._super(e);
+ onFormSubmit: function () {
+ ModalForm.prototype.onFormSubmit.apply(this, arguments);
this.sendRequest();
},
diff --git a/server/sonar-web/src/main/js/apps/metrics/form-view.js b/server/sonar-web/src/main/js/apps/metrics/form-view.js
index 03e66f715b6..18dbdbbf174 100644
--- a/server/sonar-web/src/main/js/apps/metrics/form-view.js
+++ b/server/sonar-web/src/main/js/apps/metrics/form-view.js
@@ -10,7 +10,7 @@ define([
onRender: function () {
var that = this;
- this._super();
+ ModalForm.prototype.onRender.apply(this, arguments);
this.$('[data-toggle="tooltip"]').tooltip({ container: 'body', placement: 'bottom' });
this.$('#create-metric-domain').select2({
width: '250px',
@@ -36,17 +36,17 @@ define([
},
onDestroy: function () {
- this._super();
+ ModalForm.prototype.onDestroy.apply(this, arguments);
this.$('[data-toggle="tooltip"]').tooltip('destroy');
},
- onFormSubmit: function (e) {
- this._super(e);
+ onFormSubmit: function () {
+ ModalForm.prototype.onFormSubmit.apply(this, arguments);
this.sendRequest();
},
serializeData: function () {
- return _.extend(this._super(), {
+ return _.extend(ModalForm.prototype.serializeData.apply(this, arguments), {
domains: this.options.domains,
types: this.options.types
});
diff --git a/server/sonar-web/src/main/js/apps/metrics/header-view.js b/server/sonar-web/src/main/js/apps/metrics/header-view.js
index 78a9b0da0d0..bc5f6891617 100644
--- a/server/sonar-web/src/main/js/apps/metrics/header-view.js
+++ b/server/sonar-web/src/main/js/apps/metrics/header-view.js
@@ -1,7 +1,8 @@
define([
+ 'backbone.marionette',
'./create-view',
'./templates'
-], function (CreateView) {
+], function (Marionette, CreateView) {
return Marionette.ItemView.extend({
template: Templates['metrics-header'],
diff --git a/server/sonar-web/src/main/js/apps/metrics/layout.js b/server/sonar-web/src/main/js/apps/metrics/layout.js
index 9575307d96f..59ef53f5c3c 100644
--- a/server/sonar-web/src/main/js/apps/metrics/layout.js
+++ b/server/sonar-web/src/main/js/apps/metrics/layout.js
@@ -1,6 +1,7 @@
define([
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Marionette) {
return Marionette.LayoutView.extend({
template: Templates['metrics-layout'],
diff --git a/server/sonar-web/src/main/js/apps/metrics/list-footer-view.js b/server/sonar-web/src/main/js/apps/metrics/list-footer-view.js
index 932dfd6d35f..806ddc9c863 100644
--- a/server/sonar-web/src/main/js/apps/metrics/list-footer-view.js
+++ b/server/sonar-web/src/main/js/apps/metrics/list-footer-view.js
@@ -1,6 +1,7 @@
define([
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Marionette) {
return Marionette.ItemView.extend({
template: Templates['metrics-list-footer'],
@@ -23,7 +24,7 @@ define([
},
serializeData: function () {
- return _.extend(this._super(), {
+ return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
total: this.collection.total,
count: this.collection.length,
more: this.collection.hasMore()
diff --git a/server/sonar-web/src/main/js/apps/metrics/list-item-view.js b/server/sonar-web/src/main/js/apps/metrics/list-item-view.js
index c6989e3b7b3..c1b84f3baca 100644
--- a/server/sonar-web/src/main/js/apps/metrics/list-item-view.js
+++ b/server/sonar-web/src/main/js/apps/metrics/list-item-view.js
@@ -1,8 +1,9 @@
define([
+ 'backbone.marionette',
'./update-view',
'./delete-view',
'./templates'
-], function (UpdateView, DeleteView) {
+], function (Marionette, UpdateView, DeleteView) {
return Marionette.ItemView.extend({
tagName: 'li',
diff --git a/server/sonar-web/src/main/js/apps/metrics/list-view.js b/server/sonar-web/src/main/js/apps/metrics/list-view.js
index b015c65d966..8eca5ef012f 100644
--- a/server/sonar-web/src/main/js/apps/metrics/list-view.js
+++ b/server/sonar-web/src/main/js/apps/metrics/list-view.js
@@ -1,7 +1,8 @@
define([
+ 'backbone.marionette',
'./list-item-view',
'./templates'
-], function (ListItemView) {
+], function (Marionette, ListItemView) {
return Marionette.CollectionView.extend({
tagName: 'ul',
diff --git a/server/sonar-web/src/main/js/apps/metrics/metric.js b/server/sonar-web/src/main/js/apps/metrics/metric.js
index cb160c882d0..8a2c3e82e49 100644
--- a/server/sonar-web/src/main/js/apps/metrics/metric.js
+++ b/server/sonar-web/src/main/js/apps/metrics/metric.js
@@ -1,10 +1,12 @@
-define(function () {
+define([
+ 'backbone'
+], function (Backbone) {
return Backbone.Model.extend({
idAttribute: 'id',
urlRoot: function () {
- return baseUrl + '/api/metrics';
+ return window.baseUrl + '/api/metrics';
},
sync: function (method, model, options) {
diff --git a/server/sonar-web/src/main/js/apps/metrics/metrics.js b/server/sonar-web/src/main/js/apps/metrics/metrics.js
index 393ebe3c2b1..4ff94e99b29 100644
--- a/server/sonar-web/src/main/js/apps/metrics/metrics.js
+++ b/server/sonar-web/src/main/js/apps/metrics/metrics.js
@@ -1,12 +1,13 @@
define([
+ 'backbone',
'./metric'
-], function (Metric) {
+], function (Backbone, Metric) {
return Backbone.Collection.extend({
model: Metric,
url: function () {
- return baseUrl + '/api/metrics/search';
+ return window.baseUrl + '/api/metrics/search';
},
parse: function (r) {
@@ -20,7 +21,7 @@ define([
var opts = _.defaults(options || {}, { data: {} });
this.q = opts.data.q;
opts.data.isCustom = true;
- return this._super(opts);
+ return Backbone.Collection.prototype.fetch.call(this, opts);
},
fetchMore: function () {
diff --git a/server/sonar-web/src/main/js/apps/nav/app.jsx b/server/sonar-web/src/main/js/apps/nav/app.jsx
index 1362bb8976b..04b0f1018fc 100644
--- a/server/sonar-web/src/main/js/apps/nav/app.jsx
+++ b/server/sonar-web/src/main/js/apps/nav/app.jsx
@@ -5,11 +5,9 @@ import SettingsNav from './settings/settings-nav';
export default {
start(options) {
- window.requestMessages().done(() => {
- this.renderGlobalNav(options);
- options.space === 'component' && this.renderComponentNav(options);
- options.space === 'settings' && this.renderSettingsNav(options);
- });
+ this.renderGlobalNav(options);
+ options.space === 'component' && this.renderComponentNav(options);
+ options.space === 'settings' && this.renderSettingsNav(options);
},
renderGlobalNav(options) {
diff --git a/server/sonar-web/src/main/js/apps/nav/component/component-nav-menu.jsx b/server/sonar-web/src/main/js/apps/nav/component/component-nav-menu.jsx
index c50cd53be52..5115a27f73b 100644
--- a/server/sonar-web/src/main/js/apps/nav/component/component-nav-menu.jsx
+++ b/server/sonar-web/src/main/js/apps/nav/component/component-nav-menu.jsx
@@ -13,6 +13,10 @@ const MORE_URLS = ['/dashboards', '/dashboard', '/plugins/resource'];
export default React.createClass({
mixins: [DashboardNameMixin, LinksMixin],
+ getDefaultProps() {
+ return { conf: {} };
+ },
+
renderOverviewLink() {
const url = `/overview/index?id=${encodeURIComponent(this.props.component.key)}`;
return this.renderLink(url, window.t('overview.page'), '/overview');
diff --git a/server/sonar-web/src/main/js/apps/nav/component/component-nav.jsx b/server/sonar-web/src/main/js/apps/nav/component/component-nav.jsx
index 855482981d9..fdc8a089e69 100644
--- a/server/sonar-web/src/main/js/apps/nav/component/component-nav.jsx
+++ b/server/sonar-web/src/main/js/apps/nav/component/component-nav.jsx
@@ -3,47 +3,43 @@ import ComponentNavFavorite from './component-nav-favorite';
import ComponentNavBreadcrumbs from './component-nav-breadcrumbs';
import ComponentNavMeta from './component-nav-meta';
import ComponentNavMenu from './component-nav-menu';
+import RecentHistory from '../../../libs/recent-history';
-let $ = jQuery;
+const TOP_LEVEL_QUALIFIERS = ['TRK', 'VW', 'SVW', 'DEV'];
export default React.createClass({
- getInitialState() {
- return { component: {}, conf: {} };
- },
-
componentDidMount() {
- this.loadDetails();
+ this.addToHistory();
},
- loadDetails() {
- const url = `${window.baseUrl}/api/navigation/component`;
- const data = { componentKey: this.props.componentKey };
- $.get(url, data).done(r => {
- this.setState({
- component: r,
- conf: r.configuration || {}
- });
- });
+ addToHistory() {
+ let qualifier = _.last(this.props.component.breadcrumbs).qualifier;
+ if (TOP_LEVEL_QUALIFIERS.indexOf(qualifier) !== -1) {
+ RecentHistory.add(
+ this.props.component.key,
+ this.props.component.name,
+ qualifier.toLowerCase());
+ }
},
render() {
return (
<div className="container">
<ComponentNavFavorite
- component={this.state.component.key}
- favorite={this.state.component.isFavorite}
- canBeFavorite={this.state.component.canBeFavorite}/>
+ component={this.props.component.key}
+ favorite={this.props.component.isFavorite}
+ canBeFavorite={this.props.component.canBeFavorite}/>
<ComponentNavBreadcrumbs
- breadcrumbs={this.state.component.breadcrumbs}/>
+ breadcrumbs={this.props.component.breadcrumbs}/>
<ComponentNavMeta
- version={this.state.component.version}
- snapshotDate={this.state.component.snapshotDate}/>
+ version={this.props.component.version}
+ snapshotDate={this.props.component.snapshotDate}/>
<ComponentNavMenu
- component={this.state.component}
- conf={this.state.conf}/>
+ component={this.props.component}
+ conf={this.props.component.configuration}/>
</div>
);
}
diff --git a/server/sonar-web/src/main/js/apps/nav/global/global-nav-menu.jsx b/server/sonar-web/src/main/js/apps/nav/global/global-nav-menu.jsx
index 6249b8b11fb..1b945c62fcd 100644
--- a/server/sonar-web/src/main/js/apps/nav/global/global-nav-menu.jsx
+++ b/server/sonar-web/src/main/js/apps/nav/global/global-nav-menu.jsx
@@ -91,7 +91,7 @@ export default React.createClass({
},
renderAdministrationLink() {
- if (!window.SS.isUserAdmin) {
+ if (!this.props.user.isAdmin) {
return null;
}
const url = `${window.baseUrl}/settings`;
diff --git a/server/sonar-web/src/main/js/apps/nav/global/global-nav-user.jsx b/server/sonar-web/src/main/js/apps/nav/global/global-nav-user.jsx
index d07c9a4d201..64c913461f1 100644
--- a/server/sonar-web/src/main/js/apps/nav/global/global-nav-user.jsx
+++ b/server/sonar-web/src/main/js/apps/nav/global/global-nav-user.jsx
@@ -1,5 +1,6 @@
import React from 'react';
import Avatar from 'components/shared/avatar';
+import RecentHistory from '../../../libs/recent-history';
export default React.createClass({
renderAuthenticated() {
@@ -38,9 +39,7 @@ export default React.createClass({
handleLogout(e) {
e.preventDefault();
- if (window.sonarRecentHistory) {
- window.sonarRecentHistory.clear();
- }
+ RecentHistory.clear();
const logoutUrl = `${window.baseUrl}/sessions/logout`;
window.location = logoutUrl;
},
diff --git a/server/sonar-web/src/main/js/apps/nav/global/search-view.js b/server/sonar-web/src/main/js/apps/nav/global/search-view.js
index 233a1dc5f29..ccfe575526b 100644
--- a/server/sonar-web/src/main/js/apps/nav/global/search-view.js
+++ b/server/sonar-web/src/main/js/apps/nav/global/search-view.js
@@ -1,7 +1,9 @@
define([
+ 'backbone',
+ 'backbone.marionette',
'components/common/selectable-collection-view',
'../templates'
-], function (SelectableCollectionView) {
+], function (Backbone, Marionette, SelectableCollectionView) {
var $ = jQuery,
@@ -120,7 +122,7 @@ define([
that.favorite = r.map(function (f) {
var isFile = ['FIL', 'UTS'].indexOf(f.qualifier) !== -1;
return {
- url: baseUrl + '/dashboard/index?id=' + encodeURIComponent(f.key) + dashboardParameters(true),
+ url: baseUrl + '/dashboard/index?id=' + encodeURIComponent(f.key) + window.dashboardParameters(true),
name: isFile ? window.collapsedDirFromPath(f.lname) + window.fileFromPath(f.lname) : f.name,
icon: 'favorite'
};
@@ -133,19 +135,20 @@ define([
var recentHistory = JSON.parse(localStorage.getItem('sonar_recent_history')),
history = (recentHistory || []).map(function (historyItem, index) {
return {
- url: baseUrl + '/dashboard/index?id=' + encodeURIComponent(historyItem.key) + dashboardParameters(true),
+ url: baseUrl + '/dashboard/index?id=' + encodeURIComponent(historyItem.key) +
+ window.dashboardParameters(true),
name: historyItem.name,
q: historyItem.icon,
- extra: index === 0 ? t('browsed_recently') : null
+ extra: index === 0 ? window.t('browsed_recently') : null
};
}),
favorite = _.first(this.favorite, 6).map(function (f, index) {
- return _.extend(f, { extra: index === 0 ? t('favorite') : null });
+ return _.extend(f, { extra: index === 0 ? window.t('favorite') : null });
}),
qualifiers = this.model.get('qualifiers').map(function (q, index) {
return {
url: baseUrl + '/all_projects?qualifier=' + encodeURIComponent(q),
- name: t('qualifiers.all', q),
+ name: window.t('qualifiers.all', q),
extra: index === 0 ? '' : null
};
});
@@ -155,7 +158,7 @@ define([
search: function (q) {
if (q.length < 2) {
this.resetResultsToDefault();
- return;
+ return $.Deferred().resolve().promise();
}
var that = this,
url = baseUrl + '/api/components/suggestions',
@@ -167,7 +170,7 @@ define([
collection.push(_.extend(item, {
q: domain.q,
extra: index === 0 ? domain.name : null,
- url: baseUrl + '/dashboard/index?id=' + encodeURIComponent(item.key) + dashboardParameters(true)
+ url: baseUrl + '/dashboard/index?id=' + encodeURIComponent(item.key) + window.dashboardParameters(true)
}));
});
});
@@ -182,22 +185,22 @@ define([
getNavigationFindings: function (q) {
var DEFAULT_ITEMS = [
- { name: t('issues.page'), url: baseUrl + '/issues/search' },
- { name: t('layout.measures'), url: baseUrl + '/measures/search?qualifiers[]=TRK' },
- { name: t('coding_rules.page'), url: baseUrl + '/coding_rules' },
- { name: t('quality_profiles.page'), url: baseUrl + '/profiles' },
- { name: t('quality_gates.page'), url: baseUrl + '/quality_gates' },
- { name: t('comparison_global.page'), url: baseUrl + '/comparison' }
+ { name: window.t('issues.page'), url: baseUrl + '/issues/search' },
+ { name: window.t('layout.measures'), url: baseUrl + '/measures/search?qualifiers[]=TRK' },
+ { name: window.t('coding_rules.page'), url: baseUrl + '/coding_rules' },
+ { name: window.t('quality_profiles.page'), url: baseUrl + '/profiles' },
+ { name: window.t('quality_gates.page'), url: baseUrl + '/quality_gates' },
+ { name: window.t('comparison_global.page'), url: baseUrl + '/comparison' }
],
customItems = [];
if (window.SS.isUserAdmin) {
- customItems.push({ name: t('layout.settings'), url: baseUrl + '/settings' });
+ customItems.push({ name: window.t('layout.settings'), url: baseUrl + '/settings' });
}
var findings = [].concat(DEFAULT_ITEMS, customItems).filter(function (f) {
return f.name.match(new RegExp(q, 'i'));
});
if (findings.length > 0) {
- findings[0].extra = t('navigation');
+ findings[0].extra = window.t('navigation');
}
return _.first(findings, 6);
},
@@ -211,7 +214,7 @@ define([
return f.name.match(new RegExp(q, 'i'));
});
if (findings.length > 0) {
- findings[0].extra = t('dashboard.global_dashboards');
+ findings[0].extra = window.t('dashboard.global_dashboards');
}
return _.first(findings, 6);
},
@@ -221,7 +224,7 @@ define([
return f.name.match(new RegExp(q, 'i'));
});
if (findings.length > 0) {
- findings[0].extra = t('favorite');
+ findings[0].extra = window.t('favorite');
}
return _.first(findings, 6);
}
diff --git a/server/sonar-web/src/main/js/apps/overview/app.jsx b/server/sonar-web/src/main/js/apps/overview/app.jsx
index 475b1c0348f..4f85ebd82f1 100644
--- a/server/sonar-web/src/main/js/apps/overview/app.jsx
+++ b/server/sonar-web/src/main/js/apps/overview/app.jsx
@@ -6,17 +6,16 @@ const $ = jQuery;
export default {
start(options) {
+ _.extend(options, window.overview);
$('html').toggleClass('dashboard-page', options.component.hasSnapshot);
- window.requestMessages().done(() => {
- const el = document.querySelector(options.el);
- const inner = options.component.hasSnapshot ? (
- <Main
- component={options.component}
- gate={options.gate}
- measures={options.measures}
- leak={options.leak}/>
- ) : <Empty/>;
- React.render(inner, el);
- });
+ const el = document.querySelector(options.el);
+ const inner = options.component.hasSnapshot ? (
+ <Main
+ component={options.component}
+ gate={options.gate}
+ measures={options.measures}
+ leak={options.leak}/>
+ ) : <Empty/>;
+ React.render(inner, el);
}
};
diff --git a/server/sonar-web/src/main/js/apps/project-permissions/app.jsx b/server/sonar-web/src/main/js/apps/project-permissions/app.jsx
index 28dc73b7f42..478924e9233 100644
--- a/server/sonar-web/src/main/js/apps/project-permissions/app.jsx
+++ b/server/sonar-web/src/main/js/apps/project-permissions/app.jsx
@@ -5,9 +5,7 @@ const $ = jQuery;
export default {
start(options) {
- window.requestMessages().done(() => {
- var el = document.querySelector(options.el);
- React.render(<Main/>, el);
- });
+ var el = document.querySelector(options.el);
+ React.render(<Main/>, el);
}
};
diff --git a/server/sonar-web/src/main/js/apps/project-permissions/groups-view.js b/server/sonar-web/src/main/js/apps/project-permissions/groups-view.js
index 5e00efe9b86..5f1ee7bb807 100644
--- a/server/sonar-web/src/main/js/apps/project-permissions/groups-view.js
+++ b/server/sonar-web/src/main/js/apps/project-permissions/groups-view.js
@@ -8,7 +8,7 @@ define([
template: Templates['project-permissions-groups'],
onRender: function () {
- this._super();
+ Modal.prototype.onRender.apply(this, arguments);
new window.SelectList({
el: this.$('#project-permissions-groups'),
width: '100%',
@@ -35,8 +35,10 @@ define([
},
onDestroy: function () {
- this.options.refresh && this.options.refresh();
- this._super();
+ if (this.options.refresh) {
+ this.options.refresh();
+ }
+ Modal.prototype.onDestroy.apply(this, arguments);
},
serializeData: function () {
diff --git a/server/sonar-web/src/main/js/apps/project-permissions/users-view.js b/server/sonar-web/src/main/js/apps/project-permissions/users-view.js
index 5f54a1ad2a9..316c4508d00 100644
--- a/server/sonar-web/src/main/js/apps/project-permissions/users-view.js
+++ b/server/sonar-web/src/main/js/apps/project-permissions/users-view.js
@@ -8,7 +8,7 @@ define([
template: Templates['project-permissions-users'],
onRender: function () {
- this._super();
+ Modal.prototype.onRender.apply(this, arguments);
new window.SelectList({
el: this.$('#project-permissions-users'),
width: '100%',
@@ -35,14 +35,17 @@ define([
},
onDestroy: function () {
- this.options.refresh && this.options.refresh();
- this._super();
+ if (this.options.refresh) {
+ this.options.refresh();
+ }
+ Modal.prototype.onDestroy.apply(this, arguments);
},
serializeData: function () {
return _.extend(Modal.prototype.serializeData.apply(this, arguments), {
projectName: this.options.projectName
})
+
}
});
diff --git a/server/sonar-web/src/main/js/apps/provisioning/app.js b/server/sonar-web/src/main/js/apps/provisioning/app.js
index aa754e5ba77..01145ce4957 100644
--- a/server/sonar-web/src/main/js/apps/provisioning/app.js
+++ b/server/sonar-web/src/main/js/apps/provisioning/app.js
@@ -1,11 +1,12 @@
define([
+ 'backbone.marionette',
'./layout',
'./projects',
'./header-view',
'./search-view',
'./list-view',
'./list-footer-view'
-], function (Layout, Projects, HeaderView, SearchView, ListView, ListFooterView) {
+], function (Marionette, Layout, Projects, HeaderView, SearchView, ListView, ListFooterView) {
var App = new Marionette.Application(),
init = function (options) {
@@ -37,9 +38,7 @@ define([
};
App.on('start', function (options) {
- window.requestMessages().done(function () {
- init.call(App, options);
- });
+ init.call(App, options);
});
return App;
diff --git a/server/sonar-web/src/main/js/apps/provisioning/bulk-delete-view.js b/server/sonar-web/src/main/js/apps/provisioning/bulk-delete-view.js
index 731e3e163d2..af82066c0ef 100644
--- a/server/sonar-web/src/main/js/apps/provisioning/bulk-delete-view.js
+++ b/server/sonar-web/src/main/js/apps/provisioning/bulk-delete-view.js
@@ -6,8 +6,8 @@ define([
return ModalForm.extend({
template: Templates['provisioning-bulk-delete'],
- onFormSubmit: function (e) {
- this._super(e);
+ onFormSubmit: function () {
+ ModalForm.prototype.onFormSubmit.apply(this, arguments);
this.sendRequest();
},
diff --git a/server/sonar-web/src/main/js/apps/provisioning/delete-view.js b/server/sonar-web/src/main/js/apps/provisioning/delete-view.js
index dd503c4b1a4..02b8069b076 100644
--- a/server/sonar-web/src/main/js/apps/provisioning/delete-view.js
+++ b/server/sonar-web/src/main/js/apps/provisioning/delete-view.js
@@ -6,8 +6,8 @@ define([
return ModalForm.extend({
template: Templates['provisioning-delete'],
- onFormSubmit: function (e) {
- this._super(e);
+ onFormSubmit: function () {
+ ModalForm.prototype.onFormSubmit.apply(this, arguments);
this.sendRequest();
},
diff --git a/server/sonar-web/src/main/js/apps/provisioning/form-view.js b/server/sonar-web/src/main/js/apps/provisioning/form-view.js
index bb0fc0bcef5..cb301b78997 100644
--- a/server/sonar-web/src/main/js/apps/provisioning/form-view.js
+++ b/server/sonar-web/src/main/js/apps/provisioning/form-view.js
@@ -7,17 +7,17 @@ define([
template: Templates['provisioning-form'],
onRender: function () {
- this._super();
+ ModalForm.prototype.onRender.apply(this, arguments);
this.$('[data-toggle="tooltip"]').tooltip({ container: 'body', placement: 'bottom' });
},
onDestroy: function () {
- this._super();
+ ModalForm.prototype.onDestroy.apply(this, arguments);
this.$('[data-toggle="tooltip"]').tooltip('destroy');
},
- onFormSubmit: function (e) {
- this._super(e);
+ onFormSubmit: function () {
+ ModalForm.prototype.onFormSubmit.apply(this, arguments);
this.sendRequest();
}
diff --git a/server/sonar-web/src/main/js/apps/provisioning/header-view.js b/server/sonar-web/src/main/js/apps/provisioning/header-view.js
index 37165494eac..c98eb7a12cb 100644
--- a/server/sonar-web/src/main/js/apps/provisioning/header-view.js
+++ b/server/sonar-web/src/main/js/apps/provisioning/header-view.js
@@ -1,8 +1,9 @@
define([
+ 'backbone.marionette',
'./create-view',
'./bulk-delete-view',
'./templates'
-], function (CreateView, BulkDeleteView) {
+], function (Marionette, CreateView, BulkDeleteView) {
return Marionette.ItemView.extend({
template: Templates['provisioning-header'],
diff --git a/server/sonar-web/src/main/js/apps/provisioning/layout.js b/server/sonar-web/src/main/js/apps/provisioning/layout.js
index 31b67e8b774..3fa806b7a46 100644
--- a/server/sonar-web/src/main/js/apps/provisioning/layout.js
+++ b/server/sonar-web/src/main/js/apps/provisioning/layout.js
@@ -1,6 +1,7 @@
define([
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Marionette) {
return Marionette.LayoutView.extend({
template: Templates['provisioning-layout'],
diff --git a/server/sonar-web/src/main/js/apps/provisioning/list-footer-view.js b/server/sonar-web/src/main/js/apps/provisioning/list-footer-view.js
index 902b9322372..76176ca4769 100644
--- a/server/sonar-web/src/main/js/apps/provisioning/list-footer-view.js
+++ b/server/sonar-web/src/main/js/apps/provisioning/list-footer-view.js
@@ -1,6 +1,7 @@
define([
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Marionette) {
return Marionette.ItemView.extend({
template: Templates['provisioning-list-footer'],
@@ -23,7 +24,7 @@ define([
},
serializeData: function () {
- return _.extend(this._super(), {
+ return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
total: this.collection.total,
count: this.collection.length,
more: this.collection.hasMore()
diff --git a/server/sonar-web/src/main/js/apps/provisioning/list-item-view.js b/server/sonar-web/src/main/js/apps/provisioning/list-item-view.js
index ead9b009ca3..9940f3f0e0e 100644
--- a/server/sonar-web/src/main/js/apps/provisioning/list-item-view.js
+++ b/server/sonar-web/src/main/js/apps/provisioning/list-item-view.js
@@ -1,7 +1,8 @@
define([
+ 'backbone.marionette',
'./delete-view',
'./templates'
-], function (DeleteView) {
+], function (Marionette, DeleteView) {
return Marionette.ItemView.extend({
tagName: 'li',
diff --git a/server/sonar-web/src/main/js/apps/provisioning/list-view.js b/server/sonar-web/src/main/js/apps/provisioning/list-view.js
index 24878864d30..b56e64f951d 100644
--- a/server/sonar-web/src/main/js/apps/provisioning/list-view.js
+++ b/server/sonar-web/src/main/js/apps/provisioning/list-view.js
@@ -1,7 +1,8 @@
define([
+ 'backbone.marionette',
'./list-item-view',
'./templates'
-], function (ListItemView) {
+], function (Marionette, ListItemView) {
return Marionette.CollectionView.extend({
tagName: 'ul',
diff --git a/server/sonar-web/src/main/js/apps/provisioning/project.js b/server/sonar-web/src/main/js/apps/provisioning/project.js
index fa34df605f2..a2e13d09239 100644
--- a/server/sonar-web/src/main/js/apps/provisioning/project.js
+++ b/server/sonar-web/src/main/js/apps/provisioning/project.js
@@ -1,4 +1,6 @@
-define(function () {
+define([
+ 'backbone'
+], function (Backbone) {
return Backbone.Model.extend({
idAttribute: 'uuid',
@@ -8,7 +10,7 @@ define(function () {
},
urlRoot: function () {
- return baseUrl + '/api/projects';
+ return window.baseUrl + '/api/projects';
},
sync: function (method, model, options) {
diff --git a/server/sonar-web/src/main/js/apps/provisioning/projects.js b/server/sonar-web/src/main/js/apps/provisioning/projects.js
index 05a59f822af..51697b78fc8 100644
--- a/server/sonar-web/src/main/js/apps/provisioning/projects.js
+++ b/server/sonar-web/src/main/js/apps/provisioning/projects.js
@@ -1,12 +1,13 @@
define([
+ 'backbone',
'./project'
-], function (Project) {
+], function (Backbone, Project) {
return Backbone.Collection.extend({
model: Project,
url: function () {
- return baseUrl + '/api/projects/provisioned';
+ return window.baseUrl + '/api/projects/provisioned';
},
parse: function (r) {
@@ -19,7 +20,7 @@ define([
fetch: function (options) {
var d = (options && options.data) || {};
this.q = d.q;
- return this._super(options);
+ return Backbone.Collection.prototype.fetch.apply(this, arguments);
},
fetchMore: function () {
diff --git a/server/sonar-web/src/main/js/apps/provisioning/search-view.js b/server/sonar-web/src/main/js/apps/provisioning/search-view.js
index 55c0fafc4fb..5f10d839e8a 100644
--- a/server/sonar-web/src/main/js/apps/provisioning/search-view.js
+++ b/server/sonar-web/src/main/js/apps/provisioning/search-view.js
@@ -1,6 +1,7 @@
define([
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Marionette) {
return Marionette.ItemView.extend({
template: Templates['provisioning-search'],
@@ -90,7 +91,7 @@ define([
selectedCount = this.collection.where({ selected: true }).length,
allSelected = projectsCount > 0 && projectsCount === selectedCount,
someSelected = !allSelected && selectedCount > 0;
- return _.extend(this._super(), {
+ return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
selectedCount: selectedCount,
allSelected: allSelected,
someSelected: someSelected
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/actions-view.js b/server/sonar-web/src/main/js/apps/quality-gates/actions-view.js
index 156c7d88104..44013fbc930 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/actions-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-gates/actions-view.js
@@ -1,7 +1,8 @@
define([
+ 'backbone.marionette',
'./create-view',
'./templates'
-], function (CreateView) {
+], function (Marionette, CreateView) {
return Marionette.ItemView.extend({
template: Templates['quality-gate-actions'],
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/app.js b/server/sonar-web/src/main/js/apps/quality-gates/app.js
index 6f939c9aa24..1c8f38fea0d 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/app.js
+++ b/server/sonar-web/src/main/js/apps/quality-gates/app.js
@@ -1,11 +1,13 @@
define([
+ 'backbone',
+ 'backbone.marionette',
'./gates',
'./gates-view',
'./actions-view',
'./router',
'./layout',
'./controller'
-], function (Gates, GatesView, ActionsView, Router, Layout, Controller) {
+], function (Backbone, Marionette, Gates, GatesView, ActionsView, Router, Layout, Controller) {
var $ = jQuery,
App = new Marionette.Application();
@@ -52,7 +54,7 @@ define([
});
App.on('start', function (options) {
- $.when(window.requestMessages(), appXHR).done(function () {
+ $.when(appXHR).done(function () {
init.call(App, options);
});
});
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/condition.js b/server/sonar-web/src/main/js/apps/quality-gates/condition.js
index 9ca451ee5a0..bb14f8226c0 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/condition.js
+++ b/server/sonar-web/src/main/js/apps/quality-gates/condition.js
@@ -1,4 +1,6 @@
-define(function () {
+define([
+ 'backbone'
+], function (Backbone) {
return Backbone.Model.extend({
@@ -7,7 +9,7 @@ define(function () {
},
url: function () {
- return baseUrl + '/api/qualitygates';
+ return window.baseUrl + '/api/qualitygates';
},
createUrl: function () {
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/conditions.js b/server/sonar-web/src/main/js/apps/quality-gates/conditions.js
index 49cbb23f069..08d1cb52133 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/conditions.js
+++ b/server/sonar-web/src/main/js/apps/quality-gates/conditions.js
@@ -1,6 +1,7 @@
define([
+ 'backbone',
'./condition'
-], function (Condition) {
+], function (Backbone, Condition) {
return Backbone.Collection.extend({
model: Condition,
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/controller.js b/server/sonar-web/src/main/js/apps/quality-gates/controller.js
index 890adc1ad8b..90b1c4b0d9f 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/controller.js
+++ b/server/sonar-web/src/main/js/apps/quality-gates/controller.js
@@ -1,8 +1,9 @@
define([
+ 'backbone.marionette',
'./gate',
'./details-view',
'./header-view'
-], function (Gate, DetailsView, HeaderView) {
+], function (Marionette, Gate, DetailsView, HeaderView) {
return Marionette.Controller.extend({
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/copy-view.js b/server/sonar-web/src/main/js/apps/quality-gates/copy-view.js
index fdd6c974cf8..012683d9ee8 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/copy-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-gates/copy-view.js
@@ -7,7 +7,7 @@ define([
prepareRequest: function () {
var that = this;
- var url = baseUrl + '/api/qualitygates/copy',
+ var url = window.baseUrl + '/api/qualitygates/copy',
name = this.$('#quality-gate-form-name').val(),
options = {
url: url,
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/create-view.js b/server/sonar-web/src/main/js/apps/quality-gates/create-view.js
index f58863ba315..acb0cc5e5e3 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/create-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-gates/create-view.js
@@ -7,7 +7,7 @@ define([
prepareRequest: function () {
var that = this;
- var url = baseUrl + '/api/qualitygates/create',
+ var url = window.baseUrl + '/api/qualitygates/create',
name = this.$('#quality-gate-form-name').val(),
options = {
url: url,
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/details-view.js b/server/sonar-web/src/main/js/apps/quality-gates/details-view.js
index 9af1b38e65e..6451104db2c 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/details-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-gates/details-view.js
@@ -1,9 +1,10 @@
define([
+ 'backbone.marionette',
'./conditions',
'./gate-conditions-view',
'./gate-projects-view',
'./templates'
-], function (Conditions, DetailConditionsView, ProjectsView) {
+], function (Marionette, Conditions, DetailConditionsView, ProjectsView) {
return Marionette.LayoutView.extend({
template: Templates['quality-gate-detail'],
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/form-view.js b/server/sonar-web/src/main/js/apps/quality-gates/form-view.js
index 9b61f400bf3..6d696825899 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/form-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-gates/form-view.js
@@ -1,8 +1,9 @@
define([
+ 'backbone',
'components/common/modal-form',
'./gate',
'./templates'
-], function (ModalForm, Gate) {
+], function (Backbone, ModalForm, Gate) {
return ModalForm.extend({
template: Templates['quality-gate-form'],
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/gate-condition-view.js b/server/sonar-web/src/main/js/apps/quality-gates/gate-condition-view.js
index 0dfbea0ab17..7d9bbc741eb 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/gate-condition-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-gates/gate-condition-view.js
@@ -1,7 +1,8 @@
define([
+ 'backbone.marionette',
'./gate-conditions-delete-view',
'./templates'
-], function (DeleteConditionView) {
+], function (Marionette, DeleteConditionView) {
return Marionette.ItemView.extend({
tagName: 'tr',
@@ -90,7 +91,7 @@ define([
return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
canEdit: this.options.canEdit,
periods: this.options.periods,
- periodText: period ? period.text : t('value'),
+ periodText: period ? period.text : window.t('value'),
metric: this.getMetric(),
isDiffMetric: this.isDiffMetric()
});
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/gate-conditions-delete-view.js b/server/sonar-web/src/main/js/apps/quality-gates/gate-conditions-delete-view.js
index c8ed23a2883..eaf001b0658 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/gate-conditions-delete-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-gates/gate-conditions-delete-view.js
@@ -1,7 +1,8 @@
define([
+ 'backbone.marionette',
'components/common/modal-form',
'./templates'
-], function (ModalForm) {
+], function (Marionette, ModalForm) {
return ModalForm.extend({
template: Templates['quality-gates-condition-delete'],
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/gate-conditions-empty-view.js b/server/sonar-web/src/main/js/apps/quality-gates/gate-conditions-empty-view.js
index 03390ac7a89..5bab8c1ff29 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/gate-conditions-empty-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-gates/gate-conditions-empty-view.js
@@ -1,6 +1,7 @@
define([
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Marionette) {
return Marionette.ItemView.extend({
tagName: 'tr',
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/gate-conditions-view.js b/server/sonar-web/src/main/js/apps/quality-gates/gate-conditions-view.js
index b0c0857cc95..5eb29360449 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/gate-conditions-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-gates/gate-conditions-view.js
@@ -1,9 +1,10 @@
define([
+ 'backbone.marionette',
'./condition',
'./gate-condition-view',
'./gate-conditions-empty-view',
'./templates'
-], function (Condition, ConditionView, ConditionsEmptyView) {
+], function (Marionette, Condition, ConditionView, ConditionsEmptyView) {
return Marionette.CompositeView.extend({
template: Templates['quality-gate-detail-conditions'],
@@ -34,7 +35,7 @@ define([
this.ui.metricSelect.select2({
allowClear: false,
width: '250px',
- placeholder: t('alerts.select_metric')
+ placeholder: window.t('alerts.select_metric')
});
},
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/gate-projects-view.js b/server/sonar-web/src/main/js/apps/quality-gates/gate-projects-view.js
index c188c473be5..5337fad8c52 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/gate-projects-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-gates/gate-projects-view.js
@@ -1,13 +1,15 @@
define([
+ 'backbone.marionette',
'components/common/select-list',
'./templates'
-], function () {
+], function (Marionette) {
return Marionette.ItemView.extend({
template: Templates['quality-gate-detail-projects'],
onRender: function () {
if (!this.model.isDefault()) {
+ //noinspection Eslint
new window.SelectList({
el: this.$('#select-list-projects'),
width: '100%',
@@ -16,23 +18,23 @@ define([
format: function (item) {
return item.name;
},
- searchUrl: baseUrl + '/api/qualitygates/search?gateId=' + this.model.id,
- selectUrl: baseUrl + '/api/qualitygates/select',
- deselectUrl: baseUrl + '/api/qualitygates/deselect',
+ searchUrl: window.baseUrl + '/api/qualitygates/search?gateId=' + this.model.id,
+ selectUrl: window.baseUrl + '/api/qualitygates/select',
+ deselectUrl: window.baseUrl + '/api/qualitygates/deselect',
extra: {
gateId: this.model.id
},
selectParameter: 'projectId',
selectParameterValue: 'id',
labels: {
- selected: t('quality_gates.projects.with'),
- deselected: t('quality_gates.projects.without'),
- all: t('quality_gates.projects.all'),
- noResults: t('quality_gates.projects.noResults')
+ selected: window.t('quality_gates.projects.with'),
+ deselected: window.t('quality_gates.projects.without'),
+ all: window.t('quality_gates.projects.all'),
+ noResults: window.t('quality_gates.projects.noResults')
},
tooltips: {
- select: t('quality_gates.projects.select_hint'),
- deselect: t('quality_gates.projects.deselect_hint')
+ select: window.t('quality_gates.projects.select_hint'),
+ deselect: window.t('quality_gates.projects.deselect_hint')
}
});
}
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/gate-view.js b/server/sonar-web/src/main/js/apps/quality-gates/gate-view.js
index 30036a3c313..c9fdb2ba12e 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/gate-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-gates/gate-view.js
@@ -1,6 +1,7 @@
define([
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Marionette) {
return Marionette.ItemView.extend({
tagName: 'a',
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/gate.js b/server/sonar-web/src/main/js/apps/quality-gates/gate.js
index 54b4e6ce13c..5bcda8336b1 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/gate.js
+++ b/server/sonar-web/src/main/js/apps/quality-gates/gate.js
@@ -1,4 +1,6 @@
-define(function () {
+define([
+ 'backbone'
+], function (Backbone) {
return Backbone.Model.extend({
@@ -7,7 +9,7 @@ define(function () {
},
url: function () {
- return baseUrl + '/api/qualitygates';
+ return window.baseUrl + '/api/qualitygates';
},
showUrl: function () {
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/gates-view.js b/server/sonar-web/src/main/js/apps/quality-gates/gates-view.js
index cd36c381a39..2e58b9466f9 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/gates-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-gates/gates-view.js
@@ -1,7 +1,8 @@
define([
+ 'backbone.marionette',
'./gate-view',
'./templates'
-], function (ItemView) {
+], function (Marionette, ItemView) {
return Marionette.CompositeView.extend({
className: 'list-group',
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/gates.js b/server/sonar-web/src/main/js/apps/quality-gates/gates.js
index d33b35bcfe5..55c6d681084 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/gates.js
+++ b/server/sonar-web/src/main/js/apps/quality-gates/gates.js
@@ -1,12 +1,13 @@
define([
+ 'backbone',
'./gate'
-], function (Gate) {
+], function (Backbone, Gate) {
return Backbone.Collection.extend({
model: Gate,
url: function () {
- return baseUrl + '/api/qualitygates/list';
+ return window.baseUrl + '/api/qualitygates/list';
},
parse: function (r) {
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/header-view.js b/server/sonar-web/src/main/js/apps/quality-gates/header-view.js
index b86b2c9ba62..dd6bea9ee74 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/header-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-gates/header-view.js
@@ -1,9 +1,10 @@
define([
+ 'backbone.marionette',
'./rename-view',
'./copy-view',
'./delete-view',
'./templates'
-], function (RenameView, CopyView, DeleteView) {
+], function (Marionette, RenameView, CopyView, DeleteView) {
return Marionette.ItemView.extend({
template: Templates['quality-gate-detail-header'],
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/intro-view.js b/server/sonar-web/src/main/js/apps/quality-gates/intro-view.js
index c9588a3d48f..83d6b354d13 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/intro-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-gates/intro-view.js
@@ -1,6 +1,7 @@
define([
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Marionette) {
return Marionette.ItemView.extend({
template: Templates['quality-gates-intro']
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/layout.js b/server/sonar-web/src/main/js/apps/quality-gates/layout.js
index db02143caa6..bee18432f0c 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/layout.js
+++ b/server/sonar-web/src/main/js/apps/quality-gates/layout.js
@@ -1,7 +1,9 @@
define([
+ 'backbone.marionette',
'./intro-view',
+ '../../components/common/jquery-isolated-scroll',
'./templates'
-], function (IntroView) {
+], function (Marionette, IntroView) {
return Marionette.LayoutView.extend({
template: Templates['quality-gates-layout'],
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/rename-view.js b/server/sonar-web/src/main/js/apps/quality-gates/rename-view.js
index d9b5946653a..29db22d6fa4 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/rename-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-gates/rename-view.js
@@ -7,7 +7,7 @@ define([
prepareRequest: function () {
var that = this;
- var url = baseUrl + '/api/qualitygates/rename',
+ var url = window.baseUrl + '/api/qualitygates/rename',
name = this.$('#quality-gate-form-name').val(),
options = {
url: url,
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/router.js b/server/sonar-web/src/main/js/apps/quality-gates/router.js
index 582c47361d5..35a41f33864 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/router.js
+++ b/server/sonar-web/src/main/js/apps/quality-gates/router.js
@@ -1,4 +1,6 @@
-define(function () {
+define([
+ 'backbone'
+], function (Backbone) {
return Backbone.Router.extend({
routes: {
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/actions-view.js b/server/sonar-web/src/main/js/apps/quality-profiles/actions-view.js
index fc107d10cef..9aad03fa56b 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/actions-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/actions-view.js
@@ -1,28 +1,10 @@
-/*
- * 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.
- */
define([
+ 'backbone.marionette',
'./create-profile-view',
'./restore-profile-view',
'./restore-built-in-profiles-view',
'./templates'
-], function (CreateProfileView, RestoreProfileView, RestoreBuiltInProfilesView) {
+], function (Marionette, CreateProfileView, RestoreProfileView, RestoreBuiltInProfilesView) {
var $ = jQuery;
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/app.js b/server/sonar-web/src/main/js/apps/quality-profiles/app.js
index cd94804cb03..c506cb2a56d 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/app.js
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/app.js
@@ -1,21 +1,22 @@
define([
+ 'backbone',
+ 'backbone.marionette',
'./router',
'./controller',
'./layout',
'./profiles',
'./actions-view',
'./profiles-view'
-], function (Router, Controller, Layout, Profiles, ActionsView, ProfilesView) {
+], function (Backbone, Marionette, Router, Controller, Layout, Profiles, ActionsView, ProfilesView) {
var $ = jQuery,
App = new Marionette.Application(),
- requestUser = $.get(baseUrl + '/api/users/current').done(function (r) {
- App.canWrite = r.permissions.global.indexOf('profileadmin') !== -1;
- }),
requestExporters = $.get(baseUrl + '/api/qualityprofiles/exporters').done(function (r) {
App.exporters = r.exporters;
}),
init = function (options) {
+ App.canWrite = options.user.permissions.global.indexOf('profileadmin') !== -1;
+
// Layout
this.layout = new Layout({ el: options.el });
this.layout.render();
@@ -52,7 +53,7 @@ define([
};
App.on('start', function (options) {
- $.when(window.requestMessages(), requestUser, requestExporters).done(function () {
+ $.when(requestExporters).done(function () {
init.call(App, options);
});
});
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/change-profile-parent-view.js b/server/sonar-web/src/main/js/apps/quality-profiles/change-profile-parent-view.js
index a0813a661c9..d694679452a 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/change-profile-parent-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/change-profile-parent-view.js
@@ -1,26 +1,8 @@
-/*
- * 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.
- */
define([
+ 'backbone.marionette',
'components/common/modal-form',
'./templates'
-], function (ModalFormView) {
+], function (Marionette, ModalFormView) {
var $ = jQuery;
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/controller.js b/server/sonar-web/src/main/js/apps/quality-profiles/controller.js
index 987cb0b3728..b3010cb4bd9 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/controller.js
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/controller.js
@@ -1,26 +1,8 @@
-/*
- * 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.
- */
define([
+ 'backbone.marionette',
'./profile-header-view',
'./profile-details-view'
-], function (ProfileHeaderView, ProfileDetailsView) {
+], function (Marionette, ProfileHeaderView, ProfileDetailsView) {
var $ = jQuery;
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/helpers.js b/server/sonar-web/src/main/js/apps/quality-profiles/helpers.js
index d241c123e17..cea70a76069 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/helpers.js
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/helpers.js
@@ -34,16 +34,16 @@
});
Handlebars.registerHelper('severityChangelog', function (severity) {
- var label = '<i class="icon-severity-' + severity.toLowerCase() + '"></i>&nbsp;' + t('severity', severity),
- message = tp('quality_profiles.severity_set_to_x', label);
+ var label = '<i class="icon-severity-' + severity.toLowerCase() + '"></i>&nbsp;' + window.t('severity', severity),
+ message = window.tp('quality_profiles.severity_set_to_x', label);
return new Handlebars.SafeString(message);
});
Handlebars.registerHelper('parameterChangelog', function (value, parameter) {
if (parameter) {
- return new Handlebars.SafeString(tp('quality_profiles.parameter_set_to_x', value, parameter));
+ return new Handlebars.SafeString(window.tp('quality_profiles.parameter_set_to_x', value, parameter));
} else {
- return new Handlebars.SafeString(tp('quality_profiles.changelog.parameter_reset_to_default_value_x', parameter));
+ return new Handlebars.SafeString(window.tp('quality_profiles.changelog.parameter_reset_to_default_value_x', parameter));
}
});
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/intro-view.js b/server/sonar-web/src/main/js/apps/quality-profiles/intro-view.js
index abfb416541b..8b6172ac012 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/intro-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/intro-view.js
@@ -1,25 +1,7 @@
-/*
- * 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.
- */
define([
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Marionette) {
return Marionette.ItemView.extend({
template: Templates['quality-profiles-intro']
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/layout.js b/server/sonar-web/src/main/js/apps/quality-profiles/layout.js
index 44cafd82d32..f83319a72dc 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/layout.js
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/layout.js
@@ -1,26 +1,9 @@
-/*
- * 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.
- */
define([
+ 'backbone.marionette',
'./intro-view',
+ '../../components/common/jquery-isolated-scroll',
'./templates'
-], function (IntroView) {
+], function (Marionette, IntroView) {
return Marionette.LayoutView.extend({
template: Templates['quality-profiles-layout'],
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/profile-changelog-view.js b/server/sonar-web/src/main/js/apps/quality-profiles/profile-changelog-view.js
index 28838846bba..0a8ab424273 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/profile-changelog-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/profile-changelog-view.js
@@ -1,25 +1,7 @@
-/*
- * 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.
- */
define([
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Marionette) {
return Marionette.ItemView.extend({
template: Templates['quality-profile-changelog'],
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/profile-comparison-view.js b/server/sonar-web/src/main/js/apps/quality-profiles/profile-comparison-view.js
index d5f5ea37d4b..9dc9894d166 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/profile-comparison-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/profile-comparison-view.js
@@ -1,25 +1,7 @@
-/*
- * 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.
- */
define([
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Marionette) {
return Marionette.ItemView.extend({
template: Templates['quality-profile-comparison'],
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/profile-details-view.js b/server/sonar-web/src/main/js/apps/quality-profiles/profile-details-view.js
index 112c5b39b96..e0361b19f93 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/profile-details-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/profile-details-view.js
@@ -1,30 +1,12 @@
-/*
- * 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.
- */
define([
+ 'backbone.marionette',
'./change-profile-parent-view',
'./profile-changelog-view',
'./profile-comparison-view',
'components/common/select-list',
'./helpers',
'./templates'
-], function (ChangeProfileParentView, ProfileChangelogView, ProfileComparisonView) {
+], function (Marionette, ChangeProfileParentView, ProfileChangelogView, ProfileComparisonView) {
var $ = jQuery;
@@ -87,14 +69,14 @@ define([
selectParameter: 'projectUuid',
selectParameterValue: 'uuid',
labels: {
- selected: t('quality_gates.projects.with'),
- deselected: t('quality_gates.projects.without'),
- all: t('quality_gates.projects.all'),
- noResults: t('quality_gates.projects.noResults')
+ selected: window.t('quality_gates.projects.with'),
+ deselected: window.t('quality_gates.projects.without'),
+ all: window.t('quality_gates.projects.all'),
+ noResults: window.t('quality_gates.projects.noResults')
},
tooltips: {
- select: t('quality_gates.projects.select_hint'),
- deselect: t('quality_gates.projects.deselect_hint')
+ select: window.t('quality_gates.projects.select_hint'),
+ deselect: window.t('quality_gates.projects.deselect_hint')
}
});
this.listenTo(this.projectsSelectList.collection, 'change:selected', this.onProjectsChange);
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/profile-header-view.js b/server/sonar-web/src/main/js/apps/quality-profiles/profile-header-view.js
index 57a5d310736..2137bebae18 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/profile-header-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/profile-header-view.js
@@ -1,28 +1,10 @@
-/*
- * 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.
- */
define([
+ 'backbone.marionette',
'./copy-profile-view',
'./rename-profile-view',
'./delete-profile-view',
'./templates'
-], function (ProfileCopyView, ProfileRenameView, ProfileDeleteView) {
+], function (Marionette, ProfileCopyView, ProfileRenameView, ProfileDeleteView) {
var $ = jQuery;
@@ -62,7 +44,7 @@ define([
onDeleteClick: function (e) {
e.preventDefault();
- this.delete();
+ this.deleteProfile();
},
copy: function () {
@@ -77,7 +59,7 @@ define([
this.model.trigger('setAsDefault', this.model);
},
- delete: function () {
+ deleteProfile: function () {
new ProfileDeleteView({ model: this.model }).render();
},
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/profile-view.js b/server/sonar-web/src/main/js/apps/quality-profiles/profile-view.js
index 34de0a2d0c0..1b7b8dfa471 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/profile-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/profile-view.js
@@ -1,25 +1,7 @@
-/*
- * 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.
- */
define([
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Marionette) {
return Marionette.ItemView.extend({
tagName: 'a',
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/profile.js b/server/sonar-web/src/main/js/apps/quality-profiles/profile.js
index 7315821cf1c..a9b91c3c1c2 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/profile.js
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/profile.js
@@ -1,23 +1,6 @@
-/*
- * 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.
- */
-define(function () {
+define([
+ 'backbone'
+], function (Backbone) {
var $ = jQuery;
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/profiles-empty-view.js b/server/sonar-web/src/main/js/apps/quality-profiles/profiles-empty-view.js
index f4844bfc85f..9ee9388beea 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/profiles-empty-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/profiles-empty-view.js
@@ -1,6 +1,7 @@
define([
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Marionette) {
return Marionette.ItemView.extend({
className: 'list-group-item',
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/profiles-view.js b/server/sonar-web/src/main/js/apps/quality-profiles/profiles-view.js
index 677888f451c..42573bc63b1 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/profiles-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/profiles-view.js
@@ -1,27 +1,9 @@
-/*
- * 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.
- */
define([
+ 'backbone.marionette',
'./profile-view',
'./profiles-empty-view',
'./templates'
-], function (ProfileView, ProfilesEmptyView) {
+], function (Marionette, ProfileView, ProfilesEmptyView) {
return Marionette.CompositeView.extend({
className: 'list-group',
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/profiles.js b/server/sonar-web/src/main/js/apps/quality-profiles/profiles.js
index 8b556ce8aa5..a0f93dd496f 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/profiles.js
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/profiles.js
@@ -1,25 +1,7 @@
-/*
- * 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.
- */
define([
+ 'backbone',
'./profile'
-], function (Profile) {
+], function (Backbone, Profile) {
return Backbone.Collection.extend({
model: Profile,
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/restore-built-in-profiles-view.js b/server/sonar-web/src/main/js/apps/quality-profiles/restore-built-in-profiles-view.js
index bd223c261f3..2d39c14761c 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/restore-built-in-profiles-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/restore-built-in-profiles-view.js
@@ -27,7 +27,7 @@ define([
return ModalFormView.extend({
template: Templates['quality-profiles-restore-built-in-profiles'],
- onFormSubmit: function (e) {
+ onFormSubmit: function () {
ModalFormView.prototype.onFormSubmit.apply(this, arguments);
this.disableForm();
this.sendRequest();
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/router.js b/server/sonar-web/src/main/js/apps/quality-profiles/router.js
index 7970d6d2ea6..a4702143fbf 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/router.js
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/router.js
@@ -1,23 +1,6 @@
-/*
- * 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.
- */
-define(function () {
+define([
+ 'backbone'
+], function (Backbone) {
return Backbone.Router.extend({
routes: {
diff --git a/server/sonar-web/src/main/js/apps/select-list/app.js b/server/sonar-web/src/main/js/apps/select-list/app.js
new file mode 100644
index 00000000000..5339644f14e
--- /dev/null
+++ b/server/sonar-web/src/main/js/apps/select-list/app.js
@@ -0,0 +1,11 @@
+define([
+ '../../components/common/select-list'
+], function () {
+
+ return {
+ start: function () {
+ // do nothing
+ }
+ };
+
+});
diff --git a/server/sonar-web/src/main/js/apps/source-viewer/app.js b/server/sonar-web/src/main/js/apps/source-viewer/app.js
index 1c6947db3ee..31b6047d152 100644
--- a/server/sonar-web/src/main/js/apps/source-viewer/app.js
+++ b/server/sonar-web/src/main/js/apps/source-viewer/app.js
@@ -1,6 +1,7 @@
define([
+ 'backbone.marionette',
'components/source-viewer/main'
-], function (SourceViewer) {
+], function (Marionette, SourceViewer) {
var App = new Marionette.Application(),
init = function (options) {
@@ -8,20 +9,20 @@ define([
var viewer = new SourceViewer();
this.mainRegion.show(viewer);
- viewer.open(options.file.uuid);
- if (typeof options.file.line === 'number') {
+ viewer.open(options.component.uuid);
+ if (window.line) {
viewer.on('loaded', function () {
viewer
- .highlightLine(options.file.line)
- .scrollToLine(options.file.line);
+ .highlightLine(window.line)
+ .scrollToLine(window.line);
});
}
};
App.on('start', function (options) {
- window.requestMessages().done(function () {
+ if (options.component) {
init.call(App, options);
- });
+ }
});
return App;
diff --git a/server/sonar-web/src/main/js/apps/update-center/app.js b/server/sonar-web/src/main/js/apps/update-center/app.js
index a866a0c2879..4630c21b4fe 100644
--- a/server/sonar-web/src/main/js/apps/update-center/app.js
+++ b/server/sonar-web/src/main/js/apps/update-center/app.js
@@ -1,4 +1,6 @@
define([
+ 'backbone',
+ 'backbone.marionette',
'./layout',
'./header-view',
'./search-view',
@@ -7,7 +9,7 @@ define([
'./controller',
'./router',
'./plugins'
-], function (Layout, HeaderView, SearchView, ListView, FooterView, Controller, Router, Plugins) {
+], function (Backbone, Marionette, Layout, HeaderView, SearchView, ListView, FooterView, Controller, Router, Plugins) {
var App = new Marionette.Application(),
init = function (options) {
@@ -27,7 +29,7 @@ define([
this.controller = new Controller({ collection: this.plugins, state: this.state });
// Router
- this.router = new Router({ controller: this.controller});
+ this.router = new Router({ controller: this.controller });
// Header
this.headerView = new HeaderView({ collection: this.plugins });
@@ -54,9 +56,7 @@ define([
};
App.on('start', function (options) {
- window.requestMessages().done(function () {
- init.call(App, options);
- });
+ init.call(App, options);
});
return App;
diff --git a/server/sonar-web/src/main/js/apps/update-center/controller.js b/server/sonar-web/src/main/js/apps/update-center/controller.js
index a8f069c9dc0..5aaf9a21e94 100644
--- a/server/sonar-web/src/main/js/apps/update-center/controller.js
+++ b/server/sonar-web/src/main/js/apps/update-center/controller.js
@@ -1,4 +1,6 @@
-define(function () {
+define([
+ 'backbone.marionette'
+], function (Marionette) {
return Marionette.Controller.extend({
initialize: function (options) {
diff --git a/server/sonar-web/src/main/js/apps/update-center/footer-view.js b/server/sonar-web/src/main/js/apps/update-center/footer-view.js
index 2f83d509dc7..58cddde9754 100644
--- a/server/sonar-web/src/main/js/apps/update-center/footer-view.js
+++ b/server/sonar-web/src/main/js/apps/update-center/footer-view.js
@@ -1,6 +1,7 @@
define([
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Marionette) {
return Marionette.ItemView.extend({
template: Templates['update-center-footer'],
@@ -10,7 +11,7 @@ define([
},
serializeData: function () {
- return _.extend(this._super(), {
+ return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
total: this.collection.where({ _hidden: false }).length
});
}
diff --git a/server/sonar-web/src/main/js/apps/update-center/header-view.js b/server/sonar-web/src/main/js/apps/update-center/header-view.js
index 99e1095ad7f..1963823c939 100644
--- a/server/sonar-web/src/main/js/apps/update-center/header-view.js
+++ b/server/sonar-web/src/main/js/apps/update-center/header-view.js
@@ -1,6 +1,7 @@
define([
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Marionette) {
return Marionette.ItemView.extend({
template: Templates['update-center-header'],
@@ -18,7 +19,7 @@ define([
},
serializeData: function () {
- return _.extend(this._super(), {
+ return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
installing: this.collection._installedCount,
uninstalling: this.collection._uninstalledCount
});
diff --git a/server/sonar-web/src/main/js/apps/update-center/layout.js b/server/sonar-web/src/main/js/apps/update-center/layout.js
index 58e480d16de..5db9c1e5a34 100644
--- a/server/sonar-web/src/main/js/apps/update-center/layout.js
+++ b/server/sonar-web/src/main/js/apps/update-center/layout.js
@@ -1,6 +1,7 @@
define([
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Marionette) {
return Marionette.LayoutView.extend({
template: Templates['update-center-layout'],
diff --git a/server/sonar-web/src/main/js/apps/update-center/list-item-view.js b/server/sonar-web/src/main/js/apps/update-center/list-item-view.js
index 67750c343ec..9aab6cb612a 100644
--- a/server/sonar-web/src/main/js/apps/update-center/list-item-view.js
+++ b/server/sonar-web/src/main/js/apps/update-center/list-item-view.js
@@ -1,7 +1,9 @@
define([
+ 'backbone',
+ 'backbone.marionette',
'./plugin-changelog-view',
'./templates'
-], function (PluginChangelogView) {
+], function (Backbone, Marionette, PluginChangelogView) {
var $ = jQuery;
diff --git a/server/sonar-web/src/main/js/apps/update-center/list-view.js b/server/sonar-web/src/main/js/apps/update-center/list-view.js
index e188597e511..eb1fe1bc495 100644
--- a/server/sonar-web/src/main/js/apps/update-center/list-view.js
+++ b/server/sonar-web/src/main/js/apps/update-center/list-view.js
@@ -1,6 +1,7 @@
define([
+ 'backbone.marionette',
'./list-item-view'
-], function (ListItemView) {
+], function (Marionette, ListItemView) {
return Marionette.CollectionView.extend({
tagName: 'ul',
diff --git a/server/sonar-web/src/main/js/apps/update-center/plugin-changelog-view.js b/server/sonar-web/src/main/js/apps/update-center/plugin-changelog-view.js
index 9ece2454bb7..bf96fc5ac1b 100644
--- a/server/sonar-web/src/main/js/apps/update-center/plugin-changelog-view.js
+++ b/server/sonar-web/src/main/js/apps/update-center/plugin-changelog-view.js
@@ -1,5 +1,6 @@
define([
'components/common/popup',
+ '../../components/common/jquery-isolated-scroll',
'./templates'
], function (Popup) {
@@ -7,18 +8,18 @@ define([
template: Templates['update-center-plugin-changelog'],
onRender: function () {
- this._super();
+ Popup.prototype.onRender.apply(this, arguments);
this.$('.bubble-popup-container').isolatedScroll();
this.$('[data-toggle="tooltip"]').tooltip({ container: 'body', placement: 'bottom' });
},
onClose: function () {
- this._super();
+ Popup.prototype.onClose.apply(this, arguments);
this.$('[data-toggle="tooltip"]').tooltip('destroy');
},
serializeData: function () {
- return _.extend(this._super(), {
+ return _.extend(Popup.prototype.serializeData.apply(this, arguments), {
// if there is no status, this is a new plugin
// => force COMPATIBLE status
status: this.model.get('status') || 'COMPATIBLE'
diff --git a/server/sonar-web/src/main/js/apps/update-center/plugin.js b/server/sonar-web/src/main/js/apps/update-center/plugin.js
index 697979e4ed0..623e05b6d1d 100644
--- a/server/sonar-web/src/main/js/apps/update-center/plugin.js
+++ b/server/sonar-web/src/main/js/apps/update-center/plugin.js
@@ -1,4 +1,6 @@
-define(function () {
+define([
+ 'backbone'
+], function (Backbone) {
return Backbone.Model.extend({
idAttribute: 'key',
diff --git a/server/sonar-web/src/main/js/apps/update-center/plugins.js b/server/sonar-web/src/main/js/apps/update-center/plugins.js
index 021e124511c..d03988858f4 100644
--- a/server/sonar-web/src/main/js/apps/update-center/plugins.js
+++ b/server/sonar-web/src/main/js/apps/update-center/plugins.js
@@ -1,6 +1,7 @@
define([
+ 'backbone',
'./plugin'
-], function (Plugin) {
+], function (Backbone, Plugin) {
var $ = jQuery;
diff --git a/server/sonar-web/src/main/js/apps/update-center/router.js b/server/sonar-web/src/main/js/apps/update-center/router.js
index 0a9af1440cc..48f3df055ea 100644
--- a/server/sonar-web/src/main/js/apps/update-center/router.js
+++ b/server/sonar-web/src/main/js/apps/update-center/router.js
@@ -1,4 +1,6 @@
-define(function () {
+define([
+ 'backbone'
+], function (Backbone) {
return Backbone.Router.extend({
routes: {
diff --git a/server/sonar-web/src/main/js/apps/update-center/search-view.js b/server/sonar-web/src/main/js/apps/update-center/search-view.js
index b46cf5ce293..8cccae1ae57 100644
--- a/server/sonar-web/src/main/js/apps/update-center/search-view.js
+++ b/server/sonar-web/src/main/js/apps/update-center/search-view.js
@@ -1,6 +1,7 @@
define([
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Marionette) {
return Marionette.ItemView.extend({
template: Templates['update-center-search'],
@@ -77,7 +78,9 @@ define([
},
serializeData: function () {
- return _.extend(this._super(), { state: this.options.state.toJSON() });
+ return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
+ state: this.options.state.toJSON()
+ });
}
});
diff --git a/server/sonar-web/src/main/js/apps/users/app.js b/server/sonar-web/src/main/js/apps/users/app.js
index 9fa9df3759a..575f2afc320 100644
--- a/server/sonar-web/src/main/js/apps/users/app.js
+++ b/server/sonar-web/src/main/js/apps/users/app.js
@@ -1,11 +1,12 @@
define([
+ 'backbone.marionette',
'./layout',
'./users',
'./header-view',
'./search-view',
'./list-view',
'./list-footer-view'
-], function (Layout, Users, HeaderView, SearchView, ListView, ListFooterView) {
+], function (Marionette, Layout, Users, HeaderView, SearchView, ListView, ListFooterView) {
var App = new Marionette.Application(),
init = function (options) {
@@ -37,9 +38,7 @@ define([
};
App.on('start', function (options) {
- window.requestMessages().done(function () {
- init.call(App, options);
- });
+ init.call(App, options);
});
return App;
diff --git a/server/sonar-web/src/main/js/apps/users/change-password-view.js b/server/sonar-web/src/main/js/apps/users/change-password-view.js
index 659d3012a79..edda928fb99 100644
--- a/server/sonar-web/src/main/js/apps/users/change-password-view.js
+++ b/server/sonar-web/src/main/js/apps/users/change-password-view.js
@@ -6,8 +6,8 @@ define([
return ModalForm.extend({
template: Templates['users-change-password'],
- onFormSubmit: function (e) {
- this._super(e);
+ onFormSubmit: function () {
+ ModalForm.prototype.onFormSubmit.apply(this, arguments);
this.sendRequest();
},
diff --git a/server/sonar-web/src/main/js/apps/users/deactivate-view.js b/server/sonar-web/src/main/js/apps/users/deactivate-view.js
index 000a350ea57..26143c09b2e 100644
--- a/server/sonar-web/src/main/js/apps/users/deactivate-view.js
+++ b/server/sonar-web/src/main/js/apps/users/deactivate-view.js
@@ -6,8 +6,8 @@ define([
return ModalForm.extend({
template: Templates['users-deactivate'],
- onFormSubmit: function (e) {
- this._super(e);
+ onFormSubmit: function () {
+ ModalForm.prototype.onFormSubmit.apply(this, arguments);
this.sendRequest();
},
diff --git a/server/sonar-web/src/main/js/apps/users/form-view.js b/server/sonar-web/src/main/js/apps/users/form-view.js
index 50b18c1d237..c05f57afc09 100644
--- a/server/sonar-web/src/main/js/apps/users/form-view.js
+++ b/server/sonar-web/src/main/js/apps/users/form-view.js
@@ -9,23 +9,23 @@ define([
template: Templates['users-form'],
events: function () {
- return _.extend(this._super(), {
+ return _.extend(ModalForm.prototype.events.apply(this, arguments), {
'click #create-user-add-scm-account': 'onAddScmAccountClick'
});
},
onRender: function () {
- this._super();
+ ModalForm.prototype.onRender.apply(this, arguments);
this.$('[data-toggle="tooltip"]').tooltip({ container: 'body', placement: 'bottom' });
},
onDestroy: function () {
- this._super();
+ ModalForm.prototype.onDestroy.apply(this, arguments);
this.$('[data-toggle="tooltip"]').tooltip('destroy');
},
- onFormSubmit: function (e) {
- this._super(e);
+ onFormSubmit: function () {
+ ModalForm.prototype.onFormSubmit.apply(this, arguments);
this.sendRequest();
},
diff --git a/server/sonar-web/src/main/js/apps/users/groups-view.js b/server/sonar-web/src/main/js/apps/users/groups-view.js
index 09a127fc6fd..2949f0acee6 100644
--- a/server/sonar-web/src/main/js/apps/users/groups-view.js
+++ b/server/sonar-web/src/main/js/apps/users/groups-view.js
@@ -9,7 +9,8 @@ define([
itemTemplate: Templates['users-group'],
onRender: function () {
- this._super();
+ Modal.prototype.onRender.apply(this, arguments);
+ //noinspection Eslint
new window.SelectList({
el: this.$('#users-groups'),
width: '100%',
@@ -19,9 +20,9 @@ define([
return item.name + '<br><span class="note">' + item.description + '</span>';
},
queryParam: 'q',
- searchUrl: baseUrl + '/api/users/groups?ps=100&login=' + this.model.id,
- selectUrl: baseUrl + '/api/usergroups/add_user',
- deselectUrl: baseUrl + '/api/usergroups/remove_user',
+ searchUrl: window.baseUrl + '/api/users/groups?ps=100&login=' + this.model.id,
+ selectUrl: window.baseUrl + '/api/usergroups/add_user',
+ deselectUrl: window.baseUrl + '/api/usergroups/remove_user',
extra: {
login: this.model.id
},
diff --git a/server/sonar-web/src/main/js/apps/users/header-view.js b/server/sonar-web/src/main/js/apps/users/header-view.js
index c8b76193b4c..a07bd44e6e0 100644
--- a/server/sonar-web/src/main/js/apps/users/header-view.js
+++ b/server/sonar-web/src/main/js/apps/users/header-view.js
@@ -1,7 +1,8 @@
define([
+ 'backbone.marionette',
'./create-view',
'./templates'
-], function (CreateView) {
+], function (Marionette, CreateView) {
return Marionette.ItemView.extend({
template: Templates['users-header'],
diff --git a/server/sonar-web/src/main/js/apps/users/layout.js b/server/sonar-web/src/main/js/apps/users/layout.js
index 9acb054bdad..3fb4ee142bb 100644
--- a/server/sonar-web/src/main/js/apps/users/layout.js
+++ b/server/sonar-web/src/main/js/apps/users/layout.js
@@ -1,6 +1,7 @@
define([
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Marionette) {
return Marionette.LayoutView.extend({
template: Templates['users-layout'],
diff --git a/server/sonar-web/src/main/js/apps/users/list-footer-view.js b/server/sonar-web/src/main/js/apps/users/list-footer-view.js
index cf802586354..7758d24d75b 100644
--- a/server/sonar-web/src/main/js/apps/users/list-footer-view.js
+++ b/server/sonar-web/src/main/js/apps/users/list-footer-view.js
@@ -1,6 +1,7 @@
define([
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Marionette) {
return Marionette.ItemView.extend({
template: Templates['users-list-footer'],
@@ -23,7 +24,7 @@ define([
},
serializeData: function () {
- return _.extend(this._super(), {
+ return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
total: this.collection.total,
count: this.collection.length,
more: this.collection.hasMore()
diff --git a/server/sonar-web/src/main/js/apps/users/list-item-view.js b/server/sonar-web/src/main/js/apps/users/list-item-view.js
index b11e39e2766..b123e560225 100644
--- a/server/sonar-web/src/main/js/apps/users/list-item-view.js
+++ b/server/sonar-web/src/main/js/apps/users/list-item-view.js
@@ -1,10 +1,11 @@
define([
+ 'backbone.marionette',
'./update-view',
'./change-password-view',
'./deactivate-view',
'./groups-view',
'./templates'
-], function (UpdateView, ChangePasswordView, DeactivateView, GroupsView) {
+], function (Marionette, UpdateView, ChangePasswordView, DeactivateView, GroupsView) {
return Marionette.ItemView.extend({
tagName: 'li',
@@ -101,7 +102,7 @@ define([
scmAccountsLimit = scmAccounts.length > this.scmLimit ? this.scmLimit - 1 : this.scmLimit,
groups = this.model.get('groups'),
groupsLimit = groups.length > this.groupsLimit ? this.groupsLimit - 1 : this.groupsLimit;
- return _.extend(this._super(), {
+ return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
firstScmAccounts: _.first(scmAccounts, scmAccountsLimit),
moreScmAccountsCount: scmAccounts.length - scmAccountsLimit,
firstGroups: _.first(groups, groupsLimit),
diff --git a/server/sonar-web/src/main/js/apps/users/list-view.js b/server/sonar-web/src/main/js/apps/users/list-view.js
index 24878864d30..b56e64f951d 100644
--- a/server/sonar-web/src/main/js/apps/users/list-view.js
+++ b/server/sonar-web/src/main/js/apps/users/list-view.js
@@ -1,7 +1,8 @@
define([
+ 'backbone.marionette',
'./list-item-view',
'./templates'
-], function (ListItemView) {
+], function (Marionette, ListItemView) {
return Marionette.CollectionView.extend({
tagName: 'ul',
diff --git a/server/sonar-web/src/main/js/apps/users/search-view.js b/server/sonar-web/src/main/js/apps/users/search-view.js
index 5129bf5a253..295f50b0b4b 100644
--- a/server/sonar-web/src/main/js/apps/users/search-view.js
+++ b/server/sonar-web/src/main/js/apps/users/search-view.js
@@ -1,6 +1,7 @@
define([
+ 'backbone.marionette',
'./templates'
-], function () {
+], function (Marionette) {
return Marionette.ItemView.extend({
template: Templates['users-search'],
diff --git a/server/sonar-web/src/main/js/apps/users/user.js b/server/sonar-web/src/main/js/apps/users/user.js
index 746ffe8bdd7..e438a4b5f22 100644
--- a/server/sonar-web/src/main/js/apps/users/user.js
+++ b/server/sonar-web/src/main/js/apps/users/user.js
@@ -1,10 +1,12 @@
-define(function () {
+define([
+ 'backbone'
+], function (Backbone) {
return Backbone.Model.extend({
idAttribute: 'login',
urlRoot: function () {
- return baseUrl + '/api/users';
+ return window.baseUrl + '/api/users';
},
defaults: function () {
diff --git a/server/sonar-web/src/main/js/apps/users/users.js b/server/sonar-web/src/main/js/apps/users/users.js
index 9c45979a9fe..1c199d05ace 100644
--- a/server/sonar-web/src/main/js/apps/users/users.js
+++ b/server/sonar-web/src/main/js/apps/users/users.js
@@ -1,12 +1,13 @@
define([
+ 'backbone',
'./user'
-], function (User) {
+], function (Backbone, User) {
return Backbone.Collection.extend({
model: User,
url: function () {
- return baseUrl + '/api/users/search';
+ return window.baseUrl + '/api/users/search';
},
parse: function (r) {
@@ -19,7 +20,7 @@ define([
fetch: function (options) {
var d = (options && options.data) || {};
this.q = d.q;
- return this._super(options);
+ return Backbone.Collection.prototype.fetch.apply(this, arguments);
},
fetchMore: function () {
diff --git a/server/sonar-web/src/main/js/components/common/dialogs.js b/server/sonar-web/src/main/js/components/common/dialogs.js
deleted file mode 100644
index 46f8b68354c..00000000000
--- a/server/sonar-web/src/main/js/components/common/dialogs.js
+++ /dev/null
@@ -1,44 +0,0 @@
-(function ($) {
-
- window.confirmDialog = function (options) {
- var settings = _.extend(window.confirmDialog.defaults, options),
- dialog = $('<div><div class="modal-head"><h2>' + settings.title + '</h2></div><div class="modal-body">' +
- settings.html + '</div><div class="modal-foot"><button data-confirm="yes">' + settings.yesLabel +
- '</button> <a data-confirm="no" class="action">' + settings.noLabel + '</a></div></div>');
-
- $('[data-confirm=yes]', dialog).on('click', function () {
- dialog.dialog('close');
- settings.yesHandler();
- return settings.always();
- });
-
- $('[data-confirm=no]', dialog).on('click', function () {
- dialog.dialog('close');
- settings.noHandler();
- return settings.always();
- });
-
- return dialog.dialog({
- modal: true,
- minHeight: null,
- width: 540
- });
- };
-
- window.confirmDialog.defaults = {
- title: 'Confirmation',
- html: '',
- yesLabel: 'Yes',
- noLabel: 'Cancel',
- yesHandler: function () {
- // no op
- },
- noHandler: function () {
- // no op
- },
- always: function () {
- // no op
- }
- };
-
-})(window.jQuery);
diff --git a/server/sonar-web/src/main/js/components/common/dialogs.jsx b/server/sonar-web/src/main/js/components/common/dialogs.jsx
new file mode 100644
index 00000000000..f2657d2e715
--- /dev/null
+++ b/server/sonar-web/src/main/js/components/common/dialogs.jsx
@@ -0,0 +1,44 @@
+import $ from 'jquery';
+import _ from 'underscore';
+
+const DEFAULTS = {
+ title: 'Confirmation',
+ html: '',
+ yesLabel: 'Yes',
+ noLabel: 'Cancel',
+ yesHandler: function () {
+ // no op
+ },
+ noHandler: function () {
+ // no op
+ },
+ always: function () {
+ // no op
+ }
+};
+
+export default function confirmDialog (options) {
+ var settings = _.extend({}, DEFAULTS, options),
+ dialog = $('<div><div class="modal-head"><h2>' + settings.title + '</h2></div><div class="modal-body">' +
+ settings.html + '</div><div class="modal-foot"><button data-confirm="yes">' + settings.yesLabel +
+ '</button> <a data-confirm="no" class="action">' + settings.noLabel + '</a></div></div>');
+
+ $('[data-confirm=yes]', dialog).on('click', function () {
+ dialog.dialog('close');
+ settings.yesHandler();
+ return settings.always();
+ });
+
+ $('[data-confirm=no]', dialog).on('click', function () {
+ dialog.dialog('close');
+ settings.noHandler();
+ return settings.always();
+ });
+
+ return dialog.dialog({
+ modal: true,
+ minHeight: null,
+ width: 540
+ });
+};
+
diff --git a/server/sonar-web/src/main/js/components/common/handlebars-extensions.js b/server/sonar-web/src/main/js/components/common/handlebars-extensions.js
index c85329a0535..7ebf6a4d470 100644
--- a/server/sonar-web/src/main/js/components/common/handlebars-extensions.js
+++ b/server/sonar-web/src/main/js/components/common/handlebars-extensions.js
@@ -20,16 +20,17 @@
(function () {
Handlebars.registerHelper('log', function () {
var args = Array.prototype.slice.call(arguments, 0, -1);
+ /* eslint no-console: 0 */
console.log.apply(console, args);
});
Handlebars.registerHelper('link', function () {
var url = Array.prototype.slice.call(arguments, 0, -1).join('');
- return baseUrl + url;
+ return window.baseUrl + url;
});
Handlebars.registerHelper('componentPermalink', function (componentKey) {
- return baseUrl + '/dashboard/index?id=' + encodeURIComponent(componentKey);
+ return window.baseUrl + '/dashboard/index?id=' + encodeURIComponent(componentKey);
});
Handlebars.registerHelper('componentOverviewPermalink', function (componentKey) {
@@ -44,7 +45,7 @@
var matchPeriod = window.location.search.match(/period=(\d+)/);
if (matchPeriod) {
- // If we have a match for period, check that it is not project-specific
+ // If we have a match for period, check that it is not project-specific
var period = parseInt(matchPeriod[1], 10);
if (period <= 3) {
params.push({ key: 'period', value: period });
@@ -90,7 +91,7 @@
Handlebars.registerHelper('severityHelper', function (severity) {
return new Handlebars.SafeString(
- '<i class="icon-severity-' + severity.toLowerCase() + '"></i>&nbsp;' + t('severity', severity)
+ '<i class="icon-severity-' + severity.toLowerCase() + '"></i>&nbsp;' + window.t('severity', severity)
);
});
@@ -101,9 +102,9 @@
});
Handlebars.registerHelper('statusHelper', function (status, resolution) {
- var s = '<i class="icon-status-' + status.toLowerCase() + '"></i>&nbsp;' + t('issue.status', status);
+ var s = '<i class="icon-status-' + status.toLowerCase() + '"></i>&nbsp;' + window.t('issue.status', status);
if (resolution != null) {
- s = s + '&nbsp;(' + t('issue.resolution', resolution) + ')';
+ s = s + '&nbsp;(' + window.t('issue.resolution', resolution) + ')';
}
return new Handlebars.SafeString(s);
});
@@ -198,12 +199,12 @@
});
Handlebars.registerHelper('eq', function (v1, v2, options) {
- // use `==` instead of `===` to ignore types
+ /* eslint eqeqeq: 0 */
return v1 == v2 ? options.fn(this) : options.inverse(this);
});
Handlebars.registerHelper('notEq', function (v1, v2, options) {
- // use `==` instead of `===` to ignore types
+ /* eslint eqeqeq: 0 */
return v1 != v2 ? options.fn(this) : options.inverse(this);
});
@@ -315,7 +316,7 @@
return ret;
});
- Handlebars.registerHelper('sum', function (a, b) {
+ Handlebars.registerHelper('sum', function () {
var args = Array.prototype.slice.call(arguments, 0, -1);
return args.reduce(function (p, c) {
return p + +c;
@@ -406,6 +407,7 @@
Handlebars.registerHelper('recursive', function (children, options) {
var out = '';
+ /* eslint no-undefined: 0 */
if (options.fn !== undefined) {
audaciousFn = options.fn;
}
@@ -447,13 +449,13 @@
Handlebars.registerHelper('changelog', function (diff) {
var message = '';
if (diff.newValue != null) {
- message = tp('issue.changelog.changed_to', t('issue.changelog.field', diff.key), diff.newValue);
+ message = window.tp('issue.changelog.changed_to', window.t('issue.changelog.field', diff.key), diff.newValue);
} else {
- message = tp('issue.changelog.removed', t('issue.changelog.field', diff.key));
+ message = window.tp('issue.changelog.removed', window.t('issue.changelog.field', diff.key));
}
if (diff.oldValue != null) {
message += ' (';
- message += tp('issue.changelog.was', diff.oldValue);
+ message += window.tp('issue.changelog.was', diff.oldValue);
message += ')';
}
return message;
diff --git a/server/sonar-web/src/main/js/components/common/jquery-isolated-scroll.js b/server/sonar-web/src/main/js/components/common/jquery-isolated-scroll.js
deleted file mode 100644
index e65a9c61541..00000000000
--- a/server/sonar-web/src/main/js/components/common/jquery-isolated-scroll.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.
- */
-;(function ($) {
-
- $.fn.isolatedScroll = function () {
- this.on('wheel', function (e) {
- var delta = -e.originalEvent.deltaY;
- var bottomOverflow = this.scrollTop + $(this).outerHeight() - this.scrollHeight >= 0;
- var topOverflow = this.scrollTop <= 0;
- if ((delta < 0 && bottomOverflow) || (delta > 0 && topOverflow)) {
- e.preventDefault();
- }
- });
- };
-
-})(window.jQuery);
diff --git a/server/sonar-web/src/main/js/components/common/jquery-isolated-scroll.jsx b/server/sonar-web/src/main/js/components/common/jquery-isolated-scroll.jsx
new file mode 100644
index 00000000000..3cf3086ddda
--- /dev/null
+++ b/server/sonar-web/src/main/js/components/common/jquery-isolated-scroll.jsx
@@ -0,0 +1,12 @@
+import $ from 'jquery';
+
+$.fn.isolatedScroll = function () {
+ this.on('wheel', function (e) {
+ var delta = -e.originalEvent.deltaY;
+ var bottomOverflow = this.scrollTop + $(this).outerHeight() - this.scrollHeight >= 0;
+ var topOverflow = this.scrollTop <= 0;
+ if ((delta < 0 && bottomOverflow) || (delta > 0 && topOverflow)) {
+ e.preventDefault();
+ }
+ });
+};
diff --git a/server/sonar-web/src/main/js/components/common/modals.js b/server/sonar-web/src/main/js/components/common/modals.js
index b4812096177..e1818eb30b9 100644
--- a/server/sonar-web/src/main/js/components/common/modals.js
+++ b/server/sonar-web/src/main/js/components/common/modals.js
@@ -1,23 +1,6 @@
-/*
- * 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.
- */
-define(function () {
+define([
+ 'backbone.marionette'
+], function (Marionette) {
var $ = jQuery,
EVENT_SCOPE = 'modal';
diff --git a/server/sonar-web/src/main/js/components/common/popup.js b/server/sonar-web/src/main/js/components/common/popup.js
index a3d15c1bbb8..d0dfd7c0b35 100644
--- a/server/sonar-web/src/main/js/components/common/popup.js
+++ b/server/sonar-web/src/main/js/components/common/popup.js
@@ -1,4 +1,6 @@
-define(function () {
+define([
+ 'backbone.marionette'
+], function (Marionette) {
var $ = jQuery;
diff --git a/server/sonar-web/src/main/js/components/common/processes.js b/server/sonar-web/src/main/js/components/common/processes.js
index a437192044e..cdb8f43aace 100644
--- a/server/sonar-web/src/main/js/components/common/processes.js
+++ b/server/sonar-web/src/main/js/components/common/processes.js
@@ -1,23 +1,9 @@
-/*
- * 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.
- */
-(function ($) {
+define([
+ 'backbone',
+ 'backbone.marionette'
+], function (Backbone, Marionette) {
+
+ var $ = jQuery;
var defaults = {
queue: {},
@@ -46,7 +32,7 @@
fail: function (message) {
var that = this,
- msg = message || t('process.fail');
+ msg = message || window.t('process.fail');
if (msg === 'process.fail') {
// no translation
msg = 'An error happened, some parts of the page might not render correctly. ' +
@@ -185,4 +171,4 @@
});
-})(window.jQuery);
+});
diff --git a/server/sonar-web/src/main/js/components/common/select-list.js b/server/sonar-web/src/main/js/components/common/select-list.js
index ff6bf762248..e85f59cb35f 100644
--- a/server/sonar-web/src/main/js/components/common/select-list.js
+++ b/server/sonar-web/src/main/js/components/common/select-list.js
@@ -1,23 +1,6 @@
-/*
- * 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.
- */
-define(function () {
+define([
+ 'backbone'
+], function (Backbone) {
var $ = jQuery,
showError = null;
diff --git a/server/sonar-web/src/main/js/components/common/selectable-collection-view.js b/server/sonar-web/src/main/js/components/common/selectable-collection-view.js
index c7250855946..70562c186b5 100644
--- a/server/sonar-web/src/main/js/components/common/selectable-collection-view.js
+++ b/server/sonar-web/src/main/js/components/common/selectable-collection-view.js
@@ -17,7 +17,9 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-define(function () {
+define([
+ 'backbone.marionette'
+], function (Marionette) {
return Marionette.CollectionView.extend({
diff --git a/server/sonar-web/src/main/js/components/issue/collections/action-plans.js b/server/sonar-web/src/main/js/components/issue/collections/action-plans.js
index 8cbef0a1a32..318cad85199 100644
--- a/server/sonar-web/src/main/js/components/issue/collections/action-plans.js
+++ b/server/sonar-web/src/main/js/components/issue/collections/action-plans.js
@@ -1,8 +1,10 @@
-define([], function () {
+define([
+ 'backbone'
+], function (Backbone) {
return Backbone.Collection.extend({
url: function () {
- return baseUrl + '/api/action_plans/search';
+ return window.baseUrl + '/api/action_plans/search';
},
parse: function (r) {
diff --git a/server/sonar-web/src/main/js/components/issue/collections/issues.js b/server/sonar-web/src/main/js/components/issue/collections/issues.js
index f40f9a30246..18677ece228 100644
--- a/server/sonar-web/src/main/js/components/issue/collections/issues.js
+++ b/server/sonar-web/src/main/js/components/issue/collections/issues.js
@@ -1,12 +1,13 @@
define([
+ 'backbone',
'../models/issue'
-], function (Issue) {
+], function (Backbone, Issue) {
return Backbone.Collection.extend({
model: Issue,
url: function () {
- return baseUrl + '/api/issues/search';
+ return window.baseUrl + '/api/issues/search';
},
_injectRelational: function (issue, source, baseField, lookupField) {
diff --git a/server/sonar-web/src/main/js/components/issue/issue-view.js b/server/sonar-web/src/main/js/components/issue/issue-view.js
index 3a48d4e3dd2..11019785fb8 100644
--- a/server/sonar-web/src/main/js/components/issue/issue-view.js
+++ b/server/sonar-web/src/main/js/components/issue/issue-view.js
@@ -1,4 +1,6 @@
define([
+ 'backbone',
+ 'backbone.marionette',
'./models/changelog',
'./views/changelog-view',
'./collections/action-plans',
@@ -12,8 +14,9 @@ define([
'./views/tags-form-view',
'components/workspace/main',
'./templates'
-], function (ChangeLog, ChangeLogView, ActionPlans, IssuePopup, TransitionsFormView, AssignFormView, CommentFormView,
- PlanFormView, SetSeverityFormView, MoreActionsView, TagsFormView, Workspace) {
+], function (Backbone,Marionette, ChangeLog, ChangeLogView, ActionPlans, IssuePopup, TransitionsFormView,
+ AssignFormView, CommentFormView, PlanFormView, SetSeverityFormView, MoreActionsView, TagsFormView,
+ Workspace) {
var $ = jQuery;
diff --git a/server/sonar-web/src/main/js/components/issue/manual-issue-view.js b/server/sonar-web/src/main/js/components/issue/manual-issue-view.js
index 2f819f62f2b..5e14378e430 100644
--- a/server/sonar-web/src/main/js/components/issue/manual-issue-view.js
+++ b/server/sonar-web/src/main/js/components/issue/manual-issue-view.js
@@ -1,7 +1,8 @@
define([
+ 'backbone.marionette',
'./models/issue',
'./templates'
-], function (Issue) {
+], function (Marionette, Issue) {
var $ = jQuery;
@@ -16,7 +17,7 @@ define([
initialize: function () {
var that = this;
this.rules = [];
- $.get(baseUrl + '/api/rules/search?repositories=manual&f=name&ps=9999999').done(function (r) {
+ $.get(window.baseUrl + '/api/rules/search?repositories=manual&f=name&ps=9999999').done(function (r) {
that.rules = r.rules;
that.render();
});
diff --git a/server/sonar-web/src/main/js/components/issue/models/changelog.js b/server/sonar-web/src/main/js/components/issue/models/changelog.js
index a7efe2b886a..c14fc82ffee 100644
--- a/server/sonar-web/src/main/js/components/issue/models/changelog.js
+++ b/server/sonar-web/src/main/js/components/issue/models/changelog.js
@@ -1,8 +1,10 @@
-define([], function () {
+define([
+ 'backbone'
+], function (Backbone) {
return Backbone.Collection.extend({
url: function () {
- return baseUrl + '/api/issues/changelog';
+ return window.baseUrl + '/api/issues/changelog';
},
parse: function (r) {
diff --git a/server/sonar-web/src/main/js/components/issue/models/issue.js b/server/sonar-web/src/main/js/components/issue/models/issue.js
index 62f74ceb507..1cd13ce038e 100644
--- a/server/sonar-web/src/main/js/components/issue/models/issue.js
+++ b/server/sonar-web/src/main/js/components/issue/models/issue.js
@@ -1,4 +1,6 @@
-define(function () {
+define([
+ 'backbone'
+], function (Backbone) {
return Backbone.Model.extend({
idAttribute: 'key',
@@ -11,11 +13,11 @@ define(function () {
},
url: function () {
- return baseUrl + '/api/issues';
+ return window.baseUrl + '/api/issues';
},
urlRoot: function () {
- return baseUrl + '/api/issues';
+ return window.baseUrl + '/api/issues';
},
parse: function (r) {
diff --git a/server/sonar-web/src/main/js/components/issue/views/assign-form-view.js b/server/sonar-web/src/main/js/components/issue/views/assign-form-view.js
index c4cd0e5b0f9..e7d8ecbac9d 100644
--- a/server/sonar-web/src/main/js/components/issue/views/assign-form-view.js
+++ b/server/sonar-web/src/main/js/components/issue/views/assign-form-view.js
@@ -123,7 +123,7 @@ define([
if (this.assignees) {
return this.assignees;
}
- var assignees = [{ id: '', text: t('unassigned') }],
+ var assignees = [{ id: '', text: window.t('unassigned') }],
currentUser = window.SS.user,
currentUserName = window.SS.userName;
assignees.push({ id: currentUser, text: currentUserName });
diff --git a/server/sonar-web/src/main/js/components/issue/views/plan-form-view.js b/server/sonar-web/src/main/js/components/issue/views/plan-form-view.js
index 4c459a0a60d..79fccea3dc2 100644
--- a/server/sonar-web/src/main/js/components/issue/views/plan-form-view.js
+++ b/server/sonar-web/src/main/js/components/issue/views/plan-form-view.js
@@ -32,7 +32,7 @@ define([
},
getActionPlans: function () {
- return [{ key: '', name: t('issue.unplanned') }].concat(this.collection.toJSON());
+ return [{ key: '', name: window.t('issue.unplanned') }].concat(this.collection.toJSON());
},
serializeData: function () {
diff --git a/server/sonar-web/src/main/js/components/issue/views/tags-form-view.js b/server/sonar-web/src/main/js/components/issue/views/tags-form-view.js
index 6aa05af0998..c0457e79ff4 100644
--- a/server/sonar-web/src/main/js/components/issue/views/tags-form-view.js
+++ b/server/sonar-web/src/main/js/components/issue/views/tags-form-view.js
@@ -32,7 +32,7 @@ define([
requestTags: function (query) {
var that = this;
- return $.get(baseUrl + '/api/issues/tags', { ps: 10, q: query }).done(function (data) {
+ return $.get(window.baseUrl + '/api/issues/tags', { ps: 10, q: query }).done(function (data) {
that.tags = data.tags;
that.renderTags();
});
diff --git a/server/sonar-web/src/main/js/components/navigator/controller.js b/server/sonar-web/src/main/js/components/navigator/controller.js
index 9565886da20..899cfa6f1d8 100644
--- a/server/sonar-web/src/main/js/components/navigator/controller.js
+++ b/server/sonar-web/src/main/js/components/navigator/controller.js
@@ -1,23 +1,6 @@
-/*
- * 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.
- */
-define(function () {
+define([
+ 'backbone.marionette'
+], function (Marionette) {
return Marionette.Controller.extend({
pageSize: 50,
diff --git a/server/sonar-web/src/main/js/components/navigator/facets-view.js b/server/sonar-web/src/main/js/components/navigator/facets-view.js
index bf881e018fa..a870a004d3d 100644
--- a/server/sonar-web/src/main/js/components/navigator/facets-view.js
+++ b/server/sonar-web/src/main/js/components/navigator/facets-view.js
@@ -1,25 +1,7 @@
-/*
- * 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.
- */
define([
+ 'backbone.marionette',
'components/navigator/facets/base-facet'
-], function (BaseFacet) {
+], function (Marionette, BaseFacet) {
return Marionette.CollectionView.extend({
className: 'search-navigator-facets-list',
diff --git a/server/sonar-web/src/main/js/components/navigator/facets/base-facet.js b/server/sonar-web/src/main/js/components/navigator/facets/base-facet.js
index 31d78fe36d9..e949fef3760 100644
--- a/server/sonar-web/src/main/js/components/navigator/facets/base-facet.js
+++ b/server/sonar-web/src/main/js/components/navigator/facets/base-facet.js
@@ -1,23 +1,6 @@
-/*
- * 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.
- */
-define(function () {
+define([
+ 'backbone.marionette'
+], function (Marionette) {
var $ = jQuery;
diff --git a/server/sonar-web/src/main/js/components/navigator/filters/ajax-select-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/ajax-select-filters.js
index 36c07bbe947..4bbe74a90bb 100644
--- a/server/sonar-web/src/main/js/components/navigator/filters/ajax-select-filters.js
+++ b/server/sonar-web/src/main/js/components/navigator/filters/ajax-select-filters.js
@@ -1,27 +1,10 @@
-/*
- * 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.
- */
define([
+ 'jquery',
+ 'backbone',
'./base-filters',
'./choice-filters',
'../templates'
-], function (BaseFilters, ChoiceFilters) {
+], function ($, Backbone, BaseFilters, ChoiceFilters) {
var PAGE_SIZE = 100;
@@ -29,30 +12,30 @@ define([
var Suggestions = Backbone.Collection.extend({
comparator: 'text',
- initialize: function() {
+ initialize: function () {
this.more = false;
this.page = 0;
},
- parse: function(r) {
+ parse: function (r) {
this.more = r.more;
return r.results;
},
- fetch: function(options) {
+ fetch: function (options) {
this.data = _.extend({
- p: 1,
- ps: PAGE_SIZE
- }, options.data || {});
+ p: 1,
+ ps: PAGE_SIZE
+ }, options.data || {});
var settings = _.extend({}, options, { data: this.data });
return Backbone.Collection.prototype.fetch.call(this, settings);
},
- fetchNextPage: function(options) {
+ fetchNextPage: function (options) {
if (this.more) {
this.data.p += 1;
var settings = _.extend({ remove: false }, options, { data: this.data });
@@ -64,14 +47,13 @@ define([
});
-
var UserSuggestions = Suggestions.extend({
- url: function() {
+ url: function () {
return baseUrl + '/api/users/search';
},
- parse: function(response) {
+ parse: function (response) {
var parsedResponse = window.usersToSelect2(response);
this.more = parsedResponse.more;
this.results = parsedResponse.results;
@@ -80,31 +62,29 @@ define([
});
-
var ProjectSuggestions = Suggestions.extend({
- url: function() {
+ url: function () {
return baseUrl + '/api/resources/search?f=s2&q=TRK&display_key=true';
}
});
-
var ComponentSuggestions = Suggestions.extend({
- url: function() {
+ url: function () {
return baseUrl + '/api/resources/search?f=s2&qp=supportsGlobalDashboards&display_key=true';
},
- parse: function(r) {
+ parse: function (r) {
this.more = r.more;
// If results are divided into categories
if (r.results.length > 0 && r.results[0].children) {
var results = [];
- _.each(r.results, function(category) {
- _.each(category.children, function(child) {
+ _.each(r.results, function (category) {
+ _.each(category.children, function (child) {
child.category = category.text;
results.push(child);
});
@@ -118,24 +98,25 @@ define([
});
-
var AjaxSelectDetailsFilterView = ChoiceFilters.DetailsChoiceFilterView.extend({
template: Templates['ajax-select-filter'],
listTemplate: Templates['choice-filter-template'],
searchKey: 's',
- render: function() {
+ render: function () {
ChoiceFilters.DetailsChoiceFilterView.prototype.render.apply(this, arguments);
var that = this,
- keyup = function(e) {
+ keyup = function (e) {
if (e.keyCode !== 37 && e.keyCode !== 38 && e.keyCode !== 39 && e.keyCode !== 40) {
that.search();
}
},
debouncedKeyup = _.debounce(keyup, 250),
- scroll = function() { that.scroll(); },
+ scroll = function () {
+ that.scroll();
+ },
throttledScroll = _.throttle(scroll, 1000);
this.$('.navigator-filter-search input')
@@ -149,7 +130,7 @@ define([
},
- search: function() {
+ search: function () {
var that = this;
this.query = this.$('.navigator-filter-search input').val();
if (this.query.length > 1) {
@@ -159,11 +140,11 @@ define([
data[this.searchKey] = this.query;
this.options.filterView.choices.fetch({
data: data,
- success: function() {
- selected.forEach(function(item) {
+ success: function () {
+ selected.forEach(function (item) {
that.options.filterView.choices.unshift(item);
});
- _.each(that.model.get('choices'), function(v, k) {
+ _.each(that.model.get('choices'), function (v, k) {
if (k[0] === '!') {
that.options.filterView.choices.add(new Backbone.Model({ id: k, text: v }));
}
@@ -172,7 +153,7 @@ define([
that.$el.removeClass('fetching');
that.$('.navigator-filter-search').removeClass('fetching-error');
},
- error: function() {
+ error: function () {
that.showSearchError();
}
});
@@ -183,44 +164,44 @@ define([
},
- showSearchError: function() {
+ showSearchError: function () {
this.$el.removeClass('fetching');
this.$('.navigator-filter-search').addClass('fetching-error');
},
- scroll: function() {
+ scroll: function () {
var that = this,
el = this.$('.choices'),
scrollBottom = el.scrollTop() >= el[0].scrollHeight - el.outerHeight();
if (scrollBottom) {
- this.options.filterView.choices.fetchNextPage().done(function() {
+ this.options.filterView.choices.fetchNextPage().done(function () {
that.updateLists();
});
}
},
- keydown: function(e) {
+ keydown: function (e) {
if (_([38, 40, 13]).indexOf(e.keyCode) !== -1) {
e.preventDefault();
}
},
- resetChoices: function() {
+ resetChoices: function () {
var that = this;
- this.options.filterView.choices.reset(this.options.filterView.choices.filter(function(item) {
+ this.options.filterView.choices.reset(this.options.filterView.choices.filter(function (item) {
return item.get('checked');
}));
- _.each(this.model.get('choices'), function(v, k) {
+ _.each(this.model.get('choices'), function (v, k) {
that.options.filterView.choices.add(new Backbone.Model({ id: k, text: v }));
});
},
- onShow: function() {
+ onShow: function () {
ChoiceFilters.DetailsChoiceFilterView.prototype.onShow.apply(this, arguments);
this.resetChoices();
this.render();
@@ -230,37 +211,36 @@ define([
});
-
var AjaxSelectFilterView = ChoiceFilters.ChoiceFilterView.extend({
- initialize: function(options) {
+ initialize: function (options) {
ChoiceFilters.ChoiceFilterView.prototype.initialize.call(this, {
detailsView: (options && options.detailsView) ? options.detailsView : AjaxSelectDetailsFilterView
});
},
- isDefaultValue: function() {
+ isDefaultValue: function () {
return this.getSelected().length === 0;
},
- renderInput: function() {
+ renderInput: function () {
var value = this.model.get('value') || [],
- input = $j('<input>')
- .prop('name', this.model.get('property'))
- .prop('type', 'hidden')
- .css('display', 'none')
- .val(value.join());
+ input = $('<input>')
+ .prop('name', this.model.get('property'))
+ .prop('type', 'hidden')
+ .css('display', 'none')
+ .val(value.join());
input.appendTo(this.$el);
},
- restoreFromQuery: function(q) {
+ restoreFromQuery: function (q) {
var param = _.findWhere(q, { key: this.model.get('property') });
if (this.model.get('choices')) {
- _.each(this.model.get('choices'), function(v, k) {
+ _.each(this.model.get('choices'), function (v, k) {
if (k[0] === '!') {
var x = _.findWhere(q, { key: k.substr(1) });
if (x == null) {
@@ -284,7 +264,7 @@ define([
},
- restore: function(value, param) {
+ restore: function (value, param) {
var that = this;
if (_.isString(value)) {
value = value.split(',');
@@ -293,10 +273,10 @@ define([
if (this.choices && value.length > 0) {
this.model.set({ value: value, enabled: true });
- var opposite = _.filter(value, function(item) {
+ var opposite = _.filter(value, function (item) {
return item[0] === '!';
});
- opposite.forEach(function(item) {
+ opposite.forEach(function (item) {
that.choices.add(new Backbone.Model({
id: item,
text: that.model.get('choices')[item],
@@ -304,7 +284,7 @@ define([
}));
});
- value = _.reject(value, function(item) {
+ value = _.reject(value, function (item) {
return item[0] === '!';
});
if (_.isArray(param.text) && param.text.length === value.length) {
@@ -318,9 +298,9 @@ define([
},
- restoreFromText: function(value, text) {
+ restoreFromText: function (value, text) {
var that = this;
- _.each(value, function(v, i) {
+ _.each(value, function (v, i) {
that.choices.add(new Backbone.Model({
id: v,
text: text[i],
@@ -331,25 +311,25 @@ define([
},
- restoreByRequests: function(value) {
+ restoreByRequests: function (value) {
var that = this,
- requests = _.map(value, function(v) {
+ requests = _.map(value, function (v) {
return that.createRequest(v);
});
- $j.when.apply($j, requests).done(function () {
+ $.when.apply($, requests).done(function () {
that.onRestore(value);
});
},
- onRestore: function() {
+ onRestore: function () {
this.detailsView.updateLists();
this.renderBase();
},
- clear: function() {
+ clear: function () {
this.model.unset('value');
if (this.choices) {
this.choices.reset([]);
@@ -358,15 +338,15 @@ define([
},
- createRequest: function() {}
+ createRequest: function () {
+ }
});
-
var ComponentFilterView = AjaxSelectFilterView.extend({
- initialize: function() {
+ initialize: function () {
AjaxSelectFilterView.prototype.initialize.call(this, {
detailsView: AjaxSelectDetailsFilterView
});
@@ -374,9 +354,9 @@ define([
},
- createRequest: function(v) {
+ createRequest: function (v) {
var that = this;
- return $j
+ return $
.ajax({
url: baseUrl + '/api/resources',
type: 'GET',
@@ -393,10 +373,9 @@ define([
});
-
var ProjectFilterView = AjaxSelectFilterView.extend({
- initialize: function() {
+ initialize: function () {
BaseFilters.BaseFilterView.prototype.initialize.call(this, {
detailsView: AjaxSelectDetailsFilterView
});
@@ -405,9 +384,9 @@ define([
},
- createRequest: function(v) {
+ createRequest: function (v) {
var that = this;
- return $j
+ return $
.ajax({
url: baseUrl + '/api/resources',
type: 'GET',
@@ -425,10 +404,9 @@ define([
});
-
var AssigneeFilterView = AjaxSelectFilterView.extend({
- initialize: function() {
+ initialize: function () {
BaseFilters.BaseFilterView.prototype.initialize.call(this, {
detailsView: AjaxSelectDetailsFilterView
});
@@ -436,9 +414,9 @@ define([
this.choices = new UserSuggestions();
},
- createRequest: function(v) {
+ createRequest: function (v) {
var that = this;
- return $j
+ return $
.ajax({
url: baseUrl + '/api/users/search',
type: 'GET',
@@ -456,10 +434,9 @@ define([
});
-
var ReporterFilterView = AjaxSelectFilterView.extend({
- initialize: function() {
+ initialize: function () {
BaseFilters.BaseFilterView.prototype.initialize.call(this, {
detailsView: AjaxSelectDetailsFilterView
});
@@ -469,9 +446,9 @@ define([
},
- createRequest: function(v) {
+ createRequest: function (v) {
var that = this;
- return $j
+ return $
.ajax({
url: baseUrl + '/api/users/search',
type: 'GET',
@@ -489,7 +466,6 @@ define([
});
-
/*
* Export public classes
*/
diff --git a/server/sonar-web/src/main/js/components/navigator/filters/base-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/base-filters.js
index e4298597794..17d6612f2b4 100644
--- a/server/sonar-web/src/main/js/components/navigator/filters/base-filters.js
+++ b/server/sonar-web/src/main/js/components/navigator/filters/base-filters.js
@@ -1,25 +1,9 @@
-/*
- * 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.
- */
define([
+ 'jquery',
+ 'backbone',
+ 'backbone.marionette',
'../templates'
-], function () {
+], function ($, Backbone, Marionette) {
var Filter = Backbone.Model.extend({
@@ -33,38 +17,37 @@ define([
});
-
var Filters = Backbone.Collection.extend({
model: Filter
});
-
var DetailsFilterView = Marionette.ItemView.extend({
template: Templates['base-details-filter'],
className: 'navigator-filter-details',
- initialize: function() {
- this.$el.on('click', function(e) {
+ initialize: function () {
+ this.$el.on('click', function (e) {
e.stopPropagation();
});
this.$el.attr('id', 'filter-' + this.model.get('property'));
},
- onShow: function() {},
- onHide: function() {}
+ onShow: function () {
+ },
+ onHide: function () {
+ }
});
-
var BaseFilterView = Marionette.ItemView.extend({
template: Templates['base-filter'],
className: 'navigator-filter',
- events: function() {
+ events: function () {
return {
'click': 'toggleDetails',
'click .navigator-filter-disable': 'disable'
@@ -81,7 +64,7 @@ define([
},
- initialize: function(options) {
+ initialize: function (options) {
Marionette.ItemView.prototype.initialize.apply(this, arguments);
var detailsView = (options && options.detailsView) || DetailsFilterView;
@@ -94,12 +77,12 @@ define([
},
- attachDetailsView: function() {
- this.detailsView.$el.detach().appendTo($j('body'));
+ attachDetailsView: function () {
+ this.detailsView.$el.detach().appendTo($('body'));
},
- render: function() {
+ render: function () {
this.renderBase();
this.attachDetailsView();
@@ -115,7 +98,7 @@ define([
},
- renderBase: function() {
+ renderBase: function () {
Marionette.ItemView.prototype.render.apply(this, arguments);
this.renderInput();
@@ -125,15 +108,16 @@ define([
},
- renderInput: function() {},
+ renderInput: function () {
+ },
- focus: function() {
+ focus: function () {
this.render();
},
- toggleDetails: function(e) {
+ toggleDetails: function (e) {
e.stopPropagation();
this.options.filterBarView.selected = this.options.filterBarView.getEnabledFilters().index(this.$el);
if (this.$el.hasClass('active')) {
@@ -146,7 +130,7 @@ define([
},
- showDetails: function() {
+ showDetails: function () {
this.registerShowedDetails();
var top = this.$el.offset().top + this.$el.outerHeight() - 1,
@@ -158,35 +142,35 @@ define([
},
- registerShowedDetails: function() {
+ registerShowedDetails: function () {
this.options.filterBarView.hideDetails();
this.options.filterBarView.showedView = this;
},
- hideDetails: function() {
+ hideDetails: function () {
this.detailsView.$el.removeClass('active');
this.$el.removeClass('active');
this.detailsView.onHide();
},
- isActive: function() {
+ isActive: function () {
return this.$el.is('.active');
},
- renderValue: function() {
+ renderValue: function () {
return this.model.get('value') || 'unset';
},
- isDefaultValue: function() {
+ isDefaultValue: function () {
return true;
},
- restoreFromQuery: function(q) {
+ restoreFromQuery: function (q) {
var param = _.findWhere(q, { key: this.model.get('property') });
if (param && param.value) {
this.model.set('enabled', true);
@@ -197,18 +181,18 @@ define([
},
- restore: function(value) {
+ restore: function (value) {
this.model.set({ value: value }, { silent: true });
this.renderBase();
},
- clear: function() {
+ clear: function () {
this.model.unset('value');
},
- disable: function(e) {
+ disable: function (e) {
e.stopPropagation();
this.hideDetails();
this.options.filterBarView.hideDetails();
@@ -219,7 +203,7 @@ define([
},
- formatValue: function() {
+ formatValue: function () {
var q = {};
if (this.model.has('property') && this.model.has('value') && this.model.get('value')) {
q[this.model.get('property')] = this.model.get('value');
@@ -228,7 +212,7 @@ define([
},
- serializeData: function() {
+ serializeData: function () {
return _.extend({}, this.model.toJSON(), {
value: this.renderValue(),
defaultValue: this.isDefaultValue()
@@ -238,7 +222,6 @@ define([
});
-
/*
* Export public classes
*/
diff --git a/server/sonar-web/src/main/js/components/navigator/filters/checkbox-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/checkbox-filters.js
index 8c837802e24..fe1e0573f68 100644
--- a/server/sonar-web/src/main/js/components/navigator/filters/checkbox-filters.js
+++ b/server/sonar-web/src/main/js/components/navigator/filters/checkbox-filters.js
@@ -1,45 +1,28 @@
-/*
- * 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.
- */
define([
+ 'jquery',
'./base-filters',
'../templates'
-], function (BaseFilters) {
+], function ($, BaseFilters) {
return BaseFilters.BaseFilterView.extend({
template: Templates['checkbox-filter'],
className: 'navigator-filter navigator-filter-inline',
- events: function() {
+ events: function () {
return {
'click .navigator-filter-disable': 'disable'
};
},
- showDetails: function() {},
+ showDetails: function () {
+ },
- renderInput: function() {
+ renderInput: function () {
if (this.model.get('enabled')) {
- $j('<input>')
+ $('<input>')
.prop('name', this.model.get('property'))
.prop('type', 'checkbox')
.prop('value', 'true')
@@ -50,17 +33,17 @@ define([
},
- renderValue: function() {
+ renderValue: function () {
return this.model.get('value');
},
- isDefaultValue: function() {
+ isDefaultValue: function () {
return false;
},
- restore: function(value) {
+ restore: function (value) {
this.model.set({
value: value,
enabled: true
diff --git a/server/sonar-web/src/main/js/components/navigator/filters/choice-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/choice-filters.js
index 31fc08656ba..aa5970504dc 100644
--- a/server/sonar-web/src/main/js/components/navigator/filters/choice-filters.js
+++ b/server/sonar-web/src/main/js/components/navigator/filters/choice-filters.js
@@ -1,65 +1,48 @@
-/*
- * 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.
- */
define([
+ 'jquery',
+ 'backbone',
'./base-filters',
'../templates'
-], function (BaseFilters) {
+], function ($, Backbone, BaseFilters) {
var DetailsChoiceFilterView = BaseFilters.DetailsFilterView.extend({
template: Templates['choice-filter'],
itemTemplate: Templates['choice-filter-item'],
- events: function() {
+ events: function () {
return {
'click label': 'onCheck'
};
},
- render: function() {
+ render: function () {
BaseFilters.DetailsFilterView.prototype.render.apply(this, arguments);
this.updateLists();
},
- renderList: function(collection, selector) {
+ renderList: function (collection, selector) {
var that = this,
container = this.$(selector);
container.empty().toggleClass('hidden', collection.length === 0);
collection.each(function (item) {
container.append(
- that.itemTemplate(_.extend(item.toJSON(), {
- multiple: that.model.get('multiple') && item.get('id')[0] !== '!'
- }))
+ that.itemTemplate(_.extend(item.toJSON(), {
+ multiple: that.model.get('multiple') && item.get('id')[0] !== '!'
+ }))
);
});
},
- updateLists: function() {
- var choices = new Backbone.Collection(this.options.filterView.choices.reject(function(item) {
+ updateLists: function () {
+ var choices = new Backbone.Collection(this.options.filterView.choices.reject(function (item) {
return item.get('id')[0] === '!';
})),
- opposite = new Backbone.Collection(this.options.filterView.choices.filter(function(item) {
+ opposite = new Backbone.Collection(this.options.filterView.choices.filter(function (item) {
return item.get('id')[0] === '!';
}));
@@ -71,25 +54,25 @@ define([
},
- onCheck: function(e) {
+ onCheck: function (e) {
var checkbox = jQuery(e.currentTarget),
id = checkbox.data('id'),
checked = checkbox.find('.icon-checkbox-checked').length > 0;
if (this.model.get('multiple')) {
if (checkbox.closest('.opposite').length > 0) {
- this.options.filterView.choices.each(function(item) {
- item.set('checked', false);
- });
+ this.options.filterView.choices.each(function (item) {
+ item.set('checked', false);
+ });
} else {
- this.options.filterView.choices.filter(function(item) {
+ this.options.filterView.choices.filter(function (item) {
return item.get('id')[0] === '!';
- }).forEach(function(item) {
- item.set('checked', false);
- });
+ }).forEach(function (item) {
+ item.set('checked', false);
+ });
}
} else {
- this.options.filterView.choices.each(function(item) {
+ this.options.filterView.choices.each(function (item) {
item.set('checked', false);
});
}
@@ -100,32 +83,32 @@ define([
},
- updateValue: function() {
- this.model.set('value', this.options.filterView.getSelected().map(function(m) {
+ updateValue: function () {
+ this.model.set('value', this.options.filterView.getSelected().map(function (m) {
return m.get('id');
}));
},
- updateCurrent: function(index) {
+ updateCurrent: function (index) {
this.currentChoice = index;
this.$('label').removeClass('current')
.eq(this.currentChoice).addClass('current');
},
- onShow: function() {
+ onShow: function () {
this.bindedOnKeyDown = _.bind(this.onKeyDown, this);
- $j('body').on('keydown', this.bindedOnKeyDown);
+ $('body').on('keydown', this.bindedOnKeyDown);
},
- onHide: function() {
- $j('body').off('keydown', this.bindedOnKeyDown);
+ onHide: function () {
+ $('body').off('keydown', this.bindedOnKeyDown);
},
- onKeyDown: function(e) {
+ onKeyDown: function (e) {
switch (e.keyCode) {
case 38:
e.preventDefault();
@@ -146,7 +129,7 @@ define([
},
- selectNextChoice: function() {
+ selectNextChoice: function () {
if (this.$('label').length > this.currentChoice + 1) {
this.updateCurrent(this.currentChoice + 1);
this.scrollNext();
@@ -154,7 +137,7 @@ define([
},
- scrollNext: function() {
+ scrollNext: function () {
var currentLabel = this.$('label').eq(this.currentChoice);
if (currentLabel.length > 0) {
var list = currentLabel.closest('ul'),
@@ -168,7 +151,7 @@ define([
},
- selectPrevChoice: function() {
+ selectPrevChoice: function () {
if (this.currentChoice > 0) {
this.updateCurrent(this.currentChoice - 1);
this.scrollPrev();
@@ -176,7 +159,7 @@ define([
},
- scrollPrev: function() {
+ scrollPrev: function () {
var currentLabel = this.$('label').eq(this.currentChoice);
if (currentLabel.length > 0) {
var list = currentLabel.closest('ul'),
@@ -189,18 +172,18 @@ define([
},
- selectCurrent: function() {
+ selectCurrent: function () {
var cb = this.$('label').eq(this.currentChoice);
cb.click();
},
- serializeData: function() {
+ serializeData: function () {
return _.extend({}, this.model.toJSON(), {
- choices: new Backbone.Collection(this.options.filterView.choices.reject(function(item) {
+ choices: new Backbone.Collection(this.options.filterView.choices.reject(function (item) {
return item.get('id')[0] === '!';
})).toJSON(),
- opposite: new Backbone.Collection(this.options.filterView.choices.filter(function(item) {
+ opposite: new Backbone.Collection(this.options.filterView.choices.filter(function (item) {
return item.get('id')[0] === '!';
})).toJSON()
});
@@ -209,10 +192,9 @@ define([
});
-
var ChoiceFilterView = BaseFilters.BaseFilterView.extend({
- initialize: function(options) {
+ initialize: function (options) {
BaseFilters.BaseFilterView.prototype.initialize.call(this, {
detailsView: (options && options.detailsView) ? options.detailsView : DetailsChoiceFilterView
});
@@ -221,7 +203,7 @@ define([
icons = this.model.get('choiceIcons');
this.choices = new Backbone.Collection(
- _.map(this.model.get('choices'), function(value, key) {
+ _.map(this.model.get('choices'), function (value, key) {
var model = new Backbone.Model({
id: key,
text: value,
@@ -239,20 +221,20 @@ define([
},
- getSelected: function() {
- return this.choices.filter(function(m) {
+ getSelected: function () {
+ return this.choices.filter(function (m) {
return m.get('checked');
});
},
- renderInput: function() {
- var input = $j('<select>')
+ renderInput: function () {
+ var input = $('<select>')
.prop('name', this.model.get('property'))
.prop('multiple', true)
.css('display', 'none');
- this.choices.each(function(item) {
- var option = $j('<option>')
+ this.choices.each(function (item) {
+ var option = $('<option>')
.prop('value', item.get('id'))
.prop('selected', item.get('checked'))
.text(item.get('text'));
@@ -262,37 +244,37 @@ define([
},
- renderValue: function() {
- var value = this.getSelected().map(function(item) {
+ renderValue: function () {
+ var value = this.getSelected().map(function (item) {
return item.get('text');
}),
defaultValue = this.model.has('defaultValue') ?
this.model.get('defaultValue') :
- this.model.get('multiple') ? t('all') : t('any');
+ this.model.get('multiple') ? window.t('all') : window.t('any');
return this.isDefaultValue() ? defaultValue : value.join(', ');
},
- isDefaultValue: function() {
+ isDefaultValue: function () {
var selected = this.getSelected();
return selected.length === 0;
},
- disable: function() {
- this.choices.each(function(item) {
+ disable: function () {
+ this.choices.each(function (item) {
item.set('checked', false);
});
BaseFilters.BaseFilterView.prototype.disable.apply(this, arguments);
},
- restoreFromQuery: function(q) {
+ restoreFromQuery: function (q) {
var param = _.findWhere(q, { key: this.model.get('property') });
if (this.choices) {
- this.choices.forEach(function(item) {
+ this.choices.forEach(function (item) {
if (item.get('id')[0] === '!') {
var x = _.findWhere(q, { key: item.get('id').substr(1) });
if (item.get('id').indexOf('=') >= 0) {
@@ -321,7 +303,7 @@ define([
},
- restore: function(value) {
+ restore: function (value) {
if (_.isString(value)) {
value = value.split(',');
}
@@ -329,13 +311,13 @@ define([
if (this.choices && value.length > 0) {
var that = this;
- that.choices.each(function(item) {
+ that.choices.each(function (item) {
item.set('checked', false);
});
var unknownValues = [];
- _.each(value, function(v) {
+ _.each(value, function (v) {
var cModel = that.choices.findWhere({ id: v });
if (cModel) {
cModel.set('checked', true);
@@ -358,9 +340,9 @@ define([
},
- clear: function() {
+ clear: function () {
if (this.choices) {
- this.choices.each(function(item) {
+ this.choices.each(function (item) {
item.set('checked', false);
});
}
@@ -372,14 +354,14 @@ define([
},
- formatValue: function() {
+ formatValue: function () {
var q = {};
if (this.model.has('property') && this.model.has('value') && this.model.get('value').length > 0) {
- var opposite = _.filter(this.model.get('value'), function(item) {
+ var opposite = _.filter(this.model.get('value'), function (item) {
return item[0] === '!';
});
if (opposite.length > 0) {
- opposite.forEach(function(item) {
+ opposite.forEach(function (item) {
if (item.indexOf('=') >= 0) {
var paramValue = item.split('=');
q[paramValue[0].substr(1)] = paramValue[1];
@@ -397,7 +379,6 @@ define([
});
-
/*
* Export public classes
*/
diff --git a/server/sonar-web/src/main/js/components/navigator/filters/favorite-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/favorite-filters.js
index a787a89fece..3d615c9f8a0 100644
--- a/server/sonar-web/src/main/js/components/navigator/filters/favorite-filters.js
+++ b/server/sonar-web/src/main/js/components/navigator/filters/favorite-filters.js
@@ -18,10 +18,11 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
define([
+ 'jquery',
'./base-filters',
'./choice-filters',
'../templates'
-], function (BaseFilters, ChoiceFilters) {
+], function ($, BaseFilters, ChoiceFilters) {
var DetailsFavoriteFilterView = BaseFilters.DetailsFilterView.extend({
template: Templates['favorite-details-filter'],
@@ -33,18 +34,18 @@ define([
},
- applyFavorite: function(e) {
- var id = $j(e.target).data('id');
+ applyFavorite: function (e) {
+ var id = $(e.target).data('id');
window.location = baseUrl + this.model.get('favoriteUrl') + '/' + id;
},
- manage: function() {
+ manage: function () {
window.location = baseUrl + this.model.get('manageUrl');
},
- serializeData: function() {
+ serializeData: function () {
var choices = this.model.get('choices'),
choicesArray =
_.sortBy(
@@ -61,35 +62,34 @@ define([
});
-
var FavoriteFilterView = ChoiceFilters.ChoiceFilterView.extend({
template: Templates['favorite-filter'],
className: 'navigator-filter navigator-filter-favorite',
- initialize: function() {
+ initialize: function () {
ChoiceFilters.ChoiceFilterView.prototype.initialize.call(this, {
detailsView: DetailsFavoriteFilterView
});
},
- renderValue: function() {
+ renderValue: function () {
return '';
},
- renderInput: function() {},
+ renderInput: function () {
+ },
- isDefaultValue: function() {
+ isDefaultValue: function () {
return false;
}
});
-
/*
* Export public classes
*/
diff --git a/server/sonar-web/src/main/js/components/navigator/filters/filter-bar.js b/server/sonar-web/src/main/js/components/navigator/filters/filter-bar.js
index 28ee2ceb836..b945b421d7f 100644
--- a/server/sonar-web/src/main/js/components/navigator/filters/filter-bar.js
+++ b/server/sonar-web/src/main/js/components/navigator/filters/filter-bar.js
@@ -1,29 +1,12 @@
-/*
- * 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.
- */
define(
[
+ 'jquery',
+ 'backbone.marionette',
'./base-filters',
'./more-criteria-filters',
'./favorite-filters'
],
- function (BaseFilters, MoreCriteriaFilters) {
+ function ($, Marionette, BaseFilters, MoreCriteriaFilters) {
return Marionette.CompositeView.extend({
childViewContainer: '.navigator-filters-list',
@@ -51,7 +34,7 @@ define(
Marionette.CompositeView.prototype.initialize.apply(this, arguments);
var that = this;
- $j('body').on('click', function () {
+ $('body').on('click', function () {
that.hideDetails();
});
this.addMoreCriteriaFilter();
@@ -72,20 +55,20 @@ define(
}
return r;
};
- key('tab', 'list', function() {
+ key('tab', 'list', function () {
key.setScope('filters');
that.selectFirst();
return false;
});
- key('shift+tab', 'filters', function() {
+ key('shift+tab', 'filters', function () {
that.selectPrev();
return false;
});
- key('tab', 'filters', function() {
+ key('tab', 'filters', function () {
that.selectNext();
return false;
});
- key('escape', 'filters', function() {
+ key('escape', 'filters', function () {
that.hideDetails();
this.selected = -1;
key.setScope('list');
@@ -93,7 +76,7 @@ define(
},
- getEnabledFilters: function() {
+ getEnabledFilters: function () {
return this.$(this.childViewContainer).children()
.not('.navigator-filter-disabled')
.not('.navigator-filter-inactive')
@@ -101,13 +84,13 @@ define(
},
- selectFirst: function() {
+ selectFirst: function () {
this.selected = -1;
this.selectNext();
},
- selectPrev: function() {
+ selectPrev: function () {
var filters = this.getEnabledFilters();
if (this.selected > 0) {
filters.eq(this.selected).blur();
@@ -118,7 +101,7 @@ define(
},
- selectNext: function() {
+ selectNext: function () {
var filters = this.getEnabledFilters();
if (this.selected < filters.length - 1) {
filters.eq(this.selected).blur();
@@ -132,7 +115,7 @@ define(
},
- addMoreCriteriaFilter: function() {
+ addMoreCriteriaFilter: function () {
var disabledFilters = this.collection.where({ enabled: false });
if (disabledFilters.length > 0) {
this.moreCriteriaFilter = new BaseFilters.Filter({
diff --git a/server/sonar-web/src/main/js/components/navigator/filters/metric-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/metric-filters.js
index cef960f3238..09b2d0de5e1 100644
--- a/server/sonar-web/src/main/js/components/navigator/filters/metric-filters.js
+++ b/server/sonar-web/src/main/js/components/navigator/filters/metric-filters.js
@@ -1,26 +1,8 @@
-/*
- * 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.
- */
define([
+ 'jquery',
'./base-filters',
'../templates'
-], function (BaseFilters) {
+], function ($, BaseFilters) {
var DetailsMetricFilterView = BaseFilters.DetailsFilterView.extend({
template: Templates['metric-filter'],
@@ -31,22 +13,22 @@ define([
},
- inputChanged: function() {
+ inputChanged: function () {
var metric = this.$('[name=metric]').val(),
isDifferentialMetric = metric.indexOf('new_') === 0,
periodSelect = this.$('[name=period]'),
period = periodSelect.val(),
optionZero = periodSelect.children('[value="0"]'),
value = {
- metric: metric,
- metricText: this.$('[name=metric] option:selected').text(),
- period: period,
- periodText: this.$('[name=period] option:selected').text(),
- op: this.$('[name=op]').val(),
- opText: this.$('[name=op] option:selected').text(),
- val: this.$('[name=val]').val(),
- valText: this.$('[name=val]').originalVal()
- };
+ metric: metric,
+ metricText: this.$('[name=metric] option:selected').text(),
+ period: period,
+ periodText: this.$('[name=period] option:selected').text(),
+ op: this.$('[name=op]').val(),
+ opText: this.$('[name=op] option:selected').text(),
+ val: this.$('[name=val]').val(),
+ valText: this.$('[name=val]').originalVal()
+ };
if (isDifferentialMetric) {
optionZero.remove();
@@ -68,8 +50,8 @@ define([
},
- updateDataType: function(value) {
- var metric = _.find(window.SS.metrics, function(m) {
+ updateDataType: function (value) {
+ var metric = _.find(window.SS.metrics, function (m) {
return m.metric.name === value.metric;
});
if (metric) {
@@ -84,7 +66,7 @@ define([
},
- onRender: function() {
+ onRender: function () {
var periodZeroLabel = this.$('[name=period]').children('[value="0"]').html();
this.periodZeroOption = '<option value="0">' + periodZeroLabel + '</option>';
@@ -108,7 +90,7 @@ define([
},
- onShow: function() {
+ onShow: function () {
var select = this.$('[name=metric]');
if (this.model.get('value').metric === '') {
select.select2('open');
@@ -120,10 +102,9 @@ define([
});
-
return BaseFilters.BaseFilterView.extend({
- initialize: function() {
+ initialize: function () {
BaseFilters.BaseFilterView.prototype.initialize.call(this, {
detailsView: DetailsMetricFilterView
});
@@ -132,7 +113,7 @@ define([
},
- groupMetrics: function() {
+ groupMetrics: function () {
var metrics = _.map(this.model.get('metrics'), function (metric) {
return metric.metric;
}),
@@ -152,26 +133,26 @@ define([
},
- renderValue: function() {
+ renderValue: function () {
return this.isDefaultValue() ?
window.SS.phrases.notSet :
- this.model.get('value').metricText + ' ' + this.model.get('value').opText + ' ' +
- this.model.get('value').valText;
+ this.model.get('value').metricText + ' ' + this.model.get('value').opText + ' ' +
+ this.model.get('value').valText;
},
- renderInput: function() {
+ renderInput: function () {
var that = this,
value = this.model.get('value');
if (_.isObject(value) && value.metric && value.op && (value.val != null)) {
- _.each(['metric', 'period', 'op', 'val'], function(key) {
+ _.each(['metric', 'period', 'op', 'val'], function (key) {
var v = value[key];
if (key === 'period' && v === '0') {
v = '';
}
- $j('<input>')
+ $('<input>')
.prop('name', that.model.get('property') + '_' + key)
.prop('type', 'hidden')
.css('display', 'none')
@@ -182,7 +163,7 @@ define([
},
- isDefaultValue: function() {
+ isDefaultValue: function () {
var value = this.model.get('value');
if (!_.isObject(value)) {
return true;
@@ -191,10 +172,10 @@ define([
},
- restoreFromQuery: function(q) {
+ restoreFromQuery: function (q) {
var that = this,
value = {};
- _.each(['metric', 'period', 'op', 'val'], function(p) {
+ _.each(['metric', 'period', 'op', 'val'], function (p) {
var property = that.model.get('property') + '_' + p,
pValue = _.findWhere(q, { key: property });
diff --git a/server/sonar-web/src/main/js/components/navigator/filters/more-criteria-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/more-criteria-filters.js
index f2a39f9a218..64a7807b9b0 100644
--- a/server/sonar-web/src/main/js/components/navigator/filters/more-criteria-filters.js
+++ b/server/sonar-web/src/main/js/components/navigator/filters/more-criteria-filters.js
@@ -1,27 +1,9 @@
-/*
- * 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.
- */
define([
+ 'jquery',
'./base-filters',
'./choice-filters',
'../templates'
-], function (BaseFilters, ChoiceFilters) {
+], function ($, BaseFilters, ChoiceFilters) {
var DetailsMoreCriteriaFilterView = ChoiceFilters.DetailsChoiceFilterView.extend({
template: Templates['more-criteria-details-filter'],
@@ -32,14 +14,14 @@ define([
},
- enableById: function(id) {
+ enableById: function (id) {
this.model.view.options.filterBarView.enableFilter(id);
this.model.view.hideDetails();
},
- enableByProperty: function(property) {
- var filter = _.find(this.model.get('filters'), function(f) {
+ enableByProperty: function (property) {
+ var filter = _.find(this.model.get('filters'), function (f) {
return f.get('property') === property;
});
if (filter) {
@@ -48,23 +30,23 @@ define([
},
- enableFilter: function(e) {
- var id = $j(e.target).data('id');
+ enableFilter: function (e) {
+ var id = $(e.target).data('id');
this.enableById(id);
this.updateCurrent(0);
},
- selectCurrent: function() {
+ selectCurrent: function () {
this.$('label').eq(this.currentChoice).click();
},
- serializeData: function() {
- var filters = this.model.get('filters').map(function(filter) {
+ serializeData: function () {
+ var filters = this.model.get('filters').map(function (filter) {
return _.extend(filter.toJSON(), { id: filter.cid });
}),
- getName = function(filter) {
+ getName = function (filter) {
return filter.name;
},
uniqueFilters = _.unique(filters, getName),
@@ -75,41 +57,40 @@ define([
});
-
var MoreCriteriaFilterView = ChoiceFilters.ChoiceFilterView.extend({
template: Templates['more-criteria-filter'],
className: 'navigator-filter navigator-filter-more-criteria',
- initialize: function() {
+ initialize: function () {
ChoiceFilters.ChoiceFilterView.prototype.initialize.call(this, {
detailsView: DetailsMoreCriteriaFilterView
});
},
- renderValue: function() {
+ renderValue: function () {
return '';
},
- renderInput: function() {},
+ renderInput: function () {
+ },
- renderBase: function() {
+ renderBase: function () {
ChoiceFilters.ChoiceFilterView.prototype.renderBase.call(this);
this.$el.prop('title', '');
},
- isDefaultValue: function() {
+ isDefaultValue: function () {
return false;
}
});
-
/*
* Export public classes
*/
diff --git a/server/sonar-web/src/main/js/components/navigator/filters/range-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/range-filters.js
index e46d15594fd..5c8be7a5cbc 100644
--- a/server/sonar-web/src/main/js/components/navigator/filters/range-filters.js
+++ b/server/sonar-web/src/main/js/components/navigator/filters/range-filters.js
@@ -1,26 +1,8 @@
-/*
- * 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.
- */
define([
+ 'jquery',
'./base-filters',
'../templates'
-], function (BaseFilters) {
+], function ($, BaseFilters) {
var DetailsRangeFilterView = BaseFilters.DetailsFilterView.extend({
template: Templates['range-filter'],
@@ -31,7 +13,7 @@ define([
},
- change: function() {
+ change: function () {
var value = {},
valueFrom = this.$('input').eq(0).val(),
valueTo = this.$('input').eq(1).val();
@@ -48,7 +30,7 @@ define([
},
- populateInputs: function() {
+ populateInputs: function () {
var value = this.model.get('value'),
propertyFrom = this.model.get('propertyFrom'),
propertyTo = this.model.get('propertyTo'),
@@ -60,24 +42,23 @@ define([
},
- onShow: function() {
+ onShow: function () {
this.$(':input:first').focus();
}
});
-
var RangeFilterView = BaseFilters.BaseFilterView.extend({
- initialize: function() {
+ initialize: function () {
BaseFilters.BaseFilterView.prototype.initialize.call(this, {
detailsView: DetailsRangeFilterView
});
},
- renderValue: function() {
+ renderValue: function () {
if (!this.isDefaultValue()) {
var value = _.values(this.model.get('value'));
return value.join(' — ');
@@ -87,21 +68,21 @@ define([
},
- renderInput: function() {
+ renderInput: function () {
var value = this.model.get('value'),
propertyFrom = this.model.get('propertyFrom'),
propertyTo = this.model.get('propertyTo'),
valueFrom = _.isObject(value) && value[propertyFrom],
valueTo = _.isObject(value) && value[propertyTo];
- $j('<input>')
+ $('<input>')
.prop('name', propertyFrom)
.prop('type', 'hidden')
.css('display', 'none')
.val(valueFrom || '')
.appendTo(this.$el);
- $j('<input>')
+ $('<input>')
.prop('name', propertyTo)
.prop('type', 'hidden')
.css('display', 'none')
@@ -110,7 +91,7 @@ define([
},
- isDefaultValue: function() {
+ isDefaultValue: function () {
var value = this.model.get('value'),
propertyFrom = this.model.get('propertyFrom'),
propertyTo = this.model.get('propertyTo'),
@@ -121,7 +102,7 @@ define([
},
- restoreFromQuery: function(q) {
+ restoreFromQuery: function (q) {
var paramFrom = _.findWhere(q, { key: this.model.get('propertyFrom') }),
paramTo = _.findWhere(q, { key: this.model.get('propertyTo') }),
value = {};
@@ -145,13 +126,13 @@ define([
},
- restore: function(value) {
+ restore: function (value) {
if (this.choices && this.selection && value.length > 0) {
var that = this;
this.choices.add(this.selection.models);
this.selection.reset([]);
- _.each(value, function(v) {
+ _.each(value, function (v) {
var cModel = that.choices.findWhere({ id: v });
if (cModel) {
@@ -170,12 +151,12 @@ define([
},
- formatValue: function() {
+ formatValue: function () {
return this.model.get('value');
},
- clear: function() {
+ clear: function () {
this.model.unset('value');
this.detailsView.render();
}
@@ -183,10 +164,9 @@ define([
});
-
var DateRangeFilterView = RangeFilterView.extend({
- render: function() {
+ render: function () {
RangeFilterView.prototype.render.apply(this, arguments);
this.detailsView.$('input')
.prop('placeholder', '1970-01-31')
@@ -201,7 +181,7 @@ define([
},
- renderValue: function() {
+ renderValue: function () {
if (!this.isDefaultValue()) {
var value = _.values(this.model.get('value'));
return value.join(' — ');
@@ -213,7 +193,6 @@ define([
});
-
/*
* Export public classes
*/
diff --git a/server/sonar-web/src/main/js/components/navigator/filters/string-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/string-filters.js
index c667ccc73e6..2716c4f1a59 100644
--- a/server/sonar-web/src/main/js/components/navigator/filters/string-filters.js
+++ b/server/sonar-web/src/main/js/components/navigator/filters/string-filters.js
@@ -1,26 +1,8 @@
-/*
- * 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.
- */
define([
+ 'jquery',
'./base-filters',
'../templates'
-], function (BaseFilters) {
+], function ($, BaseFilters) {
var DetailsStringFilterView = BaseFilters.DetailsFilterView.extend({
template: Templates['string-filter'],
@@ -31,18 +13,18 @@ define([
},
- change: function(e) {
- this.model.set('value', $j(e.target).val());
+ change: function (e) {
+ this.model.set('value', $(e.target).val());
},
- onShow: function() {
+ onShow: function () {
BaseFilters.DetailsFilterView.prototype.onShow.apply(this, arguments);
this.$(':input').focus();
},
- serializeData: function() {
+ serializeData: function () {
return _.extend({}, this.model.toJSON(), {
value: this.model.get('value') || ''
});
@@ -51,23 +33,22 @@ define([
});
-
return BaseFilters.BaseFilterView.extend({
- initialize: function() {
+ initialize: function () {
BaseFilters.BaseFilterView.prototype.initialize.call(this, {
detailsView: DetailsStringFilterView
});
},
- renderValue: function() {
+ renderValue: function () {
return this.isDefaultValue() ? '—' : this.model.get('value');
},
- renderInput: function() {
- $j('<input>')
+ renderInput: function () {
+ $('<input>')
.prop('name', this.model.get('property'))
.prop('type', 'hidden')
.css('display', 'none')
@@ -76,12 +57,12 @@ define([
},
- isDefaultValue: function() {
+ isDefaultValue: function () {
return !this.model.get('value');
},
- restore: function(value) {
+ restore: function (value) {
this.model.set({
value: value,
enabled: true
@@ -89,7 +70,7 @@ define([
},
- clear: function() {
+ clear: function () {
this.model.unset('value');
this.detailsView.render();
}
diff --git a/server/sonar-web/src/main/js/components/navigator/models/facet.js b/server/sonar-web/src/main/js/components/navigator/models/facet.js
index d3f32792984..94d0fadb8a7 100644
--- a/server/sonar-web/src/main/js/components/navigator/models/facet.js
+++ b/server/sonar-web/src/main/js/components/navigator/models/facet.js
@@ -1,23 +1,6 @@
-/*
- * 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.
- */
-define(function () {
+define([
+ 'backbone'
+], function (Backbone) {
return Backbone.Model.extend({
idAttribute: 'property',
diff --git a/server/sonar-web/src/main/js/components/navigator/models/facets.js b/server/sonar-web/src/main/js/components/navigator/models/facets.js
index f022ce478e8..88929deb8da 100644
--- a/server/sonar-web/src/main/js/components/navigator/models/facets.js
+++ b/server/sonar-web/src/main/js/components/navigator/models/facets.js
@@ -1,25 +1,7 @@
-/*
- * 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.
- */
define([
+ 'backbone',
'components/navigator/models/facet'
-], function (Facet) {
+], function (Backbone, Facet) {
return Backbone.Collection.extend({
model: Facet
diff --git a/server/sonar-web/src/main/js/components/navigator/models/state.js b/server/sonar-web/src/main/js/components/navigator/models/state.js
index fe53b18cf0e..e2d284aed2e 100644
--- a/server/sonar-web/src/main/js/components/navigator/models/state.js
+++ b/server/sonar-web/src/main/js/components/navigator/models/state.js
@@ -1,23 +1,6 @@
-/*
- * 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.
- */
-define(function () {
+define([
+ 'backbone'
+], function (Backbone) {
return Backbone.Model.extend({
defaults: function () {
diff --git a/server/sonar-web/src/main/js/components/navigator/router.js b/server/sonar-web/src/main/js/components/navigator/router.js
index 5eb8e47487f..41522b81d9f 100644
--- a/server/sonar-web/src/main/js/components/navigator/router.js
+++ b/server/sonar-web/src/main/js/components/navigator/router.js
@@ -1,23 +1,6 @@
-/*
- * 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.
- */
-define(function () {
+define([
+ 'backbone'
+], function (Backbone) {
return Backbone.Router.extend({
routeSeparator: '|',
diff --git a/server/sonar-web/src/main/js/components/navigator/workspace-header-view.js b/server/sonar-web/src/main/js/components/navigator/workspace-header-view.js
index 75e34798616..56f5513b7f4 100644
--- a/server/sonar-web/src/main/js/components/navigator/workspace-header-view.js
+++ b/server/sonar-web/src/main/js/components/navigator/workspace-header-view.js
@@ -1,23 +1,6 @@
-/*
- * 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.
- */
-define(function () {
+define([
+ 'backbone.marionette'
+], function (Marionette) {
return Marionette.ItemView.extend({
diff --git a/server/sonar-web/src/main/js/components/navigator/workspace-list-item-view.js b/server/sonar-web/src/main/js/components/navigator/workspace-list-item-view.js
index 4afe491481b..6736b378798 100644
--- a/server/sonar-web/src/main/js/components/navigator/workspace-list-item-view.js
+++ b/server/sonar-web/src/main/js/components/navigator/workspace-list-item-view.js
@@ -1,23 +1,6 @@
-/*
- * 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.
- */
-define(function () {
+define([
+ 'backbone.marionette'
+], function (Marionette) {
return Marionette.ItemView.extend({
diff --git a/server/sonar-web/src/main/js/components/navigator/workspace-list-view.js b/server/sonar-web/src/main/js/components/navigator/workspace-list-view.js
index a9c1831c835..ddf22fa6809 100644
--- a/server/sonar-web/src/main/js/components/navigator/workspace-list-view.js
+++ b/server/sonar-web/src/main/js/components/navigator/workspace-list-view.js
@@ -1,23 +1,6 @@
-/*
- * 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.
- */
-define(function () {
+define([
+ 'backbone.marionette'
+], function (Marionette) {
var $ = jQuery;
diff --git a/server/sonar-web/src/main/js/components/source-viewer/header.js b/server/sonar-web/src/main/js/components/source-viewer/header.js
index e241c886c09..1cd5a625024 100644
--- a/server/sonar-web/src/main/js/components/source-viewer/header.js
+++ b/server/sonar-web/src/main/js/components/source-viewer/header.js
@@ -18,13 +18,14 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
define([
+ 'backbone.marionette',
'./more-actions',
'./measures-overlay',
'./templates'
-], function (MoreActionsView, MeasuresOverlay) {
+], function (Marionette, MoreActionsView, MeasuresOverlay) {
var $ = jQuery,
- API_FAVORITE = baseUrl + '/api/favourites';
+ API_FAVORITE = window.baseUrl + '/api/favourites';
return Marionette.ItemView.extend({
template: Templates['source-viewer-header'],
diff --git a/server/sonar-web/src/main/js/components/source-viewer/main.js b/server/sonar-web/src/main/js/components/source-viewer/main.js
index dca487a3568..da399afc2a3 100644
--- a/server/sonar-web/src/main/js/components/source-viewer/main.js
+++ b/server/sonar-web/src/main/js/components/source-viewer/main.js
@@ -1,23 +1,6 @@
-/*
- * 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.
- */
define([
+ 'backbone',
+ 'backbone.marionette',
'./source',
'components/issue/models/issue',
'components/issue/collections/issues',
@@ -31,7 +14,9 @@ define([
'./helpers/code-with-issue-locations-helper',
'./templates'
],
- function (Source,
+ function (Backbone,
+ Marionette,
+ Source,
Issue,
Issues,
IssueView,
@@ -728,7 +713,7 @@ define([
$(e.currentTarget).tooltip({
container: 'body',
placement: 'right',
- title: tp('source_viewer.tooltip.new_code', this.sinceLabel),
+ title: window.tp('source_viewer.tooltip.new_code', this.sinceLabel),
trigger: 'manual'
}).tooltip('show');
},
diff --git a/server/sonar-web/src/main/js/components/source-viewer/more-actions.js b/server/sonar-web/src/main/js/components/source-viewer/more-actions.js
index a1b5ff87f99..ddfbdd60dec 100644
--- a/server/sonar-web/src/main/js/components/source-viewer/more-actions.js
+++ b/server/sonar-web/src/main/js/components/source-viewer/more-actions.js
@@ -1,26 +1,8 @@
-/*
- * 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.
- */
define([
+ 'backbone.marionette',
'components/workspace/main',
'./templates'
-], function (Workspace) {
+], function (Marionette, Workspace) {
var $ = jQuery;
diff --git a/server/sonar-web/src/main/js/components/source-viewer/popups/coverage-popup.js b/server/sonar-web/src/main/js/components/source-viewer/popups/coverage-popup.js
index 51c263819bd..f3aa57915d0 100644
--- a/server/sonar-web/src/main/js/components/source-viewer/popups/coverage-popup.js
+++ b/server/sonar-web/src/main/js/components/source-viewer/popups/coverage-popup.js
@@ -20,6 +20,7 @@
define([
'components/common/popup',
'components/workspace/main',
+ '../../../components/common/jquery-isolated-scroll',
'../templates'
], function (Popup, Workspace) {
diff --git a/server/sonar-web/src/main/js/components/source-viewer/popups/scm-popup.js b/server/sonar-web/src/main/js/components/source-viewer/popups/scm-popup.js
index bdbaea22f0f..2c92de40689 100644
--- a/server/sonar-web/src/main/js/components/source-viewer/popups/scm-popup.js
+++ b/server/sonar-web/src/main/js/components/source-viewer/popups/scm-popup.js
@@ -19,6 +19,7 @@
*/
define([
'components/common/popup',
+ '../../../components/common/jquery-isolated-scroll',
'../templates'
], function (Popup) {
diff --git a/server/sonar-web/src/main/js/components/source-viewer/source.js b/server/sonar-web/src/main/js/components/source-viewer/source.js
index 168a86bb9c2..b6ac7cd2ebf 100644
--- a/server/sonar-web/src/main/js/components/source-viewer/source.js
+++ b/server/sonar-web/src/main/js/components/source-viewer/source.js
@@ -1,23 +1,6 @@
-/*
- * 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.
- */
-define(function () {
+define([
+ 'backbone'
+], function (Backbone) {
return Backbone.Model.extend({
idAttribute: 'uuid',
diff --git a/server/sonar-web/src/main/js/components/workspace/models/item.js b/server/sonar-web/src/main/js/components/workspace/models/item.js
index 9bbe1db8110..0ce21d4df0f 100644
--- a/server/sonar-web/src/main/js/components/workspace/models/item.js
+++ b/server/sonar-web/src/main/js/components/workspace/models/item.js
@@ -1,23 +1,6 @@
-/*
- * 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.
- */
-define(function () {
+define([
+ 'backbone'
+], function (Backbone) {
return Backbone.Model.extend({
diff --git a/server/sonar-web/src/main/js/components/workspace/models/items.js b/server/sonar-web/src/main/js/components/workspace/models/items.js
index 2fa11670ed3..eb5b13dc4d3 100644
--- a/server/sonar-web/src/main/js/components/workspace/models/items.js
+++ b/server/sonar-web/src/main/js/components/workspace/models/items.js
@@ -1,23 +1,7 @@
-/*
- * 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.
- */
-define(['./item'], function (Item) {
+define([
+ 'backbone',
+ './item'
+], function (Backbone, Item) {
var STORAGE_KEY = 'sonarqube-workspace';
@@ -39,7 +23,9 @@ define(['./item'], function (Item) {
try {
var parsed = JSON.parse(dump);
this.reset(parsed);
- } catch (err) { }
+ } catch (err) {
+ // do nothing
+ }
}
},
diff --git a/server/sonar-web/src/main/js/components/workspace/views/base-viewer-view.js b/server/sonar-web/src/main/js/components/workspace/views/base-viewer-view.js
index c917fbc9f65..2562e8d0f1a 100644
--- a/server/sonar-web/src/main/js/components/workspace/views/base-viewer-view.js
+++ b/server/sonar-web/src/main/js/components/workspace/views/base-viewer-view.js
@@ -1,25 +1,8 @@
-/*
- * 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.
- */
define([
- './viewer-header-view'
-], function (HeaderView) {
+ 'backbone.marionette',
+ './viewer-header-view',
+ '../../common/jquery-isolated-scroll'
+], function (Marionette, HeaderView) {
return Marionette.LayoutView.extend({
className: 'workspace-viewer',
diff --git a/server/sonar-web/src/main/js/components/workspace/views/item-view.js b/server/sonar-web/src/main/js/components/workspace/views/item-view.js
index 17a67af8835..d51d35debaa 100644
--- a/server/sonar-web/src/main/js/components/workspace/views/item-view.js
+++ b/server/sonar-web/src/main/js/components/workspace/views/item-view.js
@@ -1,25 +1,7 @@
-/*
- * 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.
- */
define([
+ 'backbone.marionette',
'../templates'
-], function () {
+], function (Marionette) {
return Marionette.ItemView.extend({
tagName: 'li',
diff --git a/server/sonar-web/src/main/js/components/workspace/views/items-view.js b/server/sonar-web/src/main/js/components/workspace/views/items-view.js
index 36aa5679097..bbd3326ad3e 100644
--- a/server/sonar-web/src/main/js/components/workspace/views/items-view.js
+++ b/server/sonar-web/src/main/js/components/workspace/views/items-view.js
@@ -1,26 +1,8 @@
-/*
- * 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.
- */
define([
+ 'backbone.marionette',
'./item-view',
'../templates'
-], function (ItemView) {
+], function (Marionette, ItemView) {
return Marionette.CompositeView.extend({
className: 'workspace-nav',
diff --git a/server/sonar-web/src/main/js/components/workspace/views/rule-view.js b/server/sonar-web/src/main/js/components/workspace/views/rule-view.js
index f3e427116bc..f14d621b7f4 100644
--- a/server/sonar-web/src/main/js/components/workspace/views/rule-view.js
+++ b/server/sonar-web/src/main/js/components/workspace/views/rule-view.js
@@ -1,26 +1,8 @@
-/*
- * 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.
- */
define([
+ 'backbone.marionette',
'./base-viewer-view',
'../templates'
-], function (BaseView) {
+], function (Marionette, BaseView) {
return BaseView.extend({
template: Templates['workspace-rule'],
diff --git a/server/sonar-web/src/main/js/components/workspace/views/viewer-header-view.js b/server/sonar-web/src/main/js/components/workspace/views/viewer-header-view.js
index 6ef5b47f375..e877238ad19 100644
--- a/server/sonar-web/src/main/js/components/workspace/views/viewer-header-view.js
+++ b/server/sonar-web/src/main/js/components/workspace/views/viewer-header-view.js
@@ -1,25 +1,7 @@
-/*
- * 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.
- */
define([
+ 'backbone.marionette',
'../templates'
-], function () {
+], function (Marionette) {
var $ = jQuery;
diff --git a/server/sonar-web/src/main/js/libs/application.js b/server/sonar-web/src/main/js/libs/application.js
index bc3fb63b444..122916e825b 100644
--- a/server/sonar-web/src/main/js/libs/application.js
+++ b/server/sonar-web/src/main/js/libs/application.js
@@ -29,9 +29,9 @@
* @param {string} message
*/
window.showMessage = function (id, message) {
- $j('#' + id + 'msg').html(message);
- $j('#' + id).removeClass('hidden');
- $j('#messages-panel').removeClass('hidden');
+ $('#' + id + 'msg').html(message);
+ $('#' + id).removeClass('hidden');
+ $('#messages-panel').removeClass('hidden');
};
/**
@@ -40,8 +40,8 @@
* @returns {boolean} always false
*/
window.hideMessage = function (id) {
- $j('#' + id).addClass('hidden');
- var messagePanel = $j('#messages-panel'),
+ $('#' + id).addClass('hidden');
+ var messagePanel = $('#messages-panel'),
isEmpty = messagePanel.children('*:not(.hidden)').length === 0;
messagePanel.toggleClass('hidden', isEmpty);
return false;
@@ -52,7 +52,7 @@
* @param {string} message
*/
window.error = function (message) {
- showMessage('error', message);
+ window.showMessage('error', message);
};
/**
@@ -60,7 +60,7 @@
* @param {string} message
*/
window.warning = function (message) {
- showMessage('warning', message);
+ window.showMessage('warning', message);
};
/**
@@ -68,7 +68,7 @@
* @param {string} message
*/
window.info = function (message) {
- showMessage('info', message);
+ window.showMessage('info', message);
};
/**
@@ -76,7 +76,7 @@
* @returns {boolean} always false
*/
window.hideError = function () {
- return hideMessage('error');
+ return window.hideMessage('error');
};
/**
@@ -84,7 +84,7 @@
* @returns {boolean} always false
*/
window.hideWarning = function () {
- return hideMessage('warning');
+ return window.hideMessage('warning');
};
/**
@@ -92,30 +92,29 @@
* @returns {boolean} always false
*/
window.hideInfo = function () {
- return hideMessage('info');
+ return window.hideMessage('info');
};
})();
-
-function toggleFav (resourceId, elt) {
- $j.ajax({
+window.toggleFav = function (resourceId, elt) {
+ $.ajax({
type: 'POST', dataType: 'json', url: baseUrl + '/favourites/toggle/' + resourceId,
success: function (data) {
- var star = $j(elt);
+ var star = $(elt);
star.removeClass('icon-favorite icon-not-favorite');
star.addClass(data.css);
star.attr('title', data.title);
}
});
-}
+};
-function dashboardParameters (urlHasSomething) {
+window.dashboardParameters = function (urlHasSomething) {
var queryString = window.location.search;
var parameters = [];
var matchDashboard = queryString.match(/did=\d+/);
- if (matchDashboard && $j('#is-project-dashboard').length === 1) {
+ if (matchDashboard && $('#is-project-dashboard').length === 1) {
parameters.push(matchDashboard[0]);
}
@@ -133,15 +132,15 @@ function dashboardParameters (urlHasSomething) {
query = (urlHasSomething ? '&' : '?') + query;
}
return query;
-}
+};
-function openModalWindow (url, options) {
+window.openModalWindow = function (url, options) {
var width = (options && options.width) || 540;
- var $dialog = $j('#modal');
+ var $dialog = $('#modal');
if (!$dialog.length) {
- $dialog = $j('<div id="modal" class="ui-widget-overlay ui-front"></div>').appendTo('body');
+ $dialog = $('<div id="modal" class="ui-widget-overlay ui-front"></div>').appendTo('body');
}
- $j.get(url, function (html) {
+ $.get(url, function (html) {
$dialog.removeClass('ui-widget-overlay');
$dialog.html(html);
$dialog
@@ -155,7 +154,7 @@ function openModalWindow (url, options) {
resizable: false,
title: null,
close: function () {
- $j('#modal').remove();
+ $('#modal').remove();
}
});
$dialog.dialog('open');
@@ -163,20 +162,20 @@ function openModalWindow (url, options) {
$dialog.removeClass('ui-widget-overlay');
});
return false;
-}
+};
-(function ($j) {
- $j.fn.extend({
+(function ($) {
+ $.fn.extend({
openModal: function () {
return this.each(function () {
- var obj = $j(this);
+ var obj = $(this);
var url = obj.attr('modal-url') || obj.attr('href');
- return openModalWindow(url, { 'width': obj.attr('modal-width') });
+ return window.openModalWindow(url, { 'width': obj.attr('modal-width') });
});
},
modal: function () {
return this.each(function () {
- var obj = $j(this);
+ var obj = $(this);
obj.unbind('click');
var $link = obj.bind('click', function () {
$link.openModal();
@@ -186,10 +185,10 @@ function openModalWindow (url, options) {
},
modalForm: function (ajax_options) {
return this.each(function () {
- var obj = $j(this);
+ var obj = $(this);
obj.submit(function () {
- $j('input[type=submit]', this).attr('disabled', 'disabled');
- $j.ajax($j.extend({
+ $('input[type=submit]', this).attr('disabled', 'disabled');
+ $.ajax($.extend({
type: 'POST',
url: obj.attr('action'),
data: obj.serialize(),
@@ -201,14 +200,14 @@ function openModalWindow (url, options) {
var errorElt = obj.find('.modal-error');
if (errorElt.length) {
// Hide all loading images
- $j('.loading-image').addClass('hidden');
+ $('.loading-image').addClass('hidden');
// Re activate submit button
- $j('input[type=submit]', obj).removeAttr('disabled');
+ $('input[type=submit]', obj).removeAttr('disabled');
errorElt.show();
- errorElt.html($j('<div/>').html(xhr.responseText).text());
+ errorElt.html($('<div/>').html(xhr.responseText).text());
} else {
// otherwise replace modal window by the returned text
- $j('#modal').html(xhr.responseText);
+ $('#modal').html(xhr.responseText);
}
}
}, ajax_options));
@@ -219,67 +218,63 @@ function openModalWindow (url, options) {
});
})(jQuery);
-function closeModalWindow () {
- $j('#modal').dialog('close');
+window.closeModalWindow = function () {
+ $('#modal').dialog('close');
return false;
-}
-
+};
/*
* File Path
*/
-(function () {
- /**
- * Return a collapsed path without a file name
- * @example
- * // returns 'src/.../js/components/navigator/app/models/'
- * collapsedDirFromPath('src/main/js/components/navigator/app/models/state.js')
- * @param {string} path
- * @returns {string|null}
- */
- window.collapsedDirFromPath = function (path) {
- var limit = 30;
- if (typeof path === 'string') {
- var tokens = _.initial(path.split('/'));
- if (tokens.length > 2) {
- var head = _.first(tokens),
- tail = _.last(tokens),
- middle = _.initial(_.rest(tokens)),
- cut = false;
- while (middle.join().length > limit && middle.length > 0) {
- middle.shift();
- cut = true;
- }
- var body = [].concat(head, cut ? ['...'] : [], middle, tail);
- return body.join('/') + '/';
- } else {
- return tokens.join('/') + '/';
+/**
+ * Return a collapsed path without a file name
+ * @example
+ * // returns 'src/.../js/components/navigator/app/models/'
+ * collapsedDirFromPath('src/main/js/components/navigator/app/models/state.js')
+ * @param {string} path
+ * @returns {string|null}
+ */
+window.collapsedDirFromPath = function (path) {
+ var limit = 30;
+ if (typeof path === 'string') {
+ var tokens = _.initial(path.split('/'));
+ if (tokens.length > 2) {
+ var head = _.first(tokens),
+ tail = _.last(tokens),
+ middle = _.initial(_.rest(tokens)),
+ cut = false;
+ while (middle.join().length > limit && middle.length > 0) {
+ middle.shift();
+ cut = true;
}
+ var body = [].concat(head, cut ? ['...'] : [], middle, tail);
+ return body.join('/') + '/';
} else {
- return null;
+ return tokens.join('/') + '/';
}
- };
-
- /**
- * Return a file name for a given file path
- * * @example
- * // returns 'state.js'
- * collapsedDirFromPath('src/main/js/components/navigator/app/models/state.js')
- * @param {string} path
- * @returns {string|null}
- */
- window.fileFromPath = function (path) {
- if (typeof path === 'string') {
- var tokens = path.split('/');
- return _.last(tokens);
- } else {
- return null;
- }
- };
-})();
-
+ } else {
+ return null;
+ }
+};
+
+/**
+ * Return a file name for a given file path
+ * * @example
+ * // returns 'state.js'
+ * collapsedDirFromPath('src/main/js/components/navigator/app/models/state.js')
+ * @param {string} path
+ * @returns {string|null}
+ */
+window.fileFromPath = function (path) {
+ if (typeof path === 'string') {
+ var tokens = path.split('/');
+ return _.last(tokens);
+ } else {
+ return null;
+ }
+};
/*
@@ -399,15 +394,15 @@ function closeModalWindow () {
function formatDuration (isNegative, days, hours, minutes) {
var formatted = '';
if (shouldDisplayDays(days)) {
- formatted += tp('work_duration.x_days', isNegative ? -1 * days : days);
+ formatted += window.tp('work_duration.x_days', isNegative ? -1 * days : days);
}
if (shouldDisplayHours(days, hours)) {
formatted = addSpaceIfNeeded(formatted);
- formatted += tp('work_duration.x_hours', isNegative && formatted.length === 0 ? -1 * hours : hours);
+ formatted += window.tp('work_duration.x_hours', isNegative && formatted.length === 0 ? -1 * hours : hours);
}
if (shouldDisplayMinutes(days, hours, minutes)) {
formatted = addSpaceIfNeeded(formatted);
- formatted += tp('work_duration.x_minutes', isNegative && formatted.length === 0 ? -1 * minutes : minutes);
+ formatted += window.tp('work_duration.x_minutes', isNegative && formatted.length === 0 ? -1 * minutes : minutes);
}
return formatted;
}
@@ -424,18 +419,18 @@ function closeModalWindow () {
var formatted = '';
if (shouldDisplayDays(days)) {
var formattedDays = window.formatMeasure(isNegative ? -1 * days : days, 'SHORT_INT');
- formatted += tp('work_duration.x_days', formattedDays);
+ formatted += window.tp('work_duration.x_days', formattedDays);
}
if (shouldDisplayHoursInShortFormat(days, hours)) {
formatted = addSpaceIfNeeded(formatted);
- formatted += tp('work_duration.x_hours', isNegative && formatted.length === 0 ? -1 * hours : hours);
+ formatted += window.tp('work_duration.x_hours', isNegative && formatted.length === 0 ? -1 * hours : hours);
}
if (shouldDisplayMinutesInShortFormat(days, hours, minutes)) {
formatted = addSpaceIfNeeded(formatted);
- formatted += tp('work_duration.x_minutes', isNegative && formatted.length === 0 ? -1 * minutes : minutes);
+ formatted += window.tp('work_duration.x_minutes', isNegative && formatted.length === 0 ? -1 * minutes : minutes);
}
if (shouldDisplayAbout(days, hours, minutes)) {
- formatted = tp('work_duration.about', formatted);
+ formatted = window.tp('work_duration.about', formatted);
}
return formatted;
}
@@ -561,12 +556,11 @@ function closeModalWindow () {
})();
-
/*
* Users
*/
-(function() {
+(function () {
/**
* Convert the result of api/users/search to select2 format
@@ -574,7 +568,7 @@ function closeModalWindow () {
window.usersToSelect2 = function (response) {
return {
more: false,
- results: _.map(response.users, function(user) {
+ results: _.map(response.users, function (user) {
return {
id: user.login,
text: user.name + ' (' + user.login + ')'
@@ -586,7 +580,6 @@ function closeModalWindow () {
})();
-
/*
* Misc
*/
diff --git a/server/sonar-web/src/main/js/libs/csv.js b/server/sonar-web/src/main/js/libs/csv.js
deleted file mode 100644
index d015f7c5a97..00000000000
--- a/server/sonar-web/src/main/js/libs/csv.js
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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.
- */
-(function() {
-
- window.csvEscape = function(value) {
- var escaped = value.replace(/"/g, '\\"');
- return '"' + escaped + '"';
- };
-
-})();
diff --git a/server/sonar-web/src/main/js/libs/csv.jsx b/server/sonar-web/src/main/js/libs/csv.jsx
new file mode 100644
index 00000000000..126bd0f82c7
--- /dev/null
+++ b/server/sonar-web/src/main/js/libs/csv.jsx
@@ -0,0 +1,4 @@
+export default function csvEscape (value) {
+ var escaped = value.replace(/"/g, '\\"');
+ return '"' + escaped + '"';
+};
diff --git a/server/sonar-web/src/main/js/libs/inputs.js b/server/sonar-web/src/main/js/libs/inputs.js
index 78673a5e70e..8ca5407d71d 100644
--- a/server/sonar-web/src/main/js/libs/inputs.js
+++ b/server/sonar-web/src/main/js/libs/inputs.js
@@ -9,9 +9,9 @@
if (value === '0') {
return 0;
}
- daysPattern = transformPattern(t('work_duration.x_days'));
- hoursPattern = transformPattern(t('work_duration.x_hours'));
- minutesPattern = transformPattern(t('work_duration.x_minutes'));
+ daysPattern = transformPattern(window.t('work_duration.x_days'));
+ hoursPattern = transformPattern(window.t('work_duration.x_hours'));
+ minutesPattern = transformPattern(window.t('work_duration.x_minutes'));
days = value.match(daysPattern);
hours = value.match(hoursPattern);
minutes = value.match(minutesPattern);
@@ -38,13 +38,13 @@
minutes = value % 60;
result = [];
if (days > 0) {
- result.push(t('work_duration.x_days').replace('{0}', days));
+ result.push(window.t('work_duration.x_days').replace('{0}', days));
}
if (hours > 0) {
- result.push(t('work_duration.x_hours').replace('{0}', hours));
+ result.push(window.t('work_duration.x_hours').replace('{0}', hours));
}
if (minutes > 0) {
- result.push(t('work_duration.x_minutes').replace('{0}', minutes));
+ result.push(window.t('work_duration.x_minutes').replace('{0}', minutes));
}
return result.join(' ');
}
diff --git a/server/sonar-web/src/main/js/libs/recent-history.js b/server/sonar-web/src/main/js/libs/recent-history.js
deleted file mode 100644
index f2c17912911..00000000000
--- a/server/sonar-web/src/main/js/libs/recent-history.js
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.
- */
-window.Sonar = {};
-
-window.Sonar.RecentHistory = function () {
-};
-
-window.Sonar.RecentHistory.prototype.getRecentHistory = function () {
- var sonarHistory = localStorage.getItem('sonar_recent_history');
- if (sonarHistory == null) {
- sonarHistory = [];
- } else {
- sonarHistory = JSON.parse(sonarHistory);
- }
- return sonarHistory;
-};
-
-window.Sonar.RecentHistory.prototype.clear = function () {
- localStorage.removeItem('sonar_recent_history');
-};
-
-window.Sonar.RecentHistory.prototype.add = function (resourceKey, resourceName, icon) {
- var sonarHistory = this.getRecentHistory();
-
- if (resourceKey !== '') {
- var newEntry = {'key': resourceKey, 'name': resourceName, 'icon': icon};
- // removes the element of the array if it exists
- for (var i = 0; i < sonarHistory.length; i++) {
- var item = sonarHistory[i];
- if (item.key === resourceKey) {
- sonarHistory.splice(i, 1);
- break;
- }
- }
- // then add it to the beginning of the array
- sonarHistory.unshift(newEntry);
- // and finally slice the array to keep only 10 elements
- sonarHistory = sonarHistory.slice(0, 10);
-
- localStorage.setItem('sonar_recent_history', JSON.stringify(sonarHistory));
- }
-};
-
-window.Sonar.RecentHistory.prototype.populateRecentHistoryPanel = function () {
- var historyLinksList = $j('#recent-history-list');
- historyLinksList.empty();
-
- var recentHistory = this.getRecentHistory();
- if (recentHistory.length === 0) {
- $j('#recent-history').hide();
- } else {
- recentHistory.forEach(function (resource) {
- historyLinksList.append('<li><i class="icon-qualifier-' + resource.icon + '"></i><a href="' +
- baseUrl + '/dashboard/index/' + resource.key + dashboardParameters() + '"> ' + resource.name + '</a></li>');
- });
- $j('#recent-history').show();
- }
-};
diff --git a/server/sonar-web/src/main/js/libs/recent-history.jsx b/server/sonar-web/src/main/js/libs/recent-history.jsx
new file mode 100644
index 00000000000..7a7bb8ef938
--- /dev/null
+++ b/server/sonar-web/src/main/js/libs/recent-history.jsx
@@ -0,0 +1,35 @@
+import _ from 'underscore';
+
+const MAX_ITEMS = 10;
+const STORAGE_KEY = 'sonar_recent_history';
+
+class RecentHistory {
+ static getRecentHistory () {
+ let sonarHistory = localStorage.getItem(STORAGE_KEY);
+ if (sonarHistory == null) {
+ sonarHistory = [];
+ } else {
+ sonarHistory = JSON.parse(sonarHistory);
+ }
+ return sonarHistory;
+ }
+
+ static clear () {
+ localStorage.removeItem(STORAGE_KEY);
+ }
+
+ static add (resourceKey, resourceName, icon) {
+ if (resourceKey !== '') {
+ let newEntry = { key: resourceKey, name: resourceName, icon: icon };
+
+ let newHistory = this.getRecentHistory()
+ .filter(item => item.key !== newEntry.key)
+ .slice(0, MAX_ITEMS - 1);
+ newHistory.unshift(newEntry);
+
+ localStorage.setItem(STORAGE_KEY, JSON.stringify(newHistory));
+ }
+ }
+}
+
+export default RecentHistory;
diff --git a/server/sonar-web/src/main/js/libs/select2-jquery-ui-fix.js b/server/sonar-web/src/main/js/libs/select2-jquery-ui-fix.js
index b57d696ec65..f41d32302eb 100644
--- a/server/sonar-web/src/main/js/libs/select2-jquery-ui-fix.js
+++ b/server/sonar-web/src/main/js/libs/select2-jquery-ui-fix.js
@@ -19,7 +19,7 @@
*/
/* https://github.com/ivaynberg/select2/issues/1246 */
-;(function($) {
+(function($) {
$.ui.dialog.prototype._allowInteraction = function(e) {
return !!$(e.target).closest('.ui-dialog, .ui-datepicker, .select2-drop').length;
diff --git a/server/sonar-web/src/main/js/libs/shim/jquery-shim.js b/server/sonar-web/src/main/js/libs/shim/jquery-shim.js
new file mode 100644
index 00000000000..aa31e60d459
--- /dev/null
+++ b/server/sonar-web/src/main/js/libs/shim/jquery-shim.js
@@ -0,0 +1,3 @@
+define(function () {
+ return window.jQuery;
+});
diff --git a/server/sonar-web/src/main/js/libs/shim/underscore-shim.js b/server/sonar-web/src/main/js/libs/shim/underscore-shim.js
new file mode 100644
index 00000000000..c49e9f8fc1c
--- /dev/null
+++ b/server/sonar-web/src/main/js/libs/shim/underscore-shim.js
@@ -0,0 +1,3 @@
+define(function () {
+ return window._;
+});
diff --git a/server/sonar-web/src/main/js/libs/third-party/backbone-super.js b/server/sonar-web/src/main/js/libs/third-party/backbone-super.js
deleted file mode 100644
index 9562638918e..00000000000
--- a/server/sonar-web/src/main/js/libs/third-party/backbone-super.js
+++ /dev/null
@@ -1,111 +0,0 @@
-// This is a plugin, constructed from parts of Backbone.js and John Resig's inheritance script.
-// (See http://backbonejs.org, http://ejohn.org/blog/simple-javascript-inheritance/)
-// No credit goes to me as I did absolutely nothing except patch these two together.
-(function(root, factory) {
-
- // Set up Backbone appropriately for the environment. Start with AMD.
- if (typeof define === 'function' && define.amd) {
- define(['underscore', 'backbone'], function(_, Backbone) {
- // Export global even in AMD case in case this script is loaded with
- // others that may still expect a global Backbone.
- factory( _, Backbone);
- });
-
- // Next for Node.js or CommonJS.
- } else if (typeof exports !== 'undefined' && typeof require === 'function') {
- var _ = require('underscore'),
- Backbone = require('backbone');
- factory(_, Backbone);
-
- // Finally, as a browser global.
- } else {
- factory(root._, root.Backbone);
- }
-
-}(this, function factory(_, Backbone) {
- Backbone.Model.extend = Backbone.Collection.extend = Backbone.Router.extend = Backbone.View.extend = function(protoProps, classProps) {
- var child = inherits(this, protoProps, classProps);
- child.extend = this.extend;
- return child;
- };
- var unImplementedSuper = function(method){throw "Super does not implement this method: " + method;};
-
- var fnTest = /\b_super\b/;
-
- var makeWrapper = function(parentProto, name, fn) {
- var wrapper = function() {
- var tmp = this._super;
-
- // Add a new ._super() method that is the same method
- // but on the super-class
- this._super = parentProto[name] || unImplementedSuper(name);
-
- // The method only need to be bound temporarily, so we
- // remove it when we're done executing
- var ret;
- try {
- ret = fn.apply(this, arguments);
- } finally {
- this._super = tmp;
- }
- return ret;
- };
-
- //we must move properties from old function to new
- for (var prop in fn) {
- wrapper[prop] = fn[prop];
- delete fn[prop];
- }
-
- return wrapper;
- };
-
- var ctor = function(){}, inherits = function(parent, protoProps, staticProps) {
- var child, parentProto = parent.prototype;
-
- // The constructor function for the new subclass is either defined by you
- // (the "constructor" property in your `extend` definition), or defaulted
- // by us to simply call the parent's constructor.
- if (protoProps && protoProps.hasOwnProperty('constructor')) {
- child = protoProps.constructor;
- } else {
- child = function(){ return parent.apply(this, arguments); };
- }
-
- // Inherit class (static) properties from parent.
- _.extend(child, parent, staticProps);
-
- // Set the prototype chain to inherit from `parent`, without calling
- // `parent`'s constructor function.
- ctor.prototype = parentProto;
- child.prototype = new ctor();
-
- // Add prototype properties (instance properties) to the subclass,
- // if supplied.
- if (protoProps) {
- _.extend(child.prototype, protoProps);
-
- // Copy the properties over onto the new prototype
- for (var name in protoProps) {
- // Check if we're overwriting an existing function
- if (typeof protoProps[name] == "function" && fnTest.test(protoProps[name])) {
- child.prototype[name] = makeWrapper(parentProto, name, protoProps[name]);
- }
- }
- }
-
- // Add static properties to the constructor function, if supplied.
- if (staticProps) _.extend(child, staticProps);
-
- // Correctly set child's `prototype.constructor`.
- child.prototype.constructor = child;
-
- // Set a convenience property in case the parent's prototype is needed later.
- child.__super__ = parentProto;
-
- return child;
- };
-
- return inherits;
-}));
-
diff --git a/server/sonar-web/src/main/js/libs/translate.js b/server/sonar-web/src/main/js/libs/translate.js
index 6317c610bb6..0f29009952d 100644
--- a/server/sonar-web/src/main/js/libs/translate.js
+++ b/server/sonar-web/src/main/js/libs/translate.js
@@ -17,10 +17,10 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-(function() {
+(function () {
window.suppressTranslationWarnings = false;
- window.t = function() {
+ window.t = function () {
if (!window.messages) {
return window.translate.apply(this, arguments);
}
@@ -30,12 +30,12 @@
return window.messages[key] != null ? window.messages[key] : key;
};
- window.tp = function() {
+ window.tp = function () {
var args = Array.prototype.slice.call(arguments, 0),
- key = args.shift(),
- message = window.messages[key];
+ key = args.shift(),
+ message = window.messages[key];
if (message) {
- args.forEach(function(p, i) {
+ args.forEach(function (p, i) {
message = message.replace('{' + i + '}', p);
});
}
@@ -43,9 +43,9 @@
};
- window.translate = function() {
+ window.translate = function () {
var args = Array.prototype.slice.call(arguments, 0),
- tokens = args.reduce(function(prev, current) {
+ tokens = args.reduce(function (prev, current) {
return prev.concat(current.split('.'));
}, []),
key = tokens.join('.'),
@@ -54,7 +54,7 @@
result = '';
if (found) {
- result = tokens.reduce(function(prev, current) {
+ result = tokens.reduce(function (prev, current) {
if (!current || !prev[current]) {
found = false;
}
@@ -66,7 +66,7 @@
};
- window.requestMessages = function() {
+ window.requestMessages = function () {
var currentLocale = window.pageLang,
cachedLocale = localStorage.getItem('l10n.locale');
if (cachedLocale !== currentLocale) {
@@ -85,12 +85,12 @@
data: params,
dataType: 'json',
statusCode: {
- 304: function() {
+ 304: function () {
window.messages = JSON.parse(localStorage.getItem('l10n.bundle'));
}
}
- }).done(function(bundle, textStatus, jqXHR) {
- if(bundle !== undefined) {
+ }).done(function (bundle, textStatus, jqXHR) {
+ if (bundle) {
bundleTimestamp = new Date().toISOString();
bundleTimestamp = bundleTimestamp.substr(0, bundleTimestamp.indexOf('.')) + '+0000';
localStorage.setItem('l10n.timestamp', bundleTimestamp);
diff --git a/server/sonar-web/src/main/js/libs/widgets/bubble-chart.js b/server/sonar-web/src/main/js/libs/widgets/bubble-chart.js
index fc166404423..274597a68e3 100644
--- a/server/sonar-web/src/main/js/libs/widgets/bubble-chart.js
+++ b/server/sonar-web/src/main/js/libs/widgets/bubble-chart.js
@@ -1,24 +1,3 @@
-/*
- * 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.
- */
-/*global d3:false, baseUrl:false */
-
window.SonarWidgets = window.SonarWidgets == null ? {} : window.SonarWidgets;
(function () {
@@ -220,8 +199,8 @@ window.SonarWidgets = window.SonarWidgets == null ? {} : window.SonarWidgets;
sizeMetricValue = d.measures[widget.sizeMetric].fval;
return '<div class="text-left">' +
- collapsedDirFromPath(d.longName) + '<br>' +
- fileFromPath(d.longName) + '<br>' + '<br>' +
+ window.collapsedDirFromPath(d.longName) + '<br>' +
+ window.fileFromPath(d.longName) + '<br>' + '<br>' +
xMetricName + ': ' + xMetricValue + '<br>' +
yMetricName + ': ' + yMetricValue + '<br>' +
sizeMetricName + ': ' + sizeMetricValue +
diff --git a/server/sonar-web/src/main/js/libs/widgets/pie-chart.js b/server/sonar-web/src/main/js/libs/widgets/pie-chart.js
index a88f0941c55..60ac72290ee 100644
--- a/server/sonar-web/src/main/js/libs/widgets/pie-chart.js
+++ b/server/sonar-web/src/main/js/libs/widgets/pie-chart.js
@@ -1,25 +1,3 @@
-/*
- * 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.
- */
-/*global d3:false, baseUrl:false */
-/*jshint eqnull:true */
-
window.SonarWidgets = window.SonarWidgets == null ? {} : window.SonarWidgets;
(function () {
diff --git a/server/sonar-web/src/main/js/libs/widgets/tag-cloud.js b/server/sonar-web/src/main/js/libs/widgets/tag-cloud.js
index d09f38b55bb..cd2851ab8a2 100644
--- a/server/sonar-web/src/main/js/libs/widgets/tag-cloud.js
+++ b/server/sonar-web/src/main/js/libs/widgets/tag-cloud.js
@@ -64,7 +64,7 @@
TagCloud.prototype.tooltip = function (d) {
var suffixKey = d.value === 1 ? 'issue' : 'issues',
- suffix = t(suffixKey);
+ suffix = window.t(suffixKey);
return (d.value + '\u00a0') + suffix;
};
diff --git a/server/sonar-web/src/main/js/libs/widgets/timeline.js b/server/sonar-web/src/main/js/libs/widgets/timeline.js
index 5b871e5994e..4fa9c0123ac 100644
--- a/server/sonar-web/src/main/js/libs/widgets/timeline.js
+++ b/server/sonar-web/src/main/js/libs/widgets/timeline.js
@@ -310,7 +310,7 @@ window.SonarWidgets = window.SonarWidgets == null ? {} : window.SonarWidgets;
.attr('transform', function() { return trans(x, metricY); });
});
- if (metricY > -1) {
+ if (metricY > -1) {
metricY += 17;
}
diff --git a/server/sonar-web/src/main/js/main.js b/server/sonar-web/src/main/js/main.js
new file mode 100644
index 00000000000..6083556bd70
--- /dev/null
+++ b/server/sonar-web/src/main/js/main.js
@@ -0,0 +1,22 @@
+require.config({
+ baseUrl: window.baseUrl + '/js',
+ urlArgs: 'v=' + window.sonarVersion,
+ paths: {
+ 'react': 'libs/third-party/react-with-addons',
+ 'underscore': 'libs/shim/underscore-shim',
+ 'jquery': 'libs/shim/jquery-shim',
+ 'backbone': 'libs/third-party/backbone',
+ 'backbone.marionette': 'libs/third-party/backbone.marionette'
+ }
+});
+
+require([
+ './apps/main/app',
+ './components/common/processes'
+], function (App) {
+ new App({
+ space: window.space,
+ componentKey: window.component,
+ lang: window.pageLang
+ }).start();
+});
diff --git a/server/sonar-web/src/main/js/widgets/issue-filter/widget.js b/server/sonar-web/src/main/js/widgets/issue-filter/widget.js
index 97c72ca75a1..8dac26d108f 100644
--- a/server/sonar-web/src/main/js/widgets/issue-filter/widget.js
+++ b/server/sonar-web/src/main/js/widgets/issue-filter/widget.js
@@ -1,23 +1,8 @@
-/*
- * 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.
- */
-define(['./templates'], function () {
+define([
+ 'backbone',
+ 'backbone.marionette',
+ './templates'
+], function (Backbone, Marionette) {
var $ = jQuery,
FACET_LIMIT = 15,
@@ -40,10 +25,10 @@ define(['./templates'], function () {
r.facetMode = 'debt';
}
if (r.componentKey != null) {
- return baseUrl + '/component_issues/index?id=' + encodeURIComponent(r.componentKey) +
+ return window.baseUrl + '/component_issues/index?id=' + encodeURIComponent(r.componentKey) +
'#' + getQuery(_.omit(r, 'componentKey'));
} else {
- return baseUrl + '/issues/search#' + getQuery(r);
+ return window.baseUrl + '/issues/search#' + getQuery(r);
}
},
byDistributionConf = {
@@ -348,7 +333,9 @@ define(['./templates'], function () {
},
serializeData: function () {
- return _.extend(this._super(), { displayMode: this.options.displayMode });
+ return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
+ displayMode: this.options.displayMode
+ });
}
});
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb
index 9c084dea979..57c1c69abb5 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb
@@ -39,12 +39,7 @@ class DashboardController < ApplicationController
if !@resource || !@snapshot
redirect_if_bad_component()
else
- # display the layout of the parent without the sidebar, usually the directory, but display the file viewers
- @hide_sidebar = true
- @file = @resource
- @project = @snapshot.parent.project
- @metric=params[:metric]
- render :action => 'no_dashboard'
+ return redirect_to :controller => 'component', :action => 'index', :id => @resource.key
end
end
end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/index.html.erb
index b9e16dc489d..8ad02c73316 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/index.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/index.html.erb
@@ -67,11 +67,3 @@
</form>
</div>
</div>
-
-<% content_for :extra_script do %>
- <script>
- require(['apps/account/app'], function (App) {
- App.start();
- });
- </script>
-<% end %>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/api_documentation/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/api_documentation/index.html.erb
index 52765748951..e69de29bb2d 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/api_documentation/index.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/api_documentation/index.html.erb
@@ -1,7 +0,0 @@
-<% content_for :extra_script do %>
- <script>
- require(['apps/api-documentation/app'], function (App) {
- App.start({ el: '#content', urlRoot: baseUrl + '/api_documentation' });
- });
- </script>
-<% end %>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/coding_rules/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/coding_rules/index.html.erb
index 804ed54db8f..e69de29bb2d 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/coding_rules/index.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/coding_rules/index.html.erb
@@ -1,7 +0,0 @@
-<% content_for :extra_script do %>
- <script>
- require(['apps/coding-rules/app'], function (App) {
- App.start({ el: '#content' });
- });
- </script>
-<% end %>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/component/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/component/index.html.erb
index 5f6a94409f2..c3b88785859 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/component/index.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/component/index.html.erb
@@ -1,17 +1,3 @@
-<% content_for :extra_script do %>
- <script type="text/javascript">
- (function () {
- var file = {
- uuid: '<%= @resource.uuid -%>',
- key: '<%= @resource.key -%>'
- <% if @line %>, line: <%= @line -%><% end %>
- };
- require(['apps/source-viewer/app'], function (App) {
- App.start({ el: '#body', file: file })
- });
- })();
- </script>
-<% end %>
-
-
-
+<script>
+ window.line = '<%= @line %>';
+</script>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/component_issues/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/component_issues/index.html.erb
index d3a46e6eeda..78ea03879fd 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/component_issues/index.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/component_issues/index.html.erb
@@ -7,9 +7,6 @@
resourceName: '<%= escape_javascript @resource.name -%>',
periodDate: <% if @period %>'<%= escape_javascript @snapshot.period_datetime(@period) -%>'<% else %>null<% end %>
};
- require(['apps/issues/app-context'], function (App) {
- App.start({ el: '#content', config: config });
- });
})();
</script>
<% end %>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/computation/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/computation/index.html.erb
index 1e7b45c9f6c..e69de29bb2d 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/computation/index.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/computation/index.html.erb
@@ -1,7 +0,0 @@
-<% content_for :extra_script do %>
- <script>
- require(['apps/computation/app'], function (App) {
- App.start({ el: '#content', urlRoot: baseUrl + '/computation' });
- });
- </script>
-<% end %>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/custom_measures/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/custom_measures/index.html.erb
index 54ba4fcdac4..e69de29bb2d 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/custom_measures/index.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/custom_measures/index.html.erb
@@ -1,7 +0,0 @@
-<% content_for :extra_script do %>
- <script>
- require(['apps/custom-measures/app'], function (App) {
- App.start({ el: '#content', projectId: '<%= @resource.uuid -%>' });
- });
- </script>
-<% end %>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/configure.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/configure.html.erb
index 3bb4a42d099..85a8007d216 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/configure.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/configure.html.erb
@@ -1,3 +1,7 @@
+<script>
+ window.widgets = [];
+</script>
+
<div class="page" id="dashboard">
<%= render :partial => 'header', :locals => {:back => true} %>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/index.html.erb
index 2f1ea47272e..ddc1cebe390 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/index.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/index.html.erb
@@ -1,3 +1,9 @@
+<script>
+ jQuery('html').addClass('dashboard-page');
+ jQuery('[data-toggle="tooltip"]').tooltip({ container: '#body' });
+ window.widgets = [];
+</script>
+
<div class="page" id="dashboard">
<% if @resource -%>
<span class="hidden" id="is-project-dashboard">&nbsp;</span>
@@ -28,8 +34,3 @@
</div>
<div style="clear: both;"></div>
</div>
-
-<script>
- jQuery('html').addClass('dashboard-page');
- jQuery('[data-toggle="tooltip"]').tooltip({ container: '#body' });
-</script>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/no_dashboard.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/no_dashboard.html.erb
index 23e483f5746..f3be959f778 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/no_dashboard.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/no_dashboard.html.erb
@@ -7,13 +7,6 @@
(function () {
jQuery('.navbar-context').remove();
jQuery('.page-wrapper-context').addClass('page-wrapper-global').removeClass('page-wrapper-context');
- var file = {
- uuid: '<%= @resource.uuid -%>',
- key: '<%= @resource.key -%>'
- };
- require(['apps/source-viewer/app'], function (App) {
- App.start({ el: '#source-viewer', file: file })
- });
})();
</script>
<% end %>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/drilldown/measures.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/drilldown/measures.html.erb
index f5386bde638..de10bb9a347 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/drilldown/measures.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/drilldown/measures.html.erb
@@ -132,11 +132,3 @@
<%= render :partial => 'footer' -%>
</div>
-
-<% content_for :extra_script do %>
- <script>
- require(['apps/drilldown/app'], function (App) {
- App.start({ el: '#source-viewer' });
- });
- </script>
-<% end %>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/groups/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/groups/index.html.erb
index ecf82ae97bb..8b137891791 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/groups/index.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/groups/index.html.erb
@@ -1,7 +1 @@
-<% content_for :extra_script do %>
- <script>
- require(['apps/groups/app'], function (App) {
- App.start({ el: '#content' });
- });
- </script>
-<% end %>
+
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/search.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/search.html.erb
index 0c105bbd322..e69de29bb2d 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/search.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/search.html.erb
@@ -1,7 +0,0 @@
-<% content_for :extra_script do %>
- <script>
- require(['apps/issues/app'], function (App) {
- App.start({ el: '#content' });
- });
- </script>
-<% end %>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_head.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_head.html.erb
index dba33436ef8..aebfb8e361d 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_head.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_head.html.erb
@@ -1,6 +1,18 @@
+<%
+ selected_section = nil
+ selected_section = controller.class::SECTION if defined?(controller.class::SECTION)
+ if selected_section == Navigation::SECTION_RESOURCE && !@project && !@resource
+ selected_section = Navigation::SECTION_HOME
+ end
+ component = @project
+ component = @resource unless @project || selected_section == Navigation::SECTION_HOME
+%>
+
<!DOCTYPE html>
-<!--[if IE 9 ]> <html class="ie9"> <![endif]-->
-<!--[if (gt IE 9)|!(IE)]><!--> <html> <!--<![endif]-->
+<!--[if IE 9 ]>
+<html class="ie9"> <![endif]-->
+<!--[if (gt IE 9)|!(IE)]><!-->
+<html> <!--<![endif]-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
@@ -22,7 +34,18 @@
<%= yield :style -%>
<script>
- var pageLang = '<%= I18n.locale.to_s.gsub(/-/, '_') -%>';
+ window.pageLang = '<%= I18n.locale.to_s.gsub(/-/, '_') -%>';
+ window.sonarVersion = '<%= sonar_version -%>';
+ window.baseUrl = '<%= ApplicationController.root_context -%>';
+ <% if selected_section == Navigation::SECTION_RESOURCE %>
+ window.space = 'component';
+ window.component = '<%= escape_javascript component.key -%>';
+ <% elsif selected_section == Navigation::SECTION_CONFIGURATION %>
+ window.space = 'settings';
+ <% else %>
+ window.space = 'global';
+ <% end %>
+
<%# The two lines below mean that before full removal of Rails, we have to find a way to handle config properties %>
window.SS = {
hoursInDay: <%= configuration('sonar.technicalDebt.hoursInDay', 8) %>,
@@ -36,21 +59,21 @@
updateCenterActive: <%= configuration('sonar.updatecenter.activate', true) %>
};
</script>
+
<script src="<%= ApplicationController.root_context -%>/js/sonar.js?v=<%= sonar_version -%>"></script>
+
<script>
- var baseUrl = '<%= ApplicationController.root_context -%>';
- var $j = jQuery.noConflict();
- $j(document).ready(function () {$j('.open-modal').modal()});
- moment.lang(window.pageLang);
- numeral.language(window.pageLang);
- requirejs.config({
- baseUrl: baseUrl + '/js',
- urlArgs: 'v=<%= sonar_version -%>',
- paths: {
- 'react': 'libs/third-party/react-with-addons'
- }
+ require([window.baseUrl + '/js/main.js']);
+ </script>
+
+ <script>
+ <%# we should get rid of this $j ASAP %>
+ window.$j = window.jQuery;
+ $(function () {
+ $('.open-modal').modal();
});
</script>
+
<%= yield :script -%>
</head>
<body>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar.html.erb
deleted file mode 100644
index dd25b284589..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar.html.erb
+++ /dev/null
@@ -1,29 +0,0 @@
-<%= render 'layouts/recent_history' -%>
-
-<%
- selected_section = controller.class::SECTION if defined?(controller.class::SECTION)
- if selected_section == Navigation::SECTION_RESOURCE && !@project && !@resource
- selected_section = Navigation::SECTION_HOME
- end
-
- @project = @resource unless @project || selected_section == Navigation::SECTION_HOME
-%>
-
-<script>
- (function () {
- var options = {};
- <% if selected_section == Navigation::SECTION_RESOURCE %>
- options.space = 'component';
- options.componentKey = '<%= escape_javascript @project.key -%>';
- <% end %>
-
- <% if selected_section == Navigation::SECTION_CONFIGURATION %>
- options.space = 'settings';
- <% end %>
-
- window.SS.isUserAdmin = <%= current_user && is_admin? ? 'true' : 'false' -%>;
- require(['apps/nav/app'], function (App) {
- App.start(options);
- });
- })();
-</script>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_nolayout.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_nolayout.html.erb
index e1cb44b4475..2564fa8ee0c 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_nolayout.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_nolayout.html.erb
@@ -1,17 +1,19 @@
<div id="body" class="page">
- <% if @snapshot %>
- <div class="print"><h2><%= h @snapshot.project.name(true) %></h2></div>
- <% end %>
- <div class="hidden" id="messages-panel">
- <div class="alert alert-danger hidden" id="error">
- <span id="errormsg"></span> &nbsp;&nbsp;[<a href="#" onclick="return hideError();"><%= message('hide').downcase -%></a>]
- </div>
- <div class="alert alert-info hidden" id="info">
- <span id="infomsg"></span> &nbsp;&nbsp;[<a href="#" onclick="return hideInfo();"><%= message('hide').downcase -%></a>]
- </div>
- <div class="alert alert-warning hidden" id="warning">
- <span id="warningmsg"></span> &nbsp;&nbsp;[<a href="#" onclick="return hideWarning();"><%= message('hide').downcase -%></a>]
+ <div id="content">
+ <% if @snapshot %>
+ <div class="print"><h2><%= h @snapshot.project.name(true) %></h2></div>
+ <% end %>
+ <div class="hidden" id="messages-panel">
+ <div class="alert alert-danger hidden" id="error">
+ <span id="errormsg"></span> &nbsp;&nbsp;[<a href="#" onclick="return hideError();"><%= message('hide').downcase -%></a>]
+ </div>
+ <div class="alert alert-info hidden" id="info">
+ <span id="infomsg"></span> &nbsp;&nbsp;[<a href="#" onclick="return hideInfo();"><%= message('hide').downcase -%></a>]
+ </div>
+ <div class="alert alert-warning hidden" id="warning">
+ <span id="warningmsg"></span> &nbsp;&nbsp;[<a href="#" onclick="return hideWarning();"><%= message('hide').downcase -%></a>]
+ </div>
</div>
+ <%= yield %>
</div>
- <%= yield %>
</div>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_recent_history.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_recent_history.html.erb
deleted file mode 100644
index 51b81a44d3f..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_recent_history.html.erb
+++ /dev/null
@@ -1,9 +0,0 @@
-<script>
- var sonarRecentHistory = new Sonar.RecentHistory();
- <% if @resource && Project.root_qualifiers.include?(@resource.qualifier) %>
- sonarRecentHistory.add(
- '<%= escape_javascript(h(@resource.key)) -%>',
- '<%= escape_javascript(h(@resource.name)) -%>',
- '<%= escape_javascript @resource.qualifier.downcase -%>');
- <% end %>
-</script>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/application.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/application.html.erb
index be9af4a1526..142dc764cac 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/application.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/application.html.erb
@@ -14,6 +14,5 @@
<%= render :partial => 'layouts/nolayout' %>
<% else %>
<%= render :partial => 'layouts/layout' %>
- <%= render :partial => 'layouts/navbar' %>
<% end %>
<%= render :partial => 'layouts/footer' unless params[:hd]=='false' %>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/maintenance/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/maintenance/index.html.erb
index 19d88d4c4f6..e69de29bb2d 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/maintenance/index.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/maintenance/index.html.erb
@@ -1,8 +0,0 @@
-<% content_for :extra_script do %>
- <script>
- require(['apps/maintenance/app'], function (App) {
- App.start({ el: '#content', setup: false });
- });
- </script>
-<% end %>
-
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/markdown/help.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/markdown/help.html.erb
index 662ff4366d1..e69de29bb2d 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/markdown/help.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/markdown/help.html.erb
@@ -1,6 +0,0 @@
-<div id="markdown-full-help"></div>
-<script>
- require(['apps/markdown/app'], function (App) {
- App.start({ el: '#markdown-full-help' });
- });
-</script>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/search.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/search.html.erb
index f731ded1dc9..2f62510e72f 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/search.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/search.html.erb
@@ -124,10 +124,4 @@
{ key: 'nameSearch', value: '<%= escape_javascript @filter.criteria['nameSearch'] -%>' }
];
</script>
-
- <script>
- require(['apps/measures/app'], function (App) {
- App.start();
- });
- </script>
<% end %>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/metrics/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/metrics/index.html.erb
index a4c68b18805..e69de29bb2d 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/metrics/index.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/metrics/index.html.erb
@@ -1,7 +0,0 @@
-<% content_for :extra_script do %>
- <script>
- require(['apps/metrics/app'], function (App) {
- App.start({ el: '#content' });
- });
- </script>
-<% end %>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/overview/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/overview/index.html.erb
index 436d07784be..a95cbea8ce5 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/overview/index.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/overview/index.html.erb
@@ -165,9 +165,12 @@
<% end %>
};
- require(['apps/overview/app'], function (App) {
- App.start({ el: '#content', component: component, gate: gate, measures: measures, leak: leak });
- });
+ window.overview = {
+ component: component,
+ gate: gate,
+ measures: measures,
+ leak: leak
+ };
})();
</script>
<% end %>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/permission_templates/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/permission_templates/index.html.erb
index 965847fcb40..b4da7d0730f 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/permission_templates/index.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/permission_templates/index.html.erb
@@ -1,7 +1,3 @@
-<% content_for :script do %>
- <script>require(['components/common/select-list']);</script>
-<% end %>
-
<div class="page">
<header class="page-header">
<h1 class="page-title"><%= message 'roles.page' -%></h1>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb
index 9f4ee19f8cc..e69de29bb2d 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb
@@ -1,7 +0,0 @@
-<% content_for :extra_script do %>
- <script>
- require(['apps/quality-profiles/app'], function (App) {
- App.start({ el: '#content', urlRoot: baseUrl + '/profiles' });
- });
- </script>
-<% end %>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/project_roles/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/project_roles/index.html.erb
index b8cbab776b0..3cc6ca69a66 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/project_roles/index.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/project_roles/index.html.erb
@@ -1,7 +1,3 @@
-<% content_for :script do %>
- <script>require(['components/common/select-list']);</script>
-<% end %>
-
<div class="page">
<header class="page-header">
<h1 class="page-title"><%= message('project_links.page') -%></h1>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/provisioning/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/provisioning/index.html.erb
index 1dba1c73ebe..e69de29bb2d 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/provisioning/index.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/provisioning/index.html.erb
@@ -1,7 +0,0 @@
-<% content_for :extra_script do %>
- <script>
- require(['apps/provisioning/app'], function (App) {
- App.start({ el: '#content' });
- });
- </script>
-<% end %>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/quality_gates/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/quality_gates/index.html.erb
index 9563962a02a..e69de29bb2d 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/quality_gates/index.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/quality_gates/index.html.erb
@@ -1,7 +0,0 @@
-<% content_for :extra_script do %>
- <script>
- require(['apps/quality-gates/app'], function (App) {
- App.start({ el: '#content', urlRoot: baseUrl + '/quality_gates' });
- });
- </script>
-<% end %>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/roles/global.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/roles/global.html.erb
index 99a961b12b3..e69de29bb2d 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/roles/global.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/roles/global.html.erb
@@ -1,7 +0,0 @@
-<% content_for :extra_script do %>
- <script>
- require(['apps/global-permissions/app'], function (App) {
- App.start({ el: '#content' });
- });
- </script>
-<% end %>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/roles/projects.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/roles/projects.html.erb
index db45ae6982e..e69de29bb2d 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/roles/projects.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/roles/projects.html.erb
@@ -1,7 +0,0 @@
-<% content_for :extra_script do %>
- <script>
- require(['apps/project-permissions/app'], function (App) {
- App.start({ el: '#content' });
- });
- </script>
-<% end %>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/setup/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/setup/index.html.erb
index d3dacd3e7f3..e69de29bb2d 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/setup/index.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/setup/index.html.erb
@@ -1,8 +0,0 @@
-<% content_for :extra_script do %>
- <script>
- require(['apps/maintenance/app'], function (App) {
- App.start({ el: '#content', setup: true });
- });
- </script>
-<% end %>
-
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/updatecenter/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/updatecenter/index.html.erb
index 80cb9c67be0..e69de29bb2d 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/updatecenter/index.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/updatecenter/index.html.erb
@@ -1,7 +0,0 @@
-<% content_for :extra_script do %>
- <script>
- require(['apps/update-center/app'], function (App) {
- App.start({ el: '#content', urlRoot: baseUrl + '/updatecenter' });
- });
- </script>
-<% end %>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/users/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/users/index.html.erb
index 8b2ce266a10..e69de29bb2d 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/users/index.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/users/index.html.erb
@@ -1,7 +0,0 @@
-<% content_for :extra_script do %>
- <script>
- require(['apps/users/app'], function (App) {
- App.start({ el: '#content' });
- });
- </script>
-<% end %>
diff --git a/server/sonar-web/src/test/json/component-navigation.json b/server/sonar-web/src/test/json/component-navigation.json
new file mode 100644
index 00000000000..eec60a9163b
--- /dev/null
+++ b/server/sonar-web/src/test/json/component-navigation.json
@@ -0,0 +1,32 @@
+{
+ "key": "org.codehaus.sonar:sonar",
+ "uuid": "69e57151-be0d-4157-adff-c06741d88879",
+ "name": "SonarQube",
+ "isComparable": true,
+ "canBeFavorite": true,
+ "isFavorite": true,
+ "dashboards": [
+ {
+ "key": 1,
+ "name": "Dashboard"
+ },
+ {
+ "key": 88,
+ "name": "Issues"
+ },
+ {
+ "key": 13,
+ "name": "QA"
+ }
+ ],
+ "version": "5.2-SNAPSHOT",
+ "snapshotDate": "2015-08-25T10:37:21+0200",
+ "extensions": [],
+ "breadcrumbs": [
+ {
+ "key": "org.codehaus.sonar:sonar",
+ "name": "SonarQube",
+ "qualifier": "TRK"
+ }
+ ]
+}
diff --git a/server/sonar-web/test/helpers/test-page.js b/server/sonar-web/test/helpers/test-page.js
index 1679f4d1733..163ef66ac22 100644
--- a/server/sonar-web/test/helpers/test-page.js
+++ b/server/sonar-web/test/helpers/test-page.js
@@ -159,9 +159,9 @@ define(function (require) {
return new this.constructor(this, function () {
return this.parent
.execute(function (app, options) {
- require(['apps/' + app + '/app'], function (App) {
- App.start(_.extend({ el: '#content' }, options));
- });
+ var opts = options || {};
+ opts.urlRoot = '/test/medium/base.html';
+ window.App.startApp({ name: app, options: opts });
}, [app, options])
.sleep(1000);
});
@@ -175,8 +175,8 @@ define(function (require) {
return new this.constructor(this, function () {
return this.parent
.get(require.toUrl(url))
- .mockFromString('/api/l10n/index', '{}')
- .checkElementExist('#content');
+ .sleep(1000)
+ .checkElementExist('#content.ready');
});
};
diff --git a/server/sonar-web/test/intern.js b/server/sonar-web/test/intern.js
index 520d2127a40..fafb9dbe5b3 100644
--- a/server/sonar-web/test/intern.js
+++ b/server/sonar-web/test/intern.js
@@ -19,7 +19,9 @@ define(['intern'], function (intern) {
'test/unit/issue.spec',
'test/unit/overview/card.spec',
'test/unit/code-with-issue-locations-helper.spec',
- 'test/unit/nav/component/component-nav-breadcrumbs.spec'
+ 'test/unit/nav/component/component-nav-breadcrumbs.spec',
+ 'test/unit/recent-history.spec',
+ 'test/unit/csv.spec'
],
functionalSuites: [
@@ -42,7 +44,11 @@ define(['intern'], function (intern) {
loaderOptions: {
paths: {
- 'react': '../../build/js/libs/third-party/react-with-addons'
+ 'react': '../../build/js/libs/third-party/react-with-addons',
+ 'underscore': '../../build/js/libs/shim/underscore-shim',
+ 'jquery': '../../build/js/libs/shim/jquery-shim',
+ 'backbone': '../../build/js/libs/third-party/backbone',
+ 'backbone.marionette': '../../build/js/libs/third-party/backbone.marionette'
},
map: {
'*': {
diff --git a/server/sonar-web/test/medium/base.html b/server/sonar-web/test/medium/base.html
index 736dc6d6b6f..a3eba79d7be 100644
--- a/server/sonar-web/test/medium/base.html
+++ b/server/sonar-web/test/medium/base.html
@@ -2,15 +2,32 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="../../build/css/sonar.css" rel="stylesheet" media="all">
+ <script>
+ window.pageLang = 'en_US';
+ window.sonarVersion = 'SNAPSHOT';
+ window.baseUrl = '';
+ window.space = 'global';
+ window.component = 'key';
+
+ window.SS = {
+ hoursInDay: 8,
+ user: '',
+ userName: '',
+ userEmail: '',
+ lf: {
+ enableGravatar: false,
+ gravatarServerUrl: ''
+ },
+ updateCenterActive: true
+ };
+ </script>
+
<script src="../../build/js/libs/translate.js"></script>
<script src="../../build/js/libs/third-party/jquery.js"></script>
<script src="../../build/js/libs/third-party/jquery-ui.js"></script>
<script src="../../build/js/libs/third-party/d3.js"></script>
<script src="../../build/js/libs/third-party/latinize.js"></script>
<script src="../../build/js/libs/third-party/underscore.js"></script>
- <script src="../../build/js/libs/third-party/backbone.js"></script>
- <script src="../../build/js/libs/third-party/backbone-super.js"></script>
- <script src="../../build/js/libs/third-party/backbone.marionette.js"></script>
<script src="../../build/js/libs/third-party/handlebars.js"></script>
<script src="../../build/js/libs/third-party/select2.js"></script>
<script src="../../build/js/libs/third-party/keymaster.js"></script>
@@ -21,6 +38,7 @@
<script src="../../build/js/libs/third-party/bootstrap/dropdown.js"></script>
<script src="../../build/js/libs/third-party/md5.js"></script>
<script src="../../build/js/libs/select2-jquery-ui-fix.js"></script>
+
<script src="../../build/js/libs/widgets/base.js"></script>
<script src="../../build/js/libs/widgets/widget.js"></script>
<script src="../../build/js/libs/widgets/bubble-chart.js"></script>
@@ -31,48 +49,31 @@
<script src="../../build/js/libs/widgets/word-cloud.js"></script>
<script src="../../build/js/libs/widgets/tag-cloud.js"></script>
<script src="../../build/js/libs/widgets/treemap.js"></script>
+
<script src="../../build/js/libs/graphics/pie-chart.js"></script>
<script src="../../build/js/libs/graphics/barchart.js"></script>
<script src="../../build/js/libs/sortable.js"></script>
+
<script src="../../build/js/libs/inputs.js"></script>
- <script src="../../build/js/components/common/dialogs.js"></script>
- <script src="../../build/js/components/common/processes.js"></script>
- <script src="../../build/js/components/common/jquery-isolated-scroll.js"></script>
<script src="../../build/js/components/common/handlebars-extensions.js"></script>
+
<script src="../../build/js/libs/application.js"></script>
- <script src="../../build/js/libs/csv.js"></script>
<script src="../../build/js/libs/dashboard.js"></script>
- <script src="../../build/js/libs/recent-history.js"></script>
- <script src="../../build/js/libs/third-party/jquery.mockjax.js"></script>
<script src="../../build/js/libs/third-party/require.js"></script>
- <script>var baseUrl = '';
- var $j = jQuery.noConflict();
- window.suppressTranslationWarnings = true;
- jQuery.mockjaxSettings.contentType = 'text/json';
- jQuery.mockjaxSettings.responseTime = 50;
- jQuery(document).ready(function () {
- $j('.open-modal').modal();
- });
- window.SS = {
- hoursInDay: 8,
- user: '',
- userName: '',
- userEmail: '',
- lf: {
- enableGravatar: false,
- gravatarServerUrl: ''
- },
- updateCenterActive: true
- };
+
+ <script>
+ require(['test-main.js']);
</script>
+
<script>
- requirejs.config({
- baseUrl: baseUrl + '../../build/js',
- paths: {
- 'react': 'libs/third-party/react-with-addons'
- }
+ window.suppressTranslationWarnings = true;
+
+ window.$j = window.jQuery;
+ $(function () {
+ $('.open-modal').modal();
});
</script>
+
</head>
<body>
<div id="content"></div>
diff --git a/server/sonar-web/test/medium/coding-rules.spec.js b/server/sonar-web/test/medium/coding-rules.spec.js
index 1247b6cb763..03927b42d98 100644
--- a/server/sonar-web/test/medium/coding-rules.spec.js
+++ b/server/sonar-web/test/medium/coding-rules.spec.js
@@ -11,7 +11,7 @@ define(function (require) {
.mockFromFile('/api/rules/search', 'coding-rules-spec/search-no-available-profiles.json')
.mockFromFile('/api/rules/show', 'coding-rules-spec/show-no-available-profiles.json')
.mockFromString('/api/issues/search', '{}')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.checkElementExist('.coding-rule.selected')
.clickElement('.coding-rule.selected .js-rule')
.checkElementExist('.coding-rules-detail-header')
@@ -26,7 +26,7 @@ define(function (require) {
.open()
.mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')
.mockFromFile('/api/rules/search', 'coding-rules-spec/search-profile-facet.json')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.checkElementExist('.coding-rule')
.checkElementInclude('#coding-rules-total', '609')
.clickElement('[data-property="qprofile"] .js-facet-toggle')
@@ -56,7 +56,7 @@ define(function (require) {
.open()
.mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')
.mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.checkElementExist('.coding-rule')
.checkElementInclude('#coding-rules-total', '609')
.clearMocks()
@@ -78,7 +78,7 @@ define(function (require) {
.mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')
.mockFromFile('/api/rules/show', 'coding-rules-spec/show.json')
.mockFromString('/api/issues/search', '{}')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.checkElementExist('.coding-rule.selected')
.clickElement('.coding-rule.selected .js-rule')
.checkElementExist('.coding-rules-detail-header')
@@ -93,7 +93,7 @@ define(function (require) {
.mockFromFile('/api/rules/show', 'coding-rules-spec/show-activate-profile.json')
.mockFromString('/api/qualityprofiles/activate_rule', '{}')
.mockFromString('/api/issues/search', '{}')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.checkElementExist('.coding-rule.selected')
.clickElement('.coding-rule.selected .js-rule')
.checkElementExist('.coding-rules-detail-header')
@@ -117,7 +117,7 @@ define(function (require) {
.open()
.mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')
.mockFromFile('/api/rules/search', 'coding-rules-spec/search-create-custom-rules.json')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.checkElementExist('.coding-rule.selected')
.clearMocks()
.mockFromFile('/api/rules/show', 'coding-rules-spec/show-create-custom-rules.json')
@@ -144,7 +144,7 @@ define(function (require) {
.open()
.mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')
.mockFromFile('/api/rules/search', 'coding-rules-spec/search-create-custom-rules.json')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.forceJSON()
.checkElementExist('.coding-rule.selected')
.clearMocks()
@@ -179,7 +179,7 @@ define(function (require) {
.mockFromFile('/api/rules/create', 'coding-rules-spec/show-create-manual-rule.json')
.mockFromFile('/api/rules/show', 'coding-rules-spec/show-create-manual-rule.json')
.mockFromString('/api/issues/search', '{}')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.forceJSON()
.checkElementExist('.js-create-manual-rule')
.clickElement('.js-create-manual-rule')
@@ -201,7 +201,7 @@ define(function (require) {
.mockFromFile('/api/rules/create', 'coding-rules-spec/show-create-manual-rule.json', { status: 409 })
.mockFromFile('/api/rules/show', 'coding-rules-spec/show-create-manual-rule.json')
.mockFromString('/api/issues/search', '{}')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.forceJSON()
.checkElementExist('.js-create-manual-rule')
.clickElement('.js-create-manual-rule')
@@ -231,7 +231,7 @@ define(function (require) {
.mockFromFile('/api/rules/show', 'coding-rules-spec/show-delete-custom-rule.json')
.mockFromString('/api/rules/delete', '{}')
.mockFromString('/api/issues/search', '{}')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.checkElementExist('.coding-rule.selected')
.clickElement('.coding-rule.selected .js-rule')
.checkElementExist('#coding-rules-detail-custom-rules .coding-rules-detail-list-name')
@@ -248,7 +248,7 @@ define(function (require) {
.mockFromFile('/api/rules/search', 'coding-rules-spec/search-delete-manual-rule-before.json')
.mockFromFile('/api/rules/show', 'coding-rules-spec/show-delete-manual-rule.json')
.mockFromString('/api/issues/search', '{}')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.forceJSON()
.checkElementExist('.coding-rule.selected')
.clickElement('.coding-rule.selected .js-rule')
@@ -271,7 +271,7 @@ define(function (require) {
.mockFromFile('/api/rules/search', 'coding-rules-spec/search-show-cutsom-rule.json')
.mockFromFile('/api/rules/show', 'coding-rules-spec/show-show-cutsom-rule.json')
.mockFromString('/api/issues/search', '{}')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.checkElementExist('.coding-rule.selected')
.clickElement('.coding-rule.selected .js-rule')
.checkElementExist('#coding-rules-detail-custom-rules .coding-rules-detail-list-name')
@@ -286,7 +286,7 @@ define(function (require) {
.open()
.mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')
.mockFromFile('/api/rules/search', 'coding-rules-spec/search-deprecated.json')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.checkElementExist('.coding-rule.selected')
.checkElementInclude('.coding-rule.selected', 'DEPRECATED');
});
@@ -298,7 +298,7 @@ define(function (require) {
.mockFromFile('/api/rules/search', 'coding-rules-spec/search-show-details.json')
.mockFromFile('/api/rules/show', 'coding-rules-spec/show-show-details.json')
.mockFromString('/api/issues/search', '{}')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.checkElementExist('.coding-rule.selected')
.clickElement('.coding-rule.selected .js-rule')
.checkElementExist('.coding-rules-detail-header')
@@ -333,7 +333,7 @@ define(function (require) {
.open()
.mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')
.mockFromFile('/api/rules/search', 'coding-rules-spec/search-empty.json')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.checkElementExist('.search-navigator-facet-box')
.checkElementNotExist('.coding-rule')
.checkElementInclude('#coding-rules-total', 0)
@@ -345,7 +345,7 @@ define(function (require) {
.open()
.mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')
.mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.checkElementExist('.search-navigator-facet-box')
.checkElementCount('.search-navigator-facet-box', 13);
});
@@ -355,7 +355,7 @@ define(function (require) {
.open()
.mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')
.mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.checkElementExist('.coding-rule.selected')
.checkElementInclude('.coding-rule.selected', 'Values passed to SQL commands should be sanitized')
.checkElementInclude('.coding-rule.selected', 'Java')
@@ -373,7 +373,7 @@ define(function (require) {
.mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')
.mockFromFile('/api/rules/show', 'coding-rules-spec/show.json')
.mockFromFile('/api/issues/search', 'coding-rules-spec/issues-search.json')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.checkElementExist('.coding-rule.selected')
.clickElement('.coding-rule.selected .js-rule')
.checkElementExist('.coding-rules-most-violated-projects')
@@ -389,7 +389,7 @@ define(function (require) {
.open()
.mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')
.mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.checkElementExist('.coding-rule')
.checkElementCount('.coding-rule', 25)
.checkElementInclude('.coding-rule', 'Values passed to SQL commands should be sanitized')
@@ -403,7 +403,7 @@ define(function (require) {
.mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')
.mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')
.mockFromFile('/api/rules/show', 'coding-rules-spec/show.json')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.checkElementExist('.coding-rule.selected')
.clickElement('.coding-rule.selected .js-rule')
.checkElementExist('.coding-rules-detail-header')
@@ -424,7 +424,7 @@ define(function (require) {
.open()
.mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')
.mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.checkElementExist('.coding-rule.selected .js-rule-filter')
.checkElementInclude('#coding-rules-total', '609')
.clickElement('.js-rule-filter')
@@ -441,7 +441,7 @@ define(function (require) {
.open()
.mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')
.mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.checkElementExist('.coding-rule')
.checkElementInclude('#coding-rules-total', '609')
.checkElementExist('.search-navigator-facet-box-forbidden[data-property="active_severities"]')
@@ -475,7 +475,7 @@ define(function (require) {
.open()
.mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')
.mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.checkElementExist('.coding-rule')
.checkElementInclude('#coding-rules-total', '609')
.clearMocks()
@@ -496,7 +496,7 @@ define(function (require) {
.mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')
.mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')
.mockFromString('/api/qualityprofiles/activate_rules', '{ "succeeded": 225 }')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.forceJSON()
.checkElementExist('.coding-rule')
.checkElementExist('.js-bulk-change')
@@ -521,7 +521,7 @@ define(function (require) {
.mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')
.mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')
.mockFromString('/api/qualityprofiles/activate_rules', '{ "succeeded": 225, "failed": 395 }')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.forceJSON()
.checkElementExist('.coding-rule')
.checkElementExist('.js-bulk-change')
@@ -544,7 +544,7 @@ define(function (require) {
.open()
.mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')
.mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.checkElementExist('.coding-rule')
.clickElement('.js-facet[data-value="java"]')
.checkElementExist('.js-bulk-change')
@@ -565,7 +565,7 @@ define(function (require) {
{ data: { activation: true } })
.mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')
.mockFromString('/api/qualityprofiles/deactivate_rules', '{ "succeeded": 7 }')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.checkElementExist('.coding-rule')
.clickElement('[data-property="qprofile"] .js-facet-toggle')
.checkElementExist('.js-facet[data-value="java-default-with-mojo-conventions-49307"]')
@@ -588,7 +588,7 @@ define(function (require) {
.mockFromString('/api/l10n/index', '{}')
.mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')
.mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.checkElementExist('.coding-rule')
.checkElementExist('.search-navigator-facet-box-collapsed[data-property="debt_characteristics"]')
.clearMocks()
@@ -621,7 +621,7 @@ define(function (require) {
.mockFromString('/api/l10n/index', '{}')
.mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')
.mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.checkElementExist('.coding-rule')
.clearMocks()
@@ -683,7 +683,7 @@ define(function (require) {
.mockFromString('/api/l10n/index', '{}')
.mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')
.mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.checkElementExist('.coding-rule')
.checkElementExist('.search-navigator-facet-box-collapsed[data-property="is_template"]')
@@ -716,7 +716,7 @@ define(function (require) {
.mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')
.mockFromString('/api/languages/list', '{"languages":[{"key":"custom","name":"Custom"}]}',
{ data: { q: 'custom' } })
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.checkElementExist('.coding-rule')
.clickElement('[data-property="languages"] .select2-choice')
.checkElementExist('.select2-search')
@@ -746,7 +746,7 @@ define(function (require) {
.mockFromString('/api/l10n/index', '{}')
.mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')
.mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.checkElementExist('.coding-rule')
.checkElementInclude('#coding-rules-total', 609)
.clearMocks()
@@ -761,7 +761,7 @@ define(function (require) {
.mockFromString('/api/l10n/index', '{}')
.mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')
.mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.checkElementExist('.coding-rule')
.checkElementInclude('#coding-rules-total', 609)
.clearMocks()
@@ -781,7 +781,7 @@ define(function (require) {
.mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')
.mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')
.mockFromFile('/api/rules/show', 'coding-rules-spec/show.json')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.checkElementExist('.coding-rule.selected')
.clickElement('.coding-rule.selected .js-rule')
.checkElementExist('.coding-rules-detail-header')
@@ -795,7 +795,7 @@ define(function (require) {
.open()
.mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')
.mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.checkElementExist('.coding-rule')
.checkElementInclude('#coding-rules-total', '609')
.checkElementExist('.search-navigator-facet-box-forbidden[data-property="inheritance"]')
@@ -851,7 +851,7 @@ define(function (require) {
.mockFromString('/api/l10n/index', '{}')
.mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')
.mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.checkElementExist('.coding-rule')
.checkElementNotExist('.coding-rule-activation')
.clickElement('[data-property="qprofile"] .js-facet-toggle')
@@ -874,7 +874,7 @@ define(function (require) {
{ data: { activation: 'false' } })
.mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')
.mockFromString('/api/qualityprofiles/activate_rule', '{}')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.checkElementExist('.coding-rule')
.checkElementNotExist('.coding-rule-activation')
.clickElement('[data-property="qprofile"] .js-facet-toggle')
@@ -901,7 +901,7 @@ define(function (require) {
.mockFromString('/api/l10n/index', '{}')
.mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')
.mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.checkElementExist('.coding-rule')
.checkElementNotExist('.coding-rule-activation')
.clickElement('[data-property="qprofile"] .js-facet-toggle')
@@ -943,7 +943,7 @@ define(function (require) {
rule_key: 'common-java:FailedUnitTests'
}
})
- .startApp('coding-rules')
+ .startApp('coding-rules/app')
.checkElementExist('.coding-rule')
.clickElement('[data-property="qprofile"] .js-facet-toggle')
.checkElementExist('.js-facet[data-value="java-default-with-mojo-conventions-49307"]')
diff --git a/server/sonar-web/test/medium/computation.spec.js b/server/sonar-web/test/medium/computation.spec.js
index 4884204fbf1..b6fa2c501fe 100644
--- a/server/sonar-web/test/medium/computation.spec.js
+++ b/server/sonar-web/test/medium/computation.spec.js
@@ -8,7 +8,7 @@ define(function (require) {
.open()
.mockFromFile('/api/computation/queue', 'computation-spec/queue.json')
.mockFromFile('/api/computation/history', 'computation-spec/history.json')
- .startApp('computation', { urlRoot: '/test/medium/base.html' })
+ .startApp('computation/app')
.checkElementCount('#computation-list li[data-id]', 1)
.checkElementInclude('#computation-list', 'SonarQube')
.checkElementInclude('#computation-list-footer', '1')
@@ -27,7 +27,7 @@ define(function (require) {
.open('#past')
.mockFromFile('/api/computation/queue', 'computation-spec/queue.json')
.mockFromFile('/api/computation/history', 'computation-spec/history-big-1.json')
- .startApp('computation', { urlRoot: '/test/medium/base.html' })
+ .startApp('computation/app')
.checkElementCount('#computation-list li[data-id]', 2)
.clearMocks()
.mockFromFile('/api/computation/history', 'computation-spec/history-big-2.json', { data: { p: 2 } })
diff --git a/server/sonar-web/test/medium/custom-measures.spec.js b/server/sonar-web/test/medium/custom-measures.spec.js
index 26186842e26..d43274febfa 100644
--- a/server/sonar-web/test/medium/custom-measures.spec.js
+++ b/server/sonar-web/test/medium/custom-measures.spec.js
@@ -3,14 +3,14 @@ define(function (require) {
require('../helpers/test-page');
bdd.describe('Custom Measures Page', function () {
- var projectId = 'eb294572-a6a4-43cf-acc2-33c2fe37c02e';
+ var projectId = 'uuid';
bdd.it('should show list', function () {
return this.remote
.open()
.mockFromFile('/api/custom_measures/search', 'custom-measures-spec/search.json',
{ data: { projectId: projectId } })
- .startApp('custom-measures', { projectId: projectId })
+ .startApp('custom-measures/app')
.checkElementCount('#custom-measures-list li[data-id]', 4)
.checkElementInclude('#custom-measures-list .js-custom-measure-value', '35')
.checkElementInclude('#custom-measures-list .js-custom-measure-metric-name', 'Distribution')
@@ -29,7 +29,7 @@ define(function (require) {
.open()
.mockFromFile('/api/custom_measures/search', 'custom-measures-spec/search-big-1.json',
{ data: { projectId: projectId } })
- .startApp('custom-measures', { projectId: projectId })
+ .startApp('custom-measures/app')
.checkElementCount('#custom-measures-list li[data-id]', 2)
.checkElementNotExist('[data-id="3"]')
.clearMocks()
@@ -46,7 +46,7 @@ define(function (require) {
.mockFromFile('/api/custom_measures/search', 'custom-measures-spec/search.json',
{ data: { projectId: projectId } })
.mockFromFile('/api/metrics/search', 'custom-measures-spec/metrics.json', { data: { isCustom: true } })
- .startApp('custom-measures', { projectId: projectId })
+ .startApp('custom-measures/app')
.checkElementCount('#custom-measures-list li[data-id]', 4)
.clickElement('#custom-measures-create')
.checkElementExist('#create-custom-measure-form')
@@ -74,7 +74,7 @@ define(function (require) {
.mockFromFile('/api/custom_measures/search', 'custom-measures-spec/search.json',
{ data: { projectId: projectId } })
.mockFromFile('/api/metrics/search', 'custom-measures-spec/metrics.json', { data: { isCustom: true } })
- .startApp('custom-measures', { projectId: projectId })
+ .startApp('custom-measures/app')
.clickElement('#custom-measures-create')
.checkElementExist('#create-custom-measure-form')
.checkElementCount('#create-custom-measure-metric option', 1)
@@ -88,7 +88,7 @@ define(function (require) {
{ data: { projectId: projectId } })
.mockFromFile('/api/metrics/search', 'custom-measures-spec/metrics-limited.json',
{ data: { isCustom: true } })
- .startApp('custom-measures', { projectId: projectId })
+ .startApp('custom-measures/app')
.clickElement('#custom-measures-create')
.checkElementExist('#create-custom-measure-form')
.checkElementNotExist('#create-custom-measure-metric')
@@ -102,7 +102,7 @@ define(function (require) {
.mockFromFile('/api/custom_measures/search', 'custom-measures-spec/search.json',
{ data: { projectId: projectId } })
.mockFromFile('/api/metrics/search', 'custom-measures-spec/metrics.json', { data: { isCustom: true } })
- .startApp('custom-measures', { projectId: projectId })
+ .startApp('custom-measures/app')
.clickElement('[data-id="5"] .js-custom-measure-update')
.checkElementExist('#create-custom-measure-form')
.clearMocks()
@@ -126,7 +126,7 @@ define(function (require) {
.open()
.mockFromFile('/api/custom_measures/search', 'custom-measures-spec/search.json',
{ data: { projectId: projectId } })
- .startApp('custom-measures', { projectId: projectId })
+ .startApp('custom-measures/app')
.clickElement('[data-id="5"] .js-custom-measure-delete')
.checkElementExist('#delete-custom-measure-form', 1)
.clearMocks()
diff --git a/server/sonar-web/test/medium/global-permissions.spec.js b/server/sonar-web/test/medium/global-permissions.spec.js
index 9b50894fe07..dbc525846d6 100644
--- a/server/sonar-web/test/medium/global-permissions.spec.js
+++ b/server/sonar-web/test/medium/global-permissions.spec.js
@@ -9,7 +9,7 @@ define(function (require) {
.mockFromFile('/api/permissions/search_global_permissions', 'permissions/global-permissions.json')
.mockFromFile('/api/permissions/users', 'permissions/users.json')
.mockFromFile('/api/permissions/groups', 'permissions/groups.json')
- .startApp('global-permissions')
+ .startApp('global-permissions/app')
.checkElementExist('#global-permissions-header')
.checkElementExist('#global-permissions-list')
.checkElementCount('#global-permissions-list > li', 6)
diff --git a/server/sonar-web/test/medium/issues.spec.js b/server/sonar-web/test/medium/issues.spec.js
index 14991fa8af3..791025f15d5 100644
--- a/server/sonar-web/test/medium/issues.spec.js
+++ b/server/sonar-web/test/medium/issues.spec.js
@@ -10,7 +10,7 @@ define(function (require) {
.mockFromString('/api/l10n/index', '{}')
.mockFromFile('/api/issue_filters/app', 'issues-spec/app.json')
.mockFromFile('/api/issues/search', 'issues-spec/search.json')
- .startApp('issues')
+ .startApp('issues/app')
.checkElementCount('.js-filter', 2)
.checkElementCount('.js-filter[data-id="31"]', 1)
.checkElementCount('.js-filter[data-id="32"]', 1);
@@ -23,7 +23,7 @@ define(function (require) {
.mockFromFile('/api/issue_filters/app', 'issues-spec/app.json')
.mockFromFile('/api/issues/search', 'issues-spec/search.json')
.mockFromFile('/api/issue_filters/show/31', 'issues-spec/filter.json')
- .startApp('issues')
+ .startApp('issues/app')
.clickElement('.search-navigator-filters-show-list')
.clickElement('.js-filter[data-id="31"]')
.checkElementCount('.js-filter-copy', 1)
@@ -41,7 +41,7 @@ define(function (require) {
.mockFromFile('/api/issue_filters/app', 'issues-spec/app.json')
.mockFromFile('/api/issues/search', 'issues-spec/search.json')
.mockFromFile('/api/issue_filters/show/31', 'issues-spec/filter.json')
- .startApp('issues')
+ .startApp('issues/app')
.clickElement('.search-navigator-filters-show-list')
.clickElement('.js-filter[data-id="31"]')
.checkElementCount('.js-filter-copy', 1)
@@ -64,7 +64,7 @@ define(function (require) {
.mockFromString('/api/l10n/index', '{}')
.mockFromFile('/api/issue_filters/app', 'issues-spec/app.json')
.mockFromFile('/api/issues/search', 'issues-spec/search.json')
- .startApp('issues')
+ .startApp('issues/app')
.clickElement('.js-new-search')
.checkElementExist('.facet[data-value=BLOCKER]')
.checkElementExist('.facet[data-value=CRITICAL]')
@@ -103,7 +103,7 @@ define(function (require) {
.mockFromString('/api/l10n/index', '{}')
.mockFromFile('/api/issue_filters/app', 'issues-spec/app.json')
.mockFromFile('/api/issues/search', 'issues-spec/search.json')
- .startApp('issues')
+ .startApp('issues/app')
.clickElement('.js-new-search')
.checkElementCount('.issue', 50)
.clearMocks()
@@ -121,7 +121,7 @@ define(function (require) {
.mockFromString('/api/l10n/index', '{}')
.mockFromFile('/api/issue_filters/app', 'issues-spec/app.json')
.mockFromFile('/api/issues/search', 'issues-spec/search.json')
- .startApp('issues')
+ .startApp('issues/app')
.clickElement('.js-new-search')
.checkElementExist('.js-selection')
.checkElementNotExist('.js-selection.icon-checkbox-checked')
@@ -147,7 +147,7 @@ define(function (require) {
.mockFromFile('/api/issues/search', 'issues-spec/search.json')
.mockFromString('/issues/bulk_change_form*',
'<div id="bulk-change-form">bulk change form</div>', { contentType: 'text/plain' })
- .startApp('issues')
+ .startApp('issues/app')
.clickElement('.js-new-search')
.clickElement('#issues-bulk-change')
.clickElement('.js-bulk-change')
@@ -166,7 +166,7 @@ define(function (require) {
.mockFromFile('/api/issues/search', 'issues-spec/search.json')
.mockFromString('/issues/bulk_change_form*',
'<div id="bulk-change-form">bulk change form</div>', { contentType: 'text/plain' })
- .startApp('issues')
+ .startApp('issues/app')
.clickElement('.js-new-search')
.checkElementExist('.js-selection')
.checkElementNotExist('.js-selection.icon-checkbox-checked')
@@ -194,7 +194,7 @@ define(function (require) {
.mockFromString('/api/l10n/index', '{}')
.mockFromFile('/api/issue_filters/app', 'issues-spec/app.json')
.mockFromFile('/api/issues/search', 'issues-spec/search-filter-similar-issues.json')
- .startApp('issues')
+ .startApp('issues/app')
.clickElement('.js-new-search')
.checkElementCount('.issue', 2)
.clickElement('.issue.selected .js-issue-filter')
@@ -228,7 +228,7 @@ define(function (require) {
.mockFromFile('/api/issues/search', 'issues-page-should-open-issue-permalink/search.json', { data: { issues: issueKey } })
.mockFromFile('/api/components/app', 'issues-page-should-open-issue-permalink/components-app.json')
.mockFromFile('/api/sources/lines', 'issues-page-should-open-issue-permalink/lines.json')
- .startApp('issues')
+ .startApp('issues/app')
.checkElementExist('.source-line')
.checkElementInclude('.source-line', 'public void executeOn(Project project, SensorContext context')
.checkElementCount('.issue', 1)
@@ -242,7 +242,7 @@ define(function (require) {
.mockFromFile('/api/issue_filters/app', 'issues-spec/app.json')
.mockFromFile('/api/issues/search', 'issues-spec/search-rules-facet.json', { data: { facets: 'rules' } })
.mockFromFile('/api/issues/search', 'issues-spec/search.json')
- .startApp('issues')
+ .startApp('issues/app')
.clickElement('[data-property="rules"] .js-facet-toggle')
.checkElementCount('[data-property="rules"] .js-facet', 13)
.checkElementInclude('[data-property="rules"] .js-facet:nth-child(1)', 'Objects should be compared with');
diff --git a/server/sonar-web/test/medium/project-permissions.spec.js b/server/sonar-web/test/medium/project-permissions.spec.js
index 1e32733fbf3..b3bd5ec567d 100644
--- a/server/sonar-web/test/medium/project-permissions.spec.js
+++ b/server/sonar-web/test/medium/project-permissions.spec.js
@@ -7,7 +7,7 @@ define(function (require) {
return this.remote
.open()
.mockFromFile('/api/permissions/search_project_permissions', 'permissions/project-permissions.json')
- .startApp('project-permissions')
+ .startApp('project-permissions/app')
.checkElementExist('#project-permissions-header')
.checkElementExist('#projects')
.checkElementCount('#projects > thead > tr > th', 3)
diff --git a/server/sonar-web/test/medium/quality-profiles.spec.js b/server/sonar-web/test/medium/quality-profiles.spec.js
index cecc574ed3e..e2c5ea46c0a 100644
--- a/server/sonar-web/test/medium/quality-profiles.spec.js
+++ b/server/sonar-web/test/medium/quality-profiles.spec.js
@@ -6,11 +6,10 @@ define(function (require) {
bdd.it('should show list', function () {
return this.remote
.open()
- .mockFromFile('/api/users/current', 'quality-profiles/user.json')
.mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search.json')
.mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json')
.mockFromFile('/api/languages/list', 'quality-profiles/languages.json')
- .startApp('quality-profiles', { urlRoot: '/test/medium/base.html' })
+ .startApp('quality-profiles/app')
.checkElementExist('.js-list .list-group-item')
.checkElementCount('.js-list .list-group-item', 5)
.checkElementInclude('.js-list .list-group-item', 'Sonar way')
@@ -26,11 +25,10 @@ define(function (require) {
bdd.it('should filter list by language', function () {
return this.remote
.open()
- .mockFromFile('/api/users/current', 'quality-profiles/user.json')
.mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search.json')
.mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json')
.mockFromFile('/api/languages/list', 'quality-profiles/languages.json')
- .startApp('quality-profiles', { urlRoot: '/test/medium/base.html' })
+ .startApp('quality-profiles/app')
.checkElementExist('.js-list .list-group-item')
.checkElementCount('.js-list .list-group-item', 5)
.checkElementExist('.js-list .list-group-item[data-key="java-sonar-way-67887"]:not(.hidden)')
@@ -56,7 +54,6 @@ define(function (require) {
bdd.it('should show details', function () {
return this.remote
.open()
- .mockFromFile('/api/users/current', 'quality-profiles/user.json')
.mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search.json')
.mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json')
.mockFromFile('/api/languages/list', 'quality-profiles/languages.json')
@@ -64,34 +61,7 @@ define(function (require) {
{ data: { qprofile: 'java-sonar-way-67887', activation: 'true' } })
.mockFromFile('/api/qualityprofiles/inheritance', 'quality-profiles/inheritance.json',
{ data: { profileKey: 'java-sonar-way-67887' } })
- .startApp('quality-profiles', { urlRoot: '/test/medium/base.html' })
- .checkElementExist('.js-list .list-group-item')
- .clickElement('.js-list .list-group-item[data-key="java-sonar-way-67887"]')
- .checkElementExist('.search-navigator-header-component')
- .checkElementCount('.js-list .list-group-item.active', 1)
- .checkElementInclude('.js-list .list-group-item.active', 'Sonar way')
- .checkElementInclude('.search-navigator-workspace-header', 'Sonar way')
- .checkElementInclude('.search-navigator-workspace-header', 'Java')
- .checkElementExist('#quality-profile-backup')
- .checkElementNotExist('#quality-profile-rename')
- .checkElementNotExist('#quality-profile-copy')
- .checkElementNotExist('#quality-profile-delete')
- .checkElementNotExist('#quality-profile-set-as-default')
- .checkElementNotExist('#quality-profile-change-parent');
- });
-
- bdd.it('should show details for admin', function () {
- return this.remote
- .open()
- .mockFromFile('/api/users/current', 'quality-profiles/user-admin.json')
- .mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search.json')
- .mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json')
- .mockFromFile('/api/languages/list', 'quality-profiles/languages.json')
- .mockFromFile('/api/rules/search', 'quality-profiles/rules.json',
- { data: { qprofile: 'java-sonar-way-67887', activation: 'true' } })
- .mockFromFile('/api/qualityprofiles/inheritance', 'quality-profiles/inheritance.json',
- { data: { profileKey: 'java-sonar-way-67887' } })
- .startApp('quality-profiles', { urlRoot: '/test/medium/base.html' })
+ .startApp('quality-profiles/app')
.checkElementExist('.js-list .list-group-item')
.clickElement('.js-list .list-group-item[data-key="java-sonar-way-67887"]')
.checkElementExist('.search-navigator-header-component')
@@ -110,7 +80,6 @@ define(function (require) {
bdd.it('should show inheritance details', function () {
return this.remote
.open()
- .mockFromFile('/api/users/current', 'quality-profiles/user-admin.json')
.mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search-inheritance.json')
.mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json')
.mockFromFile('/api/languages/list', 'quality-profiles/languages.json')
@@ -118,7 +87,7 @@ define(function (require) {
.mockFromFile('/api/qualityprofiles/inheritance', 'quality-profiles/inheritance-plus.json', {
data: { profileKey: 'java-inherited-profile-85155' }
})
- .startApp('quality-profiles', { urlRoot: '/test/medium/base.html' })
+ .startApp('quality-profiles/app')
.checkElementExist('.js-list .list-group-item')
.clickElement('.js-list .list-group-item[data-key="java-inherited-profile-85155"]')
.checkElementExist('.search-navigator-header-component')
@@ -137,14 +106,13 @@ define(function (require) {
bdd.it('should show selected projects', function () {
return this.remote
.open()
- .mockFromFile('/api/users/current', 'quality-profiles/user-admin.json')
.mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search.json')
.mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json')
.mockFromFile('/api/languages/list', 'quality-profiles/languages.json')
.mockFromFile('/api/rules/search', 'quality-profiles/rules.json')
.mockFromFile('/api/qualityprofiles/projects?key=php-psr-2-46772', 'quality-profiles/projects.json')
.mockFromFile('/api/qualityprofiles/inheritance', 'quality-profiles/inheritance.json')
- .startApp('quality-profiles', { urlRoot: '/test/medium/base.html' })
+ .startApp('quality-profiles/app')
.checkElementExist('.js-list .list-group-item')
.clickElement('.js-list .list-group-item[data-key="php-psr-2-46772"]')
.checkElementExist('#quality-profile-projects')
@@ -156,14 +124,13 @@ define(function (require) {
bdd.it('should move between profiles', function () {
return this.remote
.open()
- .mockFromFile('/api/users/current', 'quality-profiles/user.json')
.mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search-inheritance.json')
.mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json')
.mockFromFile('/api/languages/list', 'quality-profiles/languages.json')
.mockFromFile('/api/rules/search', 'quality-profiles/rules.json',
{ data: { qprofile: 'java-inherited-profile-85155', activation: 'true' } })
.mockFromFile('/api/qualityprofiles/inheritance', 'quality-profiles/inheritance-plus.json')
- .startApp('quality-profiles', { urlRoot: '/test/medium/base.html' })
+ .startApp('quality-profiles/app')
.checkElementExist('.js-list .list-group-item')
.clickElement('.js-list .list-group-item[data-key="java-inherited-profile-85155"]')
.checkElementExist('#quality-profile-ancestors')
@@ -179,7 +146,6 @@ define(function (require) {
bdd.it('should copy profile', function () {
return this.remote
.open()
- .mockFromFile('/api/users/current', 'quality-profiles/user-admin.json')
.mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search.json')
.mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json')
.mockFromFile('/api/languages/list', 'quality-profiles/languages.json')
@@ -188,7 +154,7 @@ define(function (require) {
.mockFromFile('/api/qualityprofiles/copy', 'quality-profiles/copy.json', {
data: { fromKey: 'java-sonar-way-67887', toName: 'Copied Profile' }
})
- .startApp('quality-profiles', { urlRoot: '/test/medium/base.html' })
+ .startApp('quality-profiles/app')
.checkElementExist('.js-list .list-group-item')
.checkElementCount('.js-list .list-group-item', 5)
.clickElement('.js-list .list-group-item[data-key="java-sonar-way-67887"]')
@@ -206,13 +172,12 @@ define(function (require) {
bdd.it('should rename profile', function () {
return this.remote
.open()
- .mockFromFile('/api/users/current', 'quality-profiles/user-admin.json')
.mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search.json')
.mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json')
.mockFromFile('/api/languages/list', 'quality-profiles/languages.json')
.mockFromFile('/api/rules/search', 'quality-profiles/rules.json')
.mockFromFile('/api/qualityprofiles/inheritance', 'quality-profiles/inheritance.json')
- .startApp('quality-profiles', { urlRoot: '/test/medium/base.html' })
+ .startApp('quality-profiles/app')
.checkElementExist('.js-list .list-group-item')
.clickElement('.js-list .list-group-item[data-key="java-sonar-way-67887"]')
.checkElementExist('#quality-profile-rename')
@@ -232,13 +197,12 @@ define(function (require) {
bdd.it('should make profile default', function () {
return this.remote
.open()
- .mockFromFile('/api/users/current', 'quality-profiles/user-admin.json')
.mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search.json')
.mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json')
.mockFromFile('/api/languages/list', 'quality-profiles/languages.json')
.mockFromFile('/api/rules/search', 'quality-profiles/rules.json')
.mockFromFile('/api/qualityprofiles/inheritance', 'quality-profiles/inheritance.json')
- .startApp('quality-profiles', { urlRoot: '/test/medium/base.html' })
+ .startApp('quality-profiles/app')
.checkElementExist('.js-list .list-group-item')
.checkElementNotExist('.js-list .list-group-item[data-key="php-psr-2-46772"] .badge')
.checkElementExist('.js-list .list-group-item[data-key="php-sonar-way-10778"] .badge')
@@ -258,13 +222,12 @@ define(function (require) {
bdd.it('should delete profile', function () {
return this.remote
.open()
- .mockFromFile('/api/users/current', 'quality-profiles/user-admin.json')
.mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search-with-copy.json')
.mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json')
.mockFromFile('/api/languages/list', 'quality-profiles/languages.json')
.mockFromFile('/api/rules/search', 'quality-profiles/rules.json')
.mockFromFile('/api/qualityprofiles/inheritance', 'quality-profiles/inheritance.json')
- .startApp('quality-profiles', { urlRoot: '/test/medium/base.html' })
+ .startApp('quality-profiles/app')
.checkElementExist('.js-list .list-group-item')
.checkElementCount('.js-list .list-group-item', 6)
.clickElement('.js-list .list-group-item[data-key="java-copied-profile-11711"]')
@@ -284,14 +247,13 @@ define(function (require) {
bdd.it('should create profile', function () {
return this.remote
.open()
- .mockFromFile('/api/users/current', 'quality-profiles/user-admin.json')
.mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search.json')
.mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json')
.mockFromFile('/api/rules/search', 'quality-profiles/rules.json')
.mockFromFile('/api/qualityprofiles/inheritance', 'quality-profiles/inheritance.json')
.mockFromFile('/api/languages/list', 'quality-profiles/languages.json')
.mockFromFile('/api/qualityprofiles/importers', 'quality-profiles/importers-empty.json')
- .startApp('quality-profiles', { urlRoot: '/test/medium/base.html' })
+ .startApp('quality-profiles/app')
.checkElementExist('.js-list .list-group-item')
.checkElementCount('.js-list .list-group-item', 5)
.clickElement('#quality-profiles-create')
@@ -303,13 +265,12 @@ define(function (require) {
bdd.it('should restore profile', function () {
return this.remote
.open()
- .mockFromFile('/api/users/current', 'quality-profiles/user-admin.json')
.mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search.json')
.mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json')
.mockFromFile('/api/languages/list', 'quality-profiles/languages.json')
.mockFromFile('/api/rules/search', 'quality-profiles/rules.json')
.mockFromFile('/api/qualityprofiles/inheritance', 'quality-profiles/inheritance.json')
- .startApp('quality-profiles', { urlRoot: '/test/medium/base.html' })
+ .startApp('quality-profiles/app')
.checkElementExist('.js-list .list-group-item')
.checkElementCount('.js-list .list-group-item', 5)
.clickElement('#quality-profiles-actions')
@@ -321,14 +282,13 @@ define(function (require) {
bdd.it('should show importers', function () {
return this.remote
.open()
- .mockFromFile('/api/users/current', 'quality-profiles/user-admin.json')
.mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search.json')
.mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json')
.mockFromFile('/api/rules/search', 'quality-profiles/rules.json')
.mockFromFile('/api/qualityprofiles/inheritance', 'quality-profiles/inheritance.json')
.mockFromFile('/api/languages/list', 'quality-profiles/languages.json')
.mockFromFile('/api/qualityprofiles/importers', 'quality-profiles/importers.json')
- .startApp('quality-profiles', { urlRoot: '/test/medium/base.html' })
+ .startApp('quality-profiles/app')
.checkElementExist('.js-list .list-group-item')
.clickElement('#quality-profiles-create')
.checkElementExist('.modal')
@@ -347,13 +307,12 @@ define(function (require) {
bdd.it('should restore built-in profiles', function () {
return this.remote
.open()
- .mockFromFile('/api/users/current', 'quality-profiles/user-admin.json')
.mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search-modified.json')
.mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json')
.mockFromFile('/api/rules/search', 'quality-profiles/rules.json')
.mockFromFile('/api/qualityprofiles/inheritance', 'quality-profiles/inheritance.json')
.mockFromFile('/api/languages/list', 'quality-profiles/languages.json')
- .startApp('quality-profiles', { urlRoot: '/test/medium/base.html' })
+ .startApp('quality-profiles/app')
.checkElementExist('.js-list .list-group-item')
.checkElementCount('.js-list .list-group-item', 1)
.clickElement('#quality-profiles-actions')
@@ -372,13 +331,12 @@ define(function (require) {
bdd.it('should change profile\'s parent', function () {
return this.remote
.open()
- .mockFromFile('/api/users/current', 'quality-profiles/user-admin.json')
.mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search-change-parent.json')
.mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json')
.mockFromFile('/api/languages/list', 'quality-profiles/languages.json')
.mockFromFile('/api/rules/search', 'quality-profiles/rules.json')
.mockFromFile('/api/qualityprofiles/inheritance', 'quality-profiles/inheritance-change-parent.json')
- .startApp('quality-profiles', { urlRoot: '/test/medium/base.html' })
+ .startApp('quality-profiles/app')
.checkElementExist('.js-list .list-group-item')
.clickElement('.js-list .list-group-item[data-key="java-inherited-profile-85155"]')
.checkElementExist('#quality-profile-change-parent')
@@ -401,13 +359,12 @@ define(function (require) {
bdd.it('should open permalink', function () {
return this.remote
.open('#show?key=java-sonar-way-67887')
- .mockFromFile('/api/users/current', 'quality-profiles/user-admin.json')
.mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search.json')
.mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json')
.mockFromFile('/api/languages/list', 'quality-profiles/languages.json')
.mockFromFile('/api/rules/search', 'quality-profiles/rules.json')
.mockFromFile('/api/qualityprofiles/inheritance', 'quality-profiles/inheritance.json')
- .startApp('quality-profiles', { urlRoot: '/test/medium/base.html' })
+ .startApp('quality-profiles/app')
.checkElementExist('#quality-profile-rename')
.checkElementCount('.js-list .list-group-item.active', 1)
.checkElementInclude('.js-list .list-group-item.active', 'Sonar way')
@@ -423,7 +380,6 @@ define(function (require) {
bdd.it('should show changelog', function () {
return this.remote
.open('#show?key=java-sonar-way-67887')
- .mockFromFile('/api/users/current', 'quality-profiles/user.json')
.mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search.json')
.mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json')
.mockFromFile('/api/languages/list', 'quality-profiles/languages.json')
@@ -432,7 +388,7 @@ define(function (require) {
.mockFromFile('/api/qualityprofiles/changelog', 'quality-profiles/changelog.json', {
data: { profileKey: 'java-sonar-way-67887' }
})
- .startApp('quality-profiles', { urlRoot: '/test/medium/base.html' })
+ .startApp('quality-profiles/app')
.checkElementExist('#quality-profile-changelog-form-submit')
.checkElementNotExist('.js-show-more-changelog')
.clickElement('#quality-profile-changelog-form-submit')
@@ -470,7 +426,6 @@ define(function (require) {
bdd.it('should open changelog permalink', function () {
return this.remote
.open('#changelog?since=2015-03-25&key=java-sonar-way-67887&to=2015-03-26')
- .mockFromFile('/api/users/current', 'quality-profiles/user.json')
.mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search.json')
.mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json')
.mockFromFile('/api/languages/list', 'quality-profiles/languages.json')
@@ -483,7 +438,7 @@ define(function (require) {
profileKey: 'java-sonar-way-67887'
}
})
- .startApp('quality-profiles', { urlRoot: '/test/medium/base.html' })
+ .startApp('quality-profiles/app')
.checkElementExist('.js-show-more-changelog')
.checkElementCount('#quality-profile-changelog tbody tr', 2)
.clearMocks()
@@ -502,7 +457,6 @@ define(function (require) {
bdd.it('should show comparison', function () {
return this.remote
.open('#show?key=java-sonar-way-67887')
- .mockFromFile('/api/users/current', 'quality-profiles/user.json')
.mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search-with-copy.json')
.mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json')
.mockFromFile('/api/languages/list', 'quality-profiles/languages.json')
@@ -511,7 +465,7 @@ define(function (require) {
.mockFromFile('/api/qualityprofiles/compare', 'quality-profiles/compare.json', {
data: { leftKey: 'java-sonar-way-67887', rightKey: 'java-copied-profile-11711' }
})
- .startApp('quality-profiles', { urlRoot: '/test/medium/base.html' })
+ .startApp('quality-profiles/app')
.checkElementExist('#quality-profile-comparison-form-submit')
.checkElementCount('#quality-profile-comparison-with-key option', 1)
.clickElement('#quality-profile-comparison-form-submit')
@@ -532,7 +486,6 @@ define(function (require) {
bdd.it('should open comparison permalink', function () {
return this.remote
.open('#compare?key=java-sonar-way-67887&withKey=java-copied-profile-11711')
- .mockFromFile('/api/users/current', 'quality-profiles/user.json')
.mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search-with-copy.json')
.mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json')
.mockFromFile('/api/languages/list', 'quality-profiles/languages.json')
@@ -541,7 +494,7 @@ define(function (require) {
.mockFromFile('/api/qualityprofiles/compare', 'quality-profiles/compare.json', {
data: { leftKey: 'java-sonar-way-67887', rightKey: 'java-copied-profile-11711' }
})
- .startApp('quality-profiles', { urlRoot: '/test/medium/base.html' })
+ .startApp('quality-profiles/app')
.checkElementExist('#quality-profile-comparison table')
.checkElementCount('#quality-profile-comparison-with-key option', 1)
.checkElementCount('.js-comparison-in-left', 2)
diff --git a/server/sonar-web/test/medium/source-viewer.spec.js b/server/sonar-web/test/medium/source-viewer.spec.js
index 5872dc7c0fe..45e1a428b00 100644
--- a/server/sonar-web/test/medium/source-viewer.spec.js
+++ b/server/sonar-web/test/medium/source-viewer.spec.js
@@ -14,7 +14,7 @@ define(function (require) {
.mockFromFile('/api/issues/search',
'source-viewer-spec/issues-with-precise-location.json',
{ data: { componentUuids: 'uuid' } })
- .startApp('source-viewer', { file: file })
+ .startApp('source-viewer/app')
.checkElementExist('.source-line-code[data-line-number="3"] .source-line-code-issue')
.checkElementInclude('.source-line-code[data-line-number="3"] .source-line-code-issue', '14 So')
@@ -37,7 +37,7 @@ define(function (require) {
.mockFromFile('/api/issues/search',
'source-viewer-spec/issues-with-precise-location.json',
{ data: { componentUuids: 'uuid' } })
- .startApp('source-viewer', { file: file })
+ .startApp('source-viewer/app')
.checkElementExist('.source-line-code[data-line-number="3"] .source-line-code-issue')
.checkElementInclude('.source-line-code[data-line-number="3"] .source-line-code-issue', '14 So')
.clickElement('.source-line-with-issues[data-line-number="3"]')
@@ -56,7 +56,7 @@ define(function (require) {
.mockFromFile('/api/issues/search',
'source-viewer-spec/issues-with-precise-location.json',
{ data: { componentUuids: 'uuid' } })
- .startApp('source-viewer', { file: file })
+ .startApp('source-viewer/app')
.checkElementExist('.source-line-code[data-line-number="9"] .source-line-code-issue')
.checkElementInclude('.source-line-code[data-line-number="9"] .source-line-code-issue', 'sion')
.clickElement('.source-line-with-issues[data-line-number="9"]')
diff --git a/server/sonar-web/test/medium/test-main.js b/server/sonar-web/test/medium/test-main.js
new file mode 100644
index 00000000000..50631c08218
--- /dev/null
+++ b/server/sonar-web/test/medium/test-main.js
@@ -0,0 +1,33 @@
+require.config({
+ baseUrl: '../../build/js',
+ urlArgs: 'v=' + window.sonarVersion,
+ paths: {
+ 'react': 'libs/third-party/react-with-addons',
+ 'underscore': 'libs/shim/underscore-shim',
+ 'jquery': 'libs/shim/jquery-shim',
+ 'backbone': 'libs/third-party/backbone',
+ 'backbone.marionette': 'libs/third-party/backbone.marionette'
+ }
+});
+
+require([
+ './apps/main/app',
+ './components/common/processes',
+ 'libs/third-party/jquery.mockjax'
+], function (App) {
+ jQuery.mockjaxSettings.contentType = 'text/json';
+ jQuery.mockjaxSettings.responseTime = 50;
+
+ jQuery.mockjax({ url: '/api/l10n/index', responseText: '{}' });
+ jQuery.mockjax({ url: '/api/users/current', responseText: '{ "isLoggedIn":true, "login":"admin", "name":"Administrator", "permissions": { "global": ["provisioning", "dryRunScan", "shareDashboard", "scan", "profileadmin", "admin"] } }' });
+ jQuery.mockjax({ url: '/api/navigation/component', responseText: '{"key":"org.codehaus.sonar:sonar","uuid":"uuid","name":"SonarQube","isComparable":true,"canBeFavorite":true,"isFavorite":true,"dashboards":[{"key":109,"name":"Dev"},{"key":1,"name":"Dashboard"},{"key":2,"name":"SQALE"},{"key":8,"name":"Hotspots"},{"key":88,"name":"Issues"},{"key":18,"name":"TimeMachine"},{"key":13,"name":"QA"},{"key":59,"name":"By Developers"}],"version":"5.2-SNAPSHOT","snapshotDate":"2015-08-25T10:37:21+0200","extensions":[],"breadcrumbs":[{"key":"org.codehaus.sonar:sonar","name":"SonarQube","qualifier":"TRK"}]}' });
+
+ window.App = new App({
+ space: window.space,
+ componentKey: window.component,
+ lang: window.pageLang
+ });
+ window.App.start();
+
+ jQuery('#content').addClass('ready');
+});
diff --git a/server/sonar-web/test/medium/update-center.spec.js b/server/sonar-web/test/medium/update-center.spec.js
index 40277c7ebc3..88b1d8e8a98 100644
--- a/server/sonar-web/test/medium/update-center.spec.js
+++ b/server/sonar-web/test/medium/update-center.spec.js
@@ -10,7 +10,7 @@ define(function (require) {
.mockFromFile('/api/plugins/installed', 'update-center-spec/installed.json')
.mockFromFile('/api/plugins/updates', 'update-center-spec/updates.json')
.mockFromFile('/api/plugins/pending', 'update-center-spec/pending.json')
- .startApp('update-center', { urlRoot: '/test/medium/base.html' })
+ .startApp('update-center/app')
.checkElementExist('.js-plugin-name')
.checkElementCount('li[data-id]', 5)
.checkElementInclude('li[data-id="scmgit"] .js-plugin-name', 'Git')
@@ -36,7 +36,7 @@ define(function (require) {
.mockFromString('/api/l10n/index', '{}')
.mockFromFile('/api/plugins/pending', 'update-center-spec/pending.json')
.mockFromFile('/api/system/upgrades', 'update-center-spec/system-updates.json')
- .startApp('update-center', { urlRoot: '/test/medium/base.html' })
+ .startApp('update-center/app')
.checkElementExist('.js-plugin-name')
.checkElementCount('li[data-system]', 1)
.checkElementInclude('li[data-system] .js-plugin-name', 'SonarQube 5.3')
@@ -55,7 +55,7 @@ define(function (require) {
.mockFromFile('/api/plugins/installed', 'update-center-spec/installed.json')
.mockFromFile('/api/plugins/updates', 'update-center-spec/updates.json')
.mockFromFile('/api/plugins/pending', 'update-center-spec/pending.json')
- .startApp('update-center', { urlRoot: '/test/medium/base.html' })
+ .startApp('update-center/app')
.checkElementExist('.js-plugin-name')
.checkElementCount('li[data-id]', 5)
.checkElementExist('li[data-id="scmgit"]')
@@ -69,7 +69,7 @@ define(function (require) {
.mockFromFile('/api/plugins/installed', 'update-center-spec/installed.json')
.mockFromFile('/api/plugins/updates', 'update-center-spec/updates.json')
.mockFromFile('/api/plugins/pending', 'update-center-spec/pending.json')
- .startApp('update-center', { urlRoot: '/test/medium/base.html' })
+ .startApp('update-center/app')
.checkElementExist('.js-plugin-name')
.checkElementCount('li[data-id]', 4)
.checkElementExist('li[data-id="scmgit"]')
@@ -82,7 +82,7 @@ define(function (require) {
.mockFromString('/api/l10n/index', '{}')
.mockFromFile('/api/plugins/available', 'update-center-spec/available.json')
.mockFromFile('/api/plugins/pending', 'update-center-spec/pending.json')
- .startApp('update-center', { urlRoot: '/test/medium/base.html' })
+ .startApp('update-center/app')
.checkElementExist('.js-plugin-name')
.checkElementCount('li[data-id]', 3)
.checkElementNotExist('li[data-id="scmgit"]')
@@ -99,7 +99,7 @@ define(function (require) {
.execute(function () {
window.SS.updateCenterActive = false;
})
- .startApp('update-center', { urlRoot: '/test/medium/base.html' })
+ .startApp('update-center/app')
.checkElementExist('.js-plugin-name')
.checkElementCount('li[data-id]', 5)
.checkElementExist('li[data-id="scmgit"]')
@@ -119,7 +119,7 @@ define(function (require) {
.mockFromFile('/api/plugins/pending', 'update-center-spec/pending.json')
.mockFromFile('/api/plugins/available', 'update-center-spec/available.json')
.mockFromFile('/api/system/upgrades', 'update-center-spec/system-updates.json')
- .startApp('update-center', { urlRoot: '/test/medium/base.html' })
+ .startApp('update-center/app')
.checkElementExist('.js-plugin-name')
.checkElementCount('li[data-id]', 5)
.checkElementExist('li[data-id="javascript"]')
@@ -164,7 +164,7 @@ define(function (require) {
.mockFromFile('/api/plugins/installed', 'update-center-spec/installed.json')
.mockFromFile('/api/plugins/updates', 'update-center-spec/updates.json')
.mockFromFile('/api/plugins/pending', 'update-center-spec/pending.json')
- .startApp('update-center', { urlRoot: '/test/medium/base.html' })
+ .startApp('update-center/app')
.checkElementExist('.js-plugin-name')
.checkElementCount('li[data-id]', 5)
.checkElementNotExist('li.hidden[data-id]')
@@ -182,7 +182,7 @@ define(function (require) {
.mockFromString('/api/l10n/index', '{}')
.mockFromFile('/api/plugins/available', 'update-center-spec/available.json')
.mockFromFile('/api/plugins/pending', 'update-center-spec/pending.json')
- .startApp('update-center', { urlRoot: '/test/medium/base.html' })
+ .startApp('update-center/app')
.checkElementCount('li[data-id]:not(.hidden)', 3)
.clickElement('li[data-id="abap"] .js-plugin-category')
.checkElementCount('li[data-id]:not(.hidden)', 2);
@@ -195,7 +195,7 @@ define(function (require) {
.mockFromFile('/api/plugins/installed', 'update-center-spec/installed.json')
.mockFromFile('/api/plugins/updates', 'update-center-spec/updates.json')
.mockFromFile('/api/plugins/pending', 'update-center-spec/pending.json')
- .startApp('update-center', { urlRoot: '/test/medium/base.html' })
+ .startApp('update-center/app')
.checkElementExist('.js-plugin-name')
.clickElement('li[data-id="python"] .js-changelog')
.checkElementExist('.bubble-popup')
@@ -211,7 +211,7 @@ define(function (require) {
.mockFromString('/api/l10n/index', '{}')
.mockFromFile('/api/plugins/available', 'update-center-spec/available.json')
.mockFromFile('/api/plugins/pending', 'update-center-spec/pending.json')
- .startApp('update-center', { urlRoot: '/test/medium/base.html' })
+ .startApp('update-center/app')
.checkElementExist('.js-plugin-name')
.clickElement('li[data-id="abap"] .js-changelog')
.checkElementExist('.bubble-popup')
@@ -229,7 +229,7 @@ define(function (require) {
.mockFromFile('/api/plugins/updates', 'update-center-spec/updates.json')
.mockFromFile('/api/plugins/pending', 'update-center-spec/pending.json')
.mockFromString('/api/plugins/update', '{}', { data: { key: 'scmgit' } })
- .startApp('update-center', { urlRoot: '/test/medium/base.html' })
+ .startApp('update-center/app')
.checkElementExist('.js-plugin-name')
.clickElement('li[data-id="scmgit"] .js-update')
.checkElementNotExist('li[data-id="scmgit"] .js-spinner')
@@ -244,7 +244,7 @@ define(function (require) {
.mockFromFile('/api/plugins/updates', 'update-center-spec/updates.json')
.mockFromFile('/api/plugins/pending', 'update-center-spec/pending.json')
.mockFromString('/api/plugins/uninstall', '{}', { data: { key: 'scmgit' } })
- .startApp('update-center', { urlRoot: '/test/medium/base.html' })
+ .startApp('update-center/app')
.checkElementExist('.js-plugin-name')
.clickElement('li[data-id="scmgit"] .js-uninstall')
.checkElementNotExist('li[data-id="scmgit"] .js-spinner')
@@ -258,7 +258,7 @@ define(function (require) {
.mockFromFile('/api/plugins/available', 'update-center-spec/available.json')
.mockFromFile('/api/plugins/pending', 'update-center-spec/pending.json')
.mockFromString('/api/plugins/install', '{}', { data: { key: 'android' } })
- .startApp('update-center', { urlRoot: '/test/medium/base.html' })
+ .startApp('update-center/app')
.checkElementExist('.js-plugin-name')
.clickElement('li[data-id="android"] .js-install')
.checkElementNotExist('li[data-id="android"] .js-spinner')
@@ -272,7 +272,7 @@ define(function (require) {
.mockFromFile('/api/plugins/available', 'update-center-spec/available.json')
.mockFromFile('/api/plugins/pending', 'update-center-spec/pending.json')
.mockFromString('/api/plugins/cancel_all', '{}')
- .startApp('update-center', { urlRoot: '/test/medium/base.html' })
+ .startApp('update-center/app')
.checkElementExist('.js-plugin-name')
.checkElementExist('.js-pending')
.clickElement('.js-cancel-all')
@@ -286,7 +286,7 @@ define(function (require) {
.mockFromFile('/api/plugins/available', 'update-center-spec/available.json')
.mockFromFile('/api/plugins/pending', 'update-center-spec/pending.json')
.mockFromString('/api/plugins/install', '{}', { data: { key: 'abap' } })
- .startApp('update-center', { urlRoot: '/test/medium/base.html' })
+ .startApp('update-center/app')
.checkElementExist('.js-plugin-name')
.checkElementExist('li[data-id="abap"] .js-terms')
.checkElementExist('li[data-id="abap"] .js-install[disabled]')
diff --git a/server/sonar-web/test/medium/users.spec.js b/server/sonar-web/test/medium/users.spec.js
index e950e631f86..db0b17b9f33 100644
--- a/server/sonar-web/test/medium/users.spec.js
+++ b/server/sonar-web/test/medium/users.spec.js
@@ -8,7 +8,7 @@ define(function (require) {
.open()
.mockFromString('/api/l10n/index', '{}')
.mockFromFile('/api/users/search', 'users-spec/search.json')
- .startApp('users')
+ .startApp('users/app')
.checkElementCount('#users-list li[data-login]', 3)
.checkElementInclude('#users-list .js-user-login', 'smith')
.checkElementInclude('#users-list .js-user-name', 'Bob')
@@ -30,7 +30,7 @@ define(function (require) {
.open()
.mockFromString('/api/l10n/index', '{}')
.mockFromFile('/api/users/search', 'users-spec/search.json')
- .startApp('users')
+ .startApp('users/app')
.checkElementCount('#users-list li[data-login]', 3)
.clearMocks()
.mockFromFile('/api/users/search', 'users-spec/search-filtered.json')
@@ -51,7 +51,7 @@ define(function (require) {
.open()
.mockFromString('/api/l10n/index', '{}')
.mockFromFile('/api/users/search', 'users-spec/search-big-1.json')
- .startApp('users')
+ .startApp('users/app')
.checkElementCount('#users-list li[data-login]', 2)
.clearMocks()
.mockFromFile('/api/users/search', 'users-spec/search-big-2.json')
@@ -65,7 +65,7 @@ define(function (require) {
.open()
.mockFromString('/api/l10n/index', '{}')
.mockFromFile('/api/users/search', 'users-spec/search.json')
- .startApp('users')
+ .startApp('users/app')
.checkElementCount('#users-list li[data-login]', 3)
.clickElement('#users-create')
.checkElementCount('#create-user-form', 1)
@@ -93,7 +93,7 @@ define(function (require) {
.open()
.mockFromString('/api/l10n/index', '{}')
.mockFromFile('/api/users/search', 'users-spec/search.json')
- .startApp('users')
+ .startApp('users/app')
.clickElement('[data-login="smith"] .js-user-update')
.checkElementCount('#create-user-form', 1)
.clearMocks()
@@ -116,7 +116,7 @@ define(function (require) {
.open()
.mockFromString('/api/l10n/index', '{}')
.mockFromFile('/api/users/search', 'users-spec/search.json')
- .startApp('users')
+ .startApp('users/app')
.clickElement('[data-login="smith"] .js-user-change-password')
.checkElementCount('#change-user-password-form', 1)
.clearMocks()
@@ -136,7 +136,7 @@ define(function (require) {
.open()
.mockFromString('/api/l10n/index', '{}')
.mockFromFile('/api/users/search', 'users-spec/search.json')
- .startApp('users')
+ .startApp('users/app')
.clickElement('[data-login="smith"] .js-user-deactivate')
.checkElementCount('#deactivate-user-form', 1)
.clearMocks()
diff --git a/server/sonar-web/test/unit/csv.spec.js b/server/sonar-web/test/unit/csv.spec.js
new file mode 100644
index 00000000000..686d014415f
--- /dev/null
+++ b/server/sonar-web/test/unit/csv.spec.js
@@ -0,0 +1,16 @@
+define(function (require) {
+ var bdd = require('intern!bdd');
+ var assert = require('intern/chai!assert');
+
+ var csvEscape = require('../../build/js/libs/csv');
+
+ bdd.describe('#csvEscape', function () {
+ bdd.it('should escape', function () {
+ assert.equal(csvEscape('Hello, "World"!'), '"Hello, \\"World\\"!"');
+ });
+
+ bdd.it('should not escape', function () {
+ assert.equal(csvEscape('HelloWorld'), '"HelloWorld"');
+ });
+ });
+});
diff --git a/server/sonar-web/test/unit/recent-history.spec.js b/server/sonar-web/test/unit/recent-history.spec.js
new file mode 100644
index 00000000000..5eff7a83d66
--- /dev/null
+++ b/server/sonar-web/test/unit/recent-history.spec.js
@@ -0,0 +1,43 @@
+define(function (require) {
+ var bdd = require('intern!bdd');
+ var assert = require('intern/chai!assert');
+
+ var RecentHistory = require('../../build/js/libs/recent-history');
+
+ bdd.describe('RecentHistory', function () {
+ bdd.beforeEach(function () {
+ RecentHistory.clear();
+ });
+
+ bdd.it('should clear history', function () {
+ assert.equal(RecentHistory.getRecentHistory().length, 0);
+ RecentHistory.add('project-key', 'Project Name', 'trk');
+ assert.equal(RecentHistory.getRecentHistory().length, 1);
+ RecentHistory.clear();
+ assert.equal(RecentHistory.getRecentHistory().length, 0);
+ });
+
+ bdd.it('should add a new item', function () {
+ RecentHistory.add('project-key', 'Project Name', 'trk');
+ assert.deepEqual(RecentHistory.getRecentHistory(), [{ key: 'project-key', name: 'Project Name', icon: 'trk' }]);
+ });
+
+ bdd.it('should replace existing item', function () {
+ RecentHistory.add('project-key', 'Project Name', 'trk');
+ assert.deepEqual(RecentHistory.getRecentHistory(), [{ key: 'project-key', name: 'Project Name', icon: 'trk' }]);
+ RecentHistory.add('project-key', 'Another', 'brc');
+ assert.deepEqual(RecentHistory.getRecentHistory(), [{ key: 'project-key', name: 'Another', icon: 'brc' }]);
+ });
+
+ bdd.it('should limit the number of items', function () {
+ assert.equal(RecentHistory.getRecentHistory().length, 0);
+ for (var i = 0; i < 10; i++) {
+ RecentHistory.add('key-' + i, 'Project ' + i, 'trk');
+ }
+ assert.equal(RecentHistory.getRecentHistory().length, 10);
+ RecentHistory.add('project-key', 'Project Name', 'trk');
+ assert.equal(RecentHistory.getRecentHistory().length, 10);
+ assert.deepEqual(RecentHistory.getRecentHistory()[0], { key: 'project-key', name: 'Project Name', icon: 'trk' });
+ });
+ });
+});