aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps
diff options
context:
space:
mode:
Diffstat (limited to 'server/sonar-web/src/main/js/apps')
-rw-r--r--server/sonar-web/src/main/js/apps/account/app.js9
-rw-r--r--server/sonar-web/src/main/js/apps/account/change-password-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/api-documentation/action-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/api-documentation/app.js11
-rw-r--r--server/sonar-web/src/main/js/apps/api-documentation/filters-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/api-documentation/header-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/api-documentation/item-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/api-documentation/layout.js4
-rw-r--r--server/sonar-web/src/main/js/apps/api-documentation/search-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/app.js12
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/main.js4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/app.js14
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/bulk-change-modal-view.js6
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/bulk-change-popup-view.js6
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/confirm-dialog.js43
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/controller.js2
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/facets-view.js2
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/facets/active-severity-facet.js4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/facets/available-since-facet.js4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/facets/base-facet.js6
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/facets/characteristic-facet.js4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/facets/custom-values-facet.js4
-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/key-facet.js4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/facets/quality-profile-facet.js4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/facets/query-facet.js4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/facets/severity-facet.js4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/facets/template-facet.js4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/filters-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/layout.js4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/models/state.js2
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/partials.js8
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule-details-view.js7
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule-filter-view.js6
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-creation-view.js12
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-view.js7
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rules-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule/manual-rule-creation-view.js9
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule/profile-activation-view.js9
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule/rule-description-view.js7
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule/rule-issues-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule/rule-meta-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule/rule-parameters-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profile-view.js9
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profiles-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/workspace-header-view.js6
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/workspace-list-item-view.js9
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/workspace-list-view.js6
-rw-r--r--server/sonar-web/src/main/js/apps/component-issues/app.js (renamed from server/sonar-web/src/main/js/apps/issues/app-context.js)36
-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/delete-view.js6
-rw-r--r--server/sonar-web/src/main/js/apps/custom-measures/form-view.js8
-rw-r--r--server/sonar-web/src/main/js/apps/custom-measures/header-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/custom-measures/layout.js4
-rw-r--r--server/sonar-web/src/main/js/apps/custom-measures/list-footer-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/custom-measures/list-item-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/custom-measures/list-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/dashboard/app.js152
-rw-r--r--server/sonar-web/src/main/js/apps/drilldown/app.js10
-rw-r--r--server/sonar-web/src/main/js/apps/global-permissions/app.js8
-rw-r--r--server/sonar-web/src/main/js/apps/global-permissions/app.jsx11
-rw-r--r--server/sonar-web/src/main/js/apps/global-permissions/groups-view.js8
-rw-r--r--server/sonar-web/src/main/js/apps/global-permissions/main.js (renamed from server/sonar-web/src/main/js/apps/global-permissions/main.jsx)0
-rw-r--r--server/sonar-web/src/main/js/apps/global-permissions/permission-groups.js (renamed from server/sonar-web/src/main/js/apps/global-permissions/permission-groups.jsx)0
-rw-r--r--server/sonar-web/src/main/js/apps/global-permissions/permission-users-groups-mixin.js (renamed from server/sonar-web/src/main/js/apps/global-permissions/permission-users-groups-mixin.jsx)0
-rw-r--r--server/sonar-web/src/main/js/apps/global-permissions/permission-users.js (renamed from server/sonar-web/src/main/js/apps/global-permissions/permission-users.jsx)0
-rw-r--r--server/sonar-web/src/main/js/apps/global-permissions/permission.js (renamed from server/sonar-web/src/main/js/apps/global-permissions/permission.jsx)0
-rw-r--r--server/sonar-web/src/main/js/apps/global-permissions/permissions-list.js (renamed from server/sonar-web/src/main/js/apps/global-permissions/permissions-list.jsx)0
-rw-r--r--server/sonar-web/src/main/js/apps/global-permissions/users-view.js8
-rw-r--r--server/sonar-web/src/main/js/apps/groups/app.js13
-rw-r--r--server/sonar-web/src/main/js/apps/groups/delete-view.js6
-rw-r--r--server/sonar-web/src/main/js/apps/groups/form-view.js6
-rw-r--r--server/sonar-web/src/main/js/apps/groups/header-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/groups/layout.js4
-rw-r--r--server/sonar-web/src/main/js/apps/groups/list-footer-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/groups/list-item-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/groups/list-view.js1
-rw-r--r--server/sonar-web/src/main/js/apps/groups/search-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/groups/users-view.js8
-rw-r--r--server/sonar-web/src/main/js/apps/issues/app.js16
-rw-r--r--server/sonar-web/src/main/js/apps/issues/component-viewer/main.js3
-rw-r--r--server/sonar-web/src/main/js/apps/issues/controller.js2
-rw-r--r--server/sonar-web/src/main/js/apps/issues/facets-view.js2
-rw-r--r--server/sonar-web/src/main/js/apps/issues/facets/action-plan-facet.js4
-rw-r--r--server/sonar-web/src/main/js/apps/issues/facets/assignee-facet.js4
-rw-r--r--server/sonar-web/src/main/js/apps/issues/facets/base-facet.js6
-rw-r--r--server/sonar-web/src/main/js/apps/issues/facets/context-facet.js4
-rw-r--r--server/sonar-web/src/main/js/apps/issues/facets/creation-date-facet.js4
-rw-r--r--server/sonar-web/src/main/js/apps/issues/facets/custom-values-facet.js4
-rw-r--r--server/sonar-web/src/main/js/apps/issues/facets/file-facet.js4
-rw-r--r--server/sonar-web/src/main/js/apps/issues/facets/issue-key-facet.js4
-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/resolution-facet.js4
-rw-r--r--server/sonar-web/src/main/js/apps/issues/facets/severity-facet.js4
-rw-r--r--server/sonar-web/src/main/js/apps/issues/facets/status-facet.js4
-rw-r--r--server/sonar-web/src/main/js/apps/issues/filters-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/issues/helpers/format-facet-value.js2
-rw-r--r--server/sonar-web/src/main/js/apps/issues/issue-filter-view.js6
-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/issue.js2
-rw-r--r--server/sonar-web/src/main/js/apps/issues/models/state.js2
-rw-r--r--server/sonar-web/src/main/js/apps/issues/partials.js8
-rw-r--r--server/sonar-web/src/main/js/apps/issues/router.js2
-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.js5
-rw-r--r--server/sonar-web/src/main/js/apps/issues/workspace-list-item-view.js9
-rw-r--r--server/sonar-web/src/main/js/apps/issues/workspace-list-view.js9
-rw-r--r--server/sonar-web/src/main/js/apps/maintenance/app.js8
-rw-r--r--server/sonar-web/src/main/js/apps/maintenance/main-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/maintenance/partials.js23
-rw-r--r--server/sonar-web/src/main/js/apps/markdown/app.js5
-rw-r--r--server/sonar-web/src/main/js/apps/markdown/markdown-help-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/measures/app.js19
-rw-r--r--server/sonar-web/src/main/js/apps/measures/measures-filter-bar.js2
-rw-r--r--server/sonar-web/src/main/js/apps/metrics/app.js13
-rw-r--r--server/sonar-web/src/main/js/apps/metrics/delete-view.js6
-rw-r--r--server/sonar-web/src/main/js/apps/metrics/form-view.js6
-rw-r--r--server/sonar-web/src/main/js/apps/metrics/header-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/metrics/layout.js4
-rw-r--r--server/sonar-web/src/main/js/apps/metrics/list-footer-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/metrics/list-item-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/metrics/list-view.js1
-rw-r--r--server/sonar-web/src/main/js/apps/nav/app.jsx36
-rw-r--r--server/sonar-web/src/main/js/apps/nav/component/component-nav-breadcrumbs.jsx23
-rw-r--r--server/sonar-web/src/main/js/apps/nav/component/component-nav-favorite.jsx15
-rw-r--r--server/sonar-web/src/main/js/apps/nav/component/component-nav-menu.jsx250
-rw-r--r--server/sonar-web/src/main/js/apps/nav/component/component-nav-meta.jsx54
-rw-r--r--server/sonar-web/src/main/js/apps/nav/component/component-nav.jsx72
-rw-r--r--server/sonar-web/src/main/js/apps/nav/dashboard-name-mixin.jsx11
-rw-r--r--server/sonar-web/src/main/js/apps/nav/global/global-nav-branding.jsx21
-rw-r--r--server/sonar-web/src/main/js/apps/nav/global/global-nav-menu.jsx152
-rw-r--r--server/sonar-web/src/main/js/apps/nav/global/global-nav-search.jsx78
-rw-r--r--server/sonar-web/src/main/js/apps/nav/global/global-nav-user.jsx52
-rw-r--r--server/sonar-web/src/main/js/apps/nav/global/global-nav.jsx63
-rw-r--r--server/sonar-web/src/main/js/apps/nav/global/search-view.js232
-rw-r--r--server/sonar-web/src/main/js/apps/nav/global/shortcuts-help-view.js9
-rw-r--r--server/sonar-web/src/main/js/apps/nav/links-mixin.jsx28
-rw-r--r--server/sonar-web/src/main/js/apps/nav/settings/settings-nav.jsx77
-rw-r--r--server/sonar-web/src/main/js/apps/nav/templates/nav-search-empty.hbs1
-rw-r--r--server/sonar-web/src/main/js/apps/nav/templates/nav-search-item.hbs22
-rw-r--r--server/sonar-web/src/main/js/apps/nav/templates/nav-search.hbs8
-rw-r--r--server/sonar-web/src/main/js/apps/nav/templates/nav-shortcuts-help.hbs60
-rw-r--r--server/sonar-web/src/main/js/apps/permission-templates/app.js8
-rw-r--r--server/sonar-web/src/main/js/apps/permission-templates/app.jsx23
-rw-r--r--server/sonar-web/src/main/js/apps/permission-templates/create-view.js (renamed from server/sonar-web/src/main/js/apps/permission-templates/create-view.jsx)0
-rw-r--r--server/sonar-web/src/main/js/apps/permission-templates/delete-view.js (renamed from server/sonar-web/src/main/js/apps/permission-templates/delete-view.jsx)4
-rw-r--r--server/sonar-web/src/main/js/apps/permission-templates/form-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/permission-templates/groups-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/permission-templates/header.js (renamed from server/sonar-web/src/main/js/apps/permission-templates/header.jsx)0
-rw-r--r--server/sonar-web/src/main/js/apps/permission-templates/main.js (renamed from server/sonar-web/src/main/js/apps/permission-templates/main.jsx)0
-rw-r--r--server/sonar-web/src/main/js/apps/permission-templates/permission-template-defaults.js (renamed from server/sonar-web/src/main/js/apps/permission-templates/permission-template-defaults.jsx)0
-rw-r--r--server/sonar-web/src/main/js/apps/permission-templates/permission-template-set-defaults.js (renamed from server/sonar-web/src/main/js/apps/permission-templates/permission-template-set-defaults.jsx)0
-rw-r--r--server/sonar-web/src/main/js/apps/permission-templates/permission-template.js (renamed from server/sonar-web/src/main/js/apps/permission-templates/permission-template.jsx)0
-rw-r--r--server/sonar-web/src/main/js/apps/permission-templates/permission-templates.js (renamed from server/sonar-web/src/main/js/apps/permission-templates/permission-templates.jsx)0
-rw-r--r--server/sonar-web/src/main/js/apps/permission-templates/permissions-header.js (renamed from server/sonar-web/src/main/js/apps/permission-templates/permissions-header.jsx)0
-rw-r--r--server/sonar-web/src/main/js/apps/permission-templates/update-view.js (renamed from server/sonar-web/src/main/js/apps/permission-templates/update-view.jsx)0
-rw-r--r--server/sonar-web/src/main/js/apps/permission-templates/users-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/project-permissions/app.js15
-rw-r--r--server/sonar-web/src/main/js/apps/project-permissions/app.jsx23
-rw-r--r--server/sonar-web/src/main/js/apps/project-permissions/apply-template-view.js (renamed from server/sonar-web/src/main/js/apps/project-permissions/apply-template-view.jsx)4
-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/main.js (renamed from server/sonar-web/src/main/js/apps/project-permissions/main.jsx)0
-rw-r--r--server/sonar-web/src/main/js/apps/project-permissions/permissions-footer.js (renamed from server/sonar-web/src/main/js/apps/project-permissions/permissions-footer.jsx)0
-rw-r--r--server/sonar-web/src/main/js/apps/project-permissions/permissions-header.js (renamed from server/sonar-web/src/main/js/apps/project-permissions/permissions-header.jsx)0
-rw-r--r--server/sonar-web/src/main/js/apps/project-permissions/permissions.js (renamed from server/sonar-web/src/main/js/apps/project-permissions/permissions.jsx)0
-rw-r--r--server/sonar-web/src/main/js/apps/project-permissions/project.js (renamed from server/sonar-web/src/main/js/apps/project-permissions/project.jsx)0
-rw-r--r--server/sonar-web/src/main/js/apps/project-permissions/search.js (renamed from server/sonar-web/src/main/js/apps/project-permissions/search.jsx)0
-rw-r--r--server/sonar-web/src/main/js/apps/project-permissions/users-view.js8
-rw-r--r--server/sonar-web/src/main/js/apps/projects/app.js27
-rw-r--r--server/sonar-web/src/main/js/apps/projects/create-view.js6
-rw-r--r--server/sonar-web/src/main/js/apps/projects/delete-view.js6
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/actions-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/app.js8
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/delete-view.js6
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/details-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/form-view.js6
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/gate-condition-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/gate-conditions-delete-view.js6
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/gate-conditions-empty-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/gate-conditions-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/gate-projects-view.js6
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/gate-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/gates-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/header-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/intro-view.js4
-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-profiles/actions-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/app.js13
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/change-profile-parent-view.js6
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/copy-profile-view.js6
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/create-profile-view.js8
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/delete-profile-view.js6
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/helpers.js2
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/intro-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/layout.js4
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/profile-changelog-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/profile-comparison-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/profile-details-view.js6
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/profile-header-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/profile-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/profiles-empty-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/profiles-view.js7
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/rename-profile-view.js6
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/restore-built-in-profiles-view.js6
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/restore-profile-view.js8
-rw-r--r--server/sonar-web/src/main/js/apps/source-viewer/app.js15
-rw-r--r--server/sonar-web/src/main/js/apps/system/app.js4
-rw-r--r--server/sonar-web/src/main/js/apps/update-center/app.js14
-rw-r--r--server/sonar-web/src/main/js/apps/update-center/footer-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/update-center/header-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/update-center/layout.js4
-rw-r--r--server/sonar-web/src/main/js/apps/update-center/list-item-view.js7
-rw-r--r--server/sonar-web/src/main/js/apps/update-center/partials.js6
-rw-r--r--server/sonar-web/src/main/js/apps/update-center/plugin-changelog-view.js6
-rw-r--r--server/sonar-web/src/main/js/apps/update-center/search-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/users/app.js13
-rw-r--r--server/sonar-web/src/main/js/apps/users/change-password-view.js6
-rw-r--r--server/sonar-web/src/main/js/apps/users/deactivate-view.js6
-rw-r--r--server/sonar-web/src/main/js/apps/users/form-view.js6
-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.js4
-rw-r--r--server/sonar-web/src/main/js/apps/users/layout.js4
-rw-r--r--server/sonar-web/src/main/js/apps/users/list-footer-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/users/list-item-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/users/list-view.js1
-rw-r--r--server/sonar-web/src/main/js/apps/users/search-view.js4
226 files changed, 788 insertions, 1806 deletions
diff --git a/server/sonar-web/src/main/js/apps/account/app.js b/server/sonar-web/src/main/js/apps/account/app.js
index 0f441abacca..f552632c5f8 100644
--- a/server/sonar-web/src/main/js/apps/account/app.js
+++ b/server/sonar-web/src/main/js/apps/account/app.js
@@ -1,5 +1,6 @@
import $ from 'jquery';
import ChangePasswordView from './change-password-view';
+import '../../helpers/handlebars-helpers';
var shouldShowAvatars = window.SS && window.SS.lf && window.SS.lf.enableGravatar;
var favorites = $('.js-account-favorites tr');
@@ -8,8 +9,8 @@ function showExtraFavorites () {
favorites.removeClass('hidden');
}
-export default {
- start: function () {
+class App {
+ start () {
$('html').addClass('dashboard-page');
if (shouldShowAvatars) {
@@ -28,4 +29,6 @@ export default {
new ChangePasswordView().render();
});
}
-};
+}
+
+window.sonarqube.appStarted.then(options => new App().start(options));
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 e8f825f57b4..6bd5d992b21 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
@@ -1,9 +1,9 @@
import $ from 'jquery';
import ModalForm from '../../components/common/modal-form';
-import './templates';
+import Template from './templates/account-change-password.hbs';
export default ModalForm.extend({
- template: Templates['account-change-password'],
+ template: Template,
onFormSubmit: function (e) {
this._super(e);
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 5ccac8c097b..9ba96da7f41 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,10 +1,10 @@
import $ from 'jquery';
import Marionette from 'backbone.marionette';
-import './templates';
+import Template from './templates/api-documentation-action.hbs';
export default Marionette.ItemView.extend({
className: 'panel panel-vertical',
- template: Templates['api-documentation-action'],
+ template: Template,
modelEvents: {
'change': 'render'
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 5451cde9da7..f345685e8da 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
@@ -8,9 +8,12 @@ import List from './list';
import ListView from './list-view';
import FiltersView from './filters-view';
import SearchView from './search-view';
+import '../../helpers/handlebars-helpers';
var App = new Marionette.Application(),
- init = function (options) {
+ init = function () {
+ let options = window.sonarqube;
+
// State
this.state = new Backbone.Model({ internal: false });
this.state.match = function (test) {
@@ -61,9 +64,7 @@ var App = new Marionette.Application(),
};
App.on('start', function (options) {
- window.requestMessages().done(function () {
- init.call(App, options);
- });
+ init.call(App, options);
});
-export default App;
+window.sonarqube.appStarted.then(options => App.start(options));
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 aa54b532f2b..9ed8d763266 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,9 +1,9 @@
import _ from 'underscore';
import Marionette from 'backbone.marionette';
-import './templates';
+import Template from './templates/api-documentation-filters.hbs';
export default Marionette.ItemView.extend({
- template: Templates['api-documentation-filters'],
+ template: Template,
events: {
'change .js-toggle-internal': 'toggleInternal'
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 818ccfdde47..4b270ebbeec 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,8 +1,8 @@
import Marionette from 'backbone.marionette';
-import './templates';
+import Template from './templates/api-documentation-header.hbs';
export default Marionette.ItemView.extend({
- template: Templates['api-documentation-header'],
+ template: Template,
modelEvents: {
'change': 'render'
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 b23ffff12ff..6a8c1143b17 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,11 +1,11 @@
import _ from 'underscore';
import Marionette from 'backbone.marionette';
-import './templates';
+import Template from './templates/api-documentation-web-service.hbs';
export default Marionette.ItemView.extend({
tagName: 'a',
className: 'list-group-item',
- template: Templates['api-documentation-web-service'],
+ template: Template,
modelEvents: {
'change': 'render'
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 229b48ec560..88f40994d2c 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,8 +1,8 @@
import Marionette from 'backbone.marionette';
-import './templates';
+import Template from './templates/api-documentation-layout.hbs';
export default Marionette.LayoutView.extend({
- template: Templates['api-documentation-layout'],
+ template: Template,
regions: {
headerRegion: '.search-navigator-workspace-header',
diff --git a/server/sonar-web/src/main/js/apps/api-documentation/search-view.js b/server/sonar-web/src/main/js/apps/api-documentation/search-view.js
index 1635d8a2abf..737e909ca4a 100644
--- a/server/sonar-web/src/main/js/apps/api-documentation/search-view.js
+++ b/server/sonar-web/src/main/js/apps/api-documentation/search-view.js
@@ -1,9 +1,9 @@
import _ from 'underscore';
import Marionette from 'backbone.marionette';
-import './templates';
+import Template from './templates/api-documentation-search.hbs';
export default Marionette.ItemView.extend({
- template: Templates['api-documentation-search'],
+ template: Template,
ui: {
input: '.search-box-input'
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/app.js b/server/sonar-web/src/main/js/apps/background-tasks/app.js
index d69c1b58091..268ca65e336 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/app.js
+++ b/server/sonar-web/src/main/js/apps/background-tasks/app.js
@@ -1,11 +1,7 @@
import React from 'react';
import Main from './main';
-export default {
- start (options) {
- window.requestMessages().done(() => {
- let el = document.querySelector(options.el);
- React.render(<Main options={options}/>, el);
- });
- }
-};
+window.sonarqube.appStarted.then(options => {
+ let el = document.querySelector(options.el);
+ React.render(<Main options={options}/>, el);
+});
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/main.js b/server/sonar-web/src/main/js/apps/background-tasks/main.js
index 9545e8a76f3..cd981f76044 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/main.js
+++ b/server/sonar-web/src/main/js/apps/background-tasks/main.js
@@ -29,8 +29,8 @@ export default React.createClass({
},
getComponentFilter() {
- if (this.props.options.componentId) {
- return { componentId: this.props.options.componentId };
+ if (this.props.options.component) {
+ return { componentId: this.props.options.component.id };
} else {
return {};
}
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 e1e53516f05..61089511594 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
@@ -5,16 +5,20 @@ import Marionette from 'backbone.marionette';
import State from './models/state';
import Layout from './layout';
import Rules from './models/rules';
-import Facets from 'components/navigator/models/facets';
+import Facets from '../../components/navigator/models/facets';
import Controller from './controller';
-import Router from 'components/navigator/router';
+import Router from '../../components/navigator/router';
import WorkspaceListView from './workspace-list-view';
import WorkspaceHeaderView from './workspace-header-view';
import FacetsView from './facets-view';
import FiltersView from './filters-view';
+import './partials';
+import '../../helpers/handlebars-helpers';
var App = new Marionette.Application(),
- init = function (options) {
+ init = function () {
+ let options = window.sonarqube;
+
this.layout = new Layout({ el: options.el });
this.layout.render();
$('#footer').addClass('search-navigator-footer');
@@ -92,9 +96,9 @@ var appXHR = $.get(baseUrl + '/api/rules/app').done(function (r) {
});
App.on('start', function (options) {
- $.when(window.requestMessages(), appXHR).done(function () {
+ appXHR.done(function () {
init.call(App, options);
});
});
-export default App;
+window.sonarqube.appStarted.then(options => App.start(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 76e193d8f33..f8dcd2570a4 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
@@ -1,10 +1,10 @@
import $ from 'jquery';
import _ from 'underscore';
-import ModalFormView from 'components/common/modal-form';
-import './templates';
+import ModalFormView from '../../components/common/modal-form';
+import Template from './templates/coding-rules-bulk-change-modal.hbs';
export default ModalFormView.extend({
- template: Templates['coding-rules-bulk-change-modal'],
+ template: Template,
ui: function () {
return _.extend(ModalFormView.prototype.ui.apply(this, arguments), {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/bulk-change-popup-view.js b/server/sonar-web/src/main/js/apps/coding-rules/bulk-change-popup-view.js
index 6d6268f3ef6..881b84434de 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/bulk-change-popup-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/bulk-change-popup-view.js
@@ -1,11 +1,11 @@
import $ from 'jquery';
import _ from 'underscore';
-import PopupView from 'components/common/popup';
+import PopupView from '../../components/common/popup';
import BulkChangeModalView from './bulk-change-modal-view';
-import './templates';
+import Template from './templates/coding-rules-bulk-change-popup.hbs';
export default PopupView.extend({
- template: Templates['coding-rules-bulk-change-popup'],
+ template: Template,
events: {
'click .js-bulk-change': 'doAction'
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/confirm-dialog.js b/server/sonar-web/src/main/js/apps/coding-rules/confirm-dialog.js
new file mode 100644
index 00000000000..624f3e8b997
--- /dev/null
+++ b/server/sonar-web/src/main/js/apps/coding-rules/confirm-dialog.js
@@ -0,0 +1,43 @@
+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 (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/apps/coding-rules/controller.js b/server/sonar-web/src/main/js/apps/coding-rules/controller.js
index 2049cb8bf0c..e399ddb9acc 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/controller.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/controller.js
@@ -1,6 +1,6 @@
import $ from 'jquery';
import _ from 'underscore';
-import Controller from 'components/navigator/controller';
+import Controller from '../../components/navigator/controller';
import Rule from './models/rule';
import RuleDetailsView from './rule-details-view';
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets-view.js b/server/sonar-web/src/main/js/apps/coding-rules/facets-view.js
index c3da8bbe54b..22246af5046 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/facets-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/facets-view.js
@@ -1,4 +1,4 @@
-import FacetsView from 'components/navigator/facets-view';
+import FacetsView from '../../components/navigator/facets-view';
import BaseFacet from './facets/base-facet';
import QueryFacet from './facets/query-facet';
import KeyFacet from './facets/key-facet';
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 0f0de13b0de..35ae3641ba5 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
@@ -1,9 +1,9 @@
import _ from 'underscore';
import BaseFacet from './base-facet';
-import '../templates';
+import Template from '../templates/facets/coding-rules-severity-facet.hbs';
export default BaseFacet.extend({
- template: Templates['coding-rules-severity-facet'],
+ template: Template,
severities: ['BLOCKER', 'MINOR', 'CRITICAL', 'INFO', 'MAJOR'],
initialize: function (options) {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/available-since-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/available-since-facet.js
index 3f2f6a2839f..253c636bd8f 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/facets/available-since-facet.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/available-since-facet.js
@@ -1,9 +1,9 @@
import _ from 'underscore';
import BaseFacet from './base-facet';
-import '../templates';
+import Template from '../templates/facets/coding-rules-available-since-facet.hbs';
export default BaseFacet.extend({
- template: Templates['coding-rules-available-since-facet'],
+ template: Template,
events: function () {
return _.extend(BaseFacet.prototype.events.apply(this, arguments), {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/base-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/base-facet.js
index f02260069cb..ebdca1169e0 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/facets/base-facet.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/base-facet.js
@@ -1,9 +1,9 @@
-import BaseFacet from 'components/navigator/facets/base-facet';
-import '../templates';
+import BaseFacet from '../../../components/navigator/facets/base-facet';
+import Template from '../templates/facets/coding-rules-base-facet.hbs';
export default BaseFacet.extend({
className: 'search-navigator-facet-box',
- template: Templates['coding-rules-base-facet']
+ template: Template
});
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/characteristic-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/characteristic-facet.js
index 5463b4e13bc..9ab26b33caf 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/facets/characteristic-facet.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/characteristic-facet.js
@@ -1,10 +1,10 @@
import $ from 'jquery';
import _ from 'underscore';
import BaseFacet from './base-facet';
-import '../templates';
+import Template from '../templates/facets/coding-rules-characteristic-facet.hbs';
export default BaseFacet.extend({
- template: Templates['coding-rules-characteristic-facet'],
+ template: Template,
onRender: function () {
BaseFacet.prototype.onRender.apply(this, arguments);
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 c2499876610..ba35fe660ed 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
@@ -1,9 +1,9 @@
import _ from 'underscore';
import BaseFacet from './base-facet';
-import '../templates';
+import Template from '../templates/facets/coding-rules-custom-values-facet.hbs';
export default BaseFacet.extend({
- template: Templates['coding-rules-custom-values-facet'],
+ template: Template,
events: function () {
return _.extend(BaseFacet.prototype.events.apply(this, arguments), {
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 e3dc2c2cafc..ecf8ba9dde9 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
@@ -1,10 +1,10 @@
import $ from 'jquery';
import _ from 'underscore';
import BaseFacet from './base-facet';
-import '../templates';
+import Template from '../templates/facets/coding-rules-inheritance-facet.hbs';
export default BaseFacet.extend({
- template: Templates['coding-rules-inheritance-facet'],
+ template: Template,
initialize: function (options) {
this.listenTo(options.app.state, 'change:query', this.onQueryChange);
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/key-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/key-facet.js
index 4117345bd4b..b2854b5028a 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/facets/key-facet.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/key-facet.js
@@ -1,9 +1,9 @@
import BaseFacet from './base-facet';
import _ from 'underscore';
-import '../templates';
+import Template from '../templates/facets/coding-rules-key-facet.hbs';
export default BaseFacet.extend({
- template: Templates['coding-rules-key-facet'],
+ template: Template,
onRender: function () {
this.$el.toggleClass('hidden', !this.options.app.state.get('query').rule_key);
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/quality-profile-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/quality-profile-facet.js
index 5686d6b2cea..c04d56f93ee 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/facets/quality-profile-facet.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/quality-profile-facet.js
@@ -1,10 +1,10 @@
import $ from 'jquery';
import _ from 'underscore';
import BaseFacet from './base-facet';
-import '../templates';
+import Template from '../templates/facets/coding-rules-quality-profile-facet.hbs';
export default BaseFacet.extend({
- template: Templates['coding-rules-quality-profile-facet'],
+ template: Template,
events: function () {
return _.extend(BaseFacet.prototype.events.apply(this, arguments), {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/query-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/query-facet.js
index fe380885438..0b1216ca4bd 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/facets/query-facet.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/query-facet.js
@@ -1,9 +1,9 @@
import _ from 'underscore';
import BaseFacet from './base-facet';
-import '../templates';
+import Template from '../templates/facets/coding-rules-query-facet.hbs';
export default BaseFacet.extend({
- template: Templates['coding-rules-query-facet'],
+ template: Template,
events: function () {
return _.extend(BaseFacet.prototype.events.apply(this, arguments), {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/severity-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/severity-facet.js
index 6ab2c4f8a4d..9c019f36b95 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/facets/severity-facet.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/severity-facet.js
@@ -1,9 +1,9 @@
import _ from 'underscore';
import BaseFacet from './base-facet';
-import '../templates';
+import Template from '../templates/facets/coding-rules-severity-facet.hbs';
export default BaseFacet.extend({
- template: Templates['coding-rules-severity-facet'],
+ template: Template,
severities: ['BLOCKER', 'MINOR', 'CRITICAL', 'INFO', 'MAJOR'],
sortValues: function (values) {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/template-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/template-facet.js
index bf819b33b5f..13c5cd7b405 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/facets/template-facet.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/template-facet.js
@@ -1,9 +1,9 @@
import $ from 'jquery';
import BaseFacet from './base-facet';
-import '../templates';
+import Template from '../templates/facets/coding-rules-template-facet.hbs';
export default BaseFacet.extend({
- template: Templates['coding-rules-template-facet'],
+ template: Template,
onRender: function () {
BaseFacet.prototype.onRender.apply(this, arguments);
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 37644b06ee9..ff902dec733 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,10 +1,10 @@
import _ from 'underscore';
import Marionette from 'backbone.marionette';
import ManualRuleCreationView from './rule/manual-rule-creation-view';
-import './templates';
+import Template from './templates/coding-rules-filters.hbs';
export default Marionette.ItemView.extend({
- template: Templates['coding-rules-filters'],
+ template: Template,
events: {
'click .js-create-manual-rule': 'createManualRule'
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 ee83c4d684d..ef24f8ce321 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,9 +1,9 @@
import $ from 'jquery';
import Marionette from 'backbone.marionette';
-import './templates';
+import Template from './templates/coding-rules-layout.hbs';
export default Marionette.LayoutView.extend({
- template: Templates['coding-rules-layout'],
+ template: Template,
regions: {
filtersRegion: '.search-navigator-filters',
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/models/state.js b/server/sonar-web/src/main/js/apps/coding-rules/models/state.js
index da1dcad586c..952bff0d252 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/models/state.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/models/state.js
@@ -1,4 +1,4 @@
-import State from 'components/navigator/models/state';
+import State from '../../../components/navigator/models/state';
export default State.extend({
defaults: {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/partials.js b/server/sonar-web/src/main/js/apps/coding-rules/partials.js
new file mode 100644
index 00000000000..9eb9de128e6
--- /dev/null
+++ b/server/sonar-web/src/main/js/apps/coding-rules/partials.js
@@ -0,0 +1,8 @@
+import Handlebars from 'hbsfy/runtime';
+import ActivationPartial from './templates/_coding-rules-workspace-list-item-activation.hbs';
+import FacetHeaderPartial from './templates/facets/_coding-rules-facet-header.hbs';
+import MarkdownTipsPartial from '../../components/common/templates/_markdown-tips.hbs';
+
+Handlebars.registerPartial('_coding-rules-workspace-list-item-activation', ActivationPartial);
+Handlebars.registerPartial('_coding-rules-facet-header', FacetHeaderPartial);
+Handlebars.registerPartial('_markdown-tips', MarkdownTipsPartial);
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 c33ea38e401..f8dee5b02cd 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
@@ -11,11 +11,12 @@ import CustomRulesView from './rule/custom-rules-view';
import ManualRuleCreationView from './rule/manual-rule-creation-view';
import CustomRuleCreationView from './rule/custom-rule-creation-view';
import IssuesView from './rule/rule-issues-view';
-import './templates';
+import Template from './templates/coding-rules-rule-details.hbs';
+import confirmDialog from './confirm-dialog';
export default Marionette.LayoutView.extend({
className: 'coding-rule-details',
- template: Templates['coding-rules-rule-details'],
+ template: Template,
regions: {
metaRegion: '.js-rule-meta',
@@ -128,7 +129,7 @@ export default Marionette.LayoutView.extend({
deleteRule: function () {
var that = this,
ruleType = this.model.has('templateKey') ? 'custom' : 'manual';
- window.confirmDialog({
+ confirmDialog({
title: t('delete'),
html: tp('coding_rules.delete.' + ruleType + '.confirm', this.model.get('name')),
yesHandler: function () {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule-filter-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule-filter-view.js
index bb9acd5ccef..b2dc3619cf9 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/rule-filter-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/rule-filter-view.js
@@ -1,10 +1,10 @@
import $ from 'jquery';
import _ from 'underscore';
-import ActionOptionsView from 'components/common/action-options-view';
-import './templates';
+import ActionOptionsView from '../../components/common/action-options-view';
+import Template from './templates/coding-rules-rule-filter-form.hbs';
export default ActionOptionsView.extend({
- template: Templates['coding-rules-rule-filter-form'],
+ template: Template,
selectOption: function (e) {
var property = $(e.currentTarget).data('property'),
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 dbaf9af0d64..d3e9d49ba6b 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
@@ -1,10 +1,12 @@
import $ from 'jquery';
import _ from 'underscore';
-import ModalFormView from 'components/common/modal-form';
-import '../templates';
+import ModalFormView from '../../../components/common/modal-form';
+import Template from '../templates/rule/coding-rules-custom-rule-creation.hbs';
+import {csvEscape} from '../../../helpers/csv';
+import latinize from '../../../helpers/latinize';
export default ModalFormView.extend({
- template: Templates['coding-rules-custom-rule-creation'],
+ template: Template,
ui: function () {
return _.extend(ModalFormView.prototype.ui.apply(this, arguments), {
@@ -38,7 +40,7 @@ export default ModalFormView.extend({
generateKey: function () {
if (!this.keyModifiedByUser && this.ui.customRuleCreationKey) {
- var generatedKey = this.ui.customRuleCreationName.val().latinize().replace(/[^A-Za-z0-9]/g, '_');
+ var generatedKey = latinize(this.ui.customRuleCreationName.val()).replace(/[^A-Za-z0-9]/g, '_');
this.ui.customRuleCreationKey.val(generatedKey);
}
},
@@ -107,7 +109,7 @@ export default ModalFormView.extend({
};
}).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);
},
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 a47aef607b8..43f577429a9 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,11 +1,12 @@
import $ from 'jquery';
import _ from 'underscore';
import Marionette from 'backbone.marionette';
-import '../templates';
+import Template from '../templates/rule/coding-rules-custom-rule.hbs';
+import confirmDialog from '../confirm-dialog';
export default Marionette.ItemView.extend({
tagName: 'tr',
- template: Templates['coding-rules-custom-rule'],
+ template: Template,
modelEvents: {
'change': 'render'
@@ -17,7 +18,7 @@ export default Marionette.ItemView.extend({
deleteRule: function () {
var that = this;
- window.confirmDialog({
+ confirmDialog({
title: t('delete'),
html: t('are_you_sure'),
yesHandler: function () {
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 7486abbb573..c550708d0aa 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
@@ -2,10 +2,10 @@ import _ from 'underscore';
import Marionette from 'backbone.marionette';
import CustomRuleView from './custom-rule-view';
import CustomRuleCreationView from './custom-rule-creation-view';
-import '../templates';
+import Template from '../templates/rule/coding-rules-custom-rules.hbs';
export default Marionette.CompositeView.extend({
- template: Templates['coding-rules-custom-rules'],
+ template: Template,
childView: CustomRuleView,
childViewContainer: '#coding-rules-detail-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 f0890a06e08..d5c5dd07fbf 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
@@ -1,10 +1,11 @@
import $ from 'jquery';
import _ from 'underscore';
-import ModalFormView from 'components/common/modal-form';
-import '../templates';
+import ModalFormView from '../../../components/common/modal-form';
+import Template from '../templates/rule/coding-rules-manual-rule-creation.hbs';
+import latinize from '../../../helpers/latinize';
export default ModalFormView.extend({
- template: Templates['coding-rules-manual-rule-creation'],
+ template: Template,
ui: function () {
return _.extend(ModalFormView.prototype.ui.apply(this.arguments), {
@@ -44,7 +45,7 @@ export default ModalFormView.extend({
generateKey: function () {
if (!this.keyModifiedByUser && this.ui.manualRuleCreationKey) {
- var generatedKey = this.ui.manualRuleCreationName.val().latinize().replace(/[^A-Za-z0-9]/g, '_');
+ var generatedKey = latinize(this.ui.manualRuleCreationName.val()).replace(/[^A-Za-z0-9]/g, '_');
this.ui.manualRuleCreationKey.val(generatedKey);
}
},
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 8ea8ce0496d..e20be1987e7 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,11 +1,12 @@
import $ from 'jquery';
import _ from 'underscore';
import Backbone from 'backbone';
-import ModalForm from 'components/common/modal-form';
-import '../templates';
+import ModalForm from '../../../components/common/modal-form';
+import Template from '../templates/rule/coding-rules-profile-activation.hbs';
+import {csvEscape} from '../../../helpers/csv';
export default ModalForm.extend({
- template: Templates['coding-rules-profile-activation'],
+ template: Template,
ui: function () {
return _.extend(this._super(), {
@@ -62,7 +63,7 @@ export default ModalForm.extend({
};
}).get(),
paramsHash = (params.map(function (param) {
- return param.key + '=' + window.csvEscape(param.value);
+ return param.key + '=' + csvEscape(param.value);
})).join(';');
if (this.model) {
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 e49e2bb2a75..f169121e376 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,10 +1,11 @@
import $ from 'jquery';
import _ from 'underscore';
import Marionette from 'backbone.marionette';
-import '../templates';
+import Template from '../templates/rule/coding-rules-rule-description.hbs';
+import confirmDialog from '../confirm-dialog';
export default Marionette.ItemView.extend({
- template: Templates['coding-rules-rule-description'],
+ template: Template,
modelEvents: {
'change': 'render'
@@ -62,7 +63,7 @@ export default Marionette.ItemView.extend({
removeExtendedDescription: function () {
var that = this;
- window.confirmDialog({
+ confirmDialog({
html: t('coding_rules.remove_extended_description.confirm'),
yesHandler: function () {
that.ui.extendDescriptionText.val('');
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 0bd9da9bdac..fa4e771efd3 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,10 +1,10 @@
import $ from 'jquery';
import _ from 'underscore';
import Marionette from 'backbone.marionette';
-import '../templates';
+import Template from '../templates/rule/coding-rules-rule-issues.hbs';
export default Marionette.ItemView.extend({
- template: Templates['coding-rules-rule-issues'],
+ template: Template,
initialize: function () {
var that = this;
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 f2b947343dd..73540c26b77 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
@@ -2,10 +2,10 @@ import $ from 'jquery';
import _ from 'underscore';
import Marionette from 'backbone.marionette';
import RuleFilterMixin from './rule-filter-mixin';
-import '../templates';
+import Template from '../templates/rule/coding-rules-rule-meta.hbs';
export default Marionette.ItemView.extend(RuleFilterMixin).extend({
- template: Templates['coding-rules-rule-meta'],
+ template: Template,
modelEvents: {
'change': 'render'
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 fc34437c23c..54f85d7eaa1 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,9 +1,9 @@
import _ from 'underscore';
import Marionette from 'backbone.marionette';
-import '../templates';
+import Template from '../templates/rule/coding-rules-rule-parameters.hbs';
export default Marionette.ItemView.extend({
- template: Templates['coding-rules-rule-parameters'],
+ template: Template,
modelEvents: {
'change': 'render'
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 40e09aed4a4..1c74fc9dd63 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
@@ -3,11 +3,12 @@ import _ from 'underscore';
import Backbone from 'backbone';
import Marionette from 'backbone.marionette';
import ProfileActivationView from './profile-activation-view';
-import '../templates';
+import Template from '../templates/rule/coding-rules-rule-profile.hbs';
+import confirmDialog from '../confirm-dialog';
export default Marionette.ItemView.extend({
tagName: 'tr',
- template: Templates['coding-rules-rule-profile'],
+ template: Template,
modelEvents: {
'change': 'render'
@@ -48,7 +49,7 @@ export default Marionette.ItemView.extend({
revert: function () {
var that = this,
ruleKey = this.options.rule.get('key');
- window.confirmDialog({
+ confirmDialog({
title: t('coding_rules.revert_to_parent_definition'),
html: tp('coding_rules.revert_to_parent_definition.confirm', this.getParent().name),
yesHandler: function () {
@@ -70,7 +71,7 @@ export default Marionette.ItemView.extend({
deactivate: function () {
var that = this,
ruleKey = this.options.rule.get('key');
- window.confirmDialog({
+ confirmDialog({
title: t('coding_rules.deactivate'),
html: tp('coding_rules.deactivate.confirm'),
yesHandler: function () {
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 f449d944473..5f9f497acba 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
@@ -2,10 +2,10 @@ import _ from 'underscore';
import Marionette from 'backbone.marionette';
import ProfileView from './rule-profile-view';
import ProfileActivationView from './profile-activation-view';
-import '../templates';
+import Template from '../templates/rule/coding-rules-rule-profiles.hbs';
export default Marionette.CompositeView.extend({
- template: Templates['coding-rules-rule-profiles'],
+ template: Template,
childView: ProfileView,
childViewContainer: '#coding-rules-detail-quality-profiles',
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/workspace-header-view.js b/server/sonar-web/src/main/js/apps/coding-rules/workspace-header-view.js
index 74b1a14dc50..01028a952f6 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/workspace-header-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/workspace-header-view.js
@@ -1,11 +1,11 @@
import $ from 'jquery';
import _ from 'underscore';
-import WorkspaceHeaderView from 'components/navigator/workspace-header-view';
+import WorkspaceHeaderView from '../../components/navigator/workspace-header-view';
import BulkChangePopup from './bulk-change-popup-view';
-import './templates';
+import Template from './templates/coding-rules-workspace-header.hbs';
export default WorkspaceHeaderView.extend({
- template: Templates['coding-rules-workspace-header'],
+ template: Template,
events: function () {
return _.extend(WorkspaceHeaderView.prototype.events.apply(this, arguments), {
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 4fda1255c8c..e4e70351b97 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,14 +1,15 @@
import $ from 'jquery';
import _ from 'underscore';
import Backbone from 'backbone';
-import WorkspaceListItemView from 'components/navigator/workspace-list-item-view';
+import WorkspaceListItemView from '../../components/navigator/workspace-list-item-view';
import ProfileActivationView from './rule/profile-activation-view';
import RuleFilterMixin from './rule/rule-filter-mixin';
-import './templates';
+import Template from './templates/coding-rules-workspace-list-item.hbs';
+import confirmDialog from './confirm-dialog';
export default WorkspaceListItemView.extend(RuleFilterMixin).extend({
className: 'coding-rule',
- template: Templates['coding-rules-workspace-list-item'],
+ template: Template,
modelEvents: {
'change': 'render'
@@ -60,7 +61,7 @@ export default WorkspaceListItemView.extend(RuleFilterMixin).extend({
var that = this,
ruleKey = this.model.get('key'),
activation = this.model.get('activation');
- window.confirmDialog({
+ confirmDialog({
title: t('coding_rules.deactivate'),
html: tp('coding_rules.deactivate.confirm'),
yesHandler: function () {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-view.js b/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-view.js
index 252d5a093ce..1d7036b593e 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-view.js
@@ -1,10 +1,10 @@
-import WorkspaceListView from 'components/navigator/workspace-list-view';
+import WorkspaceListView from '../../components/navigator/workspace-list-view';
import WorkspaceListItemView from './workspace-list-item-view';
import WorkspaceListEmptyView from './workspace-list-empty-view';
-import './templates';
+import Template from './templates/coding-rules-workspace-list.hbs';
export default WorkspaceListView.extend({
- template: Templates['coding-rules-workspace-list'],
+ template: Template,
childView: WorkspaceListItemView,
childViewContainer: '.js-list',
emptyView: WorkspaceListEmptyView,
diff --git a/server/sonar-web/src/main/js/apps/issues/app-context.js b/server/sonar-web/src/main/js/apps/component-issues/app.js
index 8d28597d056..8cf2fddb3eb 100644
--- a/server/sonar-web/src/main/js/apps/issues/app-context.js
+++ b/server/sonar-web/src/main/js/apps/component-issues/app.js
@@ -2,20 +2,24 @@ import $ from 'jquery';
import _ from 'underscore';
import Backbone from 'backbone';
import Marionette from 'backbone.marionette';
-import State from './models/state';
-import Layout from './layout';
-import Issues from './models/issues';
-import Facets from 'components/navigator/models/facets';
-import Filters from './models/filters';
-import Controller from './controller';
-import Router from './router';
-import WorkspaceListView from './workspace-list-view';
-import WorkspaceHeaderView from './workspace-header-view';
-import FacetsView from './facets-view';
-import './helpers/format-facet-value';
+import State from '../issues/models/state';
+import Layout from '../issues/layout';
+import Issues from '../issues/models/issues';
+import Facets from '../../components/navigator/models/facets';
+import Filters from '../issues/models/filters';
+import Controller from '../issues/controller';
+import Router from '../issues/router';
+import WorkspaceListView from '../issues/workspace-list-view';
+import WorkspaceHeaderView from '../issues/workspace-header-view';
+import FacetsView from './../issues/facets-view';
+import './../issues/helpers/format-facet-value';
+import '../issues/partials';
+import '../../helpers/handlebars-helpers';
var App = new Marionette.Application(),
- init = function (options) {
+ init = function () {
+ let options = window.sonarqube;
+
this.config = options.config;
this.state = new State({
isContext: true,
@@ -87,11 +91,7 @@ App.updateContextFacets = function () {
};
App.on('start', function (options) {
- $.when(window.requestMessages()).done(function () {
- init.call(App, options);
- });
+ init.call(App, options);
});
-export default App;
-
-
+window.sonarqube.appStarted.then(options => App.start(options)); \ No newline at end of file
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 5d6c1c2b16c..81d58f58d84 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
@@ -4,6 +4,7 @@ import CustomMeasures from './custom-measures';
import HeaderView from './header-view';
import ListView from './list-view';
import ListFooterView from './list-footer-view';
+import '../../helpers/handlebars-helpers';
var App = new Marionette.Application(),
init = function (options) {
@@ -15,13 +16,13 @@ var App = new Marionette.Application(),
// Collection
this.customMeasures = new CustomMeasures({
- projectId: options.projectId
+ projectId: options.component.id
});
// Header View
this.headerView = new HeaderView({
collection: this.customMeasures,
- projectId: options.projectId
+ projectId: options.component.id
});
this.layout.headerRegion.show(this.headerView);
@@ -42,10 +43,8 @@ var App = new Marionette.Application(),
};
App.on('start', function (options) {
- window.requestMessages().done(function () {
- init.call(App, options);
- });
+ init.call(App, options);
});
-export default App;
+window.sonarqube.appStarted.then(options => App.start(options));
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 6798c1259a3..74fbd979adc 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
@@ -1,8 +1,8 @@
-import ModalForm from 'components/common/modal-form';
-import './templates';
+import ModalForm from '../../components/common/modal-form';
+import Template from './templates/custom-measures-delete.hbs';
export default ModalForm.extend({
- template: Templates['custom-measures-delete'],
+ template: Template,
onFormSubmit: function (e) {
this._super(e);
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 d86e0176b30..f7af5500cd0 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
@@ -1,10 +1,10 @@
import _ from 'underscore';
-import ModalForm from 'components/common/modal-form';
-import Metrics from 'apps/metrics/metrics';
-import './templates';
+import ModalForm from '../../components/common/modal-form';
+import Metrics from '../metrics/metrics';
+import Template from './templates/custom-measures-form.hbs';
export default ModalForm.extend({
- template: Templates['custom-measures-form'],
+ template: Template,
initialize: function () {
this.metrics = new Metrics();
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 02ee2a795c3..adf99c5e384 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,9 +1,9 @@
import Marionette from 'backbone.marionette';
import CreateView from './create-view';
-import './templates';
+import Template from './templates/custom-measures-header.hbs';
export default Marionette.ItemView.extend({
- template: Templates['custom-measures-header'],
+ template: Template,
events: {
'click #custom-measures-create': 'onCreateClick'
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 92ac6de28b1..a2c22f9477e 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,8 +1,8 @@
import Marionette from 'backbone.marionette';
-import './templates';
+import Template from './templates/custom-measures-layout.hbs';
export default Marionette.LayoutView.extend({
- template: Templates['custom-measures-layout'],
+ template: Template,
regions: {
headerRegion: '#custom-measures-header',
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 e917ddb294a..24906a35318 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,9 +1,9 @@
import _ from 'underscore';
import Marionette from 'backbone.marionette';
-import './templates';
+import Template from './templates/custom-measures-list-footer.hbs';
export default Marionette.ItemView.extend({
- template: Templates['custom-measures-list-footer'],
+ template: Template,
collectionEvents: {
'all': 'render'
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 7b7cb5aa6e1..7ae08cfe87b 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,11 +1,11 @@
import Marionette from 'backbone.marionette';
import UpdateView from './update-view';
import DeleteView from './delete-view';
-import './templates';
+import Template from './templates/custom-measures-list-item.hbs';
export default Marionette.ItemView.extend({
tagName: 'tr',
- template: Templates['custom-measures-list-item'],
+ template: Template,
events: {
'click .js-custom-measure-update': 'onUpdateClick',
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 2d38eae4d1d..7b45f899947 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,9 +1,9 @@
import Marionette from 'backbone.marionette';
import ListItemView from './list-item-view';
-import './templates';
+import Template from './templates/custom-measures-list.hbs';
export default Marionette.CompositeView.extend({
- template: Templates['custom-measures-list'],
+ template: Template,
childView: ListItemView,
childViewContainer: 'tbody'
});
diff --git a/server/sonar-web/src/main/js/apps/dashboard/app.js b/server/sonar-web/src/main/js/apps/dashboard/app.js
new file mode 100644
index 00000000000..aa5e99b4486
--- /dev/null
+++ b/server/sonar-web/src/main/js/apps/dashboard/app.js
@@ -0,0 +1,152 @@
+import $ from 'jquery';
+
+window.Portal = function (options) {
+ this.initialize(options);
+};
+
+window.Portal.prototype = {
+
+ initialize: function (options) {
+ this.options = options;
+ if (!this.options.editorEnabled) {
+ return;
+ }
+ this.createAllSortables();
+ this.lastSaveString = '';
+ this.saveDashboardsState();
+ },
+
+
+ createAllSortables: function () {
+ var that = this,
+ blocks = $('.' + this.options.block),
+ columnHandle = $('.' + this.options.columnHandle),
+ draggable,
+
+ onDragLeave = function (e) {
+ $(e.currentTarget).removeClass(that.options.hoverClass);
+ },
+
+ onDrop = function (e) {
+ e.preventDefault();
+ draggable.detach().insertBefore($(e.currentTarget));
+ onDragLeave(e);
+ that.saveDashboardsState();
+ };
+
+ blocks
+ .prop('draggable', true)
+ .on('selectstart', function () {
+ this.dragDrop();
+ return false;
+ })
+ .on('dragstart', function (e) {
+ e.originalEvent.dataTransfer.setData('Text', 'drag');
+ draggable = $(this);
+ columnHandle.show();
+ })
+ .on('dragover', function (e) {
+ if (draggable.prop('id') !== $(this).prop('id')) {
+ e.preventDefault();
+ $(e.currentTarget).addClass(that.options.hoverClass);
+ }
+ })
+ .on('drop', onDrop)
+ .on('dragleave', onDragLeave);
+
+ columnHandle
+ .on('dragover', function (e) {
+ e.preventDefault();
+ $(e.currentTarget).addClass(that.options.hoverClass);
+ })
+ .on('drop', onDrop)
+ .on('dragleave', onDragLeave);
+ },
+
+
+ highlightWidget: function (widgetId) {
+ var block = $('#block_' + widgetId),
+ options = this.options;
+ block.css('background-color', options.highlightStartColor);
+ setTimeout(function () {
+ block.css('background-color', options.highlightEndColor);
+ }, this.options.highlightDuration);
+ },
+
+
+ saveDashboardsState: function () {
+ var options = this.options,
+ result = $('.' + this.options.column).map(function () {
+ var blocks = $(this).find('.' + options.block);
+ $(this).find('.' + options.columnHandle).toggle(blocks.length === 0);
+
+ return blocks.map(function () {
+ return $(this).prop('id').substring(options.block.length + 1);
+ }).get().join(',');
+ }).get().join(';');
+
+ if (result === this.lastSaveString) {
+ return;
+ }
+
+ var firstTime = this.lastSaveString === '';
+ this.lastSaveString = result;
+
+ if (firstTime) {
+ return;
+ }
+
+ if (this.options.saveUrl) {
+ var postBody = this.options.dashboardState + '=' + encodeURIComponent(result);
+
+ $.ajax({
+ url: this.options.saveUrl,
+ type: 'POST',
+ data: postBody
+ });
+ }
+ },
+
+
+ editWidget: function (widgetId) {
+ $('#widget_title_' + widgetId).hide();
+ $('#widget_' + widgetId).hide();
+ $('#widget_props_' + widgetId).show();
+ $($('#block_' + widgetId + ' a.link-action')[0]).hide();
+ },
+
+
+ cancelEditWidget: function (widgetId) {
+ $('widget_title_' + widgetId).show();
+ $('#widget_' + widgetId).show();
+ $('#widget_props_' + widgetId).hide();
+ $($('#block_' + widgetId + ' a.link-action')[0]).show();
+ },
+
+
+ deleteWidget: function (element) {
+ $(element).closest('.' + this.options.block).remove();
+ this.saveDashboardsState();
+ }
+};
+
+
+window.autoResize = function (everyMs, callback) {
+ var debounce = _.debounce(callback, everyMs);
+ $(window).on('resize', debounce);
+};
+
+
+$(function () {
+ var $sidebar = jQuery('#sidebar');
+ if ($sidebar.length > 0) {
+ var $window = jQuery(window),
+ topOffset = $sidebar.offset().top;
+ $window.on('scroll', function () {
+ var scrollTop = $window.scrollTop(),
+ scrollLeft = $window.scrollLeft();
+ $sidebar.toggleClass('sticky', scrollTop > topOffset);
+ $sidebar.css('left', -scrollLeft + 10);
+ });
+ }
+});
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 f860933924f..c0dfdde6e73 100644
--- a/server/sonar-web/src/main/js/apps/drilldown/app.js
+++ b/server/sonar-web/src/main/js/apps/drilldown/app.js
@@ -1,9 +1,11 @@
import $ from 'jquery';
import Marionette from 'backbone.marionette';
import SourceViewer from '../../components/source-viewer/main';
+import '../../helpers/handlebars-helpers';
var App = new Marionette.Application(),
- init = function (options) {
+ init = function () {
+ let options = window.sonarqube;
App.addRegions({ viewerRegion: options.el });
$('.js-drilldown-link').on('click', function (e) {
e.preventDefault();
@@ -22,9 +24,7 @@ var App = new Marionette.Application(),
};
App.on('start', function (options) {
- window.requestMessages().done(function () {
- init.call(App, options);
- });
+ init.call(App, options);
});
-export default App;
+window.sonarqube.appStarted.then(options => App.start(options));
diff --git a/server/sonar-web/src/main/js/apps/global-permissions/app.js b/server/sonar-web/src/main/js/apps/global-permissions/app.js
new file mode 100644
index 00000000000..f010e11b6e0
--- /dev/null
+++ b/server/sonar-web/src/main/js/apps/global-permissions/app.js
@@ -0,0 +1,8 @@
+import React from 'react';
+import Main from './main';
+import '../../helpers/handlebars-helpers';
+
+window.sonarqube.appStarted.then(options => {
+ var el = document.querySelector(options.el);
+ React.render(<Main/>, el);
+});
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
deleted file mode 100644
index f35eeceda98..00000000000
--- a/server/sonar-web/src/main/js/apps/global-permissions/app.jsx
+++ /dev/null
@@ -1,11 +0,0 @@
-import React from 'react';
-import Main from './main';
-
-export default {
- start(options) {
- window.requestMessages().done(() => {
- 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 f6369ea191a..9e8393dbd1f 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
@@ -1,6 +1,6 @@
-import Modal from 'components/common/modals';
-import 'components/common/select-list';
-import './templates';
+import Modal from '../../components/common/modals';
+import Template from './templates/global-permissions-groups.hbs';
+import '../../components/common/select-list';
function getSearchUrl (permission, project) {
var url = baseUrl + '/api/permissions/groups?ps=100&permission=' + permission;
@@ -19,7 +19,7 @@ function getExtra (permission, project) {
}
export default Modal.extend({
- template: Templates['global-permissions-groups'],
+ template: Template,
onRender: function () {
this._super();
diff --git a/server/sonar-web/src/main/js/apps/global-permissions/main.jsx b/server/sonar-web/src/main/js/apps/global-permissions/main.js
index 11f6b032ebf..11f6b032ebf 100644
--- a/server/sonar-web/src/main/js/apps/global-permissions/main.jsx
+++ b/server/sonar-web/src/main/js/apps/global-permissions/main.js
diff --git a/server/sonar-web/src/main/js/apps/global-permissions/permission-groups.jsx b/server/sonar-web/src/main/js/apps/global-permissions/permission-groups.js
index 7a38d84c0a6..7a38d84c0a6 100644
--- a/server/sonar-web/src/main/js/apps/global-permissions/permission-groups.jsx
+++ b/server/sonar-web/src/main/js/apps/global-permissions/permission-groups.js
diff --git a/server/sonar-web/src/main/js/apps/global-permissions/permission-users-groups-mixin.jsx b/server/sonar-web/src/main/js/apps/global-permissions/permission-users-groups-mixin.js
index 91da5b747bb..91da5b747bb 100644
--- a/server/sonar-web/src/main/js/apps/global-permissions/permission-users-groups-mixin.jsx
+++ b/server/sonar-web/src/main/js/apps/global-permissions/permission-users-groups-mixin.js
diff --git a/server/sonar-web/src/main/js/apps/global-permissions/permission-users.jsx b/server/sonar-web/src/main/js/apps/global-permissions/permission-users.js
index aaed2ab0014..aaed2ab0014 100644
--- a/server/sonar-web/src/main/js/apps/global-permissions/permission-users.jsx
+++ b/server/sonar-web/src/main/js/apps/global-permissions/permission-users.js
diff --git a/server/sonar-web/src/main/js/apps/global-permissions/permission.jsx b/server/sonar-web/src/main/js/apps/global-permissions/permission.js
index 1a5f993a90e..1a5f993a90e 100644
--- a/server/sonar-web/src/main/js/apps/global-permissions/permission.jsx
+++ b/server/sonar-web/src/main/js/apps/global-permissions/permission.js
diff --git a/server/sonar-web/src/main/js/apps/global-permissions/permissions-list.jsx b/server/sonar-web/src/main/js/apps/global-permissions/permissions-list.js
index e019fbcbfec..e019fbcbfec 100644
--- a/server/sonar-web/src/main/js/apps/global-permissions/permissions-list.jsx
+++ b/server/sonar-web/src/main/js/apps/global-permissions/permissions-list.js
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 61ad9371166..cb01982c291 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
@@ -1,6 +1,6 @@
-import Modal from 'components/common/modals';
-import 'components/common/select-list';
-import './templates';
+import Modal from '../../components/common/modals';
+import Template from './templates/global-permissions-users.hbs';
+import '../../components/common/select-list';
function getSearchUrl (permission, project) {
var url = baseUrl + '/api/permissions/users?ps=100&permission=' + permission;
@@ -19,7 +19,7 @@ function getExtra (permission, project) {
}
export default Modal.extend({
- template: Templates['global-permissions-users'],
+ template: Template,
onRender: function () {
this._super();
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 8965f3ecea7..6f9bfd0c44f 100644
--- a/server/sonar-web/src/main/js/apps/groups/app.js
+++ b/server/sonar-web/src/main/js/apps/groups/app.js
@@ -5,9 +5,12 @@ import HeaderView from './header-view';
import SearchView from './search-view';
import ListView from './list-view';
import ListFooterView from './list-footer-view';
+import '../../helpers/handlebars-helpers';
var App = new Marionette.Application(),
- init = function (options) {
+ init = function () {
+ let options = window.sonarqube;
+
// Layout
this.layout = new Layout({ el: options.el });
this.layout.render();
@@ -35,12 +38,10 @@ var App = new Marionette.Application(),
this.groups.fetch();
};
-App.on('start', function (options) {
- window.requestMessages().done(function () {
- init.call(App, options);
- });
+App.on('start', function () {
+ init.call(App);
});
-export default App;
+window.sonarqube.appStarted.then(options => App.start(options));
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 272a0a85bbc..6192a4dd153 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
@@ -1,8 +1,8 @@
-import ModalForm from 'components/common/modal-form';
-import './templates';
+import ModalForm from '../../components/common/modal-form';
+import Template from './templates/groups-delete.hbs';
export default ModalForm.extend({
- template: Templates['groups-delete'],
+ template: Template,
onFormSubmit: function (e) {
this._super(e);
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 5b541f1ae12..abd64842d3c 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
@@ -1,8 +1,8 @@
-import ModalForm from 'components/common/modal-form';
-import './templates';
+import ModalForm from '../../components/common/modal-form';
+import Template from './templates/groups-form.hbs';
export default ModalForm.extend({
- template: Templates['groups-form'],
+ template: Template,
onRender: function () {
this._super();
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 bd7226176b2..e4a118f2822 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,9 +1,9 @@
import Marionette from 'backbone.marionette';
import CreateView from './create-view';
-import './templates';
+import Template from './templates/groups-header.hbs';
export default Marionette.ItemView.extend({
- template: Templates['groups-header'],
+ template: Template,
events: {
'click #groups-create': 'onCreateClick'
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 ba1f58e81fc..52e9e96901d 100644
--- a/server/sonar-web/src/main/js/apps/groups/layout.js
+++ b/server/sonar-web/src/main/js/apps/groups/layout.js
@@ -1,8 +1,8 @@
import Marionette from 'backbone.marionette';
-import './templates';
+import Template from './templates/groups-layout.hbs';
export default Marionette.LayoutView.extend({
- template: Templates['groups-layout'],
+ template: Template,
regions: {
headerRegion: '#groups-header',
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 53dc3e7acaa..74953a7a601 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,9 +1,9 @@
import _ from 'underscore';
import Marionette from 'backbone.marionette';
-import './templates';
+import Template from './templates/groups-list-footer.hbs';
export default Marionette.ItemView.extend({
- template: Templates['groups-list-footer'],
+ template: Template,
collectionEvents: {
'all': 'render'
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 43278c2ac6e..968218d1c4c 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
@@ -3,12 +3,12 @@ import Marionette from 'backbone.marionette';
import UpdateView from './update-view';
import DeleteView from './delete-view';
import UsersView from './users-view';
-import './templates';
+import Template from './templates/groups-list-item.hbs';
export default Marionette.ItemView.extend({
tagName: 'li',
className: 'panel panel-vertical',
- template: Templates['groups-list-item'],
+ template: Template,
events: {
'click .js-group-update': 'onUpdateClick',
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 695bf2ac034..699e9c76a85 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,6 +1,5 @@
import Marionette from 'backbone.marionette';
import ListItemView from './list-item-view';
-import './templates';
export default 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 db3d4d8bb18..442c5533904 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,9 +1,9 @@
import _ from 'underscore';
import Marionette from 'backbone.marionette';
-import './templates';
+import Template from './templates/groups-search.hbs';
export default Marionette.ItemView.extend({
- template: Templates['groups-search'],
+ template: Template,
events: {
'submit #groups-search-form': 'onFormSubmit',
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 fa8e632ef07..4c6643a8cc8 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
@@ -1,9 +1,9 @@
-import Modal from 'components/common/modals';
-import 'components/common/select-list';
-import './templates';
+import Modal from '../../components/common/modals';
+import '../../components/common/select-list';
+import Template from './templates/groups-users.hbs';
export default Modal.extend({
- template: Templates['groups-users'],
+ template: Template,
onRender: function () {
this._super();
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 fe9188b27f8..6ab3502f2b8 100644
--- a/server/sonar-web/src/main/js/apps/issues/app.js
+++ b/server/sonar-web/src/main/js/apps/issues/app.js
@@ -4,7 +4,7 @@ import Marionette from 'backbone.marionette';
import State from './models/state';
import Layout from './layout';
import Issues from './models/issues';
-import Facets from 'components/navigator/models/facets';
+import Facets from '../../components/navigator/models/facets';
import Filters from './models/filters';
import Controller from './controller';
import Router from './router';
@@ -13,9 +13,13 @@ import WorkspaceHeaderView from './workspace-header-view';
import FacetsView from './facets-view';
import FiltersView from './filters-view';
import './helpers/format-facet-value';
+import './partials';
+import '../../helpers/handlebars-helpers';
var App = new Marionette.Application(),
- init = function (options) {
+ init = function () {
+ let options = window.sonarqube;
+
this.state = new State();
this.list = new Issues();
this.facets = new Facets();
@@ -59,12 +63,10 @@ var App = new Marionette.Application(),
});
};
-App.on('start', function (options) {
- $.when(window.requestMessages()).done(function () {
- init.call(App, options);
- });
+App.on('start', function () {
+ init.call(App);
});
-export default App;
+window.sonarqube.appStarted.then(options => App.start(options));
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 2397bf06cb0..3877b2707fe 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
@@ -1,8 +1,7 @@
import $ from 'jquery';
import _ from 'underscore';
-import SourceViewer from 'components/source-viewer/main';
+import SourceViewer from '../../../components/source-viewer/main';
import IssueView from './issue-view';
-import '../templates';
export default SourceViewer.extend({
events: function () {
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 54e74f39980..db002a48944 100644
--- a/server/sonar-web/src/main/js/apps/issues/controller.js
+++ b/server/sonar-web/src/main/js/apps/issues/controller.js
@@ -1,7 +1,7 @@
import $ from 'jquery';
import _ from 'underscore';
import Backbone from 'backbone';
-import Controller from 'components/navigator/controller';
+import Controller from '../../components/navigator/controller';
import ComponentViewer from './component-viewer/main';
import HomeView from './workspace-home-view';
diff --git a/server/sonar-web/src/main/js/apps/issues/facets-view.js b/server/sonar-web/src/main/js/apps/issues/facets-view.js
index 82fd76fe714..3d99d8c7082 100644
--- a/server/sonar-web/src/main/js/apps/issues/facets-view.js
+++ b/server/sonar-web/src/main/js/apps/issues/facets-view.js
@@ -1,4 +1,4 @@
-import FacetsView from 'components/navigator/facets-view';
+import FacetsView from '../../components/navigator/facets-view';
import BaseFacet from './facets/base-facet';
import SeverityFacet from './facets/severity-facet';
import StatusFacet from './facets/status-facet';
diff --git a/server/sonar-web/src/main/js/apps/issues/facets/action-plan-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/action-plan-facet.js
index fa415f981ff..46c8139467b 100644
--- a/server/sonar-web/src/main/js/apps/issues/facets/action-plan-facet.js
+++ b/server/sonar-web/src/main/js/apps/issues/facets/action-plan-facet.js
@@ -1,10 +1,10 @@
import $ from 'jquery';
import _ from 'underscore';
import BaseFacet from './base-facet';
-import '../templates';
+import Template from '../templates/facets/issues-action-plan-facet.hbs';
export default BaseFacet.extend({
- template: Templates['issues-action-plan-facet'],
+ template: Template,
onRender: function () {
BaseFacet.prototype.onRender.apply(this, arguments);
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 edebc4adf52..672ca67726a 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
@@ -1,10 +1,10 @@
import $ from 'jquery';
import _ from 'underscore';
import CustomValuesFacet from './custom-values-facet';
-import '../templates';
+import Template from '../templates/facets/issues-assignee-facet.hbs';
export default CustomValuesFacet.extend({
- template: Templates['issues-assignee-facet'],
+ template: Template,
getUrl: function () {
return baseUrl + '/api/users/search';
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 d781c602fbd..59ac379e704 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
@@ -1,9 +1,9 @@
import _ from 'underscore';
-import BaseFacet from 'components/navigator/facets/base-facet';
-import '../templates';
+import BaseFacet from '../../../components/navigator/facets/base-facet';
+import Template from '../templates/facets/issues-base-facet.hbs';
export default BaseFacet.extend({
- template: Templates['issues-base-facet'],
+ template: Template,
onRender: function () {
BaseFacet.prototype.onRender.apply(this, arguments);
diff --git a/server/sonar-web/src/main/js/apps/issues/facets/context-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/context-facet.js
index 4f49aebc6ea..a043235164d 100644
--- a/server/sonar-web/src/main/js/apps/issues/facets/context-facet.js
+++ b/server/sonar-web/src/main/js/apps/issues/facets/context-facet.js
@@ -1,9 +1,9 @@
import _ from 'underscore';
import BaseFacet from './base-facet';
-import '../templates';
+import Template from '../templates/facets/issues-context-facet.hbs';
export default BaseFacet.extend({
- template: Templates['issues-context-facet'],
+ template: Template,
serializeData: function () {
return _.extend(BaseFacet.prototype.serializeData.apply(this, arguments), {
diff --git a/server/sonar-web/src/main/js/apps/issues/facets/creation-date-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/creation-date-facet.js
index 34edcbf706d..49bb2cd7cde 100644
--- a/server/sonar-web/src/main/js/apps/issues/facets/creation-date-facet.js
+++ b/server/sonar-web/src/main/js/apps/issues/facets/creation-date-facet.js
@@ -1,10 +1,10 @@
import $ from 'jquery';
import _ from 'underscore';
import BaseFacet from './base-facet';
-import '../templates';
+import Template from '../templates/facets/issues-creation-date-facet.hbs';
export default BaseFacet.extend({
- template: Templates['issues-creation-date-facet'],
+ template: Template,
events: function () {
return _.extend(BaseFacet.prototype.events.apply(this, arguments), {
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 04faae8470b..bf86b4970fb 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
@@ -1,9 +1,9 @@
import _ from 'underscore';
import BaseFacet from './base-facet';
-import '../templates';
+import Template from '../templates/facets/issues-custom-values-facet.hbs';
export default BaseFacet.extend({
- template: Templates['issues-custom-values-facet'],
+ template: Template,
events: function () {
return _.extend(BaseFacet.prototype.events.apply(this, arguments), {
diff --git a/server/sonar-web/src/main/js/apps/issues/facets/file-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/file-facet.js
index 0c904feeec5..af18cbcbb18 100644
--- a/server/sonar-web/src/main/js/apps/issues/facets/file-facet.js
+++ b/server/sonar-web/src/main/js/apps/issues/facets/file-facet.js
@@ -1,10 +1,10 @@
import $ from 'jquery';
import _ from 'underscore';
import BaseFacet from './base-facet';
-import '../templates';
+import Template from '../templates/facets/issues-file-facet.hbs';
export default BaseFacet.extend({
- template: Templates['issues-file-facet'],
+ template: Template,
onRender: function () {
BaseFacet.prototype.onRender.apply(this, arguments);
diff --git a/server/sonar-web/src/main/js/apps/issues/facets/issue-key-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/issue-key-facet.js
index b7e8cfd136a..f10e6dab2b9 100644
--- a/server/sonar-web/src/main/js/apps/issues/facets/issue-key-facet.js
+++ b/server/sonar-web/src/main/js/apps/issues/facets/issue-key-facet.js
@@ -1,9 +1,9 @@
import _ from 'underscore';
import BaseFacet from './base-facet';
-import '../templates';
+import Template from '../templates/facets/issues-issue-key-facet.hbs';
export default BaseFacet.extend({
- template: Templates['issues-issue-key-facet'],
+ template: Template,
onRender: function () {
return this.$el.toggleClass('hidden', !this.options.app.state.get('query').issues);
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 d826c379940..bbe12185686 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
@@ -1,9 +1,9 @@
import _ from 'underscore';
import BaseFacet from './base-facet';
-import '../templates';
+import Template from '../templates/facets/issues-mode-facet.hbs';
export default BaseFacet.extend({
- template: Templates['issues-mode-facet'],
+ template: Template,
events: {
'change [name="issues-page-mode"]': 'onModeChange'
diff --git a/server/sonar-web/src/main/js/apps/issues/facets/resolution-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/resolution-facet.js
index a15cf51aed7..62dee4d48de 100644
--- a/server/sonar-web/src/main/js/apps/issues/facets/resolution-facet.js
+++ b/server/sonar-web/src/main/js/apps/issues/facets/resolution-facet.js
@@ -1,10 +1,10 @@
import $ from 'jquery';
import _ from 'underscore';
import BaseFacet from './base-facet';
-import '../templates';
+import Template from '../templates/facets/issues-resolution-facet.hbs';
export default BaseFacet.extend({
- template: Templates['issues-resolution-facet'],
+ template: Template,
onRender: function () {
BaseFacet.prototype.onRender.apply(this, arguments);
diff --git a/server/sonar-web/src/main/js/apps/issues/facets/severity-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/severity-facet.js
index e1dc9abe396..45ec1c16a53 100644
--- a/server/sonar-web/src/main/js/apps/issues/facets/severity-facet.js
+++ b/server/sonar-web/src/main/js/apps/issues/facets/severity-facet.js
@@ -1,9 +1,9 @@
import _ from 'underscore';
import BaseFacet from './base-facet';
-import '../templates';
+import Template from '../templates/facets/issues-severity-facet.hbs';
export default BaseFacet.extend({
- template: Templates['issues-severity-facet'],
+ template: Template,
sortValues: function (values) {
var order = ['BLOCKER', 'MINOR', 'CRITICAL', 'INFO', 'MAJOR'];
diff --git a/server/sonar-web/src/main/js/apps/issues/facets/status-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/status-facet.js
index 9293d393cf7..c87a36aa209 100644
--- a/server/sonar-web/src/main/js/apps/issues/facets/status-facet.js
+++ b/server/sonar-web/src/main/js/apps/issues/facets/status-facet.js
@@ -1,9 +1,9 @@
import _ from 'underscore';
import BaseFacet from './base-facet';
-import '../templates';
+import Template from '../templates/facets/issues-status-facet.hbs';
export default BaseFacet.extend({
- template: Templates['issues-status-facet'],
+ template: Template,
sortValues: function (values) {
var order = ['OPEN', 'RESOLVED', 'REOPENED', 'CLOSED', 'CONFIRMED'];
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 18a46bfd096..50fdae86217 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,10 +1,10 @@
import $ from 'jquery';
import _ from 'underscore';
import Marionette from 'backbone.marionette';
-import './templates';
+import Template from './templates/issues-filters.hbs';
export default Marionette.ItemView.extend({
- template: Templates['issues-filters'],
+ template: Template,
events: {
'click .js-toggle-filters': 'toggleFilters',
diff --git a/server/sonar-web/src/main/js/apps/issues/helpers/format-facet-value.js b/server/sonar-web/src/main/js/apps/issues/helpers/format-facet-value.js
index 5cef0500ded..94ddec317a4 100644
--- a/server/sonar-web/src/main/js/apps/issues/helpers/format-facet-value.js
+++ b/server/sonar-web/src/main/js/apps/issues/helpers/format-facet-value.js
@@ -1,3 +1,5 @@
+import Handlebars from 'hbsfy/runtime';
+
Handlebars.registerHelper('formatFacetValue', function (value, facetMode) {
var formatter = facetMode === 'debt' ? 'SHORT_WORK_DUR' : 'SHORT_INT';
return window.formatMeasure(value, formatter);
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 980a0eceded..fa39dce2f5e 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
@@ -1,10 +1,10 @@
import $ from 'jquery';
import _ from 'underscore';
-import ActionOptionsView from 'components/common/action-options-view';
-import './templates';
+import ActionOptionsView from '../../components/common/action-options-view';
+import Template from './templates/issues-issue-filter-form.hbs';
export default ActionOptionsView.extend({
- template: Templates['issues-issue-filter-form'],
+ template: Template,
selectOption: function (e) {
var property = $(e.currentTarget).data('property'),
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 7b6c7b8366e..cfed80f3356 100644
--- a/server/sonar-web/src/main/js/apps/issues/layout.js
+++ b/server/sonar-web/src/main/js/apps/issues/layout.js
@@ -1,10 +1,10 @@
import $ from 'jquery';
import _ from 'underscore';
import Marionette from 'backbone.marionette';
-import './templates';
+import Template from './templates/issues-layout.hbs';
export default Marionette.LayoutView.extend({
- template: Templates['issues-layout'],
+ template: Template,
regions: {
filtersRegion: '.search-navigator-filters',
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 f466243ad63..52779091ed7 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
@@ -1,4 +1,4 @@
-import Issue from 'components/issue/models/issue';
+import Issue from '../../../components/issue/models/issue';
export default Issue.extend({
reset: function (attrs, options) {
diff --git a/server/sonar-web/src/main/js/apps/issues/models/state.js b/server/sonar-web/src/main/js/apps/issues/models/state.js
index f49d2566dfc..533c41f7842 100644
--- a/server/sonar-web/src/main/js/apps/issues/models/state.js
+++ b/server/sonar-web/src/main/js/apps/issues/models/state.js
@@ -1,5 +1,5 @@
import _ from 'underscore';
-import State from 'components/navigator/models/state';
+import State from '../../../components/navigator/models/state';
export default State.extend({
defaults: {
diff --git a/server/sonar-web/src/main/js/apps/issues/partials.js b/server/sonar-web/src/main/js/apps/issues/partials.js
new file mode 100644
index 00000000000..ba4cab9716f
--- /dev/null
+++ b/server/sonar-web/src/main/js/apps/issues/partials.js
@@ -0,0 +1,8 @@
+import Handlebars from 'hbsfy/runtime';
+import FilterNamePartial from './templates/_issues-filter-name.hbs';
+import FacetHeaderPartial from './templates/facets/_issues-facet-header.hbs';
+import MarkdownTipsPartial from '../../components/common/templates/_markdown-tips.hbs';
+
+Handlebars.registerPartial('_issues-filter-name', FilterNamePartial);
+Handlebars.registerPartial('_issues-facet-header', FacetHeaderPartial);
+Handlebars.registerPartial('_markdown-tips', MarkdownTipsPartial);
diff --git a/server/sonar-web/src/main/js/apps/issues/router.js b/server/sonar-web/src/main/js/apps/issues/router.js
index 6cb6622da6e..f3b560c14c5 100644
--- a/server/sonar-web/src/main/js/apps/issues/router.js
+++ b/server/sonar-web/src/main/js/apps/issues/router.js
@@ -1,4 +1,4 @@
-import Router from 'components/navigator/router';
+import Router from '../../components/navigator/router';
export default Router.extend({
routes: {
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 dba0e384c5a..867fcfcaccd 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
@@ -1,10 +1,10 @@
import $ from 'jquery';
import _ from 'underscore';
-import WorkspaceHeaderView from 'components/navigator/workspace-header-view';
-import './templates';
+import WorkspaceHeaderView from '../../components/navigator/workspace-header-view';
+import Template from './templates/issues-workspace-header.hbs';
export default WorkspaceHeaderView.extend({
- template: Templates['issues-workspace-header'],
+ template: Template,
events: function () {
return _.extend(WorkspaceHeaderView.prototype.events.apply(this, arguments), {
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 44efc574890..31607238594 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,12 +1,13 @@
import Marionette from 'backbone.marionette';
-import './templates';
+import Handlebars from 'hbsfy/runtime';
+import Template from './templates/issues-workspace-home.hbs';
Handlebars.registerHelper('issueFilterHomeLink', function (id) {
return baseUrl + '/issues/search#id=' + id;
});
export default Marionette.ItemView.extend({
- template: Templates['issues-workspace-home']
+ template: Template
});
diff --git a/server/sonar-web/src/main/js/apps/issues/workspace-list-item-view.js b/server/sonar-web/src/main/js/apps/issues/workspace-list-item-view.js
index 585beb1afce..568fc546723 100644
--- a/server/sonar-web/src/main/js/apps/issues/workspace-list-item-view.js
+++ b/server/sonar-web/src/main/js/apps/issues/workspace-list-item-view.js
@@ -1,8 +1,9 @@
import $ from 'jquery';
import _ from 'underscore';
-import IssueView from 'components/issue/issue-view';
+import IssueView from '../../components/issue/issue-view';
import IssueFilterView from './issue-filter-view';
-import './templates';
+import CheckboxTemplate from './templates/issues-issue-checkbox.hbs';
+import FilterTemplate from './templates/issues-issue-filter.hbs';
var SHOULD_NULL = {
any: ['issues'],
@@ -15,8 +16,8 @@ var SHOULD_NULL = {
};
export default IssueView.extend({
- checkboxTemplate: Templates['issues-issue-checkbox'],
- filterTemplate: Templates['issues-issue-filter'],
+ checkboxTemplate: CheckboxTemplate,
+ filterTemplate: FilterTemplate,
events: function () {
return _.extend(IssueView.prototype.events.apply(this, arguments), {
diff --git a/server/sonar-web/src/main/js/apps/issues/workspace-list-view.js b/server/sonar-web/src/main/js/apps/issues/workspace-list-view.js
index 3fcccd1546f..45efbf8dc0d 100644
--- a/server/sonar-web/src/main/js/apps/issues/workspace-list-view.js
+++ b/server/sonar-web/src/main/js/apps/issues/workspace-list-view.js
@@ -1,15 +1,16 @@
import $ from 'jquery';
-import WorkspaceListView from 'components/navigator/workspace-list-view';
+import WorkspaceListView from '../../components/navigator/workspace-list-view';
import IssueView from './workspace-list-item-view';
import EmptyView from './workspace-list-empty-view';
-import './templates';
+import Template from './templates/issues-workspace-list.hbs';
+import ComponentTemplate from './templates/issues-workspace-list-component.hbs';
var COMPONENT_HEIGHT = 29,
BOTTOM_OFFSET = 60;
export default WorkspaceListView.extend({
- template: Templates['issues-workspace-list'],
- componentTemplate: Templates['issues-workspace-list-component'],
+ template: Template,
+ componentTemplate: ComponentTemplate,
childView: IssueView,
childViewContainer: '.js-list',
emptyView: EmptyView,
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 b089a9cb574..dd2a626399d 100644
--- a/server/sonar-web/src/main/js/apps/maintenance/app.js
+++ b/server/sonar-web/src/main/js/apps/maintenance/app.js
@@ -2,10 +2,14 @@ import _ from 'underscore';
import Backbone from 'backbone';
import Marionette from 'backbone.marionette';
import MainView from './main-view';
+import './partials';
+import '../../helpers/handlebars-helpers';
var App = new Marionette.Application();
-App.on('start', function (options) {
+App.on('start', function () {
+ let options = window.sonarqube;
+
var viewOptions = _.extend(options, {
model: new Backbone.Model()
});
@@ -13,6 +17,6 @@ App.on('start', function (options) {
mainView.render().refresh();
});
-export default App;
+App.start();
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 3e9825adfa0..ece2ee8c1c2 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
@@ -2,10 +2,10 @@ import $ from 'jquery';
import _ from 'underscore';
import Backbone from 'backbone';
import Marionette from 'backbone.marionette';
-import './templates';
+import Template from './templates/maintenance-main.hbs';
export default Marionette.ItemView.extend({
- template: Templates['maintenance-main'],
+ template: Template,
events: {
'click #start-migration': 'startMigration'
diff --git a/server/sonar-web/src/main/js/apps/maintenance/partials.js b/server/sonar-web/src/main/js/apps/maintenance/partials.js
new file mode 100644
index 00000000000..9fdc6d07f22
--- /dev/null
+++ b/server/sonar-web/src/main/js/apps/maintenance/partials.js
@@ -0,0 +1,23 @@
+import Handlebars from 'hbsfy/runtime';
+
+import StateMigrationFailedPartial from './templates/_maintenance-state-migration-failed.hbs';
+import StateMigrationNotSupportedPartial from './templates/_maintenance-state-migration-not-supported.hbs';
+import StateMigrationRequiredPartial from './templates/_maintenance-state-migration-required.hbs';
+import StateMigrationRunningPartial from './templates/_maintenance-state-migration-running.hbs';
+import StateMigrationSucceededPartial from './templates/_maintenance-state-migration-succeeded.hbs';
+import StateNoMigrationPartial from './templates/_maintenance-state-no-migration.hbs';
+
+import StatusDownPartial from './templates/_maintenance-status-down.hbs';
+import StatusMigrationPartial from './templates/_maintenance-status-migration.hbs';
+import StatusUpPartial from './templates/_maintenance-status-up.hbs';
+
+Handlebars.registerPartial('_maintenance-state-migration-failed', StateMigrationFailedPartial);
+Handlebars.registerPartial('_maintenance-state-migration-not-supported', StateMigrationNotSupportedPartial);
+Handlebars.registerPartial('_maintenance-state-migration-required', StateMigrationRequiredPartial);
+Handlebars.registerPartial('_maintenance-state-migration-running', StateMigrationRunningPartial);
+Handlebars.registerPartial('_maintenance-state-migration-succeeded', StateMigrationSucceededPartial);
+Handlebars.registerPartial('_maintenance-state-no-migration', StateNoMigrationPartial);
+
+Handlebars.registerPartial('_maintenance-status-down', StatusDownPartial);
+Handlebars.registerPartial('_maintenance-status-migration', StatusMigrationPartial);
+Handlebars.registerPartial('_maintenance-status-up', StatusUpPartial);
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 86ed29e5207..b2a79a646c5 100644
--- a/server/sonar-web/src/main/js/apps/markdown/app.js
+++ b/server/sonar-web/src/main/js/apps/markdown/app.js
@@ -3,10 +3,11 @@ import MarkdownView from './markdown-help-view';
var App = new Marionette.Application();
-App.on('start', function (options) {
+App.on('start', function () {
+ let options = window.sonarqube;
new MarkdownView({ el: options.el }).render();
});
-export default App;
+window.sonarqube.appStarted.then(options => App.start(options));
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 c7db13a5b09..65a603c5653 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,8 +1,8 @@
import Marionette from 'backbone.marionette';
-import './templates';
+import Template from './templates/markdown-help.hbs';
export default Marionette.ItemView.extend({
- template: Templates['markdown-help']
+ template: Template
});
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 a3b533d0958..7a1826cd669 100644
--- a/server/sonar-web/src/main/js/apps/measures/app.js
+++ b/server/sonar-web/src/main/js/apps/measures/app.js
@@ -1,14 +1,15 @@
import _ from 'underscore';
import Marionette from 'backbone.marionette';
import FilterBar from './measures-filter-bar';
-import BaseFilters from 'components/navigator/filters/base-filters';
-import CheckboxFilterView from 'components/navigator/filters/checkbox-filters';
-import ChoiceFilters from 'components/navigator/filters/choice-filters';
-import AjaxSelectFilters from 'components/navigator/filters/ajax-select-filters';
-import FavoriteFilters from 'components/navigator/filters/favorite-filters';
-import RangeFilters from 'components/navigator/filters/range-filters';
-import StringFilterView from 'components/navigator/filters/string-filters';
-import MetricFilterView from 'components/navigator/filters/metric-filters';
+import BaseFilters from '../../components/navigator/filters/base-filters';
+import CheckboxFilterView from '../../components/navigator/filters/checkbox-filters';
+import ChoiceFilters from '../../components/navigator/filters/choice-filters';
+import AjaxSelectFilters from '../../components/navigator/filters/ajax-select-filters';
+import FavoriteFilters from '../../components/navigator/filters/favorite-filters';
+import RangeFilters from '../../components/navigator/filters/range-filters';
+import StringFilterView from '../../components/navigator/filters/string-filters';
+import MetricFilterView from '../../components/navigator/filters/metric-filters';
+import '../../helpers/handlebars-helpers';
var NavigatorApp = new Marionette.Application(),
init = function () {
@@ -161,4 +162,4 @@ NavigatorApp.on('start', function () {
init.call(NavigatorApp);
});
-export default NavigatorApp;
+window.sonarqube.appStarted.then(options => NavigatorApp.start(options));
diff --git a/server/sonar-web/src/main/js/apps/measures/measures-filter-bar.js b/server/sonar-web/src/main/js/apps/measures/measures-filter-bar.js
index acd0c0dea3a..9e61faf2b2c 100644
--- a/server/sonar-web/src/main/js/apps/measures/measures-filter-bar.js
+++ b/server/sonar-web/src/main/js/apps/measures/measures-filter-bar.js
@@ -1,5 +1,5 @@
import $ from 'jquery';
-import FilterBarView from 'components/navigator/filters/filter-bar';
+import FilterBarView from '../../components/navigator/filters/filter-bar';
export default FilterBarView.extend({
template: function () {
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 42eecceff9a..15a2aacb1a5 100644
--- a/server/sonar-web/src/main/js/apps/metrics/app.js
+++ b/server/sonar-web/src/main/js/apps/metrics/app.js
@@ -5,9 +5,12 @@ import Metrics from './metrics';
import HeaderView from './header-view';
import ListView from './list-view';
import ListFooterView from './list-footer-view';
+import '../../helpers/handlebars-helpers';
var App = new Marionette.Application(),
- init = function (options) {
+ init = function () {
+ let options = window.sonarqube;
+
// Layout
this.layout = new Layout({ el: options.el });
this.layout.render();
@@ -52,12 +55,12 @@ App.requestTypes = function () {
});
};
-App.on('start', function (options) {
- $.when(window.requestMessages(), App.requestDomains(), App.requestTypes()).done(function () {
- init.call(App, options);
+App.on('start', function () {
+ $.when(App.requestDomains(), App.requestTypes()).done(function () {
+ init.call(App);
});
});
-export default App;
+window.sonarqube.appStarted.then(options => App.start(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 cef043b54b8..0210d0c2e35 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
@@ -1,8 +1,8 @@
-import ModalForm from 'components/common/modal-form';
-import './templates';
+import ModalForm from '../../components/common/modal-form';
+import Template from './templates/metrics-delete.hbs';
export default ModalForm.extend({
- template: Templates['metrics-delete'],
+ template: Template,
onFormSubmit: function (e) {
this._super(e);
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 7396e4da8ff..91aeda83a7c 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
@@ -1,10 +1,10 @@
import $ from 'jquery';
import _ from 'underscore';
-import ModalForm from 'components/common/modal-form';
-import './templates';
+import ModalForm from '../../components/common/modal-form';
+import Template from './templates/metrics-form.hbs';
export default ModalForm.extend({
- template: Templates['metrics-form'],
+ template: Template,
onRender: function () {
var that = this;
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 37cdc7dc8b4..9278318d73a 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,9 +1,9 @@
import Marionette from 'backbone.marionette';
import CreateView from './create-view';
-import './templates';
+import Template from './templates/metrics-header.hbs';
export default Marionette.ItemView.extend({
- template: Templates['metrics-header'],
+ template: Template,
events: {
'click #metrics-create': 'onCreateClick'
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 6d1a560cf89..14917cdff33 100644
--- a/server/sonar-web/src/main/js/apps/metrics/layout.js
+++ b/server/sonar-web/src/main/js/apps/metrics/layout.js
@@ -1,8 +1,8 @@
import Marionette from 'backbone.marionette';
-import './templates';
+import Template from './templates/metrics-layout.hbs';
export default Marionette.LayoutView.extend({
- template: Templates['metrics-layout'],
+ template: Template,
regions: {
headerRegion: '#metrics-header',
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 a48c0a11e7a..9a2aaa64000 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,9 +1,9 @@
import _ from 'underscore';
import Marionette from 'backbone.marionette';
-import './templates';
+import Template from './templates/metrics-list-footer.hbs';
export default Marionette.ItemView.extend({
- template: Templates['metrics-list-footer'],
+ template: Template,
collectionEvents: {
'all': 'render'
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 3a56e9c9650..e5ab41fd532 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,12 +1,12 @@
import Marionette from 'backbone.marionette';
import UpdateView from './update-view';
import DeleteView from './delete-view';
-import './templates';
+import Template from './templates/metrics-list-item.hbs';
export default Marionette.ItemView.extend({
tagName: 'li',
className: 'panel panel-vertical',
- template: Templates['metrics-list-item'],
+ template: Template,
events: {
'click .js-metric-update': 'onUpdateClick',
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 e5a0f9f1e96..496b7240df1 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,6 +1,5 @@
import Marionette from 'backbone.marionette';
import ListItemView from './list-item-view';
-import './templates';
export default Marionette.CollectionView.extend({
tagName: 'ul',
diff --git a/server/sonar-web/src/main/js/apps/nav/app.jsx b/server/sonar-web/src/main/js/apps/nav/app.jsx
deleted file mode 100644
index 509a438d0ae..00000000000
--- a/server/sonar-web/src/main/js/apps/nav/app.jsx
+++ /dev/null
@@ -1,36 +0,0 @@
-import React from 'react';
-import GlobalNav from './global/global-nav';
-import ComponentNav from './component/component-nav';
-import SettingsNav from './settings/settings-nav';
-import '../../components/workspace/main';
-
-export default {
- start(options) {
- window.requestMessages().done(() => {
- this.renderGlobalNav(options);
- options.space === 'component' && this.renderComponentNav(options);
- options.space === 'settings' && this.renderSettingsNav(options);
- });
- },
-
- renderGlobalNav(options) {
- const el = document.getElementById('global-navigation');
- if (el) {
- React.render(<GlobalNav {...options}/>, el);
- }
- },
-
- renderComponentNav(options) {
- const el = document.getElementById('context-navigation');
- if (el) {
- React.render(<ComponentNav {...options}/>, el);
- }
- },
-
- renderSettingsNav(options) {
- const el = document.getElementById('context-navigation');
- if (el) {
- React.render(<SettingsNav {...options}/>, el);
- }
- }
-};
diff --git a/server/sonar-web/src/main/js/apps/nav/component/component-nav-breadcrumbs.jsx b/server/sonar-web/src/main/js/apps/nav/component/component-nav-breadcrumbs.jsx
deleted file mode 100644
index d128d5ac002..00000000000
--- a/server/sonar-web/src/main/js/apps/nav/component/component-nav-breadcrumbs.jsx
+++ /dev/null
@@ -1,23 +0,0 @@
-import React from 'react';
-import QualifierIcon from '../../../components/shared/qualifier-icon';
-
-export default React.createClass({
- render() {
- if (!this.props.breadcrumbs) {
- return null;
- }
- const items = this.props.breadcrumbs.map((item, index) => {
- const url = `${window.baseUrl}/dashboard/index?id=${encodeURIComponent(item.key)}`;
- return (
- <li key={index}>
- <a href={url}>
- <QualifierIcon qualifier={item.qualifier}/>&nbsp;{item.name}
- </a>
- </li>
- );
- });
- return (
- <ul className="nav navbar-nav nav-crumbs">{items}</ul>
- );
- }
-});
diff --git a/server/sonar-web/src/main/js/apps/nav/component/component-nav-favorite.jsx b/server/sonar-web/src/main/js/apps/nav/component/component-nav-favorite.jsx
deleted file mode 100644
index 8e2b8624abd..00000000000
--- a/server/sonar-web/src/main/js/apps/nav/component/component-nav-favorite.jsx
+++ /dev/null
@@ -1,15 +0,0 @@
-import React from 'react';
-import Favorite from 'components/shared/favorite';
-
-export default React.createClass({
- render() {
- if (!this.props.canBeFavorite) {
- return null;
- }
- return (
- <div className="navbar-context-favorite">
- <Favorite component={this.props.component} favorite={this.props.favorite}/>
- </div>
- );
- }
-});
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
deleted file mode 100644
index b7db14235b9..00000000000
--- a/server/sonar-web/src/main/js/apps/nav/component/component-nav-menu.jsx
+++ /dev/null
@@ -1,250 +0,0 @@
-import _ from 'underscore';
-import React from 'react';
-import DashboardNameMixin from '../dashboard-name-mixin';
-import LinksMixin from '../links-mixin';
-
-const SETTINGS_URLS = [
- '/project/settings', '/project/profile', '/project/qualitygate', '/manual_measures/index',
- '/action_plans/index', '/project/links', '/project_roles/index', '/project/history', '/project/key',
- '/project/deletion'
-];
-
-export default React.createClass({
- mixins: [DashboardNameMixin, LinksMixin],
-
- periodParameter() {
- let params = window.getQueryParams();
- return params.period ? `&period=${params.period}` : '';
- },
-
- renderOverviewLink() {
- if (_.size(this.props.component.dashboards) === 0) {
- return null;
- }
- let firstDashboard = _.first(this.props.component.dashboards);
- let url = `/dashboard/index?id=${encodeURIComponent(this.props.component.key)}${this.periodParameter()}`;
- let name = this.getLocalizedDashboardName(firstDashboard.name);
- return this.renderLink(url, name, () => {
- /* eslint eqeqeq: 0 */
- let pathMatch = window.location.pathname === `${window.baseUrl}/dashboard` ||
- window.location.pathname === `${window.baseUrl}/dashboard/index`;
- let params = window.getQueryParams();
- let paramMatch = !params['did'] || params['did'] == firstDashboard.key;
- return pathMatch && paramMatch ? 'active' : null;
- });
- },
-
- renderComponentsLink() {
- const url = `/components/index?id=${encodeURIComponent(this.props.component.key)}`;
- return this.renderLink(url, window.t('components.page'), '/components');
- },
-
- renderComponentIssuesLink() {
- const url = `/component_issues/index?id=${encodeURIComponent(this.props.component.key)}`;
- return this.renderLink(url, window.t('issues.page'), '/component_issues');
- },
-
- renderAdministration() {
- let shouldShowAdministration =
- this.props.conf.showActionPlans ||
- this.props.conf.showBackgroundTasks ||
- this.props.conf.showDeletion ||
- this.props.conf.showHistory ||
- this.props.conf.showLinks ||
- this.props.conf.showManualMeasures ||
- this.props.conf.showPermissions ||
- this.props.conf.showQualityGates ||
- this.props.conf.showQualityProfiles ||
- this.props.conf.showSettings ||
- this.props.conf.showUpdateKey;
- if (!shouldShowAdministration) {
- return null;
- }
- let isSettingsActive = SETTINGS_URLS.some(url => {
- return window.location.href.indexOf(url) !== -1;
- }),
- className = 'dropdown' + (isSettingsActive ? ' active' : '');
- return (
- <li className={className}>
- <a className="dropdown-toggle navbar-admin-link" data-toggle="dropdown" href="#">
- {window.t('layout.settings')}&nbsp;<i className="icon-dropdown"/></a>
- <ul className="dropdown-menu">
- {this.renderSettingsLink()}
- {this.renderProfilesLink()}
- {this.renderQualityGatesLink()}
- {this.renderCustomMeasuresLink()}
- {this.renderActionPlansLink()}
- {this.renderLinksLink()}
- {this.renderPermissionsLink()}
- {this.renderHistoryLink()}
- {this.renderBackgroundTasksLink()}
- {this.renderUpdateKeyLink()}
- {this.renderDeletionLink()}
- {this.renderExtensions()}
- </ul>
- </li>
- );
- },
-
- renderSettingsLink() {
- if (!this.props.conf.showSettings) {
- return null;
- }
- const url = `/project/settings?id=${encodeURIComponent(this.props.component.key)}`;
- return this.renderLink(url, window.t('project_settings.page'), '/project/settings');
- },
-
- renderProfilesLink() {
- if (!this.props.conf.showQualityProfiles) {
- return null;
- }
- const url = `/project/profile?id=${encodeURIComponent(this.props.component.key)}`;
- return this.renderLink(url, window.t('project_quality_profiles.page'), '/project/profile');
- },
-
- renderQualityGatesLink() {
- if (!this.props.conf.showQualityGates) {
- return null;
- }
- const url = `/project/qualitygate?id=${encodeURIComponent(this.props.component.key)}`;
- return this.renderLink(url, window.t('project_quality_gate.page'), '/project/qualitygate');
- },
-
- renderCustomMeasuresLink() {
- if (!this.props.conf.showManualMeasures) {
- return null;
- }
- const url = `/custom_measures?id=${encodeURIComponent(this.props.component.key)}`;
- return this.renderLink(url, window.t('custom_measures.page'), '/custom_measures');
- },
-
- renderActionPlansLink() {
- if (!this.props.conf.showActionPlans) {
- return null;
- }
- const url = `/action_plans?id=${encodeURIComponent(this.props.component.key)}`;
- return this.renderLink(url, window.t('action_plans.page'), '/action_plans');
- },
-
- renderLinksLink() {
- if (!this.props.conf.showLinks) {
- return null;
- }
- const url = `/project/links?id=${encodeURIComponent(this.props.component.key)}`;
- return this.renderLink(url, window.t('project_links.page'), '/project/links');
- },
-
- renderPermissionsLink() {
- if (!this.props.conf.showPermissions) {
- return null;
- }
- const url = `/project_roles?id=${encodeURIComponent(this.props.component.key)}`;
- return this.renderLink(url, window.t('permissions.page'), '/project_roles');
- },
-
- renderHistoryLink() {
- if (!this.props.conf.showHistory) {
- return null;
- }
- const url = `/project/history?id=${encodeURIComponent(this.props.component.key)}`;
- return this.renderLink(url, window.t('project_history.page'), '/project/history');
- },
-
- renderBackgroundTasksLink() {
- if (!this.props.conf.showBackgroundTasks) {
- return null;
- }
- const url = `/project/background_tasks?id=${encodeURIComponent(this.props.component.key)}`;
- return this.renderLink(url, window.t('background_tasks.page'), '/project/background_tasks');
- },
-
- renderUpdateKeyLink() {
- if (!this.props.conf.showUpdateKey) {
- return null;
- }
- const url = `/project/key?id=${encodeURIComponent(this.props.component.key)}`;
- return this.renderLink(url, window.t('update_key.page'), '/project/key');
- },
-
- renderDeletionLink() {
- if (!this.props.conf.showDeletion) {
- return null;
- }
- const url = `/project/deletion?id=${encodeURIComponent(this.props.component.key)}`;
- return this.renderLink(url, window.t('deletion.page'), '/project/deletion');
- },
-
- renderExtensions() {
- let extensions = this.props.conf.extensions || [];
- return extensions.map(e => {
- return this.renderLink(e.url, e.name, e.url);
- });
- },
-
- renderMore() {
- return (
- <li className="dropdown">
- <a className="dropdown-toggle" data-toggle="dropdown" href="#">
- {window.t('more')}&nbsp;<i className="icon-dropdown"></i>
- </a>
- <ul className="dropdown-menu">
- {this.renderDashboards()}
- {this.renderDashboardManagementLink()}
- {this.renderTools()}
- </ul>
- </li>
- );
- },
-
- renderDashboards() {
- let dashboards = _.rest(this.props.component.dashboards || []).map(d => {
- let url = `/dashboard?id=${encodeURIComponent(this.props.component.key)}&did=${d.key}${this.periodParameter()}`;
- let name = this.getLocalizedDashboardName(d.name);
- return this.renderLink(url, name);
- });
- return [<li key="0" className="dropdown-header">{window.t('layout.dashboards')}</li>].concat(dashboards);
- },
-
- renderDashboardManagementLink() {
- if (!window.SS.user) {
- return null;
- }
- let url = `/dashboards?resource=${encodeURIComponent(this.props.component.key)}`;
- let name = window.t('dashboard.manage_dashboards');
- return [
- <li key="dashboard-divider" className="small-divider"></li>,
- this.renderLink(url, name, '/dashboards')
- ];
- },
-
- renderTools() {
- let component = this.props.component;
- if (!component.isComparable && !_.size(component.extensions)) {
- return null;
- }
- let tools = [
- <li key="tools-divider" className="divider"></li>,
- <li key="tools" className="dropdown-header">Tools</li>
- ];
- if (component.isComparable) {
- let compareUrl = `/comparison/index?resource=${component.key}`;
- tools.push(this.renderLink(compareUrl, window.t('comparison.page')));
- }
- (component.extensions || []).forEach(e => {
- tools.push(this.renderLink(e.url, e.name));
- });
- return tools;
- },
-
- render() {
- return (
- <ul className="nav navbar-nav nav-tabs">
- {this.renderOverviewLink()}
- {this.renderComponentsLink()}
- {this.renderComponentIssuesLink()}
- {this.renderAdministration()}
- {this.renderMore()}
- </ul>
- );
- }
-});
diff --git a/server/sonar-web/src/main/js/apps/nav/component/component-nav-meta.jsx b/server/sonar-web/src/main/js/apps/nav/component/component-nav-meta.jsx
deleted file mode 100644
index 45061352e56..00000000000
--- a/server/sonar-web/src/main/js/apps/nav/component/component-nav-meta.jsx
+++ /dev/null
@@ -1,54 +0,0 @@
-import React from 'react';
-import PendingIcon from '../../../components/shared/pending-icon';
-
-export default React.createClass({
- render() {
- let metaList = [],
- // FIXME check right permission
- canSeeBackgroundTasks = this.props.conf.showSettings,
- backgroundTasksUrl = `${baseUrl}/project/background_tasks?id=${encodeURIComponent(this.props.component.key)}`;
-
- if (this.props.isInProgress) {
- let tooltip = canSeeBackgroundTasks ?
- window.tp('component_navigation.status.in_progress.admin', backgroundTasksUrl) :
- window.t('component_navigation.status.in_progress');
- metaList.push(
- <li key="isInProgress" data-toggle="tooltip" title={tooltip}>
- <i className="spinner" style={{ marginTop: '-1px' }}/> <span className="text-info">{window.t('background_task.status.IN_PROGRESS')}</span>
- </li>
- );
- } else if (this.props.isPending) {
- let tooltip = canSeeBackgroundTasks ?
- window.tp('component_navigation.status.pending.admin', backgroundTasksUrl) :
- window.t('component_navigation.status.pending');
- metaList.push(
- <li key="isPending" data-toggle="tooltip" title={tooltip}>
- <PendingIcon/> <span>{window.t('background_task.status.PENDING')}</span>
- </li>
- );
- } else if (this.props.isFailed) {
- let tooltip = canSeeBackgroundTasks ?
- window.tp('component_navigation.status.failed.admin', backgroundTasksUrl) :
- window.t('component_navigation.status.failed');
- metaList.push(
- <li key="isFailed" data-toggle="tooltip" title={tooltip}>
- <i className="icon-test-status-error"/> <span className="text-danger">{window.t('background_task.status.FAILED')}</span>
- </li>
- );
- }
-
- if (this.props.snapshotDate) {
- metaList.push(<li key="snapshotDate">{moment(this.props.snapshotDate).format('LLL')}</li>);
- }
-
- if (this.props.version) {
- metaList.push(<li key="version">Version {this.props.version}</li>);
- }
-
- return (
- <div className="navbar-right navbar-context-meta">
- <ul className="list-inline">{metaList}</ul>
- </div>
- );
- }
-});
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
deleted file mode 100644
index 917d54a6899..00000000000
--- a/server/sonar-web/src/main/js/apps/nav/component/component-nav.jsx
+++ /dev/null
@@ -1,72 +0,0 @@
-import $ from 'jquery';
-import _ from 'underscore';
-import React from 'react';
-import {STATUSES} from '../../background-tasks/constants';
-import {getTasksForComponent} from '../../../api/ce';
-import ComponentNavFavorite from './component-nav-favorite';
-import ComponentNavBreadcrumbs from './component-nav-breadcrumbs';
-import ComponentNavMeta from './component-nav-meta';
-import ComponentNavMenu from './component-nav-menu';
-
-export default React.createClass({
- getInitialState() {
- return { component: {}, conf: {} };
- },
-
- componentDidMount() {
- this.loadDetails().then(this.loadStatus);
- },
-
- loadDetails() {
- const url = `${window.baseUrl}/api/navigation/component`;
- const data = { componentKey: this.props.componentKey };
- return $.get(url, data).done(r => {
- this.setState({
- component: r,
- conf: r.configuration || {}
- });
- });
- },
-
- loadStatus(component) {
- getTasksForComponent(component.uuid).done(r => {
- this.setState({
- isPending: !!_.findWhere(r.queue, { status: STATUSES.PENDING }),
- isInProgress: !!_.findWhere(r.queue, { status: STATUSES.IN_PROGRESS }),
- isFailed: r.current && r.current.status === STATUSES.FAILED
- }, this.initTooltips);
- });
- },
-
- initTooltips() {
- $('[data-toggle="tooltip"]', React.findDOMNode(this)).tooltip({
- container: 'body',
- placement: 'bottom',
- delay: { show: 0, hide: 1000 },
- html: true
- });
- },
-
- render() {
- return (
- <div className="container">
- <ComponentNavFavorite
- component={this.state.component.key}
- favorite={this.state.component.isFavorite}
- canBeFavorite={this.state.component.canBeFavorite}/>
-
- <ComponentNavBreadcrumbs
- breadcrumbs={this.state.component.breadcrumbs}/>
-
- <ComponentNavMeta
- {...this.state}
- version={this.state.component.version}
- snapshotDate={this.state.component.snapshotDate}/>
-
- <ComponentNavMenu
- component={this.state.component}
- conf={this.state.conf}/>
- </div>
- );
- }
-});
diff --git a/server/sonar-web/src/main/js/apps/nav/dashboard-name-mixin.jsx b/server/sonar-web/src/main/js/apps/nav/dashboard-name-mixin.jsx
deleted file mode 100644
index e8366f137c7..00000000000
--- a/server/sonar-web/src/main/js/apps/nav/dashboard-name-mixin.jsx
+++ /dev/null
@@ -1,11 +0,0 @@
-export default {
- getLocalizedDashboardName(baseName) {
- var l10nKey = 'dashboard.' + baseName + '.name';
- var l10nLabel = window.t(l10nKey);
- if (l10nLabel !== l10nKey) {
- return l10nLabel;
- } else {
- return baseName;
- }
- }
-};
diff --git a/server/sonar-web/src/main/js/apps/nav/global/global-nav-branding.jsx b/server/sonar-web/src/main/js/apps/nav/global/global-nav-branding.jsx
deleted file mode 100644
index 680654fc37e..00000000000
--- a/server/sonar-web/src/main/js/apps/nav/global/global-nav-branding.jsx
+++ /dev/null
@@ -1,21 +0,0 @@
-import React from 'react';
-
-export default React.createClass({
- renderLogo() {
- let url = this.props.logoUrl || `${window.baseUrl}/images/logo.svg`,
- width = this.props.logoWidth || null,
- height = this.props.logoWidth ? 30 : null,
- title = window.t('layout.sonar.slogan');
- return <img src={url} width={width} height={height} alt={title} title={title}/>;
- },
-
- render() {
- const homeUrl = window.baseUrl + '/';
- const homeLinkClassName = 'navbar-brand' + (this.props.logoUrl ? ' navbar-brand-custom' : '');
- return (
- <div className="navbar-header">
- <a className={homeLinkClassName} href={homeUrl}>{this.renderLogo()}</a>
- </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
deleted file mode 100644
index 6249b8b11fb..00000000000
--- a/server/sonar-web/src/main/js/apps/nav/global/global-nav-menu.jsx
+++ /dev/null
@@ -1,152 +0,0 @@
-import React from 'react';
-import DashboardNameMixin from '../dashboard-name-mixin';
-import LinksMixin from '../links-mixin';
-
-export default React.createClass({
- mixins: [DashboardNameMixin, LinksMixin],
-
- getDefaultProps: function () {
- return { globalDashboards: [], globalPages: [] };
- },
-
- renderDashboardLink(dashboard) {
- const url = `${window.baseUrl}/dashboard/index?did=${encodeURIComponent(dashboard.key)}`;
- const name = this.getLocalizedDashboardName(dashboard.name);
- return (
- <li key={dashboard.name}>
- <a href={url}>{name}</a>
- </li>
- );
- },
-
- renderDashboardsManagementLink() {
- const url = `${window.baseUrl}/dashboards`;
- return (
- <li>
- <a href={url}>{window.t('dashboard.manage_dashboards')}</a>
- </li>
- );
- },
-
- renderDashboards() {
- const dashboards = this.props.globalDashboards.map(this.renderDashboardLink);
- const canManageDashboards = !!window.SS.user;
- return (
- <li className="dropdown">
- <a className="dropdown-toggle" data-toggle="dropdown" href="#">
- {window.t('layout.dashboards')}&nbsp;<span className="icon-dropdown"/>
- </a>
- <ul className="dropdown-menu">
- {dashboards}
- {canManageDashboards ? <li className="divider"/> : null}
- {canManageDashboards ? this.renderDashboardsManagementLink() : null}
- </ul>
- </li>
- );
- },
-
- renderIssuesLink() {
- const url = `${window.baseUrl}/issues/search`;
- return (
- <li className={this.activeLink('/issues')}>
- <a href={url}>{window.t('issues.page')}</a>
- </li>
- );
- },
-
- renderMeasuresLink() {
- const url = `${window.baseUrl}/measures/search?qualifiers[]=TRK`;
- return (
- <li className={this.activeLink('/measures')}>
- <a href={url}>{window.t('layout.measures')}</a>
- </li>
- );
- },
-
- renderRulesLink() {
- const url = `${window.baseUrl}/coding_rules`;
- return (
- <li className={this.activeLink('/coding_rules')}>
- <a href={url}>{window.t('coding_rules.page')}</a>
- </li>
- );
- },
-
- renderProfilesLink() {
- const url = `${window.baseUrl}/profiles`;
- return (
- <li className={this.activeLink('/profiles')}>
- <a href={url}>{window.t('quality_profiles.page')}</a>
- </li>
- );
- },
-
- renderQualityGatesLink() {
- const url = `${window.baseUrl}/quality_gates`;
- return (
- <li className={this.activeLink('/quality_gates')}>
- <a href={url}>{window.t('quality_gates.page')}</a>
- </li>
- );
- },
-
- renderAdministrationLink() {
- if (!window.SS.isUserAdmin) {
- return null;
- }
- const url = `${window.baseUrl}/settings`;
- return (
- <li className={this.activeLink('/settings')}>
- <a className="navbar-admin-link" href={url}>{window.t('layout.settings')}</a>
- </li>
- );
- },
-
- renderComparisonLink() {
- const url = `${window.baseUrl}/comparison`;
- return (
- <li className={this.activeLink('/comparison')}>
- <a href={url}>{window.t('comparison_global.page')}</a>
- </li>
- );
- },
-
- renderGlobalPageLink(globalPage, index) {
- const url = window.baseUrl + globalPage.url;
- return (
- <li key={index}>
- <a href={url}>{globalPage.name}</a>
- </li>
- );
- },
-
- renderMore() {
- const globalPages = this.props.globalPages.map(this.renderGlobalPageLink);
- return (
- <li className="dropdown">
- <a className="dropdown-toggle" data-toggle="dropdown" href="#">
- {window.t('more')}&nbsp;<span className="icon-dropdown"/>
- </a>
- <ul className="dropdown-menu">
- {this.renderComparisonLink()}
- {globalPages}
- </ul>
- </li>
- );
- },
-
- render() {
- return (
- <ul className="nav navbar-nav">
- {this.renderDashboards()}
- {this.renderIssuesLink()}
- {this.renderMeasuresLink()}
- {this.renderRulesLink()}
- {this.renderProfilesLink()}
- {this.renderQualityGatesLink()}
- {this.renderAdministrationLink()}
- {this.renderMore()}
- </ul>
- );
- }
-});
diff --git a/server/sonar-web/src/main/js/apps/nav/global/global-nav-search.jsx b/server/sonar-web/src/main/js/apps/nav/global/global-nav-search.jsx
deleted file mode 100644
index 48fadbfe6eb..00000000000
--- a/server/sonar-web/src/main/js/apps/nav/global/global-nav-search.jsx
+++ /dev/null
@@ -1,78 +0,0 @@
-import Backbone from 'backbone';
-import React from 'react';
-import SearchView from './search-view';
-
-function contains (root, node) {
- while (node) {
- if (node === root) {
- return true;
- }
- node = node.parentNode;
- }
- return false;
-}
-
-export default React.createClass({
- getInitialState() {
- return { open: false };
- },
-
- componentDidMount() {
- key('s', () => {
- this.openSearch();
- return false;
- });
- },
-
- componentWillUnmount() {
- this.closeSearch();
- key.unbind('s');
- },
-
- openSearch() {
- window.addEventListener('click', this.onClickOutside);
- this.setState({ open: true }, this.renderSearchView);
- },
-
- closeSearch() {
- window.removeEventListener('click', this.onClickOutside);
- this.resetSearchView();
- this.setState({ open: false });
- },
-
- renderSearchView() {
- let searchContainer = React.findDOMNode(this.refs.container);
- this.searchView = new SearchView({
- model: new Backbone.Model(this.props),
- hide: this.closeSearch
- });
- this.searchView.render().$el.appendTo(searchContainer);
- },
-
- resetSearchView() {
- this.searchView && this.searchView.destroy();
- },
-
- onClick(e) {
- e.preventDefault();
- this.state.open ? this.closeSearch() : this.openSearch();
- },
-
- onClickOutside(e) {
- if (!contains(React.findDOMNode(this.refs.dropdown), e.target)) {
- this.closeSearch();
- }
- },
-
- render() {
- const dropdownClassName = 'dropdown' + (this.state.open ? ' open' : '');
- return (
- <li ref="dropdown" className={dropdownClassName}>
- <a className="navbar-search-dropdown" href="#" onClick={this.onClick}>
- <i className="icon-search navbar-icon"/>&nbsp;<i className="icon-dropdown"/>
- </a>
- <div ref="container" className="dropdown-menu dropdown-menu-right"></div>
- </li>
- );
- }
-});
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
deleted file mode 100644
index d07c9a4d201..00000000000
--- a/server/sonar-web/src/main/js/apps/nav/global/global-nav-user.jsx
+++ /dev/null
@@ -1,52 +0,0 @@
-import React from 'react';
-import Avatar from 'components/shared/avatar';
-
-export default React.createClass({
- renderAuthenticated() {
- return (
- <li className="dropdown">
- <a className="dropdown-toggle" data-toggle="dropdown" href="#">
- <Avatar email={window.SS.userEmail} size={20}/>&nbsp;
- {window.SS.userName}&nbsp;<i className="icon-dropdown"/>
- </a>
- <ul className="dropdown-menu dropdown-menu-right">
- <li>
- <a href={`${window.baseUrl}/account/index`}>{window.t('layout.user_panel.my_profile')}</a>
- </li>
- <li>
- <a onClick={this.handleLogout} href="#">{window.t('layout.logout')}</a>
- </li>
- </ul>
- </li>
- );
- },
-
- renderAnonymous() {
- return (
- <li>
- <a onClick={this.handleLogin}>{window.t('layout.login')}</a>
- </li>
- );
- },
-
- handleLogin(e) {
- e.preventDefault();
- const returnTo = window.location.pathname + window.location.search;
- const loginUrl = `${window.baseUrl}/sessions/new?return_to=${encodeURIComponent(returnTo)}${window.location.hash}`;
- window.location = loginUrl;
- },
-
- handleLogout(e) {
- e.preventDefault();
- if (window.sonarRecentHistory) {
- window.sonarRecentHistory.clear();
- }
- const logoutUrl = `${window.baseUrl}/sessions/logout`;
- window.location = logoutUrl;
- },
-
- render() {
- const isUserAuthenticated = !!window.SS.user;
- return isUserAuthenticated ? this.renderAuthenticated() : this.renderAnonymous();
- }
-});
diff --git a/server/sonar-web/src/main/js/apps/nav/global/global-nav.jsx b/server/sonar-web/src/main/js/apps/nav/global/global-nav.jsx
deleted file mode 100644
index ebbdc07db5c..00000000000
--- a/server/sonar-web/src/main/js/apps/nav/global/global-nav.jsx
+++ /dev/null
@@ -1,63 +0,0 @@
-import $ from 'jquery';
-import React from 'react';
-import GlobalNavBranding from './global-nav-branding';
-import GlobalNavMenu from './global-nav-menu';
-import GlobalNavUser from './global-nav-user';
-import GlobalNavSearch from './global-nav-search';
-import ShortcutsHelpView from './shortcuts-help-view';
-
-export default React.createClass({
- getInitialState() {
- return this.props;
- },
-
- componentDidMount() {
- this.loadGlobalNavDetails();
- window.addEventListener('keypress', this.onKeyPress);
- },
-
- componentWillUnmount() {
- window.removeEventListener('keypress', this.onKeyPress);
- },
-
- loadGlobalNavDetails() {
- $.get(`${window.baseUrl}/api/navigation/global`).done(r => {
- this.setState(r);
- });
- },
-
- onKeyPress(e) {
- var tagName = e.target.tagName;
- if (tagName !== 'INPUT' && tagName !== 'SELECT' && tagName !== 'TEXTAREA') {
- var code = e.keyCode || e.which;
- if (code === 63) {
- this.openHelp();
- }
- }
- },
-
- openHelp(e) {
- e && e.preventDefault();
- new ShortcutsHelpView().render();
- },
-
- render() {
- return (
- <div className="container">
- <GlobalNavBranding {...this.state}/>
-
- <GlobalNavMenu {...this.state}/>
-
- <ul className="nav navbar-nav navbar-right">
- <GlobalNavUser {...this.state}/>
- <GlobalNavSearch {...this.state}/>
- <li>
- <a onClick={this.openHelp} href="#">
- <i className="icon-help navbar-icon"/>
- </a>
- </li>
- </ul>
- </div>
- );
- }
-});
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
deleted file mode 100644
index 12e170da60b..00000000000
--- a/server/sonar-web/src/main/js/apps/nav/global/search-view.js
+++ /dev/null
@@ -1,232 +0,0 @@
-import $ from 'jquery';
-import _ from 'underscore';
-import Backbone from 'backbone';
-import Marionette from 'backbone.marionette';
-import SelectableCollectionView from 'components/common/selectable-collection-view';
-import '../templates';
-
-var SearchItemView = Marionette.ItemView.extend({
- tagName: 'li',
- template: Templates['nav-search-item'],
-
- select: function () {
- this.$el.addClass('active');
- },
-
- deselect: function () {
- this.$el.removeClass('active');
- },
-
- submit: function () {
- this.$('a')[0].click();
- },
-
- serializeData: function () {
- return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
- index: this.options.index
- });
- }
- }),
-
- SearchEmptyView = Marionette.ItemView.extend({
- tagName: 'li',
- template: Templates['nav-search-empty']
- }),
-
- SearchResultsView = SelectableCollectionView.extend({
- className: 'menu',
- tagName: 'ul',
- childView: SearchItemView,
- emptyView: SearchEmptyView
- });
-
-export default Marionette.LayoutView.extend({
- className: 'navbar-search',
- tagName: 'form',
- template: Templates['nav-search'],
-
- regions: {
- resultsRegion: '.js-search-results'
- },
-
- events: {
- 'submit': 'onSubmit',
- 'keydown .js-search-input': 'onKeyDown',
- 'keyup .js-search-input': 'debouncedOnKeyUp'
- },
-
- initialize: function () {
- var that = this;
- this.results = new Backbone.Collection();
- this.favorite = [];
- if (window.SS.user) {
- this.fetchFavorite().always(function () {
- that.resetResultsToDefault();
- });
- } else {
- this.resetResultsToDefault();
- }
- this.resultsView = new SearchResultsView({ collection: this.results });
- this.debouncedOnKeyUp = _.debounce(this.onKeyUp, 400);
- this._bufferedValue = '';
- },
-
- onRender: function () {
- var that = this;
- this.resultsRegion.show(this.resultsView);
- setTimeout(function () {
- that.$('.js-search-input').focus();
- }, 0);
- },
-
- onKeyDown: function (e) {
- if (e.keyCode === 38) {
- this.resultsView.selectPrev();
- return false;
- }
- if (e.keyCode === 40) {
- this.resultsView.selectNext();
- return false;
- }
- if (e.keyCode === 13) {
- this.resultsView.submitCurrent();
- return false;
- }
- if (e.keyCode === 27) {
- this.options.hide();
- return false;
- }
- },
-
- onKeyUp: function () {
- var value = this.$('.js-search-input').val();
- if (value === this._bufferedValue) {
- return;
- }
- this._bufferedValue = this.$('.js-search-input').val();
- if (this.searchRequest != null && this.searchRequest.abort != null) {
- this.searchRequest.abort();
- }
- this.searchRequest = this.search(value);
- },
-
- onSubmit: function () {
- return false;
- },
-
- fetchFavorite: function () {
- var that = this;
- return $.get(baseUrl + '/api/favourites').done(function (r) {
- that.favorite = r.map(function (f) {
- var isFile = ['FIL', 'UTS'].indexOf(f.qualifier) !== -1;
- return {
- 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'
- };
- });
- that.favorite = _.sortBy(that.favorite, 'name');
- });
- },
-
- resetResultsToDefault: function () {
- var recentHistory = JSON.parse(localStorage.getItem('sonar_recent_history')),
- history = (recentHistory || []).map(function (historyItem, index) {
- var url = baseUrl + '/dashboard/index?id=' + encodeURIComponent(historyItem.key) +
- window.dashboardParameters(true);
- return {
- url: url,
- name: historyItem.name,
- q: historyItem.icon,
- extra: index === 0 ? t('browsed_recently') : null
- };
- }),
- favorite = _.first(this.favorite, 6).map(function (f, index) {
- return _.extend(f, { extra: index === 0 ? 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),
- extra: index === 0 ? '' : null
- };
- });
- this.results.reset([].concat(history, favorite, qualifiers));
- },
-
- search: function (q) {
- if (q.length < 2) {
- this.resetResultsToDefault();
- return;
- }
- var that = this,
- url = baseUrl + '/api/components/suggestions',
- options = { s: q };
- return $.get(url, options).done(function (r) {
- var collection = [];
- r.results.forEach(function (domain) {
- domain.items.forEach(function (item, index) {
- collection.push(_.extend(item, {
- q: domain.q,
- extra: index === 0 ? domain.name : null,
- url: baseUrl + '/dashboard/index?id=' + encodeURIComponent(item.key) + window.dashboardParameters(true)
- }));
- });
- });
- that.results.reset([].concat(
- that.getNavigationFindings(q),
- that.getGlobalDashboardFindings(q),
- that.getFavoriteFindings(q),
- collection
- ));
- });
- },
-
- 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' }
- ],
- customItems = [];
- if (window.SS.isUserAdmin) {
- customItems.push({ name: 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');
- }
- return _.first(findings, 6);
- },
-
- getGlobalDashboardFindings: function (q) {
- var dashboards = this.model.get('globalDashboards') || [],
- items = dashboards.map(function (d) {
- return { name: d.name, url: baseUrl + '/dashboard/index?did=' + encodeURIComponent(d.key) };
- });
- var findings = items.filter(function (f) {
- return f.name.match(new RegExp(q, 'i'));
- });
- if (findings.length > 0) {
- findings[0].extra = t('dashboard.global_dashboards');
- }
- return _.first(findings, 6);
- },
-
- getFavoriteFindings: function (q) {
- var findings = this.favorite.filter(function (f) {
- return f.name.match(new RegExp(q, 'i'));
- });
- if (findings.length > 0) {
- findings[0].extra = t('favorite');
- }
- return _.first(findings, 6);
- }
-});
-
-
diff --git a/server/sonar-web/src/main/js/apps/nav/global/shortcuts-help-view.js b/server/sonar-web/src/main/js/apps/nav/global/shortcuts-help-view.js
deleted file mode 100644
index 02807d5951f..00000000000
--- a/server/sonar-web/src/main/js/apps/nav/global/shortcuts-help-view.js
+++ /dev/null
@@ -1,9 +0,0 @@
-import ModalView from 'components/common/modals';
-import '../templates';
-
-export default ModalView.extend({
- className: 'modal modal-large',
- template: Templates['nav-shortcuts-help']
-});
-
-
diff --git a/server/sonar-web/src/main/js/apps/nav/links-mixin.jsx b/server/sonar-web/src/main/js/apps/nav/links-mixin.jsx
deleted file mode 100644
index 72f70966d93..00000000000
--- a/server/sonar-web/src/main/js/apps/nav/links-mixin.jsx
+++ /dev/null
@@ -1,28 +0,0 @@
-import _ from 'underscore';
-import React from 'react';
-
-export default {
- activeLink(url) {
- return window.location.pathname.indexOf(window.baseUrl + url) === 0 ? 'active' : null;
- },
-
- renderLink(url, title, highlightUrl = url) {
- let fullUrl = window.baseUrl + url;
- let check = _.isFunction(highlightUrl) ? highlightUrl : this.activeLink;
- return (
- <li key={highlightUrl} className={check(highlightUrl)}>
- <a href={fullUrl}>{title}</a>
- </li>
- );
- },
-
- renderNewLink(url, title, highlightUrl = url) {
- let fullUrl = window.baseUrl + url;
- let check = _.isFunction(highlightUrl) ? highlightUrl : this.activeLink;
- return (
- <li key={highlightUrl} className={check(highlightUrl)}>
- <a href={fullUrl} className="nowrap">{title} <span className="spacer-left badge">New</span></a>
- </li>
- );
- }
-};
diff --git a/server/sonar-web/src/main/js/apps/nav/settings/settings-nav.jsx b/server/sonar-web/src/main/js/apps/nav/settings/settings-nav.jsx
deleted file mode 100644
index 87de9371fc3..00000000000
--- a/server/sonar-web/src/main/js/apps/nav/settings/settings-nav.jsx
+++ /dev/null
@@ -1,77 +0,0 @@
-import $ from 'jquery';
-import React from 'react';
-import LinksMixin from '../links-mixin';
-
-export default React.createClass({
- mixins: [LinksMixin],
-
- getInitialState() {
- return { extensions: [] };
- },
-
- componentDidMount() {
- this.loadDetails();
- },
-
- loadDetails() {
- $.get(`${window.baseUrl}/api/navigation/settings`).done(r => this.setState(r));
- },
-
- render() {
- return (
- <div className="container">
- <ul className="nav navbar-nav nav-crumbs">
- {this.renderLink('/settings', window.t('layout.settings'))}
- </ul>
-
- <ul className="nav navbar-nav nav-tabs">
- <li className="dropdown">
- <a className="dropdown-toggle" data-toggle="dropdown" href="#">
- {window.t('sidebar.project_settings')}&nbsp;<i className="icon-dropdown"></i>
- </a>
- <ul className="dropdown-menu">
- {this.renderLink('/settings', window.t('settings.page'))}
- {this.renderLink('/metrics', 'Custom Metrics')}
- {this.renderLink('/admin_dashboards', window.t('default_dashboards.page'))}
- {this.state.extensions.map(e => this.renderLink(e.url, e.name))}
- </ul>
- </li>
-
- <li className="dropdown">
- <a className="dropdown-toggle" data-toggle="dropdown" href="#">
- {window.t('sidebar.security')}&nbsp;<i className="icon-dropdown"></i>
- </a>
- <ul className="dropdown-menu">
- {this.renderLink('/users', window.t('users.page'))}
- {this.renderLink('/groups', window.t('user_groups.page'))}
- {this.renderLink('/roles/global', window.t('global_permissions.page'))}
- {this.renderLink('/roles/projects', window.t('roles.page'))}
- {this.renderLink('/permission_templates', window.t('permission_templates'))}
- </ul>
- </li>
-
- <li className="dropdown">
- <a className="dropdown-toggle" data-toggle="dropdown" href="#">
- {window.t('sidebar.projects')}&nbsp;<i className="icon-dropdown"></i>
- </a>
- <ul className="dropdown-menu">
- {this.renderLink('/projects', 'Management')}
- {this.renderLink('/background_tasks', window.t('background_tasks.page'))}
- </ul>
- </li>
-
- <li className="dropdown">
- <a className="dropdown-toggle" data-toggle="dropdown" href="#">
- {window.t('sidebar.system')}&nbsp;<i className="icon-dropdown"></i>
- </a>
- <ul className="dropdown-menu">
- {this.renderLink('/updatecenter', window.t('update_center.page'))}
- {this.renderLink('/system', window.t('system_info.page'))}
- </ul>
- </li>
- </ul>
- </div>
-
- );
- }
-});
diff --git a/server/sonar-web/src/main/js/apps/nav/templates/nav-search-empty.hbs b/server/sonar-web/src/main/js/apps/nav/templates/nav-search-empty.hbs
deleted file mode 100644
index fb76e686612..00000000000
--- a/server/sonar-web/src/main/js/apps/nav/templates/nav-search-empty.hbs
+++ /dev/null
@@ -1 +0,0 @@
-<span class="note">{{t 'no_results'}}</span>
diff --git a/server/sonar-web/src/main/js/apps/nav/templates/nav-search-item.hbs b/server/sonar-web/src/main/js/apps/nav/templates/nav-search-item.hbs
deleted file mode 100644
index 855b5175187..00000000000
--- a/server/sonar-web/src/main/js/apps/nav/templates/nav-search-item.hbs
+++ /dev/null
@@ -1,22 +0,0 @@
-{{#notNull extra}}
- {{#gt index 0}}
- <div class="divider"></div>
- {{/gt}}
- {{#if extra}}
- <div class="dropdown-header">{{extra}}</div>
- {{/if}}
-{{/notNull}}
-
-<a href="{{url}}" title="{{name}}">
- {{#if icon}}<i class="icon-{{icon}} text-text-bottom"></i>{{/if}}
- {{#if q}}{{qualifierIcon q}}{{/if}}
- {{#eq q 'FIL'}}
- {{collapsedDirFromPath name}}{{fileFromPath name}}
- {{else}}
- {{#eq q 'UTS'}}
- {{collapsedDirFromPath name}}{{fileFromPath name}}
- {{else}}
- {{name}}
- {{/eq}}
- {{/eq}}
-</a>
diff --git a/server/sonar-web/src/main/js/apps/nav/templates/nav-search.hbs b/server/sonar-web/src/main/js/apps/nav/templates/nav-search.hbs
deleted file mode 100644
index 68e1f3ad168..00000000000
--- a/server/sonar-web/src/main/js/apps/nav/templates/nav-search.hbs
+++ /dev/null
@@ -1,8 +0,0 @@
-<i class="navbar-search-icon icon-search"></i>
-
-<input class="navbar-search-input js-search-input" type="search" name="q" placeholder="{{t 'search_verb'}}"
- maxlength="30" autocomplete="off">
-
-<div class="js-search-results"></div>
-
-<div class="note navbar-search-subtitle">{{t 'search.shortcut'}}</div>
diff --git a/server/sonar-web/src/main/js/apps/nav/templates/nav-shortcuts-help.hbs b/server/sonar-web/src/main/js/apps/nav/templates/nav-shortcuts-help.hbs
deleted file mode 100644
index 2ef8a865b8b..00000000000
--- a/server/sonar-web/src/main/js/apps/nav/templates/nav-shortcuts-help.hbs
+++ /dev/null
@@ -1,60 +0,0 @@
-<div class="modal-head">
- <h2>{{t 'help'}}</h2>
-</div>
-
-<div class="modal-body modal-container">
- <div class="spacer-bottom">
- <a href="http://www.sonarqube.org" target="sonar">Community</a> -
- <a href="http://www.sonarqube.org/documentation" target="sonar_doc">Documentation</a> -
- <a href="http://www.sonarqube.org/support" target="support">Get Support</a> -
- <a href="http://redirect.sonarsource.com/doc/plugin-library.html" target="plugins">Plugins</a> -
- <a href="{{link '/api_documentation'}}">Web Service API</a>
- </div>
-
- <h2 class="spacer-top spacer-bottom">{{t 'shortcuts.modal_title'}}</h2>
-
- <div class="columns">
- <div class="column-half">
- <div class="spacer-bottom">
- <h3 class="shortcuts-section-title">{{t 'shortcuts.section.global'}}</h3>
- <ul class="shortcuts-list">
- <li><span class="shortcut-button">s</span> &nbsp;&nbsp; {{t 'shortcuts.section.global.search'}}</li>
- <li><span class="shortcut-button">?</span> &nbsp;&nbsp; {{t 'shortcuts.section.global.shortcuts'}}</li>
- </ul>
- </div>
-
- <h3 class="shortcuts-section-title">{{t 'shortcuts.section.rules'}}</h3>
- <ul class="shortcuts-list">
- <li><span class="shortcut-button">&uarr;</span> <span
- class="shortcut-button">&darr;</span> &nbsp;&nbsp; {{t 'shortcuts.section.rules.navigate_between_rules'}}</li>
- <li><span class="shortcut-button">&rarr;</span> &nbsp;&nbsp; {{t 'shortcuts.section.rules.open_details'}}</li>
- <li><span class="shortcut-button">&larr;</span> &nbsp;&nbsp; {{t 'shortcuts.section.rules.return_to_list'}}</li>
- <li><span class="shortcut-button">a</span> &nbsp;&nbsp; {{t 'shortcuts.section.rules.activate'}}</li>
- <li><span class="shortcut-button">d</span> &nbsp;&nbsp; {{t 'shortcuts.section.rules.deactivate'}}</li>
- </ul>
- </div>
-
- <div class="column-half">
- <h3 class="shortcuts-section-title">{{t 'shortcuts.section.issues'}}</h3>
- <ul class="shortcuts-list">
- <li><span class="shortcut-button">&uarr;</span> <span
- class="shortcut-button">&darr;</span> &nbsp;&nbsp; {{t 'shortcuts.section.issues.navigate_between_issues'}}
- </li>
- <li><span class="shortcut-button">&rarr;</span> &nbsp;&nbsp; {{t 'shortcuts.section.issues.open_details'}}</li>
- <li><span class="shortcut-button">&larr;</span> &nbsp;&nbsp; {{t 'shortcuts.section.issues.return_to_list'}}</li>
- <li><span class="shortcut-button">⎵</span> &nbsp;&nbsp; {{t 'shortcuts.section.issue.select'}}</li>
- <li><span class="shortcut-button">f</span> &nbsp;&nbsp; {{t 'shortcuts.section.issue.do_transition'}}</li>
- <li><span class="shortcut-button">a</span> &nbsp;&nbsp; {{t 'shortcuts.section.issue.assign'}}</li>
- <li><span class="shortcut-button">m</span> &nbsp;&nbsp; {{t 'shortcuts.section.issue.assign_to_me'}}</li>
- <li><span class="shortcut-button">p</span> &nbsp;&nbsp; {{t 'shortcuts.section.issue.plan'}}</li>
- <li><span class="shortcut-button">i</span> &nbsp;&nbsp; {{t 'shortcuts.section.issue.change_severity'}}</li>
- <li><span class="shortcut-button">c</span> &nbsp;&nbsp; {{t 'shortcuts.section.issue.comment'}}</li>
- <li><span class="shortcut-button">t</span> &nbsp;&nbsp; {{t 'shortcuts.section.issue.change_tags'}}</li>
- </ul>
- </div>
- </div>
-</div>
-
-<div class="modal-foot">
- <a class="js-modal-close" href="#">{{t 'close'}}</a>
-</div>
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/app.js b/server/sonar-web/src/main/js/apps/permission-templates/app.js
new file mode 100644
index 00000000000..aec705a28d6
--- /dev/null
+++ b/server/sonar-web/src/main/js/apps/permission-templates/app.js
@@ -0,0 +1,8 @@
+import React from 'react';
+import Main from './main';
+import '../../helpers/handlebars-helpers';
+
+window.sonarqube.appStarted.then(options => {
+ var el = document.querySelector(options.el);
+ React.render(<Main topQualifiers={options.rootQualifiers}/>, el);
+});
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/app.jsx b/server/sonar-web/src/main/js/apps/permission-templates/app.jsx
deleted file mode 100644
index 44ff6954266..00000000000
--- a/server/sonar-web/src/main/js/apps/permission-templates/app.jsx
+++ /dev/null
@@ -1,23 +0,0 @@
-import $ from 'jquery';
-import React from 'react';
-import Main from './main';
-
-let topQualifiers = [];
-
-export default {
- start(options) {
- $.when(
- window.requestMessages(),
- this.requestTopQualifiers()
- ).then(() => {
- var el = document.querySelector(options.el);
- React.render(<Main topQualifiers={topQualifiers}/>, el);
- });
- },
-
- requestTopQualifiers() {
- return $.get(baseUrl + '/api/navigation/global').done(r => {
- topQualifiers = r.qualifiers;
- });
- }
-};
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/create-view.jsx b/server/sonar-web/src/main/js/apps/permission-templates/create-view.js
index 733e970069f..733e970069f 100644
--- a/server/sonar-web/src/main/js/apps/permission-templates/create-view.jsx
+++ b/server/sonar-web/src/main/js/apps/permission-templates/create-view.js
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/delete-view.jsx b/server/sonar-web/src/main/js/apps/permission-templates/delete-view.js
index 60b81fb701c..8f86bb0759d 100644
--- a/server/sonar-web/src/main/js/apps/permission-templates/delete-view.jsx
+++ b/server/sonar-web/src/main/js/apps/permission-templates/delete-view.js
@@ -1,9 +1,9 @@
import ModalForm from '../../components/common/modal-form';
import {deletePermissionTemplate} from '../../api/permissions';
-import './templates';
+import Template from './templates/permission-templates-delete.hbs';
export default ModalForm.extend({
- template: Templates['permission-templates-delete'],
+ template: Template,
onFormSubmit: function () {
ModalForm.prototype.onFormSubmit.apply(this, arguments);
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/form-view.js b/server/sonar-web/src/main/js/apps/permission-templates/form-view.js
index 71d0802a790..f2cbf834af9 100644
--- a/server/sonar-web/src/main/js/apps/permission-templates/form-view.js
+++ b/server/sonar-web/src/main/js/apps/permission-templates/form-view.js
@@ -1,8 +1,8 @@
import ModalForm from '../../components/common/modal-form';
-import './templates';
+import Template from './templates/permission-templates-form.hbs';
export default ModalForm.extend({
- template: Templates['permission-templates-form'],
+ template: Template,
onRender: function () {
this._super();
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/groups-view.js b/server/sonar-web/src/main/js/apps/permission-templates/groups-view.js
index c13d978d9d3..fc43c68c24c 100644
--- a/server/sonar-web/src/main/js/apps/permission-templates/groups-view.js
+++ b/server/sonar-web/src/main/js/apps/permission-templates/groups-view.js
@@ -1,7 +1,7 @@
import _ from 'underscore';
import Modal from '../../components/common/modals';
import '../../components/common/select-list';
-import './templates';
+import Template from './templates/permission-templates-groups.hbs';
function getSearchUrl (permission, permissionTemplate) {
return baseUrl + '/api/permissions/template_groups?ps=100&permission=' + permission.key +
@@ -9,7 +9,7 @@ function getSearchUrl (permission, permissionTemplate) {
}
export default Modal.extend({
- template: Templates['permission-templates-groups'],
+ template: Template,
onRender: function () {
this._super();
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/header.jsx b/server/sonar-web/src/main/js/apps/permission-templates/header.js
index 0325d4bf6cb..0325d4bf6cb 100644
--- a/server/sonar-web/src/main/js/apps/permission-templates/header.jsx
+++ b/server/sonar-web/src/main/js/apps/permission-templates/header.js
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/main.jsx b/server/sonar-web/src/main/js/apps/permission-templates/main.js
index 1a0abfc8ead..1a0abfc8ead 100644
--- a/server/sonar-web/src/main/js/apps/permission-templates/main.jsx
+++ b/server/sonar-web/src/main/js/apps/permission-templates/main.js
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/permission-template-defaults.jsx b/server/sonar-web/src/main/js/apps/permission-templates/permission-template-defaults.js
index 39b9ec52021..39b9ec52021 100644
--- a/server/sonar-web/src/main/js/apps/permission-templates/permission-template-defaults.jsx
+++ b/server/sonar-web/src/main/js/apps/permission-templates/permission-template-defaults.js
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/permission-template-set-defaults.jsx b/server/sonar-web/src/main/js/apps/permission-templates/permission-template-set-defaults.js
index 87a75de168b..87a75de168b 100644
--- a/server/sonar-web/src/main/js/apps/permission-templates/permission-template-set-defaults.jsx
+++ b/server/sonar-web/src/main/js/apps/permission-templates/permission-template-set-defaults.js
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/permission-template.jsx b/server/sonar-web/src/main/js/apps/permission-templates/permission-template.js
index ced79afd895..ced79afd895 100644
--- a/server/sonar-web/src/main/js/apps/permission-templates/permission-template.jsx
+++ b/server/sonar-web/src/main/js/apps/permission-templates/permission-template.js
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/permission-templates.jsx b/server/sonar-web/src/main/js/apps/permission-templates/permission-templates.js
index a86379e256d..a86379e256d 100644
--- a/server/sonar-web/src/main/js/apps/permission-templates/permission-templates.jsx
+++ b/server/sonar-web/src/main/js/apps/permission-templates/permission-templates.js
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/permissions-header.jsx b/server/sonar-web/src/main/js/apps/permission-templates/permissions-header.js
index 7768f9ec414..7768f9ec414 100644
--- a/server/sonar-web/src/main/js/apps/permission-templates/permissions-header.jsx
+++ b/server/sonar-web/src/main/js/apps/permission-templates/permissions-header.js
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/update-view.jsx b/server/sonar-web/src/main/js/apps/permission-templates/update-view.js
index 38e546b820d..38e546b820d 100644
--- a/server/sonar-web/src/main/js/apps/permission-templates/update-view.jsx
+++ b/server/sonar-web/src/main/js/apps/permission-templates/update-view.js
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/users-view.js b/server/sonar-web/src/main/js/apps/permission-templates/users-view.js
index 6c6fa5f90e4..83b474ddb70 100644
--- a/server/sonar-web/src/main/js/apps/permission-templates/users-view.js
+++ b/server/sonar-web/src/main/js/apps/permission-templates/users-view.js
@@ -1,10 +1,10 @@
import _ from 'underscore';
import Modal from '../../components/common/modals';
import '../../components/common/select-list';
-import './templates';
+import Template from './templates/permission-templates-users.hbs';
export default Modal.extend({
- template: Templates['permission-templates-users'],
+ template: Template,
onRender: function () {
this._super();
diff --git a/server/sonar-web/src/main/js/apps/project-permissions/app.js b/server/sonar-web/src/main/js/apps/project-permissions/app.js
new file mode 100644
index 00000000000..1c6f5645fc6
--- /dev/null
+++ b/server/sonar-web/src/main/js/apps/project-permissions/app.js
@@ -0,0 +1,15 @@
+import $ from 'jquery';
+import React from 'react';
+import Main from './main';
+import '../../helpers/handlebars-helpers';
+
+function requestPermissionTemplates () {
+ return $.get(baseUrl + '/api/permissions/search_templates');
+}
+
+window.sonarqube.appStarted.then(options => {
+ requestPermissionTemplates().done(r => {
+ var el = document.querySelector(options.el);
+ React.render(<Main permissionTemplates={r.permissionTemplates} componentId={options.componentId}/>, 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
deleted file mode 100644
index 25abfb8629d..00000000000
--- a/server/sonar-web/src/main/js/apps/project-permissions/app.jsx
+++ /dev/null
@@ -1,23 +0,0 @@
-import $ from 'jquery';
-import React from 'react';
-import Main from './main';
-
-let permissionTemplates = [];
-
-export default {
- start(options) {
- $.when(
- window.requestMessages(),
- this.requestPermissionTemplates()
- ).then(() => {
- var el = document.querySelector(options.el);
- React.render(<Main permissionTemplates={permissionTemplates} componentId={options.componentId}/>, el);
- });
- },
-
- requestPermissionTemplates() {
- return $.get(baseUrl + '/api/permissions/search_templates').done(r => {
- permissionTemplates = r.permissionTemplates;
- });
- }
-};
diff --git a/server/sonar-web/src/main/js/apps/project-permissions/apply-template-view.jsx b/server/sonar-web/src/main/js/apps/project-permissions/apply-template-view.js
index dbf1c26520f..73dc0ec1b95 100644
--- a/server/sonar-web/src/main/js/apps/project-permissions/apply-template-view.jsx
+++ b/server/sonar-web/src/main/js/apps/project-permissions/apply-template-view.js
@@ -2,10 +2,10 @@ import $ from 'jquery';
import _ from 'underscore';
import ModalForm from '../../components/common/modal-form';
import {applyTemplateToProject} from '../../api/permissions';
-import './templates';
+import Template from './templates/project-permissions-apply-template.hbs';
export default ModalForm.extend({
- template: Templates['project-permissions-apply-template'],
+ template: Template,
onRender: function () {
ModalForm.prototype.onRender.apply(this, arguments);
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 ed88709054a..0f63aac99b9 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
@@ -1,14 +1,14 @@
import _ from 'underscore';
-import Modal from 'components/common/modals';
-import 'components/common/select-list';
-import './templates';
+import Modal from '../../components/common/modals';
+import '../../components/common/select-list';
+import Template from './templates/project-permissions-groups.hbs';
function getSearchUrl (permission, project) {
return baseUrl + '/api/permissions/groups?ps=100&permission=' + permission + '&projectId=' + project;
}
export default Modal.extend({
- template: Templates['project-permissions-groups'],
+ template: Template,
onRender: function () {
this._super();
diff --git a/server/sonar-web/src/main/js/apps/project-permissions/main.jsx b/server/sonar-web/src/main/js/apps/project-permissions/main.js
index 2c248f81344..2c248f81344 100644
--- a/server/sonar-web/src/main/js/apps/project-permissions/main.jsx
+++ b/server/sonar-web/src/main/js/apps/project-permissions/main.js
diff --git a/server/sonar-web/src/main/js/apps/project-permissions/permissions-footer.jsx b/server/sonar-web/src/main/js/apps/project-permissions/permissions-footer.js
index cab1354e3ff..cab1354e3ff 100644
--- a/server/sonar-web/src/main/js/apps/project-permissions/permissions-footer.jsx
+++ b/server/sonar-web/src/main/js/apps/project-permissions/permissions-footer.js
diff --git a/server/sonar-web/src/main/js/apps/project-permissions/permissions-header.jsx b/server/sonar-web/src/main/js/apps/project-permissions/permissions-header.js
index 7768f9ec414..7768f9ec414 100644
--- a/server/sonar-web/src/main/js/apps/project-permissions/permissions-header.jsx
+++ b/server/sonar-web/src/main/js/apps/project-permissions/permissions-header.js
diff --git a/server/sonar-web/src/main/js/apps/project-permissions/permissions.jsx b/server/sonar-web/src/main/js/apps/project-permissions/permissions.js
index 26da7da40d6..26da7da40d6 100644
--- a/server/sonar-web/src/main/js/apps/project-permissions/permissions.jsx
+++ b/server/sonar-web/src/main/js/apps/project-permissions/permissions.js
diff --git a/server/sonar-web/src/main/js/apps/project-permissions/project.jsx b/server/sonar-web/src/main/js/apps/project-permissions/project.js
index 57b87b71cbd..57b87b71cbd 100644
--- a/server/sonar-web/src/main/js/apps/project-permissions/project.jsx
+++ b/server/sonar-web/src/main/js/apps/project-permissions/project.js
diff --git a/server/sonar-web/src/main/js/apps/project-permissions/search.jsx b/server/sonar-web/src/main/js/apps/project-permissions/search.js
index dfc243f8636..dfc243f8636 100644
--- a/server/sonar-web/src/main/js/apps/project-permissions/search.jsx
+++ b/server/sonar-web/src/main/js/apps/project-permissions/search.js
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 31cbc91c653..62ab87e8143 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
@@ -1,10 +1,10 @@
import _ from 'underscore';
-import Modal from 'components/common/modals';
-import 'components/common/select-list';
-import './templates';
+import Modal from '../../components/common/modals';
+import '../../components/common/select-list';
+import Template from './templates/project-permissions-users.hbs';
export default Modal.extend({
- template: Templates['project-permissions-users'],
+ template: Template,
onRender: function () {
this._super();
diff --git a/server/sonar-web/src/main/js/apps/projects/app.js b/server/sonar-web/src/main/js/apps/projects/app.js
index 8e98bb1686b..917d7342adc 100644
--- a/server/sonar-web/src/main/js/apps/projects/app.js
+++ b/server/sonar-web/src/main/js/apps/projects/app.js
@@ -1,21 +1,14 @@
-import $ from 'jquery';
import React from 'react';
import Main from './main';
import {getCurrentUser} from '../../api/users';
-import {getGlobalNavigation} from '../../api/nav';
+import '../../helpers/handlebars-helpers';
-export default {
- start(options) {
- $.when(
- getCurrentUser(),
- getGlobalNavigation(),
- window.requestMessages()
- ).then((user, nav) => {
- let el = document.querySelector(options.el),
- hasProvisionPermission = user[0].permissions.global.indexOf('provisioning') !== -1,
- topLevelQualifiers = nav[0].qualifiers;
- React.render(<Main hasProvisionPermission={hasProvisionPermission}
- topLevelQualifiers={topLevelQualifiers}/>, el);
- });
- }
-};
+window.sonarqube.appStarted.then(options => {
+ getCurrentUser().done(user => {
+ let el = document.querySelector(options.el),
+ hasProvisionPermission = user.permissions.global.indexOf('provisioning') !== -1,
+ topLevelQualifiers = options.rootQualifiers;
+ React.render(<Main hasProvisionPermission={hasProvisionPermission}
+ topLevelQualifiers={topLevelQualifiers}/>, el);
+ });
+});
diff --git a/server/sonar-web/src/main/js/apps/projects/create-view.js b/server/sonar-web/src/main/js/apps/projects/create-view.js
index 6307b708614..89425a212f8 100644
--- a/server/sonar-web/src/main/js/apps/projects/create-view.js
+++ b/server/sonar-web/src/main/js/apps/projects/create-view.js
@@ -1,9 +1,9 @@
-import ModalForm from 'components/common/modal-form';
+import ModalForm from '../../components/common/modal-form';
import {createProject} from '../../api/components';
-import './templates';
+import Template from './templates/projects-create-form.hbs';
export default ModalForm.extend({
- template: Templates['projects-create-form'],
+ template: Template,
onRender: function () {
this._super();
diff --git a/server/sonar-web/src/main/js/apps/projects/delete-view.js b/server/sonar-web/src/main/js/apps/projects/delete-view.js
index 56d5f1587b8..2a677ee1355 100644
--- a/server/sonar-web/src/main/js/apps/projects/delete-view.js
+++ b/server/sonar-web/src/main/js/apps/projects/delete-view.js
@@ -1,8 +1,8 @@
-import ModalForm from 'components/common/modal-form';
-import './templates';
+import ModalForm from '../../components/common/modal-form';
+import Template from './templates/projects-delete.hbs';
export default ModalForm.extend({
- template: Templates['projects-delete'],
+ template: Template,
onFormSubmit: function (e) {
this._super(e);
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 62d27477f50..66c200cdb77 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,10 +1,10 @@
import _ from 'underscore';
import Marionette from 'backbone.marionette';
import CreateView from './create-view';
-import './templates';
+import Template from './templates/quality-gate-actions.hbs';
export default Marionette.ItemView.extend({
- template: Templates['quality-gate-actions'],
+ template: Template,
events: {
'click #quality-gate-add': 'add'
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 3dc3eece7f6..bf8fb14aa7b 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
@@ -7,10 +7,12 @@ import ActionsView from './actions-view';
import Router from './router';
import Layout from './layout';
import Controller from './controller';
+import '../../helpers/handlebars-helpers';
var App = new Marionette.Application();
-var init = function (options) {
+var init = function () {
+ let options = window.sonarqube;
// Layout
this.layout = new Layout({ el: options.el });
this.layout.render();
@@ -52,11 +54,11 @@ var appXHR = $.get(baseUrl + '/api/qualitygates/app')
});
App.on('start', function (options) {
- $.when(window.requestMessages(), appXHR).done(function () {
+ appXHR.done(function () {
init.call(App, options);
});
});
-export default App;
+window.sonarqube.appStarted.then(options => App.start(options));
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/delete-view.js b/server/sonar-web/src/main/js/apps/quality-gates/delete-view.js
index ca25708f342..4cef8ac5363 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/delete-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-gates/delete-view.js
@@ -1,8 +1,8 @@
-import ModalForm from 'components/common/modal-form';
-import './templates';
+import ModalForm from '../../components/common/modal-form';
+import Template from './templates/quality-gates-delete.hbs';
export default ModalForm.extend({
- template: Templates['quality-gates-delete'],
+ template: Template,
onFormSubmit: function () {
ModalForm.prototype.onFormSubmit.apply(this, arguments);
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 6f7429cc5f6..5e7f9782b43 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
@@ -2,10 +2,10 @@ import Marionette from 'backbone.marionette';
import Conditions from './conditions';
import DetailConditionsView from './gate-conditions-view';
import ProjectsView from './gate-projects-view';
-import './templates';
+import Template from './templates/quality-gate-detail.hbs';
export default Marionette.LayoutView.extend({
- template: Templates['quality-gate-detail'],
+ template: Template,
regions: {
conditionsRegion: '#quality-gate-conditions',
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 f3f4d55d869..6d0b022334c 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,11 +1,11 @@
import _ from 'underscore';
import Backbone from 'backbone';
-import ModalForm from 'components/common/modal-form';
+import ModalForm from '../../components/common/modal-form';
import Gate from './gate';
-import './templates';
+import Template from './templates/quality-gate-form.hbs';
export default ModalForm.extend({
- template: Templates['quality-gate-form'],
+ template: Template,
onFormSubmit: function () {
ModalForm.prototype.onFormSubmit.apply(this, arguments);
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 7678405c622..9ab319a78e7 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,11 +1,11 @@
import _ from 'underscore';
import Marionette from 'backbone.marionette';
import DeleteConditionView from './gate-conditions-delete-view';
-import './templates';
+import Template from './templates/quality-gate-detail-condition.hbs';
export default Marionette.ItemView.extend({
tagName: 'tr',
- template: Templates['quality-gate-detail-condition'],
+ template: Template,
modelEvents: {
'change': 'render'
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 9922a0bc5b1..b617e603358 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,10 +1,10 @@
import _ from 'underscore';
import Marionette from 'backbone.marionette';
-import ModalForm from 'components/common/modal-form';
-import './templates';
+import ModalForm from '../../components/common/modal-form';
+import Template from './templates/quality-gates-condition-delete.hbs';
export default ModalForm.extend({
- template: Templates['quality-gates-condition-delete'],
+ template: Template,
onFormSubmit: function () {
ModalForm.prototype.onFormSubmit.apply(this, arguments);
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 5be03d5a0c6..a23861c00c1 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,10 +1,10 @@
import _ from 'underscore';
import Marionette from 'backbone.marionette';
-import './templates';
+import Template from './templates/quality-gate-detail-conditions-empty.hbs';
export default Marionette.ItemView.extend({
tagName: 'tr',
- template: Templates['quality-gate-detail-conditions-empty'],
+ template: Template,
serializeData: function () {
return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
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 d02f8f93603..4994a9da37b 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
@@ -3,10 +3,10 @@ import Marionette from 'backbone.marionette';
import Condition from './condition';
import ConditionView from './gate-condition-view';
import ConditionsEmptyView from './gate-conditions-empty-view';
-import './templates';
+import Template from './templates/quality-gate-detail-conditions.hbs';
export default Marionette.CompositeView.extend({
- template: Templates['quality-gate-detail-conditions'],
+ template: Template,
childView: ConditionView,
emptyView: ConditionsEmptyView,
childViewContainer: '.js-conditions',
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 732074be79d..ff7816bd659 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,10 +1,10 @@
import _ from 'underscore';
import Marionette from 'backbone.marionette';
-import 'components/common/select-list';
-import './templates';
+import Template from './templates/quality-gate-detail-projects.hbs';
+import '../../components/common/select-list';
export default Marionette.ItemView.extend({
- template: Templates['quality-gate-detail-projects'],
+ template: Template,
onRender: function () {
if (!this.model.isDefault()) {
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 13b3e582b96..937b2e013d6 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,10 +1,10 @@
import Marionette from 'backbone.marionette';
-import './templates';
+import Template from './templates/quality-gates-gate.hbs';
export default Marionette.ItemView.extend({
tagName: 'a',
className: 'list-group-item',
- template: Templates['quality-gates-gate'],
+ template: Template,
modelEvents: {
'change': 'render'
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 956cc21826a..6864665239e 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,10 +1,10 @@
import Marionette from 'backbone.marionette';
import ItemView from './gate-view';
-import './templates';
+import Template from './templates/quality-gates-gates.hbs';
export default Marionette.CompositeView.extend({
className: 'list-group',
- template: Templates['quality-gates-gates'],
+ template: Template,
childView: ItemView,
childViewContainer: '.js-list',
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 7a002258513..4a51fd42696 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
@@ -3,10 +3,10 @@ import Marionette from 'backbone.marionette';
import RenameView from './rename-view';
import CopyView from './copy-view';
import DeleteView from './delete-view';
-import './templates';
+import Template from './templates/quality-gate-detail-header.hbs';
export default Marionette.ItemView.extend({
- template: Templates['quality-gate-detail-header'],
+ template: Template,
modelEvents: {
'change': 'render'
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 6128211275c..53c95caa621 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,8 +1,8 @@
import Marionette from 'backbone.marionette';
-import './templates';
+import Template from './templates/quality-gates-intro.hbs';
export default Marionette.ItemView.extend({
- template: Templates['quality-gates-intro']
+ template: Template
});
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 5d0a65ae47b..2eeece27cd0 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,9 +1,9 @@
import Marionette from 'backbone.marionette';
import IntroView from './intro-view';
-import './templates';
+import Template from './templates/quality-gates-layout.hbs';
export default Marionette.LayoutView.extend({
- template: Templates['quality-gates-layout'],
+ template: Template,
regions: {
headerRegion: '.search-navigator-workspace-header',
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 a2fe43cbe18..021343f4878 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
@@ -4,10 +4,10 @@ import Marionette from 'backbone.marionette';
import CreateProfileView from './create-profile-view';
import RestoreProfileView from './restore-profile-view';
import RestoreBuiltInProfilesView from './restore-built-in-profiles-view';
-import './templates';
+import Template from './templates/quality-profiles-actions.hbs';
export default Marionette.ItemView.extend({
- template: Templates['quality-profiles-actions'],
+ template: Template,
events: {
'click #quality-profiles-create': 'onCreateClick',
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 1a81ee6598b..9e95e793ad3 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
@@ -7,6 +7,7 @@ import Layout from './layout';
import Profiles from './profiles';
import ActionsView from './actions-view';
import ProfilesView from './profiles-view';
+import '../../helpers/handlebars-helpers';
var App = new Marionette.Application(),
requestUser = $.get(baseUrl + '/api/users/current').done(function (r) {
@@ -15,7 +16,9 @@ var App = new Marionette.Application(),
requestExporters = $.get(baseUrl + '/api/qualityprofiles/exporters').done(function (r) {
App.exporters = r.exporters;
}),
- init = function (options) {
+ init = function () {
+ let options = window.sonarqube;
+
// Layout
this.layout = new Layout({ el: options.el });
this.layout.render();
@@ -51,12 +54,12 @@ var App = new Marionette.Application(),
});
};
-App.on('start', function (options) {
- $.when(window.requestMessages(), requestUser, requestExporters).done(function () {
- init.call(App, options);
+App.on('start', function () {
+ $.when(requestUser, requestExporters).done(function () {
+ init.call(App);
});
});
-export default App;
+window.sonarqube.appStarted.then(options => App.start(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 a3d5ec6b7ad..e4ebc87eb29 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,11 +1,11 @@
import $ from 'jquery';
import _ from 'underscore';
import Marionette from 'backbone.marionette';
-import ModalFormView from 'components/common/modal-form';
-import './templates';
+import ModalFormView from '../../components/common/modal-form';
+import Template from './templates/quality-profiles-change-profile-parent.hbs';
export default ModalFormView.extend({
- template: Templates['quality-profiles-change-profile-parent'],
+ template: Template,
onRender: function () {
ModalFormView.prototype.onRender.apply(this, arguments);
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/copy-profile-view.js b/server/sonar-web/src/main/js/apps/quality-profiles/copy-profile-view.js
index 9c7d29d0dbc..c1060e9ea27 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/copy-profile-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/copy-profile-view.js
@@ -1,10 +1,10 @@
import $ from 'jquery';
-import ModalFormView from 'components/common/modal-form';
+import ModalFormView from '../../components/common/modal-form';
import Profile from './profile';
-import './templates';
+import Template from './templates/quality-profiles-copy-profile.hbs';
export default ModalFormView.extend({
- template: Templates['quality-profiles-copy-profile'],
+ template: Template,
onFormSubmit: function () {
ModalFormView.prototype.onFormSubmit.apply(this, arguments);
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/create-profile-view.js b/server/sonar-web/src/main/js/apps/quality-profiles/create-profile-view.js
index a6258bff571..8a788d23b67 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/create-profile-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/create-profile-view.js
@@ -1,12 +1,12 @@
import $ from 'jquery';
import _ from 'underscore';
-import ModalFormView from 'components/common/modal-form';
-import uploader from 'components/common/file-upload';
+import ModalFormView from '../../components/common/modal-form';
+import uploader from '../../components/common/file-upload';
import Profile from './profile';
-import './templates';
+import Template from './templates/quality-profiles-create-profile.hbs';
export default ModalFormView.extend({
- template: Templates['quality-profiles-create-profile'],
+ template: Template,
events: function () {
return _.extend(ModalFormView.prototype.events.apply(this, arguments), {
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/delete-profile-view.js b/server/sonar-web/src/main/js/apps/quality-profiles/delete-profile-view.js
index ed2ee8ac7da..49cd86ef4af 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/delete-profile-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/delete-profile-view.js
@@ -1,9 +1,9 @@
import $ from 'jquery';
-import ModalFormView from 'components/common/modal-form';
-import './templates';
+import ModalFormView from '../../components/common/modal-form';
+import Template from './templates/quality-profiles-delete-profile.hbs';
export default ModalFormView.extend({
- template: Templates['quality-profiles-delete-profile'],
+ template: Template,
modelEvents: {
'destroy': 'destroy'
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 efb8e83253d..7e060b9599b 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
@@ -1,3 +1,5 @@
+import Handlebars from 'hbsfy/runtime';
+
Handlebars.registerHelper('profileUrl', function (key) {
return baseUrl + '/profiles/show?key=' + encodeURIComponent(key);
});
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 c250e4c7569..ac19cf7e72b 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,8 +1,8 @@
import Marionette from 'backbone.marionette';
-import './templates';
+import Template from './templates/quality-profiles-intro.hbs';
export default Marionette.ItemView.extend({
- template: Templates['quality-profiles-intro']
+ template: Template
});
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 6f7a0af9057..3fc1d0543ff 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,9 +1,9 @@
import Marionette from 'backbone.marionette';
import IntroView from './intro-view';
-import './templates';
+import Template from './templates/quality-profiles-layout.hbs';
export default Marionette.LayoutView.extend({
- template: Templates['quality-profiles-layout'],
+ template: Template,
regions: {
headerRegion: '.search-navigator-workspace-header',
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 4d9e18ad660..b18d730d768 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,8 +1,8 @@
import Marionette from 'backbone.marionette';
-import './templates';
+import Template from './templates/quality-profile-changelog.hbs';
export default Marionette.ItemView.extend({
- template: Templates['quality-profile-changelog'],
+ template: Template,
events: {
'submit #quality-profile-changelog-form': 'onFormSubmit',
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 aab7018aac6..17217c5921a 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,9 +1,9 @@
import _ from 'underscore';
import Marionette from 'backbone.marionette';
-import './templates';
+import Template from './templates/quality-profile-comparison.hbs';
export default Marionette.ItemView.extend({
- template: Templates['quality-profile-comparison'],
+ template: Template,
events: {
'submit #quality-profile-comparison-form': 'onFormSubmit'
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 03ea016e555..7ea7ef2dc96 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
@@ -4,12 +4,12 @@ import Marionette from 'backbone.marionette';
import ChangeProfileParentView from './change-profile-parent-view';
import ProfileChangelogView from './profile-changelog-view';
import ProfileComparisonView from './profile-comparison-view';
-import 'components/common/select-list';
+import '../../components/common/select-list';
import './helpers';
-import './templates';
+import Template from './templates/quality-profiles-profile-details.hbs';
export default Marionette.LayoutView.extend({
- template: Templates['quality-profiles-profile-details'],
+ template: Template,
regions: {
changelogRegion: '#quality-profile-changelog',
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 4c75884fff8..9a209d04530 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
@@ -4,10 +4,10 @@ import Marionette from 'backbone.marionette';
import ProfileCopyView from './copy-profile-view';
import ProfileRenameView from './rename-profile-view';
import ProfileDeleteView from './delete-profile-view';
-import './templates';
+import Template from './templates/quality-profiles-profile-header.hbs';
export default Marionette.ItemView.extend({
- template: Templates['quality-profiles-profile-header'],
+ template: Template,
modelEvents: {
'change': '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 541482a5569..862c86f2d6c 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,11 +1,11 @@
import _ from 'underscore';
import Marionette from 'backbone.marionette';
-import './templates';
+import Template from './templates/quality-profiles-profile.hbs';
export default Marionette.ItemView.extend({
tagName: 'a',
className: 'list-group-item',
- template: Templates['quality-profiles-profile'],
+ template: Template,
modelEvents: {
'change': 'render'
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 49a0a803749..5e5a0b1adb1 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,9 +1,9 @@
import Marionette from 'backbone.marionette';
-import './templates';
+import Template from './templates/quality-profiles-empty.hbs';
export default Marionette.ItemView.extend({
className: 'list-group-item',
- template: Templates['quality-profiles-empty']
+ template: Template
});
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 82d8c26f297..713487a5dd5 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,12 +1,13 @@
import Marionette from 'backbone.marionette';
import ProfileView from './profile-view';
import ProfilesEmptyView from './profiles-empty-view';
-import './templates';
+import Template from './templates/quality-profiles-profiles.hbs';
+import LanguageTemplate from './templates/quality-profiles-profiles-language.hbs';
export default Marionette.CompositeView.extend({
className: 'list-group',
- template: Templates['quality-profiles-profiles'],
- languageTemplate: Templates['quality-profiles-profiles-language'],
+ template: Template,
+ languageTemplate: LanguageTemplate,
childView: ProfileView,
childViewContainer: '.js-list',
emptyView: ProfilesEmptyView,
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/rename-profile-view.js b/server/sonar-web/src/main/js/apps/quality-profiles/rename-profile-view.js
index 9e4aef76403..5ab77f11dc3 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/rename-profile-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/rename-profile-view.js
@@ -1,9 +1,9 @@
import $ from 'jquery';
-import ModalFormView from 'components/common/modal-form';
-import './templates';
+import ModalFormView from '../../components/common/modal-form';
+import Template from './templates/quality-profiles-rename-profile.hbs';
export default ModalFormView.extend({
- template: Templates['quality-profiles-rename-profile'],
+ template: Template,
onFormSubmit: function () {
ModalFormView.prototype.onFormSubmit.apply(this, arguments);
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 76ca3851738..e23638f8f5b 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
@@ -1,10 +1,10 @@
import $ from 'jquery';
import _ from 'underscore';
-import ModalFormView from 'components/common/modal-form';
-import './templates';
+import ModalFormView from '../../components/common/modal-form';
+import Template from './templates/quality-profiles-restore-built-in-profiles.hbs';
export default ModalFormView.extend({
- template: Templates['quality-profiles-restore-built-in-profiles'],
+ template: Template,
onFormSubmit: function () {
ModalFormView.prototype.onFormSubmit.apply(this, arguments);
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/restore-profile-view.js b/server/sonar-web/src/main/js/apps/quality-profiles/restore-profile-view.js
index 57540d9b4a4..2d280acafa9 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/restore-profile-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/restore-profile-view.js
@@ -1,12 +1,12 @@
import $ from 'jquery';
import _ from 'underscore';
-import ModalFormView from 'components/common/modal-form';
-import uploader from 'components/common/file-upload';
+import ModalFormView from '../../components/common/modal-form';
+import uploader from '../../components/common/file-upload';
import Profile from './profile';
-import './templates';
+import Template from './templates/quality-profiles-restore-profile.hbs';
export default ModalFormView.extend({
- template: Templates['quality-profiles-restore-profile'],
+ template: Template,
onFormSubmit: function (e) {
var that = this;
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 3c013e406de..8d7ecb575f7 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,8 +1,11 @@
import Marionette from 'backbone.marionette';
-import SourceViewer from 'components/source-viewer/main';
+import SourceViewer from '../../components/source-viewer/main';
+import '../../helpers/handlebars-helpers';
var App = new Marionette.Application(),
- init = function (options) {
+ init = function () {
+ let options = window.sonarqube;
+
this.addRegions({ mainRegion: options.el });
var viewer = new SourceViewer();
@@ -17,12 +20,10 @@ var App = new Marionette.Application(),
}
};
-App.on('start', function (options) {
- window.requestMessages().done(function () {
- init.call(App, options);
- });
+App.on('start', function () {
+ init.call(App);
});
-export default App;
+window.sonarqube.appStarted.then(options => App.start(options));
diff --git a/server/sonar-web/src/main/js/apps/system/app.js b/server/sonar-web/src/main/js/apps/system/app.js
index 6f01aa94453..223337df883 100644
--- a/server/sonar-web/src/main/js/apps/system/app.js
+++ b/server/sonar-web/src/main/js/apps/system/app.js
@@ -3,7 +3,7 @@ import {setLogLevel} from '../../api/system';
const LOG_LEVELS = ['INFO', 'DEBUG', 'TRACE'];
-window.requestMessages().done(() => {
+window.sonarqube.appStarted.then(() => {
let cell = $('#sonarqube-logs-level').find('td:last-child');
if (cell.length) {
let currentValue = cell.text().trim();
@@ -53,3 +53,5 @@ window.requestMessages().done(() => {
});
}
});
+
+
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 b667f6736b8..01d4c554cc6 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
@@ -8,9 +8,13 @@ import FooterView from './footer-view';
import Controller from './controller';
import Router from './router';
import Plugins from './plugins';
+import './partials';
+import '../../helpers/handlebars-helpers';
var App = new Marionette.Application(),
- init = function (options) {
+ init = function () {
+ let options = window.sonarqube;
+
// State
this.state = new Backbone.Model({
updateCenterActive: window.SS.updateCenterActive
@@ -53,12 +57,10 @@ var App = new Marionette.Application(),
});
};
-App.on('start', function (options) {
- window.requestMessages().done(function () {
- init.call(App, options);
- });
+App.on('start', function () {
+ init.call(App);
});
-export default App;
+window.sonarqube.appStarted.then(options => App.start(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 085dacf43c2..07f8e622124 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,9 +1,9 @@
import _ from 'underscore';
import Marionette from 'backbone.marionette';
-import './templates';
+import Template from './templates/update-center-footer.hbs';
export default Marionette.ItemView.extend({
- template: Templates['update-center-footer'],
+ template: Template,
collectionEvents: {
'all': 'render'
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 1a78ad8533b..c22354b1233 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,9 +1,9 @@
import _ from 'underscore';
import Marionette from 'backbone.marionette';
-import './templates';
+import Template from './templates/update-center-header.hbs';
export default Marionette.ItemView.extend({
- template: Templates['update-center-header'],
+ template: Template,
collectionEvents: {
all: 'render'
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 2a8c5d7b4e8..16aad883f3a 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,8 +1,8 @@
import Marionette from 'backbone.marionette';
-import './templates';
+import Template from './templates/update-center-layout.hbs';
export default Marionette.LayoutView.extend({
- template: Templates['update-center-layout'],
+ template: Template,
regions: {
headerRegion: '#update-center-header',
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 163d3c61fa0..695994f9e18 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
@@ -2,13 +2,14 @@ import $ from 'jquery';
import Backbone from 'backbone';
import Marionette from 'backbone.marionette';
import PluginChangelogView from './plugin-changelog-view';
-import './templates';
+import Template from './templates/update-center-plugin.hbs';
+import SystemTemplate from './templates/update-center-system-update.hbs';
export default Marionette.ItemView.extend({
tagName: 'li',
className: 'panel panel-vertical',
- template: Templates['update-center-plugin'],
- systemTemplate: Templates['update-center-system-update'],
+ template: Template,
+ systemTemplate: SystemTemplate,
modelEvents: {
'change:_hidden': 'toggleDisplay',
diff --git a/server/sonar-web/src/main/js/apps/update-center/partials.js b/server/sonar-web/src/main/js/apps/update-center/partials.js
new file mode 100644
index 00000000000..88483429742
--- /dev/null
+++ b/server/sonar-web/src/main/js/apps/update-center/partials.js
@@ -0,0 +1,6 @@
+import Handlebars from 'hbsfy/runtime';
+import ChangeEntryPartial from './templates/_update-center-plugin-changelog-entry.hbs';
+import ActionsPartial from './templates/_update-center-plugin-actions.hbs';
+
+Handlebars.registerPartial('_update-center-plugin-changelog-entry', ChangeEntryPartial);
+Handlebars.registerPartial('_update-center-plugin-actions', ActionsPartial);
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 56ce094b922..c07b2d3c7ac 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,9 +1,9 @@
import _ from 'underscore';
-import Popup from 'components/common/popup';
-import './templates';
+import Popup from '../../components/common/popup';
+import Template from './templates/update-center-plugin-changelog.hbs';
export default Popup.extend({
- template: Templates['update-center-plugin-changelog'],
+ template: Template,
onRender: function () {
this._super();
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 739f11a2c96..c711e8a56af 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,9 +1,9 @@
import _ from 'underscore';
import Marionette from 'backbone.marionette';
-import './templates';
+import Template from './templates/update-center-search.hbs';
export default Marionette.ItemView.extend({
- template: Templates['update-center-search'],
+ template: Template,
events: {
'change [name="update-center-filter"]': 'onFilterChange',
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 cf64028a2e7..5e51c04d989 100644
--- a/server/sonar-web/src/main/js/apps/users/app.js
+++ b/server/sonar-web/src/main/js/apps/users/app.js
@@ -5,9 +5,12 @@ import HeaderView from './header-view';
import SearchView from './search-view';
import ListView from './list-view';
import ListFooterView from './list-footer-view';
+import '../../helpers/handlebars-helpers';
var App = new Marionette.Application(),
- init = function (options) {
+ init = function () {
+ let options = window.sonarqube;
+
// Layout
this.layout = new Layout({ el: options.el });
this.layout.render();
@@ -35,12 +38,10 @@ var App = new Marionette.Application(),
this.users.fetch();
};
-App.on('start', function (options) {
- window.requestMessages().done(function () {
- init.call(App, options);
- });
+App.on('start', function () {
+ init.call(App);
});
-export default App;
+window.sonarqube.appStarted.then(options => App.start(options));
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 f8b9f95eb60..f9912b607ad 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
@@ -1,8 +1,8 @@
-import ModalForm from 'components/common/modal-form';
-import './templates';
+import ModalForm from '../../components/common/modal-form';
+import Template from './templates/users-change-password.hbs';
export default ModalForm.extend({
- template: Templates['users-change-password'],
+ template: Template,
onFormSubmit: function (e) {
this._super(e);
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 bf7cbe80489..780e140f39a 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
@@ -1,8 +1,8 @@
-import ModalForm from 'components/common/modal-form';
-import './templates';
+import ModalForm from '../../components/common/modal-form';
+import Template from './templates/users-deactivate.hbs';
export default ModalForm.extend({
- template: Templates['users-deactivate'],
+ template: Template,
onFormSubmit: function (e) {
this._super(e);
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 71bd7716038..85d8affe3bb 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
@@ -1,10 +1,10 @@
import $ from 'jquery';
import _ from 'underscore';
-import ModalForm from 'components/common/modal-form';
-import './templates';
+import ModalForm from '../../components/common/modal-form';
+import Template from './templates/users-form.hbs';
export default ModalForm.extend({
- template: Templates['users-form'],
+ template: Template,
events: function () {
return _.extend(this._super(), {
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 6e4a9048854..498ab93df92 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
@@ -1,10 +1,9 @@
-import Modal from 'components/common/modals';
-import 'components/common/select-list';
-import './templates';
+import Modal from '../../components/common/modals';
+import '../../components/common/select-list';
+import Template from './templates/users-groups.hbs';
export default Modal.extend({
- template: Templates['users-groups'],
- itemTemplate: Templates['users-group'],
+ template: Template,
onRender: function () {
this._super();
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 ae9bae8e422..66e5df75b1a 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,9 +1,9 @@
import Marionette from 'backbone.marionette';
import CreateView from './create-view';
-import './templates';
+import Template from './templates/users-header.hbs';
export default Marionette.ItemView.extend({
- template: Templates['users-header'],
+ template: Template,
events: {
'click #users-create': 'onCreateClick'
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 90866f6f6e1..f72e5f2caa3 100644
--- a/server/sonar-web/src/main/js/apps/users/layout.js
+++ b/server/sonar-web/src/main/js/apps/users/layout.js
@@ -1,8 +1,8 @@
import Marionette from 'backbone.marionette';
-import './templates';
+import Template from './templates/users-layout.hbs';
export default Marionette.LayoutView.extend({
- template: Templates['users-layout'],
+ template: Template,
regions: {
headerRegion: '#users-header',
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 7c4d2482efa..6a4dd06a2b1 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,9 +1,9 @@
import _ from 'underscore';
import Marionette from 'backbone.marionette';
-import './templates';
+import Template from './templates/users-list-footer.hbs';
export default Marionette.ItemView.extend({
- template: Templates['users-list-footer'],
+ template: Template,
collectionEvents: {
'all': 'render'
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 50e864992fa..316d0428576 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
@@ -4,12 +4,12 @@ import UpdateView from './update-view';
import ChangePasswordView from './change-password-view';
import DeactivateView from './deactivate-view';
import GroupsView from './groups-view';
-import './templates';
+import Template from './templates/users-list-item.hbs';
export default Marionette.ItemView.extend({
tagName: 'li',
className: 'panel panel-vertical',
- template: Templates['users-list-item'],
+ template: Template,
events: {
'click .js-user-more-scm': 'onMoreScmClick',
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 695bf2ac034..699e9c76a85 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,6 +1,5 @@
import Marionette from 'backbone.marionette';
import ListItemView from './list-item-view';
-import './templates';
export default 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 114f0971e71..beae12b40ad 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,9 +1,9 @@
import _ from 'underscore';
import Marionette from 'backbone.marionette';
-import './templates';
+import Template from './templates/users-search.hbs';
export default Marionette.ItemView.extend({
- template: Templates['users-search'],
+ template: Template,
events: {
'submit #users-search-form': 'onFormSubmit',