aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js
diff options
context:
space:
mode:
authorStas Vilchik <stas.vilchik@sonarsource.com>2018-12-05 17:32:18 +0100
committerSonarTech <sonartech@sonarsource.com>2018-12-05 20:20:59 +0100
commit41c98779d38bda9fdfdca182a5f20c73fcff9a84 (patch)
treed895a9f8bfd0276aee5ffacf7bb33a0109436cbd /server/sonar-web/src/main/js
parenta9c22c1185c5fd8c8dc4c9388f4a3b967e3f463d (diff)
downloadsonarqube-41c98779d38bda9fdfdca182a5f20c73fcff9a84.tar.gz
sonarqube-41c98779d38bda9fdfdca182a5f20c73fcff9a84.zip
create global type definitions (#1017)
Diffstat (limited to 'server/sonar-web/src/main/js')
-rw-r--r--server/sonar-web/src/main/js/api/alm-integration.ts19
-rw-r--r--server/sonar-web/src/main/js/api/billing.ts3
-rw-r--r--server/sonar-web/src/main/js/api/branches.ts5
-rw-r--r--server/sonar-web/src/main/js/api/ce.ts7
-rw-r--r--server/sonar-web/src/main/js/api/components.ts57
-rw-r--r--server/sonar-web/src/main/js/api/issues.ts3
-rw-r--r--server/sonar-web/src/main/js/api/languages.ts3
-rw-r--r--server/sonar-web/src/main/js/api/measures.ts22
-rw-r--r--server/sonar-web/src/main/js/api/metrics.ts9
-rw-r--r--server/sonar-web/src/main/js/api/nav.ts5
-rw-r--r--server/sonar-web/src/main/js/api/notifications.ts3
-rw-r--r--server/sonar-web/src/main/js/api/organizations.ts29
-rw-r--r--server/sonar-web/src/main/js/api/permissions.ts21
-rw-r--r--server/sonar-web/src/main/js/api/projectActivity.ts5
-rw-r--r--server/sonar-web/src/main/js/api/projectLinks.ts5
-rw-r--r--server/sonar-web/src/main/js/api/quality-gates.ts21
-rw-r--r--server/sonar-web/src/main/js/api/quality-profiles.ts5
-rw-r--r--server/sonar-web/src/main/js/api/rules.ts11
-rw-r--r--server/sonar-web/src/main/js/api/security-reports.ts3
-rw-r--r--server/sonar-web/src/main/js/api/settings.ts21
-rw-r--r--server/sonar-web/src/main/js/api/tests.ts7
-rw-r--r--server/sonar-web/src/main/js/api/time-machine.ts7
-rw-r--r--server/sonar-web/src/main/js/api/user_groups.ts7
-rw-r--r--server/sonar-web/src/main/js/api/users.ts15
-rw-r--r--server/sonar-web/src/main/js/api/webhooks.ts11
-rw-r--r--server/sonar-web/src/main/js/app/components/AdminContainer.tsx5
-rw-r--r--server/sonar-web/src/main/js/app/components/App.tsx5
-rw-r--r--server/sonar-web/src/main/js/app/components/ComponentContainer.tsx55
-rw-r--r--server/sonar-web/src/main/js/app/components/ComponentContext.tsx5
-rw-r--r--server/sonar-web/src/main/js/app/components/GlobalFooter.tsx4
-rw-r--r--server/sonar-web/src/main/js/app/components/GlobalFooterContainer.tsx3
-rw-r--r--server/sonar-web/src/main/js/app/components/Landing.tsx3
-rw-r--r--server/sonar-web/src/main/js/app/components/ProjectAdminContainer.tsx7
-rw-r--r--server/sonar-web/src/main/js/app/components/StartupModal.tsx10
-rw-r--r--server/sonar-web/src/main/js/app/components/__tests__/ComponentContainer-test.tsx40
-rw-r--r--server/sonar-web/src/main/js/app/components/__tests__/StartupModal-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/app/components/extensions/Extension.tsx3
-rw-r--r--server/sonar-web/src/main/js/app/components/extensions/GlobalAdminPageExtension.tsx3
-rw-r--r--server/sonar-web/src/main/js/app/components/extensions/GlobalPageExtension.tsx3
-rw-r--r--server/sonar-web/src/main/js/app/components/extensions/OrganizationPageExtension.tsx3
-rw-r--r--server/sonar-web/src/main/js/app/components/extensions/ProjectAdminPageExtension.tsx3
-rw-r--r--server/sonar-web/src/main/js/app/components/extensions/ProjectPageExtension.tsx3
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/ComponentNav.tsx11
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBgTaskNotif.tsx5
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranch.tsx7
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranchesMenu.tsx15
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranchesMenuItem.tsx7
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/ComponentNavHeader.tsx11
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/ComponentNavLicenseNotif.tsx3
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx7
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMeta.tsx26
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBgTaskNotif-test.tsx7
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBranch-test.tsx32
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBranchesMenu-test.tsx22
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBranchesMenuItem-test.tsx11
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavHeader-test.tsx9
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavLicenseNotif-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavMenu-test.tsx9
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavMeta-test.tsx11
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/global/GlobalNav.tsx5
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/global/GlobalNavMenu.tsx7
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/global/GlobalNavPlus.tsx5
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/global/GlobalNavUser.tsx7
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/global/GlobalNavUserContainer.tsx3
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/global/__tests__/GlobalNavPlus-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/global/__tests__/GlobalNavUser-test.tsx9
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.tsx5
-rw-r--r--server/sonar-web/src/main/js/app/components/search/Search.tsx5
-rw-r--r--server/sonar-web/src/main/js/app/components/search/SearchResult.tsx3
-rw-r--r--server/sonar-web/src/main/js/app/types.d.ts865
-rw-r--r--server/sonar-web/src/main/js/app/types.ts916
-rw-r--r--server/sonar-web/src/main/js/app/utils/getStore.ts5
-rw-r--r--server/sonar-web/src/main/js/app/utils/startReactApp.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/about/components/AboutApp.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/about/components/AboutStandards.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/about/components/EntryIssueTypes.tsx15
-rw-r--r--server/sonar-web/src/main/js/apps/about/sonarcloud/Contact.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/about/sonarcloud/components/SQPageContainer.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/account/components/Account.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/account/components/Password.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/account/components/Security.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/account/components/UserCard.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/account/notifications/GlobalNotifications.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/account/notifications/Notifications.tsx13
-rw-r--r--server/sonar-web/src/main/js/apps/account/notifications/NotificationsList.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/account/notifications/ProjectNotifications.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/account/notifications/Projects.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/account/organizations/OrganizationCard.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/account/organizations/OrganizationsList.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/account/organizations/UserOrganizations.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/account/profile/Profile.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/account/profile/UserExternalIdentity.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/account/profile/UserScmAccounts.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/account/projects/ProjectCard.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/account/projects/Projects.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/account/projects/ProjectsContainer.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/Footer.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/ScannerContext.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/Stacktrace.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/Task.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/TaskActions.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskActions-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/utils.ts3
-rw-r--r--server/sonar-web/src/main/js/apps/code/__tests__/buckets-test.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/code/bucket.ts19
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/App.tsx17
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/Breadcrumbs.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/Component.tsx11
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/ComponentLink.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/ComponentMeasure.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/ComponentName.tsx11
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/ComponentPin.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/Components.tsx13
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/ComponentsHeader.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/Search.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/__tests__/Components-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/code/utils.ts45
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/ActivationButton.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/ActivationFormModal.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/App.tsx28
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/BulkChange.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/BulkChangeModal.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleButton.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormModal.tsx11
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/InheritanceFacet.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/PageActions.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetails.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsCustomRules.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsDescription.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsIssues.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsMeta.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsParameters.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsProfiles.tsx27
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/RuleInheritanceIcon.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/RuleListItem.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/SimilarRulesFilter.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/TemplateFacet.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/TypeFacet.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleDetailsDescription-test.tsx16
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleDetailsIssues-test.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleDetailsMeta-test.tsx20
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleListItem-test.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/query.ts17
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/App.tsx32
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/AppContainer.tsx31
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/Breadcrumb.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/Breadcrumbs.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/LeakPeriodLegend.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.tsx36
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/MeasureContentContainer.tsx30
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/MeasureFavoriteContainer.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/MeasureHeader.tsx13
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/MeasureOverview.tsx25
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/MeasureOverviewContainer.tsx13
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/MeasureViewSelect.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/PageActions.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/__tests__/LeakPeriodLegend-test.tsx11
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureHeader-test.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureViewSelect-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/drilldown/BubbleChart.tsx21
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/drilldown/CodeView.tsx17
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentCell.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsList.tsx11
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsListRow.tsx11
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/drilldown/FilesView.tsx23
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/drilldown/MeasureCell.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.tsx15
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/sidebar/DomainFacet.tsx11
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/sidebar/FacetMeasureValue.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/sidebar/Sidebar.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/utils.ts44
-rw-r--r--server/sonar-web/src/main/js/apps/create/components/OrganizationSelect.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/create/organization/AutoOrganizationBind.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/create/organization/AutoOrganizationCreate.tsx25
-rw-r--r--server/sonar-web/src/main/js/apps/create/organization/AutoPersonalOrganizationBind.tsx18
-rw-r--r--server/sonar-web/src/main/js/apps/create/organization/BillingFormShim.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/create/organization/CreateOrganization.tsx43
-rw-r--r--server/sonar-web/src/main/js/apps/create/organization/ManualOrganizationCreate.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/create/organization/OrganizationDetailsForm.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/create/organization/OrganizationDetailsStep.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/create/organization/PlanStep.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/create/organization/RemoteOrganizationChoose.tsx18
-rw-r--r--server/sonar-web/src/main/js/apps/create/organization/__tests__/CreateOrganization-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/AlmRepositoryItem.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/AutoProjectCreate.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/CreateProjectPage.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/ManualProjectCreate.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/OrganizationInput.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/RemoteRepositories.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/__tests__/CreateProjectPage-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/custom-measures/components/App.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/custom-measures/components/DeleteForm.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/custom-measures/components/Form.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/custom-measures/components/Item.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/custom-measures/components/List.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/custom-measures/components/MeasureDate.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/custom-metrics/components/App.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/custom-metrics/components/DeleteForm.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/custom-metrics/components/Form.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/custom-metrics/components/Item.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/custom-metrics/components/List.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/groups/components/App.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/groups/components/DeleteForm.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/groups/components/EditMembers.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/groups/components/EditMembersModal.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/groups/components/Form.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/groups/components/List.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/groups/components/ListItem.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/issues/IssuesPageSelector.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/issues/components/App.tsx44
-rw-r--r--server/sonar-web/src/main/js/apps/issues/components/AppContainer.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/issues/components/BulkChangeModal.tsx17
-rw-r--r--server/sonar-web/src/main/js/apps/issues/components/ComponentBreadcrumbs.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/issues/components/IssuesList.tsx11
-rw-r--r--server/sonar-web/src/main/js/apps/issues/components/IssuesSourceViewer.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/issues/components/ListItem.tsx13
-rw-r--r--server/sonar-web/src/main/js/apps/issues/components/PageActions.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/issues/components/__tests__/App-test.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/issues/components/__tests__/BulkChangeModal-test.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/issues/components/__tests__/ComponentBreadcrumbs-test.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssue.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueBox.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueLocations.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueLocationsNavigator.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssuesList.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssuesListHeader.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/issues/conciseIssuesList/CrossFileLocationsNavigator.tsx11
-rw-r--r--server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/ConciseIssue-test.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/ConciseIssueLocationsNavigator-test.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/ConciseIssuesList-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/CrossFileLocationsNavigator-test.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/AuthorFacet.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/CreationDateFacet.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/ProjectFacet.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/RuleFacet.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/Sidebar.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/TagFacet.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/TypeFacet.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/issues/utils.ts9
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/App.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/AppContainer.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/EditionBoxes.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/Header.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/EditionBox.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/utils.ts2
-rw-r--r--server/sonar-web/src/main/js/apps/organizationMembers/AddMemberForm.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/organizationMembers/ManageMemberGroupsForm.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/organizationMembers/MembersList.tsx11
-rw-r--r--server/sonar-web/src/main/js/apps/organizationMembers/MembersListItem.tsx11
-rw-r--r--server/sonar-web/src/main/js/apps/organizationMembers/OrganizationMembers.tsx20
-rw-r--r--server/sonar-web/src/main/js/apps/organizationMembers/OrganizationMembersContainer.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/organizationMembers/RemoveMemberForm.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/organizationMembers/__tests__/OrganizationMembers-test.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/organizations/actions.ts9
-rw-r--r--server/sonar-web/src/main/js/apps/organizations/components/OrganizationAccessContainer.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/organizations/components/OrganizationContainer.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/organizations/components/OrganizationDelete.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/organizations/components/OrganizationEdit.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/organizations/components/OrganizationGroupCheckbox.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/organizations/components/OrganizationJustCreated.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/organizations/components/OrganizationPage.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/organizations/components/OrganizationProjects.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/organizations/components/__tests__/OrganizationAccessContainer-test.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/organizations/components/__tests__/OrganizationJustCreated-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigation.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigationAdministration.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigationExtensions.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigationHeader.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigationHeaderContainer.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigationMenuContainer.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigationMeta.tsx11
-rw-r--r--server/sonar-web/src/main/js/apps/organizations/navigation/__tests__/OrganizationNavigation-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/organizations/navigation/__tests__/OrganizationNavigationAdministration-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/organizations/navigation/__tests__/OrganizationNavigationHeader-test.tsx13
-rw-r--r--server/sonar-web/src/main/js/apps/organizations/navigation/__tests__/OrganizationNavigationMenuContainer-test.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/organizations/navigation/__tests__/OrganizationNavigationMeta-test.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/overview/badges/BadgeParams.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/overview/badges/BadgesModal.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/overview/badges/__tests__/BadgeParams-test.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/overview/badges/__tests__/BadgesModal-test.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/overview/components/App.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/overview/components/ApplicationLeakPeriodLegend.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/overview/components/EmptyOverview.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/overview/components/LeakPeriodLegend.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/overview/components/OverviewApp.tsx13
-rw-r--r--server/sonar-web/src/main/js/apps/overview/components/SonarCloudEmptyOverview.tsx11
-rw-r--r--server/sonar-web/src/main/js/apps/overview/components/__tests__/App-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/overview/components/__tests__/EmptyOverview-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/overview/components/__tests__/LeakPeriodLegend-test.tsx15
-rw-r--r--server/sonar-web/src/main/js/apps/overview/components/__tests__/SonarCloudEmptyOverview-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/overview/events/AnalysesList.tsx11
-rw-r--r--server/sonar-web/src/main/js/apps/overview/events/Analysis.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/overview/events/Event.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/overview/main/BugsAndVulnerabilities.tsx11
-rw-r--r--server/sonar-web/src/main/js/apps/overview/main/CodeSmells.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/overview/main/enhance.tsx15
-rw-r--r--server/sonar-web/src/main/js/apps/overview/meta/MetaContainer.tsx25
-rw-r--r--server/sonar-web/src/main/js/apps/overview/meta/MetaLink.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/overview/meta/MetaLinks.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/overview/meta/MetaQualityProfiles.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/overview/meta/MetaSize.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/overview/meta/MetaTags.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/overview/qualityGate/ApplicationQualityGate.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/overview/qualityGate/ApplicationQualityGateProject.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/overview/qualityGate/QualityGate.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/overview/qualityGate/QualityGateCondition.tsx21
-rw-r--r--server/sonar-web/src/main/js/apps/overview/qualityGate/QualityGateConditions.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/overview/utils.ts3
-rw-r--r--server/sonar-web/src/main/js/apps/permission-templates/components/ActionsCell.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/permission-templates/components/DeleteForm.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/global/components/AllHoldersList.tsx23
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/global/components/App.tsx23
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/project/components/AllHoldersList.tsx25
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/project/components/App.tsx37
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/project/components/ApplyTemplate.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/project/components/PageHeader.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/shared/components/GroupHolder.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/shared/components/HoldersList.tsx23
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/shared/components/PermissionCell.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/shared/components/PermissionHeader.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/shared/components/UserHolder.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/utils.ts9
-rw-r--r--server/sonar-web/src/main/js/apps/portfolio/components/Activity.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/portfolio/components/App.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/portfolio/components/Subscription.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/portfolio/components/__tests__/App-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/actions.ts5
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/DefinitionChangeEventInner.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/Event.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/EventInner.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/Events.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/GraphHistory.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltips.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentEvents.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityApp.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAppContainer.tsx17
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityGraphs.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityGraphsHeader.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityPageFooter.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityPageHeader.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/RichQualityGateEventInner.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/DefinitionChangeEventInner-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/forms/AddGraphMetric.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/forms/ChangeEventForm.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/forms/RemoveEventForm.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/utils.ts7
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/App.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/BranchRow.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/DeleteBranchModal.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/LeakPeriodForm.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/LongBranchesPattern.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/LongBranchesPatternForm.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/RenameBranchModal.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/SettingForm.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/App-test.tsx23
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchRow-test.tsx17
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/DeleteBranchModal-test.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/RenameBranchModal-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectDeletion/App.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectDeletion/Form.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectDeletion/Header.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectLinks/App.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/projectLinks/LinkRow.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/projectLinks/Table.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectLinks/utils.ts5
-rw-r--r--server/sonar-web/src/main/js/apps/projectQualityGate/App.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/projectQualityGate/Form.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/App-test.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/projectQualityProfiles/App.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/AllProjects.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/DefaultPageSelector.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/EmptyInstance.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/FavoriteFilter.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/NoFavoriteProjects.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/PageHeader.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/ProjectCard.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/ProjectCardLanguages.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/ProjectCardLeak.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/ProjectCardOverall.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/ProjectsList.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/__tests__/DefaultPageSelector-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/__tests__/NoFavoriteProjects-test.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCardLeak-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCardOverall-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/projects/filters/LanguagesFilter.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projects/types.ts3
-rw-r--r--server/sonar-web/src/main/js/apps/projects/utils.ts5
-rw-r--r--server/sonar-web/src/main/js/apps/projects/visualizations/SimpleBubbleChart.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/Risk-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/SimpleBubbleChart-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/App.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/AppContainer.tsx17
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/BulkApplyTemplateModal.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/ChangeVisibilityForm.tsx16
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/CreateProjectForm.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/Header.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/Projects.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/Search.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/__tests__/App-test.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ChangeVisibilityForm-test.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/__tests__/CreateProjectForm-test.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Header-test.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ProjectRow-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ProjectRowActions-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Projects-test.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Search-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/AddConditionSelect.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/Condition.tsx15
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/ConditionModal.tsx21
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/ConditionOperator.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.tsx17
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/CopyQualityGateForm.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/DeleteQualityGateForm.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/DetailsApp.tsx17
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/DetailsContent.tsx11
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/DetailsHeader.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/Intro.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/List.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/Period.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/Projects.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatesApp.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/RenameQualityGateForm.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/ThresholdInput.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/utils.ts16
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/components/App.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissions.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileRules-test.tsx17
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionRules.tsx8
-rwxr-xr-xserver/sonar-web/src/main/js/apps/securityReports/components/App.tsx7
-rwxr-xr-xserver/sonar-web/src/main/js/apps/securityReports/components/VulnerabilityList.tsx27
-rw-r--r--server/sonar-web/src/main/js/apps/securityReports/components/__tests__/App-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/securityReports/components/__tests__/VulnerabilityList-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/sessions/components/EmailAlreadyExists.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/sessions/components/Login.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/sessions/components/LoginContainer.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/sessions/components/LoginSonarCloud.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/sessions/components/OAuthProviders.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/sessions/components/UpdateLogin.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/settings/__tests__/utils-test.ts29
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/AllCategoriesList.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/AppContainer.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/CategoryDefinitionsList.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/Definition.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/DefinitionActions.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/DefinitionsList.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/EmailForm.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/PageHeader.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/SubCategoryDefinitionsList.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/__tests__/DefinitionActions-test.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/inputs/Input.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/inputs/InputForSingleSelectList.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/inputs/PrimitiveInput.tsx19
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/Input-test.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/MultiValueInput-test.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/settings/store/actions.ts3
-rw-r--r--server/sonar-web/src/main/js/apps/settings/store/definitions.ts5
-rw-r--r--server/sonar-web/src/main/js/apps/settings/store/values.ts9
-rw-r--r--server/sonar-web/src/main/js/apps/settings/utils.ts49
-rw-r--r--server/sonar-web/src/main/js/apps/tutorials/analyzeProject/AnalyzeTutorial.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/tutorials/analyzeProject/__tests__/AnalyzeTutorial-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/tutorials/components/LanguageForm.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/tutorials/components/OrganizationStep.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/tutorials/components/ProjectAnalysisStep.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/tutorials/components/commands/AnalysisCommand.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/tutorials/onboarding/OnboardingModal.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/tutorials/onboarding/OnboardingPage.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/tutorials/projectOnboarding/ProjectOnboarding.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/users/UsersApp.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/users/UsersList.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/DeactivateForm.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/GroupsForm.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/PasswordForm.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/TokensFormModal.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/UserActions.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/UserForm.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/UserGroups.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/UserListItem.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/UserListItemIdentity.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/webhooks/components/App.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/webhooks/components/CreateWebhookForm.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/webhooks/components/DeleteWebhookForm.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/webhooks/components/DeliveriesForm.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/webhooks/components/DeliveryAccordion.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/webhooks/components/DeliveryItem.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/webhooks/components/LatestDeliveryForm.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/webhooks/components/WebhookActions.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/webhooks/components/WebhookItem.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/webhooks/components/WebhookItemLatestDelivery.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/webhooks/components/WebhooksList.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/webhooks/components/__tests__/App-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/SourceViewerBase.tsx68
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/SourceViewerCode.tsx42
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/CoveragePopup.tsx7
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/DuplicationPopup.tsx11
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/Line.tsx19
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/LineCode.tsx11
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/LineCoverage.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/LineDuplicationBlock.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/LineDuplications.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesIndicator.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesList.tsx7
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/LineNumber.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/LineOptionsPopup.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/LineSCM.tsx7
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlay.tsx27
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlayCoveredFiles.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlayMeasure.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlayTestCase.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlayTestCases.tsx7
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/SCMPopup.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineCode-test.tsx9
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineCoverage-test.tsx9
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineIssuesIndicator-test.tsx7
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineIssuesList-test.tsx7
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineOptionsPopup-test.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlay-test.tsx7
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlayTestCases-test.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/helpers/getCoverageStatus.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/helpers/highlight.ts3
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/helpers/indexing.ts13
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/helpers/issueLocations.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/helpers/loadIssues.tsx11
-rw-r--r--server/sonar-web/src/main/js/components/charts/LanguageDistribution.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/common/BranchMeasures.tsx9
-rw-r--r--server/sonar-web/src/main/js/components/common/BranchStatus.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/common/OrganizationAvatar.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/common/PrivacyBadgeContainer.tsx21
-rw-r--r--server/sonar-web/src/main/js/components/common/VisibilitySelector.tsx15
-rw-r--r--server/sonar-web/src/main/js/components/common/__tests__/BranchMeasures-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/common/__tests__/BranchStatus-test.tsx11
-rw-r--r--server/sonar-web/src/main/js/components/common/__tests__/PrivacyBadgeContainer-test.tsx13
-rw-r--r--server/sonar-web/src/main/js/components/common/__tests__/VisibilitySelector-test.tsx19
-rw-r--r--server/sonar-web/src/main/js/components/controls/HomePageSelect.tsx16
-rw-r--r--server/sonar-web/src/main/js/components/controls/ValidationForm.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/controls/__tests__/HomePageSelect-test.tsx9
-rw-r--r--server/sonar-web/src/main/js/components/facet/ListStyleFacet.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/hoc/__tests__/withCurrentUser-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/hoc/__tests__/withUserOrganizations-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/hoc/whenLoggedIn.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/hoc/withCurrentUser.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/hoc/withUserOrganizations.tsx10
-rw-r--r--server/sonar-web/src/main/js/components/icons-components/BranchIcon.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/issue/Issue.tsx9
-rw-r--r--server/sonar-web/src/main/js/components/issue/IssueView.tsx9
-rw-r--r--server/sonar-web/src/main/js/components/issue/actions.ts7
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/IssueActionsBar.tsx13
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/IssueAssign.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/IssueChangelog.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/IssueCommentAction.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/IssueCommentLine.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/IssueSeverity.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/IssueTags.tsx9
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.tsx9
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/IssueTransition.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/IssueType.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/SimilarIssuesFilter.tsx7
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/__tests__/IssueCommentLine-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTitleBar-test.tsx19
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/__tests__/IssueType-test.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/issue/popups/ChangelogPopup.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/issue/popups/CommentPopup.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/issue/popups/SetAssigneePopup.tsx7
-rw-r--r--server/sonar-web/src/main/js/components/issue/popups/SetSeverityPopup.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/issue/popups/SetTypePopup.tsx7
-rw-r--r--server/sonar-web/src/main/js/components/issue/popups/SimilarIssuesPopup.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/issue/popups/__tests__/SetTypePopup-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/measure/utils.ts9
-rw-r--r--server/sonar-web/src/main/js/components/preview-graph/PreviewGraph.tsx7
-rw-r--r--server/sonar-web/src/main/js/components/shared/DrilldownLink.tsx9
-rw-r--r--server/sonar-web/src/main/js/components/shared/TypeHelper.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/ui/IdentityProviderLink.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/ui/OrganizationListItem.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/ui/__tests__/OrganizationListItem-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/ui/buttons.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/withAppState.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/workspace/WorkspaceComponentViewer.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/workspace/WorkspaceRuleDetails.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/workspace/WorkspaceRuleViewer.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/workspace/context.ts3
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/branches-test.ts19
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/organizations-test.ts3
-rw-r--r--server/sonar-web/src/main/js/helpers/almIntegrations.ts5
-rw-r--r--server/sonar-web/src/main/js/helpers/branches.ts56
-rw-r--r--server/sonar-web/src/main/js/helpers/constants.ts22
-rw-r--r--server/sonar-web/src/main/js/helpers/issues.ts25
-rw-r--r--server/sonar-web/src/main/js/helpers/measures.ts15
-rw-r--r--server/sonar-web/src/main/js/helpers/organizations.ts17
-rw-r--r--server/sonar-web/src/main/js/helpers/periods.ts11
-rw-r--r--server/sonar-web/src/main/js/helpers/urls.ts31
-rw-r--r--server/sonar-web/src/main/js/helpers/users.ts6
-rw-r--r--server/sonar-web/src/main/js/store/appState.ts9
-rw-r--r--server/sonar-web/src/main/js/store/languages.ts7
-rw-r--r--server/sonar-web/src/main/js/store/metrics.ts5
-rw-r--r--server/sonar-web/src/main/js/store/organizations.ts11
-rw-r--r--server/sonar-web/src/main/js/store/rootReducer.ts5
-rw-r--r--server/sonar-web/src/main/js/store/users.ts13
-rw-r--r--server/sonar-web/src/main/js/store/utils/actions.ts3
602 files changed, 2833 insertions, 3706 deletions
diff --git a/server/sonar-web/src/main/js/api/alm-integration.ts b/server/sonar-web/src/main/js/api/alm-integration.ts
index 4ede88d3bff..dd5660065ae 100644
--- a/server/sonar-web/src/main/js/api/alm-integration.ts
+++ b/server/sonar-web/src/main/js/api/alm-integration.ts
@@ -18,20 +18,13 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { getJSON, postJSON, post } from '../helpers/request';
-import {
- AlmApplication,
- AlmOrganization,
- AlmRepository,
- AlmUnboundApplication,
- OrganizationBase
-} from '../app/types';
import throwGlobalError from '../app/utils/throwGlobalError';
export function bindAlmOrganization(data: { installationId: string; organization: string }) {
return post('/api/alm_integration/bind_organization', data).catch(throwGlobalError);
}
-export function getAlmAppInfo(): Promise<{ application: AlmApplication }> {
+export function getAlmAppInfo(): Promise<{ application: T.AlmApplication }> {
return getJSON('/api/alm_integration/show_app_info').catch(throwGlobalError);
}
@@ -53,8 +46,8 @@ function fetchAlmOrganization(data: { installationId: string }, remainingTries:
}
export interface GetAlmOrganizationResponse {
- almOrganization: AlmOrganization;
- boundOrganization?: OrganizationBase;
+ almOrganization: T.AlmOrganization;
+ boundOrganization?: T.OrganizationBase;
}
export function getAlmOrganization(data: {
@@ -71,14 +64,14 @@ export function getAlmOrganization(data: {
export function getRepositories(data: {
organization: string;
-}): Promise<{ repositories: AlmRepository[] }> {
+}): Promise<{ repositories: T.AlmRepository[] }> {
return getJSON('/api/alm_integration/list_repositories', data).catch(throwGlobalError);
}
-export function listUnboundApplications(): Promise<AlmUnboundApplication[]> {
+export function listUnboundApplications(): Promise<T.AlmUnboundApplication[]> {
return getJSON('/api/alm_integration/list_unbound_applications').then(
({ applications }) =>
- applications.map((app: AlmUnboundApplication) => ({ ...app, name: app.name || app.key })),
+ applications.map((app: T.AlmUnboundApplication) => ({ ...app, name: app.name || app.key })),
throwGlobalError
);
}
diff --git a/server/sonar-web/src/main/js/api/billing.ts b/server/sonar-web/src/main/js/api/billing.ts
index f0a20dca756..c8c2f7012ff 100644
--- a/server/sonar-web/src/main/js/api/billing.ts
+++ b/server/sonar-web/src/main/js/api/billing.ts
@@ -19,9 +19,8 @@
*/
import { getJSON } from '../helpers/request';
import throwGlobalError from '../app/utils/throwGlobalError';
-import { SubscriptionPlan } from '../app/types';
-export function getSubscriptionPlans(): Promise<SubscriptionPlan[]> {
+export function getSubscriptionPlans(): Promise<T.SubscriptionPlan[]> {
return getJSON('/api/billing/show_subscription_plans').then(
({ subscriptionPlans }) => subscriptionPlans,
throwGlobalError
diff --git a/server/sonar-web/src/main/js/api/branches.ts b/server/sonar-web/src/main/js/api/branches.ts
index 9cb5dbaec27..d89c7951acc 100644
--- a/server/sonar-web/src/main/js/api/branches.ts
+++ b/server/sonar-web/src/main/js/api/branches.ts
@@ -18,14 +18,13 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { getJSON, post } from '../helpers/request';
-import { Branch, PullRequest } from '../app/types';
import throwGlobalError from '../app/utils/throwGlobalError';
-export function getBranches(project: string): Promise<Branch[]> {
+export function getBranches(project: string): Promise<T.Branch[]> {
return getJSON('/api/project_branches/list', { project }).then(r => r.branches, throwGlobalError);
}
-export function getPullRequests(project: string): Promise<PullRequest[]> {
+export function getPullRequests(project: string): Promise<T.PullRequest[]> {
return getJSON('/api/project_pull_requests/list', { project }).then(
r => r.pullRequests,
throwGlobalError
diff --git a/server/sonar-web/src/main/js/api/ce.ts b/server/sonar-web/src/main/js/api/ce.ts
index 6b6476a2798..a159628a65f 100644
--- a/server/sonar-web/src/main/js/api/ce.ts
+++ b/server/sonar-web/src/main/js/api/ce.ts
@@ -19,7 +19,6 @@
*/
import { getJSON, post, RequestData } from '../helpers/request';
import throwGlobalError from '../app/utils/throwGlobalError';
-import { Task } from '../app/types';
export function getAnalysisStatus(data: {
component: string;
@@ -38,7 +37,7 @@ export function getAnalysisStatus(data: {
return getJSON('/api/ce/analysis_status', data).catch(throwGlobalError);
}
-export function getActivity(data: RequestData): Promise<{ tasks: Task[] }> {
+export function getActivity(data: RequestData): Promise<{ tasks: T.Task[] }> {
return getJSON('/api/ce/activity', data);
}
@@ -52,7 +51,7 @@ export function getStatus(
return getJSON('/api/ce/activity_status', data);
}
-export function getTask(id: string, additionalFields?: string[]): Promise<Task> {
+export function getTask(id: string, additionalFields?: string[]): Promise<T.Task> {
return getJSON('/api/ce/task', { id, additionalFields }).then(r => r.task);
}
@@ -66,7 +65,7 @@ export function cancelAllTasks(): Promise<any> {
export function getTasksForComponent(
componentKey: string
-): Promise<{ queue: Task[]; current: Task }> {
+): Promise<{ queue: T.Task[]; current: T.Task }> {
return getJSON('/api/ce/component', { componentKey }).catch(throwGlobalError);
}
diff --git a/server/sonar-web/src/main/js/api/components.ts b/server/sonar-web/src/main/js/api/components.ts
index ae01e608b7b..c2706de28ef 100644
--- a/server/sonar-web/src/main/js/api/components.ts
+++ b/server/sonar-web/src/main/js/api/components.ts
@@ -19,17 +19,6 @@
*/
import throwGlobalError from '../app/utils/throwGlobalError';
import { getJSON, postJSON, post, RequestData } from '../helpers/request';
-import {
- SourceLine,
- Paging,
- Visibility,
- BranchParameters,
- MyProject,
- Metric,
- ComponentMeasure,
- LightComponent,
- SourceViewerFile
-} from '../app/types';
export interface BaseSearchProjectsParameters {
analyzedBefore?: string;
@@ -38,14 +27,14 @@ export interface BaseSearchProjectsParameters {
projects?: string;
q?: string;
qualifiers?: string;
- visibility?: Visibility;
+ visibility?: T.Visibility;
}
export interface ProjectBase {
key: string;
name: string;
qualifier: string;
- visibility: Visibility;
+ visibility: T.Visibility;
}
export interface Project extends ProjectBase {
@@ -63,7 +52,7 @@ export function getComponents(
parameters: SearchProjectsParameters
): Promise<{
components: Project[];
- paging: Paging;
+ paging: T.Paging;
}> {
return getJSON('/api/projects/search', parameters);
}
@@ -104,9 +93,9 @@ export function getComponentTree(
metrics: string[] = [],
additional: RequestData = {}
): Promise<{
- components: ComponentMeasure[];
- metrics: Metric[];
- paging: Paging;
+ components: T.ComponentMeasure[];
+ metrics: T.Metric[];
+ paging: T.Paging;
}> {
const url = '/api/measures/component_tree';
const data = Object.assign({}, additional, {
@@ -134,19 +123,19 @@ export function getComponentLeaves(
}
export function getComponent(
- data: { componentKey: string; metricKeys: string } & BranchParameters
+ data: { componentKey: string; metricKeys: string } & T.BranchParameters
): Promise<any> {
return getJSON('/api/measures/component', data).then(r => r.component, throwGlobalError);
}
-export interface TreeComponent extends LightComponent {
+export interface TreeComponent extends T.LightComponent {
id: string;
name: string;
path?: string;
refId?: string;
refKey?: string;
tags?: string[];
- visibility: Visibility;
+ visibility: T.Visibility;
}
export function getTree(data: {
@@ -160,12 +149,12 @@ export function getTree(data: {
qualifiers?: string;
s?: string;
strategy?: 'all' | 'leaves' | 'children';
-}): Promise<{ baseComponent: TreeComponent; components: TreeComponent[]; paging: Paging }> {
+}): Promise<{ baseComponent: TreeComponent; components: TreeComponent[]; paging: T.Paging }> {
return getJSON('/api/components/tree', data).catch(throwGlobalError);
}
export function doesComponentExists(
- data: { component: string } & BranchParameters
+ data: { component: string } & T.BranchParameters
): Promise<boolean> {
return getJSON('/api/components/show', data).then(
({ component }) => component !== undefined,
@@ -173,7 +162,7 @@ export function doesComponentExists(
);
}
-export function getComponentShow(data: { component: string } & BranchParameters): Promise<any> {
+export function getComponentShow(data: { component: string } & T.BranchParameters): Promise<any> {
return getJSON('/api/components/show', data).catch(throwGlobalError);
}
@@ -181,21 +170,21 @@ export function getParents(component: string): Promise<any> {
return getComponentShow({ component }).then(r => r.ancestors);
}
-export function getBreadcrumbs(data: { component: string } & BranchParameters): Promise<any> {
+export function getBreadcrumbs(data: { component: string } & T.BranchParameters): Promise<any> {
return getComponentShow(data).then(r => {
const reversedAncestors = [...r.ancestors].reverse();
return [...reversedAncestors, r.component];
});
}
-export function getComponentData(data: { component: string } & BranchParameters): Promise<any> {
+export function getComponentData(data: { component: string } & T.BranchParameters): Promise<any> {
return getComponentShow(data).then(r => r.component);
}
export function getMyProjects(data: {
p?: number;
ps?: number;
-}): Promise<{ paging: Paging; projects: MyProject[] }> {
+}): Promise<{ paging: T.Paging; projects: T.MyProject[] }> {
return getJSON('/api/projects/search_my_projects', data);
}
@@ -207,7 +196,7 @@ export interface Component {
isFavorite?: boolean;
analysisDate?: string;
tags: string[];
- visibility: Visibility;
+ visibility: T.Visibility;
leakPeriodDate?: string;
}
@@ -222,7 +211,7 @@ export function searchProjects(
components: Component[];
facets: Facet[];
organizations: Array<{ key: string; name: string }>;
- paging: Paging;
+ paging: T.Paging;
}> {
const url = '/api/components/search_projects';
return getJSON(url, data);
@@ -297,23 +286,23 @@ export function getSuggestions(
}
export function getComponentForSourceViewer(
- data: { component: string } & BranchParameters
-): Promise<SourceViewerFile> {
+ data: { component: string } & T.BranchParameters
+): Promise<T.SourceViewerFile> {
return getJSON('/api/components/app', data);
}
export function getSources(
- data: { key: string; from?: number; to?: number } & BranchParameters
-): Promise<SourceLine[]> {
+ data: { key: string; from?: number; to?: number } & T.BranchParameters
+): Promise<T.SourceLine[]> {
return getJSON('/api/sources/lines', data).then(r => r.sources);
}
-export function getDuplications(data: { key: string } & BranchParameters): Promise<any> {
+export function getDuplications(data: { key: string } & T.BranchParameters): Promise<any> {
return getJSON('/api/duplications/show', data);
}
export function getTests(
- data: { sourceFileKey: string; sourceFileLineNumber: number | string } & BranchParameters
+ data: { sourceFileKey: string; sourceFileLineNumber: number | string } & T.BranchParameters
): Promise<any> {
return getJSON('/api/tests/list', data).then(r => r.tests);
}
diff --git a/server/sonar-web/src/main/js/api/issues.ts b/server/sonar-web/src/main/js/api/issues.ts
index fc49c0f7658..96163c169d9 100644
--- a/server/sonar-web/src/main/js/api/issues.ts
+++ b/server/sonar-web/src/main/js/api/issues.ts
@@ -17,7 +17,6 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { FacetValue } from '../app/types';
import { getJSON, post, postJSON, RequestData } from '../helpers/request';
import { RawIssue } from '../helpers/issues';
import throwGlobalError from '../app/utils/throwGlobalError';
@@ -75,7 +74,7 @@ export function getFacets(
query: RequestData,
facets: FacetName[]
): Promise<{
- facets: Array<{ property: string; values: FacetValue[] }>;
+ facets: Array<{ property: string; values: T.FacetValue[] }>;
response: IssuesResponse;
}> {
const data = {
diff --git a/server/sonar-web/src/main/js/api/languages.ts b/server/sonar-web/src/main/js/api/languages.ts
index ebf3efdb631..8f0f328fc2d 100644
--- a/server/sonar-web/src/main/js/api/languages.ts
+++ b/server/sonar-web/src/main/js/api/languages.ts
@@ -18,9 +18,8 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { getJSON } from '../helpers/request';
-import { Language } from '../app/types';
import throwGlobalError from '../app/utils/throwGlobalError';
-export function getLanguages(): Promise<Language[]> {
+export function getLanguages(): Promise<T.Language[]> {
return getJSON('/api/languages/list').then(r => r.languages, throwGlobalError);
}
diff --git a/server/sonar-web/src/main/js/api/measures.ts b/server/sonar-web/src/main/js/api/measures.ts
index 9a5357a174a..58d537385db 100644
--- a/server/sonar-web/src/main/js/api/measures.ts
+++ b/server/sonar-web/src/main/js/api/measures.ts
@@ -19,20 +19,10 @@
*/
import { getJSON, RequestData, postJSON, post } from '../helpers/request';
import throwGlobalError from '../app/utils/throwGlobalError';
-import {
- BranchParameters,
- ComponentMeasure,
- CustomMeasure,
- Measure,
- Metric,
- Paging,
- Period,
- PeriodMeasure
-} from '../app/types';
export function getMeasures(
- data: { componentKey: string; metricKeys: string } & BranchParameters
-): Promise<Measure[]> {
+ data: { componentKey: string; metricKeys: string } & T.BranchParameters
+): Promise<T.Measure[]> {
return getJSON('/api/measures/component', data).then(r => r.component.measures, throwGlobalError);
}
@@ -40,7 +30,7 @@ export function getMeasuresAndMeta(
componentKey: string,
metrics: string[],
additional: RequestData = {}
-): Promise<{ component: ComponentMeasure; metrics?: Metric[]; periods?: Period[] }> {
+): Promise<{ component: T.ComponentMeasure; metrics?: T.Metric[]; periods?: T.Period[] }> {
const data = { ...additional, componentKey, metricKeys: metrics.join(',') };
return getJSON('/api/measures/component', data);
}
@@ -48,7 +38,7 @@ export function getMeasuresAndMeta(
interface MeasuresForProjects {
component: string;
metric: string;
- periods?: PeriodMeasure[];
+ periods?: T.PeriodMeasure[];
value?: string;
}
@@ -67,7 +57,7 @@ export function getCustomMeasures(data: {
p?: number;
projectKey: string;
ps?: number;
-}): Promise<{ customMeasures: CustomMeasure[]; paging: Paging }> {
+}): Promise<{ customMeasures: T.CustomMeasure[]; paging: T.Paging }> {
return getJSON('/api/custom_measures/search', data).then(
r =>
({
@@ -83,7 +73,7 @@ export function createCustomMeasure(data: {
metricKey: string;
projectKey: string;
value: string;
-}): Promise<CustomMeasure> {
+}): Promise<T.CustomMeasure> {
return postJSON('/api/custom_measures/create', data).catch(throwGlobalError);
}
diff --git a/server/sonar-web/src/main/js/api/metrics.ts b/server/sonar-web/src/main/js/api/metrics.ts
index 25cbbf710bc..96a0ed32230 100644
--- a/server/sonar-web/src/main/js/api/metrics.ts
+++ b/server/sonar-web/src/main/js/api/metrics.ts
@@ -18,11 +18,10 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { getJSON, post, postJSON } from '../helpers/request';
-import { Metric } from '../app/types';
import throwGlobalError from '../app/utils/throwGlobalError';
export interface MetricsResponse {
- metrics: Metric[];
+ metrics: T.Metric[];
p: number;
ps: number;
total: number;
@@ -40,13 +39,13 @@ export function getAllMetrics(data?: {
isCustom?: boolean;
p?: number;
ps?: number;
-}): Promise<Metric[]> {
+}): Promise<T.Metric[]> {
return inner(data);
function inner(
data: { p?: number; ps?: number } = { ps: 500 },
prev?: MetricsResponse
- ): Promise<Metric[]> {
+ ): Promise<T.Metric[]> {
return getMetrics(data).then(r => {
const result = prev ? prev.metrics.concat(r.metrics) : r.metrics;
if (r.p * r.ps >= r.total) {
@@ -71,7 +70,7 @@ export function createMetric(data: {
key: string;
name: string;
type: string;
-}): Promise<Metric> {
+}): Promise<T.Metric> {
return postJSON('/api/metrics/create', data).catch(throwGlobalError);
}
diff --git a/server/sonar-web/src/main/js/api/nav.ts b/server/sonar-web/src/main/js/api/nav.ts
index e5af1bb7e91..66da48b10ab 100644
--- a/server/sonar-web/src/main/js/api/nav.ts
+++ b/server/sonar-web/src/main/js/api/nav.ts
@@ -18,15 +18,14 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { getJSON } from '../helpers/request';
-import { AppState, BranchParameters } from '../app/types';
import throwGlobalError from '../app/utils/throwGlobalError';
-export function getGlobalNavigation(): Promise<AppState> {
+export function getGlobalNavigation(): Promise<T.AppState> {
return getJSON('/api/navigation/global');
}
export function getComponentNavigation(
- data: { componentKey: string } & BranchParameters
+ data: { componentKey: string } & T.BranchParameters
): Promise<any> {
return getJSON('/api/navigation/component', data).catch(throwGlobalError);
}
diff --git a/server/sonar-web/src/main/js/api/notifications.ts b/server/sonar-web/src/main/js/api/notifications.ts
index d1f0db0e09c..025967c5583 100644
--- a/server/sonar-web/src/main/js/api/notifications.ts
+++ b/server/sonar-web/src/main/js/api/notifications.ts
@@ -17,14 +17,13 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { Notification } from '../app/types';
import throwGlobalError from '../app/utils/throwGlobalError';
import { getJSON, post } from '../helpers/request';
export function getNotifications(): Promise<{
channels: string[];
globalTypes: string[];
- notifications: Notification[];
+ notifications: T.Notification[];
perProjectTypes: string[];
}> {
return getJSON('/api/notifications/list').catch(throwGlobalError);
diff --git a/server/sonar-web/src/main/js/api/organizations.ts b/server/sonar-web/src/main/js/api/organizations.ts
index 79397d3b5a2..deae9b7b39b 100644
--- a/server/sonar-web/src/main/js/api/organizations.ts
+++ b/server/sonar-web/src/main/js/api/organizations.ts
@@ -19,36 +19,29 @@
*/
import { getJSON, post, postJSON } from '../helpers/request';
import throwGlobalError from '../app/utils/throwGlobalError';
-import {
- Organization,
- OrganizationBase,
- Paging,
- OrganizationMember,
- Extension
-} from '../app/types';
export function getOrganizations(data: {
organizations?: string;
member?: boolean;
}): Promise<{
- organizations: Organization[];
- paging: Paging;
+ organizations: T.Organization[];
+ paging: T.Paging;
}> {
return getJSON('/api/organizations/search', data).catch(throwGlobalError);
}
-export function getOrganization(key: string): Promise<Organization | undefined> {
+export function getOrganization(key: string): Promise<T.Organization | undefined> {
return getJSON('/api/organizations/search', { organizations: key }).then(
- r => r.organizations.find((o: Organization) => o.key === key),
+ r => r.organizations.find((o: T.Organization) => o.key === key),
throwGlobalError
);
}
interface GetOrganizationNavigation {
- adminPages: Extension[];
+ adminPages: T.Extension[];
canUpdateProjectsVisibilityToPrivate: boolean;
isDefault: boolean;
- pages: Extension[];
+ pages: T.Extension[];
}
export function getOrganizationNavigation(key: string): Promise<GetOrganizationNavigation> {
@@ -59,12 +52,12 @@ export function getOrganizationNavigation(key: string): Promise<GetOrganizationN
}
export function createOrganization(
- data: OrganizationBase & { installationId?: string }
-): Promise<Organization> {
+ data: T.OrganizationBase & { installationId?: string }
+): Promise<T.Organization> {
return postJSON('/api/organizations/create', data).then(r => r.organization, throwGlobalError);
}
-export function updateOrganization(key: string, changes: OrganizationBase) {
+export function updateOrganization(key: string, changes: T.OrganizationBase) {
return post('/api/organizations/update', { key, ...changes }).catch(throwGlobalError);
}
@@ -78,14 +71,14 @@ export function searchMembers(data: {
ps?: number;
q?: string;
selected?: string;
-}): Promise<{ paging: Paging; users: OrganizationMember[] }> {
+}): Promise<{ paging: T.Paging; users: T.OrganizationMember[] }> {
return getJSON('/api/organizations/search_members', data).catch(throwGlobalError);
}
export function addMember(data: {
login: string;
organization: string;
-}): Promise<OrganizationMember> {
+}): Promise<T.OrganizationMember> {
return postJSON('/api/organizations/add_member', data).then(r => r.user, throwGlobalError);
}
diff --git a/server/sonar-web/src/main/js/api/permissions.ts b/server/sonar-web/src/main/js/api/permissions.ts
index 235d5c5ef36..1ba67a885a3 100644
--- a/server/sonar-web/src/main/js/api/permissions.ts
+++ b/server/sonar-web/src/main/js/api/permissions.ts
@@ -18,13 +18,6 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { BaseSearchProjectsParameters } from './components';
-import {
- Paging,
- PermissionGroup,
- PermissionTemplate,
- PermissionUser,
- Visibility
-} from '../app/types';
import { getJSON, post, postJSON, RequestData } from '../helpers/request';
import throwGlobalError from '../app/utils/throwGlobalError';
@@ -67,7 +60,7 @@ export function revokePermissionFromGroup(data: {
}
interface GetPermissionTemplatesResponse {
- permissionTemplates: PermissionTemplate[];
+ permissionTemplates: T.PermissionTemplate[];
defaultTemplates: Array<{ templateId: string; qualifier: string }>;
permissions: Array<{ key: string; name: string; description: string }>;
}
@@ -150,7 +143,7 @@ export function getPermissionsUsersForComponent(data: {
organization?: string;
p?: number;
ps?: number;
-}): Promise<{ paging: Paging; users: PermissionUser[] }> {
+}): Promise<{ paging: T.Paging; users: T.PermissionUser[] }> {
if (!data.ps) {
data.ps = PAGE_SIZE;
}
@@ -164,7 +157,7 @@ export function getPermissionsGroupsForComponent(data: {
organization?: string;
p?: number;
ps?: number;
-}): Promise<{ paging: Paging; groups: PermissionGroup[] }> {
+}): Promise<{ paging: T.Paging; groups: T.PermissionGroup[] }> {
if (!data.ps) {
data.ps = PAGE_SIZE;
}
@@ -177,7 +170,7 @@ export function getGlobalPermissionsUsers(data: {
organization?: string;
p?: number;
ps?: number;
-}): Promise<{ paging: Paging; users: PermissionUser[] }> {
+}): Promise<{ paging: T.Paging; users: T.PermissionUser[] }> {
if (!data.ps) {
data.ps = PAGE_SIZE;
}
@@ -190,7 +183,7 @@ export function getGlobalPermissionsGroups(data: {
organization?: string;
p?: number;
ps?: number;
-}): Promise<{ paging: Paging; groups: PermissionGroup[] }> {
+}): Promise<{ paging: T.Paging; groups: T.PermissionGroup[] }> {
if (!data.ps) {
data.ps = PAGE_SIZE;
}
@@ -237,14 +230,14 @@ export function getPermissionTemplateGroups(
export function changeProjectVisibility(
project: string,
- visibility: Visibility
+ visibility: T.Visibility
): Promise<void | Response> {
return post('/api/projects/update_visibility', { project, visibility }).catch(throwGlobalError);
}
export function changeProjectDefaultVisibility(
organization: string,
- projectVisibility: Visibility
+ projectVisibility: T.Visibility
): Promise<void | Response> {
return post('/api/projects/update_default_visibility', { organization, projectVisibility }).catch(
throwGlobalError
diff --git a/server/sonar-web/src/main/js/api/projectActivity.ts b/server/sonar-web/src/main/js/api/projectActivity.ts
index d16733b5ebb..8d9af2debc1 100644
--- a/server/sonar-web/src/main/js/api/projectActivity.ts
+++ b/server/sonar-web/src/main/js/api/projectActivity.ts
@@ -19,11 +19,10 @@
*/
import { getJSON, postJSON, post, RequestData } from '../helpers/request';
import throwGlobalError from '../app/utils/throwGlobalError';
-import { Paging, BranchParameters, Analysis } from '../app/types';
export function getProjectActivity(
- data: { project: string; category?: string; p?: number; ps?: number } & BranchParameters
-): Promise<{ analyses: Analysis[]; paging: Paging }> {
+ data: { project: string; category?: string; p?: number; ps?: number } & T.BranchParameters
+): Promise<{ analyses: T.Analysis[]; paging: T.Paging }> {
return getJSON('/api/project_analyses/search', data).catch(throwGlobalError);
}
diff --git a/server/sonar-web/src/main/js/api/projectLinks.ts b/server/sonar-web/src/main/js/api/projectLinks.ts
index eec3d0f4a72..2e5e92e6c75 100644
--- a/server/sonar-web/src/main/js/api/projectLinks.ts
+++ b/server/sonar-web/src/main/js/api/projectLinks.ts
@@ -17,11 +17,10 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { ProjectLink } from '../app/types';
import throwGlobalError from '../app/utils/throwGlobalError';
import { getJSON, post, postJSON } from '../helpers/request';
-export function getProjectLinks(projectKey: string): Promise<ProjectLink[]> {
+export function getProjectLinks(projectKey: string): Promise<T.ProjectLink[]> {
return getJSON('/api/project_links/search', { projectKey }).then(r => r.links, throwGlobalError);
}
@@ -33,6 +32,6 @@ export function createLink(data: {
name: string;
projectKey: string;
url: string;
-}): Promise<ProjectLink> {
+}): Promise<T.ProjectLink> {
return postJSON('/api/project_links/create', data).then(r => r.link, throwGlobalError);
}
diff --git a/server/sonar-web/src/main/js/api/quality-gates.ts b/server/sonar-web/src/main/js/api/quality-gates.ts
index af49578283e..cd47f7709e3 100644
--- a/server/sonar-web/src/main/js/api/quality-gates.ts
+++ b/server/sonar-web/src/main/js/api/quality-gates.ts
@@ -19,13 +19,12 @@
*/
import { getJSON, post, postJSON } from '../helpers/request';
import throwGlobalError from '../app/utils/throwGlobalError';
-import { Condition, Metric, QualityGate, Omit } from '../app/types';
export function fetchQualityGates(data: {
organization?: string;
}): Promise<{
actions: { create: boolean };
- qualitygates: QualityGate[];
+ qualitygates: T.QualityGate[];
}> {
return getJSON('/api/qualitygates/list', data).catch(throwGlobalError);
}
@@ -33,14 +32,14 @@ export function fetchQualityGates(data: {
export function fetchQualityGate(data: {
id: number;
organization?: string;
-}): Promise<QualityGate> {
+}): Promise<T.QualityGate> {
return getJSON('/api/qualitygates/show', data).catch(throwGlobalError);
}
export function createQualityGate(data: {
name: string;
organization?: string;
-}): Promise<QualityGate> {
+}): Promise<T.QualityGate> {
return postJSON('/api/qualitygates/create', data).catch(throwGlobalError);
}
@@ -63,7 +62,7 @@ export function copyQualityGate(data: {
id: number;
name: string;
organization?: string;
-}): Promise<QualityGate> {
+}): Promise<T.QualityGate> {
return postJSON('/api/qualitygates/copy', data).catch(throwGlobalError);
}
@@ -78,12 +77,14 @@ export function createCondition(
data: {
gateId: number;
organization?: string;
- } & Omit<Condition, 'id'>
-): Promise<Condition> {
+ } & T.Omit<T.Condition, 'id'>
+): Promise<T.Condition> {
return postJSON('/api/qualitygates/create_condition', data);
}
-export function updateCondition(data: { organization?: string } & Condition): Promise<Condition> {
+export function updateCondition(
+ data: { organization?: string } & T.Condition
+): Promise<T.Condition> {
return postJSON('/api/qualitygates/update_condition', data);
}
@@ -94,7 +95,7 @@ export function deleteCondition(data: { id: number; organization?: string }): Pr
export function getGateForProject(data: {
organization?: string;
project: string;
-}): Promise<QualityGate | undefined> {
+}): Promise<T.QualityGate | undefined> {
return getJSON('/api/qualitygates/get_by_project', data).then(
({ qualityGate }) =>
qualityGate && {
@@ -153,7 +154,7 @@ export interface ApplicationProject {
}
export interface ApplicationQualityGate {
- metrics: Metric[];
+ metrics: T.Metric[];
projects: ApplicationProject[];
status: string;
}
diff --git a/server/sonar-web/src/main/js/api/quality-profiles.ts b/server/sonar-web/src/main/js/api/quality-profiles.ts
index d07a6194341..4f1b3bd364e 100644
--- a/server/sonar-web/src/main/js/api/quality-profiles.ts
+++ b/server/sonar-web/src/main/js/api/quality-profiles.ts
@@ -28,7 +28,6 @@ import {
postJSON,
RequestData
} from '../helpers/request';
-import { Paging } from '../app/types';
import throwGlobalError from '../app/utils/throwGlobalError';
export interface ProfileActions {
@@ -193,7 +192,7 @@ export interface SearchUsersResponse {
name: string;
selected?: boolean;
}>;
- paging: Paging;
+ paging: T.Paging;
}
export function searchUsers(parameters: SearchUsersGroupsParameters): Promise<SearchUsersResponse> {
@@ -202,7 +201,7 @@ export function searchUsers(parameters: SearchUsersGroupsParameters): Promise<Se
export interface SearchGroupsResponse {
groups: Array<{ name: string }>;
- paging: Paging;
+ paging: T.Paging;
}
export function searchGroups(
diff --git a/server/sonar-web/src/main/js/api/rules.ts b/server/sonar-web/src/main/js/api/rules.ts
index ea42bf0a1a7..329af4239a8 100644
--- a/server/sonar-web/src/main/js/api/rules.ts
+++ b/server/sonar-web/src/main/js/api/rules.ts
@@ -19,7 +19,6 @@
*/
import { post, getJSON, postJSON } from '../helpers/request';
import throwGlobalError from '../app/utils/throwGlobalError';
-import { Rule, RuleDetails, RuleActivation } from '../app/types';
export interface GetRulesAppResponse {
canWrite?: boolean;
@@ -33,11 +32,11 @@ export function getRulesApp(data: {
}
export interface SearchRulesResponse {
- actives?: { [rule: string]: RuleActivation[] };
+ actives?: { [rule: string]: T.RuleActivation[] };
facets?: { property: string; values: { count: number; val: string }[] }[];
p: number;
ps: number;
- rules: Rule[];
+ rules: T.Rule[];
total: number;
}
@@ -57,7 +56,7 @@ export function getRuleDetails(parameters: {
actives?: boolean;
key: string;
organization: string | undefined;
-}): Promise<{ actives?: RuleActivation[]; rule: RuleDetails }> {
+}): Promise<{ actives?: T.RuleActivation[]; rule: T.RuleDetails }> {
return getJSON('/api/rules/show', parameters).catch(throwGlobalError);
}
@@ -80,7 +79,7 @@ export function createRule(data: {
status?: string;
template_key: string;
type?: string;
-}): Promise<RuleDetails> {
+}): Promise<T.RuleDetails> {
return postJSON('/api/rules/create', data).then(
r => r.rule,
error => {
@@ -112,6 +111,6 @@ export function updateRule(data: {
severity?: string;
status?: string;
tags?: string;
-}): Promise<RuleDetails> {
+}): Promise<T.RuleDetails> {
return postJSON('/api/rules/update', data).then(r => r.rule, throwGlobalError);
}
diff --git a/server/sonar-web/src/main/js/api/security-reports.ts b/server/sonar-web/src/main/js/api/security-reports.ts
index 2747ea7536f..eba073fc227 100644
--- a/server/sonar-web/src/main/js/api/security-reports.ts
+++ b/server/sonar-web/src/main/js/api/security-reports.ts
@@ -17,7 +17,6 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { SecurityHotspot } from '../app/types';
import { getJSON } from '../helpers/request';
import throwGlobalError from '../app/utils/throwGlobalError';
@@ -26,6 +25,6 @@ export function getSecurityHotspots(data: {
standard: 'owaspTop10' | 'sansTop25' | 'cwe';
includeDistribution?: boolean;
branch?: string;
-}): Promise<{ categories: Array<SecurityHotspot> }> {
+}): Promise<{ categories: T.SecurityHotspot[] }> {
return getJSON('/api/security_reports/show', data).catch(throwGlobalError);
}
diff --git a/server/sonar-web/src/main/js/api/settings.ts b/server/sonar-web/src/main/js/api/settings.ts
index 11b37f1d02f..ae7339db76c 100644
--- a/server/sonar-web/src/main/js/api/settings.ts
+++ b/server/sonar-web/src/main/js/api/settings.ts
@@ -19,17 +19,10 @@
*/
import { omitBy } from 'lodash';
import { getJSON, RequestData, post, postJSON } from '../helpers/request';
-import {
- BranchParameters,
- SettingCategoryDefinition,
- SettingValue,
- SettingType,
- SettingDefinition
-} from '../app/types';
import throwGlobalError from '../app/utils/throwGlobalError';
import { isCategoryDefinition } from '../apps/settings/utils';
-export function getDefinitions(component?: string): Promise<SettingCategoryDefinition[]> {
+export function getDefinitions(component?: string): Promise<T.SettingCategoryDefinition[]> {
return getJSON('/api/settings/list_definitions', { component }).then(
r => r.definitions,
throwGlobalError
@@ -37,13 +30,13 @@ export function getDefinitions(component?: string): Promise<SettingCategoryDefin
}
export function getValues(
- data: { keys: string; component?: string } & BranchParameters
-): Promise<SettingValue[]> {
+ data: { keys: string; component?: string } & T.BranchParameters
+): Promise<T.SettingValue[]> {
return getJSON('/api/settings/values', data).then(r => r.settings);
}
export function setSettingValue(
- definition: SettingDefinition,
+ definition: T.SettingDefinition,
value: any,
component?: string
): Promise<void> {
@@ -52,7 +45,7 @@ export function setSettingValue(
if (isCategoryDefinition(definition) && definition.multiValues) {
data.values = value;
- } else if (definition.type === SettingType.PropertySet) {
+ } else if (definition.type === 'PROPERTY_SET') {
data.fieldValues = value
.map((fields: any) => omitBy(fields, value => value == null))
.map(JSON.stringify);
@@ -64,13 +57,13 @@ export function setSettingValue(
}
export function setSimpleSettingValue(
- data: { component?: string; value: string; key: string } & BranchParameters
+ data: { component?: string; value: string; key: string } & T.BranchParameters
): Promise<void | Response> {
return post('/api/settings/set', data).catch(throwGlobalError);
}
export function resetSettingValue(
- data: { keys: string; component?: string } & BranchParameters
+ data: { keys: string; component?: string } & T.BranchParameters
): Promise<void> {
return post('/api/settings/reset', data);
}
diff --git a/server/sonar-web/src/main/js/api/tests.ts b/server/sonar-web/src/main/js/api/tests.ts
index 5b649d1d99b..7dbb75c19af 100644
--- a/server/sonar-web/src/main/js/api/tests.ts
+++ b/server/sonar-web/src/main/js/api/tests.ts
@@ -18,7 +18,6 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import throwGlobalError from '../app/utils/throwGlobalError';
-import { Paging, TestCase, CoveredFile, BranchParameters } from '../app/types';
import { getJSON } from '../helpers/request';
export function getTests(
@@ -29,11 +28,11 @@ export function getTests(
sourceFileLineNumber?: number;
testFileKey: string;
testId?: string;
- } & BranchParameters
-): Promise<{ paging: Paging; tests: TestCase[] }> {
+ } & T.BranchParameters
+): Promise<{ paging: T.Paging; tests: T.TestCase[] }> {
return getJSON('/api/tests/list', parameters).catch(throwGlobalError);
}
-export function getCoveredFiles(data: { testId: string }): Promise<CoveredFile[]> {
+export function getCoveredFiles(data: { testId: string }): Promise<T.CoveredFile[]> {
return getJSON('/api/tests/covered_files', data).then(r => r.files, throwGlobalError);
}
diff --git a/server/sonar-web/src/main/js/api/time-machine.ts b/server/sonar-web/src/main/js/api/time-machine.ts
index d397c89345e..6e52132de85 100644
--- a/server/sonar-web/src/main/js/api/time-machine.ts
+++ b/server/sonar-web/src/main/js/api/time-machine.ts
@@ -18,7 +18,6 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { getJSON } from '../helpers/request';
-import { Paging, BranchParameters } from '../app/types';
import throwGlobalError from '../app/utils/throwGlobalError';
interface TimeMachineResponse {
@@ -26,7 +25,7 @@ interface TimeMachineResponse {
metric: string;
history: Array<{ date: string; value?: string }>;
}[];
- paging: Paging;
+ paging: T.Paging;
}
export function getTimeMachineData(
@@ -37,7 +36,7 @@ export function getTimeMachineData(
p?: number;
ps?: number;
to?: string;
- } & BranchParameters
+ } & T.BranchParameters
): Promise<TimeMachineResponse> {
return getJSON('/api/measures/search_history', data).catch(throwGlobalError);
}
@@ -49,7 +48,7 @@ export function getAllTimeMachineData(
from?: string;
p?: number;
to?: string;
- } & BranchParameters,
+ } & T.BranchParameters,
prev?: TimeMachineResponse
): Promise<TimeMachineResponse> {
return getTimeMachineData({ ...data, ps: 1000 }).then(r => {
diff --git a/server/sonar-web/src/main/js/api/user_groups.ts b/server/sonar-web/src/main/js/api/user_groups.ts
index eadd920a5f0..d64fde6cf26 100644
--- a/server/sonar-web/src/main/js/api/user_groups.ts
+++ b/server/sonar-web/src/main/js/api/user_groups.ts
@@ -18,7 +18,6 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { getJSON, post, postJSON } from '../helpers/request';
-import { Paging, Group } from '../app/types';
import throwGlobalError from '../app/utils/throwGlobalError';
export function searchUsersGroups(data: {
@@ -27,7 +26,7 @@ export function searchUsersGroups(data: {
p?: number;
ps?: number;
q?: string;
-}): Promise<{ groups: Group[]; paging: Paging }> {
+}): Promise<{ groups: T.Group[]; paging: T.Paging }> {
return getJSON('/api/user_groups/search', data).catch(throwGlobalError);
}
@@ -45,7 +44,7 @@ export function getUsersInGroup(data: {
ps?: number;
q?: string;
selected?: string;
-}): Promise<{ paging: Paging; users: GroupUser[] }> {
+}): Promise<{ paging: T.Paging; users: GroupUser[] }> {
return getJSON('/api/user_groups/users', data).catch(throwGlobalError);
}
@@ -71,7 +70,7 @@ export function createGroup(data: {
description?: string;
organization: string | undefined;
name: string;
-}): Promise<Group> {
+}): Promise<T.Group> {
return postJSON('/api/user_groups/create', data).then(r => r.group, throwGlobalError);
}
diff --git a/server/sonar-web/src/main/js/api/users.ts b/server/sonar-web/src/main/js/api/users.ts
index 1954f192c50..75405a9173f 100644
--- a/server/sonar-web/src/main/js/api/users.ts
+++ b/server/sonar-web/src/main/js/api/users.ts
@@ -19,9 +19,8 @@
*/
import { getJSON, post, postJSON, RequestData } from '../helpers/request';
import throwGlobalError from '../app/utils/throwGlobalError';
-import { Paging, HomePage, CurrentUser, IdentityProvider, User } from '../app/types';
-export function getCurrentUser(): Promise<CurrentUser> {
+export function getCurrentUser(): Promise<T.CurrentUser> {
return getJSON('/api/users/current');
}
@@ -46,7 +45,7 @@ export function getUserGroups(
organization?: string,
query?: string,
selected?: string
-): Promise<{ paging: Paging; groups: UserGroup[] }> {
+): Promise<{ paging: T.Paging; groups: UserGroup[] }> {
const data: RequestData = { login };
if (organization) {
data.organization = organization;
@@ -60,7 +59,7 @@ export function getUserGroups(
return getJSON('/api/users/groups', data);
}
-export function getIdentityProviders(): Promise<{ identityProviders: IdentityProvider[] }> {
+export function getIdentityProviders(): Promise<{ identityProviders: T.IdentityProvider[] }> {
return getJSON('/api/users/identity_providers').catch(throwGlobalError);
}
@@ -68,7 +67,7 @@ export function searchUsers(data: {
p?: number;
ps?: number;
q?: string;
-}): Promise<{ paging: Paging; users: User[] }> {
+}): Promise<{ paging: T.Paging; users: T.User[] }> {
data.q = data.q || undefined;
return getJSON('/api/users/search', data).catch(throwGlobalError);
}
@@ -89,14 +88,14 @@ export function updateUser(data: {
login: string;
name?: string;
scmAccount: string[];
-}): Promise<User> {
+}): Promise<T.User> {
return postJSON('/api/users/update', {
...data,
scmAccount: data.scmAccount.length > 0 ? data.scmAccount : ''
});
}
-export function deactivateUser(data: { login: string }): Promise<User> {
+export function deactivateUser(data: { login: string }): Promise<T.User> {
return postJSON('/api/users/deactivate', data).catch(throwGlobalError);
}
@@ -104,6 +103,6 @@ export function skipOnboarding(): Promise<void | Response> {
return post('/api/users/skip_onboarding_tutorial').catch(throwGlobalError);
}
-export function setHomePage(homepage: HomePage): Promise<void | Response> {
+export function setHomePage(homepage: T.HomePage): Promise<void | Response> {
return post('/api/users/set_homepage', homepage).catch(throwGlobalError);
}
diff --git a/server/sonar-web/src/main/js/api/webhooks.ts b/server/sonar-web/src/main/js/api/webhooks.ts
index a51a01c0948..b3327608c25 100644
--- a/server/sonar-web/src/main/js/api/webhooks.ts
+++ b/server/sonar-web/src/main/js/api/webhooks.ts
@@ -19,14 +19,13 @@
*/
import { getJSON, post, postJSON } from '../helpers/request';
import throwGlobalError from '../app/utils/throwGlobalError';
-import { Webhook, WebhookDelivery, Paging } from '../app/types';
export function createWebhook(data: {
name: string;
organization: string | undefined;
project?: string;
url: string;
-}): Promise<{ webhook: Webhook }> {
+}): Promise<{ webhook: T.Webhook }> {
return postJSON('/api/webhooks/create', data).catch(throwGlobalError);
}
@@ -37,7 +36,7 @@ export function deleteWebhook(data: { webhook: string }): Promise<void | Respons
export function searchWebhooks(data: {
organization: string | undefined;
project?: string;
-}): Promise<{ webhooks: Webhook[] }> {
+}): Promise<{ webhooks: T.Webhook[] }> {
return getJSON('/api/webhooks/list', data).catch(throwGlobalError);
}
@@ -56,14 +55,14 @@ export function searchDeliveries(data: {
p?: number;
ps?: number;
}): Promise<{
- deliveries: WebhookDelivery[];
- paging: Paging;
+ deliveries: T.WebhookDelivery[];
+ paging: T.Paging;
}> {
return getJSON('/api/webhooks/deliveries', data).catch(throwGlobalError);
}
export function getDelivery(data: {
deliveryId: string;
-}): Promise<{ delivery: WebhookDelivery & { payload: string } }> {
+}): Promise<{ delivery: T.WebhookDelivery & { payload: string } }> {
return getJSON('/api/webhooks/delivery', data).catch(throwGlobalError);
}
diff --git a/server/sonar-web/src/main/js/app/components/AdminContainer.tsx b/server/sonar-web/src/main/js/app/components/AdminContainer.tsx
index cb2d5b99709..6f65e1d4c26 100644
--- a/server/sonar-web/src/main/js/app/components/AdminContainer.tsx
+++ b/server/sonar-web/src/main/js/app/components/AdminContainer.tsx
@@ -27,16 +27,15 @@ import { getAppState, Store } from '../../store/rootReducer';
import { getSettingsNavigation } from '../../api/nav';
import { setAdminPages } from '../../store/appState';
import { translate } from '../../helpers/l10n';
-import { Extension, AppState } from '../types';
import { PluginPendingResult, getPendingPlugins } from '../../api/plugins';
import handleRequiredAuthorization from '../utils/handleRequiredAuthorization';
interface StateProps {
- appState: Pick<AppState, 'adminPages' | 'organizationsEnabled'>;
+ appState: Pick<T.AppState, 'adminPages' | 'organizationsEnabled'>;
}
interface DispatchToProps {
- setAdminPages: (adminPages: Extension[]) => void;
+ setAdminPages: (adminPages: T.Extension[]) => void;
}
interface OwnProps {
diff --git a/server/sonar-web/src/main/js/app/components/App.tsx b/server/sonar-web/src/main/js/app/components/App.tsx
index df1277c2222..d3f99a4985b 100644
--- a/server/sonar-web/src/main/js/app/components/App.tsx
+++ b/server/sonar-web/src/main/js/app/components/App.tsx
@@ -21,7 +21,6 @@ import * as React from 'react';
import * as PropTypes from 'prop-types';
import { connect } from 'react-redux';
import Helmet from 'react-helmet';
-import { AppState, CurrentUser } from '../types';
import { fetchLanguages } from '../../store/rootActions';
import { fetchMyOrganizations } from '../../apps/account/organizations/actions';
import { getInstance, isSonarCloud } from '../../helpers/system';
@@ -32,8 +31,8 @@ import { isLoggedIn } from '../../helpers/users';
const PageTracker = lazyLoad(() => import('./PageTracker'));
interface StateProps {
- appState: AppState | undefined;
- currentUser: CurrentUser | undefined;
+ appState: T.AppState | undefined;
+ currentUser: T.CurrentUser | undefined;
enableGravatar: boolean;
gravatarServerUrl: string;
}
diff --git a/server/sonar-web/src/main/js/app/components/ComponentContainer.tsx b/server/sonar-web/src/main/js/app/components/ComponentContainer.tsx
index faea1ccdef2..1d458306d2b 100644
--- a/server/sonar-web/src/main/js/app/components/ComponentContainer.tsx
+++ b/server/sonar-web/src/main/js/app/components/ComponentContainer.tsx
@@ -24,7 +24,6 @@ import { differenceBy } from 'lodash';
import { ComponentContext } from './ComponentContext';
import ComponentContainerNotFound from './ComponentContainerNotFound';
import ComponentNav from './nav/component/ComponentNav';
-import { Component, BranchLike, Measure, Task } from '../types';
import handleRequiredAuthorization from '../utils/handleRequiredAuthorization';
import { getBranches, getPullRequests } from '../../api/branches';
import { getTasksForComponent, getAnalysisStatus } from '../../api/ce';
@@ -51,14 +50,14 @@ interface Props {
}
interface State {
- branchLike?: BranchLike;
- branchLikes: BranchLike[];
- branchMeasures?: Measure[];
- component?: Component;
- currentTask?: Task;
+ branchLike?: T.BranchLike;
+ branchLikes: T.BranchLike[];
+ branchMeasures?: T.Measure[];
+ component?: T.Component;
+ currentTask?: T.Task;
isPending: boolean;
loading: boolean;
- tasksInProgress?: Task[];
+ tasksInProgress?: T.Task[];
warnings: string[];
}
@@ -97,7 +96,7 @@ export class ComponentContainer extends React.PureComponent<Props, State> {
window.clearTimeout(this.watchStatusTimer);
}
- addQualifier = (component: Component) => ({
+ addQualifier = (component: T.Component) => ({
...component,
qualifier: component.breadcrumbs[component.breadcrumbs.length - 1].qualifier
});
@@ -147,11 +146,11 @@ export class ComponentContainer extends React.PureComponent<Props, State> {
}
fetchBranches = (
- component: Component
+ component: T.Component
): Promise<{
- branchLike?: BranchLike;
- branchLikes: BranchLike[];
- component: Component;
+ branchLike?: T.BranchLike;
+ branchLikes: T.BranchLike[];
+ component: T.Component;
}> => {
const application = component.breadcrumbs.find(({ qualifier }) => qualifier === 'APP');
if (application) {
@@ -182,14 +181,14 @@ export class ComponentContainer extends React.PureComponent<Props, State> {
branchLikes,
component
}: {
- branchLike: BranchLike;
- branchLikes: BranchLike[];
- component: Component;
+ branchLike: T.BranchLike;
+ branchLikes: T.BranchLike[];
+ component: T.Component;
}): Promise<{
- branchLike?: BranchLike;
- branchLikes: BranchLike[];
- branchMeasures?: Measure[];
- component: Component;
+ branchLike?: T.BranchLike;
+ branchLikes: T.BranchLike[];
+ branchMeasures?: T.Measure[];
+ component: T.Component;
}> => {
const project = component.breadcrumbs.find(({ qualifier }) => qualifier === 'TRK');
if (project && (isShortLivingBranch(branchLike) || isPullRequest(branchLike))) {
@@ -204,7 +203,7 @@ export class ComponentContainer extends React.PureComponent<Props, State> {
return Promise.resolve({ branchLike, branchLikes, component });
};
- fetchStatus = (component: Component) => {
+ fetchStatus = (component: T.Component) => {
getTasksForComponent(component.key).then(
({ current, queue }) => {
if (this.mounted) {
@@ -257,7 +256,7 @@ export class ComponentContainer extends React.PureComponent<Props, State> {
);
};
- fetchWarnings = (component: Component, branchLike?: BranchLike) => {
+ fetchWarnings = (component: T.Component, branchLike?: T.BranchLike) => {
if (component.qualifier === 'TRK') {
getAnalysisStatus({
component: component.key,
@@ -271,14 +270,14 @@ export class ComponentContainer extends React.PureComponent<Props, State> {
}
};
- getCurrentBranchLike = (branchLikes: BranchLike[]) => {
+ getCurrentBranchLike = (branchLikes: T.BranchLike[]) => {
const { query } = this.props.location;
return query.pullRequest
? branchLikes.find(b => isPullRequest(b) && b.key === query.pullRequest)
: branchLikes.find(b => isBranch(b) && (query.branch ? b.name === query.branch : b.isMain));
};
- getCurrentTask = (current: Task, branchLike?: BranchLike) => {
+ getCurrentTask = (current: T.Task, branchLike?: T.BranchLike) => {
if (!current) {
return undefined;
}
@@ -288,13 +287,13 @@ export class ComponentContainer extends React.PureComponent<Props, State> {
: undefined;
};
- getPendingTasks = (pendingTasks: Task[], branchLike?: BranchLike) => {
+ getPendingTasks = (pendingTasks: T.Task[], branchLike?: T.BranchLike) => {
return pendingTasks.filter(task => this.isSameBranch(task, branchLike));
};
isSameBranch = (
- task: Pick<Task, 'branch' | 'branchType' | 'pullRequest'>,
- branchLike?: BranchLike
+ task: Pick<T.Task, 'branch' | 'branchType' | 'pullRequest'>,
+ branchLike?: T.BranchLike
) => {
if (branchLike && !isMainBranch(branchLike)) {
if (isPullRequest(branchLike)) {
@@ -307,11 +306,11 @@ export class ComponentContainer extends React.PureComponent<Props, State> {
return !task.branch && !task.pullRequest;
};
- handleComponentChange = (changes: Partial<Component>) => {
+ handleComponentChange = (changes: Partial<T.Component>) => {
if (this.mounted) {
this.setState(state => {
if (state.component) {
- const newComponent: Component = { ...state.component, ...changes };
+ const newComponent: T.Component = { ...state.component, ...changes };
return { component: newComponent };
}
return null;
diff --git a/server/sonar-web/src/main/js/app/components/ComponentContext.tsx b/server/sonar-web/src/main/js/app/components/ComponentContext.tsx
index b62a351cd3f..a7f5f1ffa20 100644
--- a/server/sonar-web/src/main/js/app/components/ComponentContext.tsx
+++ b/server/sonar-web/src/main/js/app/components/ComponentContext.tsx
@@ -18,11 +18,10 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { Component, BranchLike } from '../types';
interface ComponentContextType {
- branchLike: BranchLike | undefined;
- component: Component | undefined;
+ branchLike: T.BranchLike | undefined;
+ component: T.Component | undefined;
}
export const ComponentContext = React.createContext<ComponentContextType>({
diff --git a/server/sonar-web/src/main/js/app/components/GlobalFooter.tsx b/server/sonar-web/src/main/js/app/components/GlobalFooter.tsx
index be0881f79df..b426464f053 100644
--- a/server/sonar-web/src/main/js/app/components/GlobalFooter.tsx
+++ b/server/sonar-web/src/main/js/app/components/GlobalFooter.tsx
@@ -22,7 +22,7 @@ import { Link } from 'react-router';
import GlobalFooterSonarCloud from './GlobalFooterSonarCloud';
import GlobalFooterBranding from './GlobalFooterBranding';
import InstanceMessage from '../../components/common/InstanceMessage';
-import { EDITIONS, EditionKey } from '../../apps/marketplace/utils';
+import { EDITIONS } from '../../apps/marketplace/utils';
import { translate, translateWithParameters } from '../../helpers/l10n';
import { isSonarCloud } from '../../helpers/system';
import { Alert } from '../../components/ui/Alert';
@@ -30,7 +30,7 @@ import { Alert } from '../../components/ui/Alert';
interface Props {
hideLoggedInInfo?: boolean;
productionDatabase: boolean;
- sonarqubeEdition?: EditionKey;
+ sonarqubeEdition?: T.EditionKey;
sonarqubeVersion?: string;
}
diff --git a/server/sonar-web/src/main/js/app/components/GlobalFooterContainer.tsx b/server/sonar-web/src/main/js/app/components/GlobalFooterContainer.tsx
index 158478034d5..c10498eae7a 100644
--- a/server/sonar-web/src/main/js/app/components/GlobalFooterContainer.tsx
+++ b/server/sonar-web/src/main/js/app/components/GlobalFooterContainer.tsx
@@ -20,11 +20,10 @@
import { connect } from 'react-redux';
import GlobalFooter from './GlobalFooter';
import { getAppState, Store } from '../../store/rootReducer';
-import { EditionKey } from '../../apps/marketplace/utils';
interface StateProps {
productionDatabase: boolean;
- sonarqubeEdition?: EditionKey;
+ sonarqubeEdition?: T.EditionKey;
sonarqubeVersion?: string;
}
diff --git a/server/sonar-web/src/main/js/app/components/Landing.tsx b/server/sonar-web/src/main/js/app/components/Landing.tsx
index 421c6cceb7c..310d2f27629 100644
--- a/server/sonar-web/src/main/js/app/components/Landing.tsx
+++ b/server/sonar-web/src/main/js/app/components/Landing.tsx
@@ -21,13 +21,12 @@ import * as React from 'react';
import * as PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { Location } from 'history';
-import { CurrentUser } from '../types';
import { getCurrentUser, Store } from '../../store/rootReducer';
import { getHomePageUrl } from '../../helpers/urls';
import { isLoggedIn } from '../../helpers/users';
interface StateProps {
- currentUser: CurrentUser | undefined;
+ currentUser: T.CurrentUser | undefined;
}
interface OwnProps {
diff --git a/server/sonar-web/src/main/js/app/components/ProjectAdminContainer.tsx b/server/sonar-web/src/main/js/app/components/ProjectAdminContainer.tsx
index e2293316ea9..8ae7a52196c 100644
--- a/server/sonar-web/src/main/js/app/components/ProjectAdminContainer.tsx
+++ b/server/sonar-web/src/main/js/app/components/ProjectAdminContainer.tsx
@@ -19,13 +19,12 @@
*/
import * as React from 'react';
import handleRequiredAuthorization from '../utils/handleRequiredAuthorization';
-import { BranchLike, Component } from '../types';
interface Props {
children: JSX.Element;
- branchLike?: BranchLike;
- branchLikes: BranchLike[];
- component: Component;
+ branchLike?: T.BranchLike;
+ branchLikes: T.BranchLike[];
+ component: T.Component;
isInProgress?: boolean;
isPending?: boolean;
onBranchesChange: () => void;
diff --git a/server/sonar-web/src/main/js/app/components/StartupModal.tsx b/server/sonar-web/src/main/js/app/components/StartupModal.tsx
index db691307413..bb92eb2c447 100644
--- a/server/sonar-web/src/main/js/app/components/StartupModal.tsx
+++ b/server/sonar-web/src/main/js/app/components/StartupModal.tsx
@@ -21,9 +21,7 @@ import * as React from 'react';
import * as PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { withRouter, WithRouterProps } from 'react-router';
-import { CurrentUser, Organization } from '../types';
import { differenceInDays, parseDate, toShortNotSoISOString } from '../../helpers/dates';
-import { EditionKey } from '../../apps/marketplace/utils';
import { getCurrentUser, getAppState, Store } from '../../store/rootReducer';
import { skipOnboarding } from '../../store/users';
import { showLicense } from '../../api/marketplace';
@@ -48,8 +46,8 @@ const TeamOnboardingModal = lazyLoad(() =>
interface StateProps {
canAdmin?: boolean;
- currentEdition?: EditionKey;
- currentUser: CurrentUser;
+ currentEdition?: T.EditionKey;
+ currentUser: T.CurrentUser;
}
interface DispatchProps {
@@ -119,7 +117,7 @@ export class StartupModal extends React.PureComponent<Props, State> {
this.props.router.push({ pathname: '/create-organization', state: { paid: true } });
};
- openProjectOnboarding = (organization?: Organization) => {
+ openProjectOnboarding = (organization?: T.Organization) => {
if (isSonarCloud()) {
this.setState({ automatic: false, modal: undefined });
const state: { organization?: string; tab?: string } = {};
@@ -140,7 +138,7 @@ export class StartupModal extends React.PureComponent<Props, State> {
tryAutoOpenLicense = () => {
const { canAdmin, currentEdition, currentUser } = this.props;
const hasLicenseManager = hasMessage('license.prompt.title');
- const hasLicensedEdition = currentEdition && currentEdition !== EditionKey.community;
+ const hasLicensedEdition = currentEdition && currentEdition !== 'community';
if (canAdmin && hasLicensedEdition && isLoggedIn(currentUser) && hasLicenseManager) {
const lastPrompt = get(LICENSE_PROMPT, currentUser.login);
diff --git a/server/sonar-web/src/main/js/app/components/__tests__/ComponentContainer-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/ComponentContainer-test.tsx
index e37029c0b64..f78e8ea0189 100644
--- a/server/sonar-web/src/main/js/app/components/__tests__/ComponentContainer-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/__tests__/ComponentContainer-test.tsx
@@ -24,16 +24,6 @@ import { getBranches, getPullRequests } from '../../../api/branches';
import { getTasksForComponent } from '../../../api/ce';
import { getComponentData } from '../../../api/components';
import { getComponentNavigation } from '../../../api/nav';
-import {
- ShortLivingBranch,
- MainBranch,
- LongLivingBranch,
- PullRequest,
- BranchType,
- Visibility,
- Task,
- Component
-} from '../../types';
import { STATUSES } from '../../../apps/background-tasks/constants';
import { waitAndUpdate } from '../../../helpers/testUtils';
import { getMeasures } from '../../../api/measures';
@@ -93,12 +83,12 @@ it('changes component', () => {
wrapper.instance().mounted = true;
wrapper.setState({
branchLikes: [{ isMain: true, name: 'master' }],
- component: { qualifier: 'TRK', visibility: Visibility.Public } as Component,
+ component: { qualifier: 'TRK', visibility: 'public' } as T.Component,
loading: false
});
- (wrapper.find(Inner).prop('onComponentChange') as Function)({ visibility: Visibility.Private });
- expect(wrapper.state().component).toEqual({ qualifier: 'TRK', visibility: Visibility.Private });
+ (wrapper.find(Inner).prop('onComponentChange') as Function)({ visibility: 'private' });
+ expect(wrapper.state().component).toEqual({ qualifier: 'TRK', visibility: 'private' });
});
it("loads branches for module's project", async () => {
@@ -164,7 +154,7 @@ it('updates the branch measures', async () => {
key: 'foo'
});
(getBranches as jest.Mock<any>).mockResolvedValueOnce([
- { isMain: false, mergeBranch: 'master', name: 'feature', type: BranchType.SHORT }
+ { isMain: false, mergeBranch: 'master', name: 'feature', type: 'SHORT' }
]);
(getPullRequests as jest.Mock<any>).mockResolvedValueOnce([]);
const wrapper = shallow(
@@ -229,15 +219,19 @@ it('filters correctly the pending tasks for a main branch', () => {
);
const component = wrapper.instance() as ComponentContainer;
- const mainBranch: MainBranch = { isMain: true, name: 'master' };
- const shortBranch: ShortLivingBranch = {
+ const mainBranch: T.MainBranch = { isMain: true, name: 'master' };
+ const shortBranch: T.ShortLivingBranch = {
isMain: false,
mergeBranch: 'master',
name: 'feature',
- type: BranchType.SHORT
+ type: 'SHORT'
};
- const longBranch: LongLivingBranch = { isMain: false, name: 'branch-7.2', type: BranchType.LONG };
- const pullRequest: PullRequest = {
+ const longBranch: T.LongLivingBranch = {
+ isMain: false,
+ name: 'branch-7.2',
+ type: 'LONG'
+ };
+ const pullRequest: T.PullRequest = {
base: 'feature',
branch: 'feature',
key: 'pr-89',
@@ -264,12 +258,12 @@ it('filters correctly the pending tasks for a main branch', () => {
).toBeFalsy();
expect(component.isSameBranch({ pullRequest: 'pr-89' }, pullRequest)).toBeTruthy();
- const currentTask = { pullRequest: 'pr-89', status: STATUSES.IN_PROGRESS } as Task;
+ const currentTask = { pullRequest: 'pr-89', status: STATUSES.IN_PROGRESS } as T.Task;
const failedTask = { ...currentTask, status: STATUSES.FAILED };
const pendingTasks = [
currentTask,
- { branch: 'feature', branchType: 'SHORT' } as Task,
- {} as Task
+ { branch: 'feature', branchType: 'SHORT' } as T.Task,
+ {} as T.Task
];
expect(component.getCurrentTask(currentTask, undefined)).toBe(undefined);
expect(component.getCurrentTask(failedTask, mainBranch)).toBe(failedTask);
@@ -281,7 +275,7 @@ it('filters correctly the pending tasks for a main branch', () => {
it('reload component after task progress finished', async () => {
jest.useFakeTimers();
- const inProgressTask = { id: 'foo', status: STATUSES.IN_PROGRESS } as Task;
+ const inProgressTask = { id: 'foo', status: STATUSES.IN_PROGRESS } as T.Task;
(getTasksForComponent as jest.Mock<any>).mockResolvedValueOnce({ queue: [inProgressTask] });
const wrapper = shallow(
<ComponentContainer fetchOrganizations={jest.fn()} location={{ query: { id: 'foo' } }}>
diff --git a/server/sonar-web/src/main/js/app/components/__tests__/StartupModal-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/StartupModal-test.tsx
index 4e4691f0d85..5632c136274 100644
--- a/server/sonar-web/src/main/js/app/components/__tests__/StartupModal-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/__tests__/StartupModal-test.tsx
@@ -27,7 +27,6 @@ import { save, get } from '../../../helpers/storage';
import { hasMessage } from '../../../helpers/l10n';
import { waitAndUpdate, mockRouter } from '../../../helpers/testUtils';
import { differenceInDays, toShortNotSoISOString } from '../../../helpers/dates';
-import { LoggedInUser } from '../../types';
import { EditionKey } from '../../../apps/marketplace/utils';
jest.mock('../../../api/marketplace', () => ({
@@ -49,7 +48,7 @@ jest.mock('../../../helpers/dates', () => ({
toShortNotSoISOString: jest.fn().mockReturnValue('short-not-iso-date')
}));
-const LOGGED_IN_USER: LoggedInUser = {
+const LOGGED_IN_USER: T.LoggedInUser = {
groups: [],
isLoggedIn: true,
login: 'luke',
diff --git a/server/sonar-web/src/main/js/app/components/extensions/Extension.tsx b/server/sonar-web/src/main/js/app/components/extensions/Extension.tsx
index e67237255c3..b3e6c9343ec 100644
--- a/server/sonar-web/src/main/js/app/components/extensions/Extension.tsx
+++ b/server/sonar-web/src/main/js/app/components/extensions/Extension.tsx
@@ -25,10 +25,9 @@ import { injectIntl, InjectedIntlProps } from 'react-intl';
import { getExtensionStart } from './utils';
import { translate } from '../../../helpers/l10n';
import getStore from '../../utils/getStore';
-import { CurrentUser } from '../../types';
interface OwnProps {
- currentUser: CurrentUser;
+ currentUser: T.CurrentUser;
extension: { key: string; name: string };
onFail: (message: string) => void;
options?: {};
diff --git a/server/sonar-web/src/main/js/app/components/extensions/GlobalAdminPageExtension.tsx b/server/sonar-web/src/main/js/app/components/extensions/GlobalAdminPageExtension.tsx
index e479fbc7537..8db930dd62b 100644
--- a/server/sonar-web/src/main/js/app/components/extensions/GlobalAdminPageExtension.tsx
+++ b/server/sonar-web/src/main/js/app/components/extensions/GlobalAdminPageExtension.tsx
@@ -21,11 +21,10 @@ import * as React from 'react';
import { connect } from 'react-redux';
import ExtensionContainer from './ExtensionContainer';
import NotFound from '../NotFound';
-import { Extension } from '../../types';
import { getAppState, Store } from '../../../store/rootReducer';
interface Props {
- adminPages: Extension[] | undefined;
+ adminPages: T.Extension[] | undefined;
params: { extensionKey: string; pluginKey: string };
}
diff --git a/server/sonar-web/src/main/js/app/components/extensions/GlobalPageExtension.tsx b/server/sonar-web/src/main/js/app/components/extensions/GlobalPageExtension.tsx
index 8d7d535333b..b37ac541bea 100644
--- a/server/sonar-web/src/main/js/app/components/extensions/GlobalPageExtension.tsx
+++ b/server/sonar-web/src/main/js/app/components/extensions/GlobalPageExtension.tsx
@@ -22,10 +22,9 @@ import { connect } from 'react-redux';
import ExtensionContainer from './ExtensionContainer';
import NotFound from '../NotFound';
import { getAppState, Store } from '../../../store/rootReducer';
-import { Extension } from '../../types';
interface Props {
- globalPages: Extension[] | undefined;
+ globalPages: T.Extension[] | undefined;
params: { extensionKey: string; pluginKey: string };
}
diff --git a/server/sonar-web/src/main/js/app/components/extensions/OrganizationPageExtension.tsx b/server/sonar-web/src/main/js/app/components/extensions/OrganizationPageExtension.tsx
index 56eef2983dc..16ae71708ac 100644
--- a/server/sonar-web/src/main/js/app/components/extensions/OrganizationPageExtension.tsx
+++ b/server/sonar-web/src/main/js/app/components/extensions/OrganizationPageExtension.tsx
@@ -23,10 +23,9 @@ import ExtensionContainer from './ExtensionContainer';
import NotFound from '../NotFound';
import { getOrganizationByKey, Store } from '../../../store/rootReducer';
import { fetchOrganization } from '../../../apps/organizations/actions';
-import { Organization } from '../../types';
interface StateToProps {
- organization?: Organization;
+ organization?: T.Organization;
}
interface DispatchProps {
diff --git a/server/sonar-web/src/main/js/app/components/extensions/ProjectAdminPageExtension.tsx b/server/sonar-web/src/main/js/app/components/extensions/ProjectAdminPageExtension.tsx
index d4fb48cc14d..9502e405b63 100644
--- a/server/sonar-web/src/main/js/app/components/extensions/ProjectAdminPageExtension.tsx
+++ b/server/sonar-web/src/main/js/app/components/extensions/ProjectAdminPageExtension.tsx
@@ -23,10 +23,9 @@ import { Location } from 'history';
import ExtensionContainer from './ExtensionContainer';
import NotFound from '../NotFound';
import { addGlobalErrorMessage } from '../../../store/globalMessages';
-import { Component } from '../../types';
interface Props {
- component: Component;
+ component: T.Component;
location: Location;
params: { extensionKey: string; pluginKey: string };
}
diff --git a/server/sonar-web/src/main/js/app/components/extensions/ProjectPageExtension.tsx b/server/sonar-web/src/main/js/app/components/extensions/ProjectPageExtension.tsx
index df6c0f88e90..ada4b4f3e69 100644
--- a/server/sonar-web/src/main/js/app/components/extensions/ProjectPageExtension.tsx
+++ b/server/sonar-web/src/main/js/app/components/extensions/ProjectPageExtension.tsx
@@ -20,10 +20,9 @@
import * as React from 'react';
import ExtensionContainer from './ExtensionContainer';
import NotFound from '../NotFound';
-import { Component } from '../../types';
interface Props {
- component: Component;
+ component: T.Component;
location: { query: { id: string } };
params: {
extensionKey: string;
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNav.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNav.tsx
index 89561422d42..c25f240f1ab 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNav.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNav.tsx
@@ -24,17 +24,16 @@ import ComponentNavMenu from './ComponentNavMenu';
import ComponentNavBgTaskNotif from './ComponentNavBgTaskNotif';
import RecentHistory from '../../RecentHistory';
import * as theme from '../../../theme';
-import { BranchLike, Component, Measure, Task } from '../../../types';
import ContextNavBar from '../../../../components/nav/ContextNavBar';
import { STATUSES } from '../../../../apps/background-tasks/constants';
import './ComponentNav.css';
interface Props {
- branchLikes: BranchLike[];
- branchMeasures?: Measure[];
- currentBranchLike: BranchLike | undefined;
- component: Component;
- currentTask?: Task;
+ branchLikes: T.BranchLike[];
+ branchMeasures?: T.Measure[];
+ currentBranchLike: T.BranchLike | undefined;
+ component: T.Component;
+ currentTask?: T.Task;
currentTaskOnSameBranch?: boolean;
isInProgress?: boolean;
isPending?: boolean;
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBgTaskNotif.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBgTaskNotif.tsx
index 86ca810dcfd..6a0828e4fa1 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBgTaskNotif.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBgTaskNotif.tsx
@@ -23,14 +23,13 @@ import { FormattedMessage } from 'react-intl';
import ComponentNavLicenseNotif from './ComponentNavLicenseNotif';
import NavBarNotif from '../../../../components/nav/NavBarNotif';
import PendingIcon from '../../../../components/icons-components/PendingIcon';
-import { Component, Task } from '../../../types';
import { STATUSES } from '../../../../apps/background-tasks/constants';
import { getComponentBackgroundTaskUrl } from '../../../../helpers/urls';
import { hasMessage, translate } from '../../../../helpers/l10n';
interface Props {
- component: Component;
- currentTask?: Task;
+ component: T.Component;
+ currentTask?: T.Task;
currentTaskOnSameBranch?: boolean;
isInProgress?: boolean;
isPending?: boolean;
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranch.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranch.tsx
index fbdad095b35..8fee54db550 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranch.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranch.tsx
@@ -23,7 +23,6 @@ import { FormattedMessage } from 'react-intl';
import { Link } from 'react-router';
import ComponentNavBranchesMenu from './ComponentNavBranchesMenu';
import DocTooltip from '../../../../components/docs/DocTooltip';
-import { BranchLike, Component } from '../../../types';
import * as theme from '../../../theme';
import BranchIcon from '../../../../components/icons-components/BranchIcon';
import {
@@ -41,9 +40,9 @@ import { isSonarCloud } from '../../../../helpers/system';
import { getPortfolioAdminUrl } from '../../../../helpers/urls';
interface Props {
- branchLikes: BranchLike[];
- component: Component;
- currentBranchLike: BranchLike;
+ branchLikes: T.BranchLike[];
+ component: T.Component;
+ currentBranchLike: T.BranchLike;
location?: any;
}
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranchesMenu.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranchesMenu.tsx
index c599dda07d9..5f876d1a6f6 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranchesMenu.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranchesMenu.tsx
@@ -21,7 +21,6 @@ import * as React from 'react';
import * as PropTypes from 'prop-types';
import { Link } from 'react-router';
import ComponentNavBranchesMenuItem from './ComponentNavBranchesMenuItem';
-import { BranchLike, Component } from '../../../types';
import {
sortBranchesAsTree,
isLongLivingBranch,
@@ -39,16 +38,16 @@ import HelpTooltip from '../../../../components/controls/HelpTooltip';
import { DropdownOverlay } from '../../../../components/controls/Dropdown';
interface Props {
- branchLikes: BranchLike[];
+ branchLikes: T.BranchLike[];
canAdmin?: boolean;
- component: Component;
- currentBranchLike: BranchLike;
+ component: T.Component;
+ currentBranchLike: T.BranchLike;
onClose: () => void;
}
interface State {
query: string;
- selected: BranchLike | undefined;
+ selected: T.BranchLike | undefined;
}
export default class ComponentNavBranchesMenu extends React.PureComponent<Props, State> {
@@ -136,7 +135,7 @@ export default class ComponentNavBranchesMenu extends React.PureComponent<Props,
}
};
- handleSelect = (branchLike: BranchLike) => {
+ handleSelect = (branchLike: T.BranchLike) => {
this.setState({ selected: branchLike });
};
@@ -157,10 +156,10 @@ export default class ComponentNavBranchesMenu extends React.PureComponent<Props,
return undefined;
};
- getProjectBranchUrl = (branchLike: BranchLike) =>
+ getProjectBranchUrl = (branchLike: T.BranchLike) =>
getBranchLikeUrl(this.props.component.key, branchLike);
- isOrphan = (branchLike: BranchLike) => {
+ isOrphan = (branchLike: T.BranchLike) => {
return (isShortLivingBranch(branchLike) || isPullRequest(branchLike)) && branchLike.isOrphan;
};
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranchesMenuItem.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranchesMenuItem.tsx
index 204014a567e..d702f959584 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranchesMenuItem.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranchesMenuItem.tsx
@@ -21,7 +21,6 @@ import * as React from 'react';
import { Link } from 'react-router';
import * as classNames from 'classnames';
import BranchStatus from '../../../../components/common/BranchStatus';
-import { BranchLike, Component } from '../../../types';
import BranchIcon from '../../../../components/icons-components/BranchIcon';
import {
isShortLivingBranch,
@@ -34,9 +33,9 @@ import { translate } from '../../../../helpers/l10n';
import { getBranchLikeUrl } from '../../../../helpers/urls';
export interface Props {
- branchLike: BranchLike;
- component: Component;
- onSelect: (branchLike: BranchLike) => void;
+ branchLike: T.BranchLike;
+ component: T.Component;
+ onSelect: (branchLike: T.BranchLike) => void;
selected: boolean;
innerRef?: (node: HTMLLIElement) => void;
}
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavHeader.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavHeader.tsx
index f3301290cd3..6e847bd13bd 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavHeader.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavHeader.tsx
@@ -21,7 +21,6 @@ import * as React from 'react';
import { connect } from 'react-redux';
import { Link } from 'react-router';
import ComponentNavBranch from './ComponentNavBranch';
-import { Component, Organization, BranchLike, Breadcrumb } from '../../../types';
import QualifierIcon from '../../../../components/icons-components/QualifierIcon';
import {
getOrganizationByKey,
@@ -37,14 +36,14 @@ import { getProjectUrl, getBaseUrl } from '../../../../helpers/urls';
import { isSonarCloud } from '../../../../helpers/system';
interface StateProps {
- organization?: Organization;
+ organization?: T.Organization;
shouldOrganizationBeDisplayed?: boolean;
}
interface OwnProps {
- branchLikes: BranchLike[];
- component: Component;
- currentBranchLike: BranchLike | undefined;
+ branchLikes: T.BranchLike[];
+ component: T.Component;
+ currentBranchLike: T.BranchLike | undefined;
location?: any;
}
@@ -101,7 +100,7 @@ export function ComponentNavHeader(props: Props) {
);
}
-function renderBreadcrumbs(breadcrumbs: Breadcrumb[]) {
+function renderBreadcrumbs(breadcrumbs: T.Breadcrumb[]) {
const lastItem = breadcrumbs[breadcrumbs.length - 1];
return breadcrumbs.map((item, index) => {
const isPath = item.qualifier === 'DIR';
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavLicenseNotif.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavLicenseNotif.tsx
index 1fc44c1cbbb..116cb1489fa 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavLicenseNotif.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavLicenseNotif.tsx
@@ -23,10 +23,9 @@ import * as PropTypes from 'prop-types';
import NavBarNotif from '../../../../components/nav/NavBarNotif';
import { translate } from '../../../../helpers/l10n';
import { isValidLicense } from '../../../../api/marketplace';
-import { Task } from '../../../types';
interface Props {
- currentTask?: Task;
+ currentTask?: T.Task;
}
interface State {
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx
index 80bebedbd02..1499680b2a8 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx
@@ -21,7 +21,6 @@ import * as React from 'react';
import { Link } from 'react-router';
import * as classNames from 'classnames';
import * as PropTypes from 'prop-types';
-import { BranchLike, Component, Extension } from '../../../types';
import Dropdown from '../../../../components/controls/Dropdown';
import NavBarTabs from '../../../../components/nav/NavBarTabs';
import {
@@ -50,8 +49,8 @@ const SETTINGS_URLS = [
];
interface Props {
- branchLike: BranchLike | undefined;
- component: Component;
+ branchLike: T.BranchLike | undefined;
+ component: T.Component;
location?: any;
}
@@ -443,7 +442,7 @@ export default class ComponentNavMenu extends React.PureComponent<Props> {
);
}
- renderExtension = ({ key, name }: Extension, isAdmin: boolean) => {
+ renderExtension = ({ key, name }: T.Extension, isAdmin: boolean) => {
const pathname = isAdmin ? `/project/admin/extension/${key}` : `/project/extension/${key}`;
const query = { id: this.props.component.key, qualifier: this.props.component.qualifier };
return (
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMeta.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMeta.tsx
index a3093d3e2fb..f7c559de6a3 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMeta.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMeta.tsx
@@ -20,14 +20,6 @@
import * as React from 'react';
import { connect } from 'react-redux';
import ComponentNavWarnings from './ComponentNavWarnings';
-import {
- BranchLike,
- Component,
- CurrentUser,
- HomePageType,
- HomePage,
- Measure
-} from '../../../types';
import BranchMeasures from '../../../../components/common/BranchMeasures';
import BranchStatus from '../../../../components/common/BranchStatus';
import DateTimeFormatter from '../../../../components/intl/DateTimeFormatter';
@@ -46,13 +38,13 @@ import { isLoggedIn } from '../../../../helpers/users';
import { getCurrentUser, Store } from '../../../../store/rootReducer';
interface StateProps {
- currentUser: CurrentUser;
+ currentUser: T.CurrentUser;
}
interface Props extends StateProps {
- branchLike?: BranchLike;
- branchMeasures?: Measure[];
- component: Component;
+ branchLike?: T.BranchLike;
+ branchMeasures?: T.Measure[];
+ component: T.Component;
warnings: string[];
}
@@ -129,17 +121,17 @@ export function ComponentNavMeta({
);
}
-function getCurrentPage(component: Component, branchLike: BranchLike | undefined) {
- let currentPage: HomePage | undefined;
+function getCurrentPage(component: T.Component, branchLike: T.BranchLike | undefined) {
+ let currentPage: T.HomePage | undefined;
if (component.qualifier === 'VW' || component.qualifier === 'SVW') {
- currentPage = { type: HomePageType.Portfolio, component: component.key };
+ currentPage = { type: 'PORTFOLIO', component: component.key };
} else if (component.qualifier === 'APP') {
const branch = isLongLivingBranch(branchLike) ? branchLike.name : undefined;
- currentPage = { type: HomePageType.Application, component: component.key, branch };
+ currentPage = { type: 'APPLICATION', component: component.key, branch };
} else if (component.qualifier === 'TRK') {
// when home page is set to the default branch of a project, its name is returned as `undefined`
const branch = isLongLivingBranch(branchLike) ? branchLike.name : undefined;
- currentPage = { type: HomePageType.Project, component: component.key, branch };
+ currentPage = { type: 'PROJECT', component: component.key, branch };
}
return currentPage;
}
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBgTaskNotif-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBgTaskNotif-test.tsx
index 0843db6b9df..2010ef6f8ab 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBgTaskNotif-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBgTaskNotif-test.tsx
@@ -27,7 +27,6 @@ jest.mock('../../../../../helpers/l10n', () => {
import * as React from 'react';
import { shallow } from 'enzyme';
import ComponentNavBgTaskNotif from '../ComponentNavBgTaskNotif';
-import { Task } from '../../../../types';
const component = {
analysisDate: '2017-01-02T00:00:00.000Z',
@@ -46,7 +45,7 @@ it('renders background task error correctly', () => {
it('renders background task error correctly for a different branch/PR', () => {
expect(
getWrapper({
- currentTask: { branch: 'my/branch', status: 'FAILED' } as Task,
+ currentTask: { branch: 'my/branch', status: 'FAILED' } as T.Task,
currentTaskOnSameBranch: false
})
).toMatchSnapshot();
@@ -56,7 +55,7 @@ it('renders background task error correctly for a different branch/PR', () => {
pullRequest: '650',
pullRequestTitle: 'feature/my_pr',
status: 'FAILED'
- } as Task,
+ } as T.Task,
currentTaskOnSameBranch: false
})
).toMatchSnapshot();
@@ -89,7 +88,7 @@ function getWrapper(props = {}) {
return shallow(
<ComponentNavBgTaskNotif
component={component}
- currentTask={{ status: 'FAILED' } as Task}
+ currentTask={{ status: 'FAILED' } as T.Task}
{...props}
/>
);
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBranch-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBranch-test.tsx
index 3fd20dbc41e..17c44b1beb9 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBranch-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBranch-test.tsx
@@ -20,28 +20,20 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import ComponentNavBranch from '../ComponentNavBranch';
-import {
- BranchType,
- ShortLivingBranch,
- MainBranch,
- Component,
- LongLivingBranch,
- PullRequest
-} from '../../../../types';
import { click } from '../../../../../helpers/testUtils';
import { isSonarCloud } from '../../../../../helpers/system';
jest.mock('../../../../../helpers/system', () => ({ isSonarCloud: jest.fn() }));
-const mainBranch: MainBranch = { isMain: true, name: 'master' };
-const fooBranch: LongLivingBranch = { isMain: false, name: 'foo', type: BranchType.LONG };
+const mainBranch: T.MainBranch = { isMain: true, name: 'master' };
+const fooBranch: T.LongLivingBranch = { isMain: false, name: 'foo', type: 'LONG' };
beforeEach(() => {
(isSonarCloud as jest.Mock).mockImplementation(() => false);
});
it('renders main branch', () => {
- const component = {} as Component;
+ const component = {} as T.Component;
expect(
shallow(
<ComponentNavBranch
@@ -55,14 +47,14 @@ it('renders main branch', () => {
});
it('renders short-living branch', () => {
- const branch: ShortLivingBranch = {
+ const branch: T.ShortLivingBranch = {
isMain: false,
mergeBranch: 'master',
name: 'foo',
status: { bugs: 0, codeSmells: 0, qualityGateStatus: 'OK', vulnerabilities: 0 },
- type: BranchType.SHORT
+ type: 'SHORT'
};
- const component = {} as Component;
+ const component = {} as T.Component;
expect(
shallow(
<ComponentNavBranch
@@ -76,14 +68,14 @@ it('renders short-living branch', () => {
});
it('renders pull request', () => {
- const pullRequest: PullRequest = {
+ const pullRequest: T.PullRequest = {
base: 'master',
branch: 'feature',
key: '1234',
title: 'Feature PR',
url: 'https://example.com/pull/1234'
};
- const component = {} as Component;
+ const component = {} as T.Component;
expect(
shallow(
<ComponentNavBranch
@@ -97,7 +89,7 @@ it('renders pull request', () => {
});
it('opens menu', () => {
- const component = {} as Component;
+ const component = {} as T.Component;
const wrapper = shallow(
<ComponentNavBranch
branchLikes={[mainBranch, fooBranch]}
@@ -112,7 +104,7 @@ it('opens menu', () => {
});
it('renders single branch popup', () => {
- const component = {} as Component;
+ const component = {} as T.Component;
const wrapper = shallow(
<ComponentNavBranch
branchLikes={[mainBranch]}
@@ -125,7 +117,7 @@ it('renders single branch popup', () => {
});
it('renders no branch support popup', () => {
- const component = {} as Component;
+ const component = {} as T.Component;
const wrapper = shallow(
<ComponentNavBranch
branchLikes={[mainBranch, fooBranch]}
@@ -139,7 +131,7 @@ it('renders no branch support popup', () => {
it('renders nothing on SonarCloud without branch support', () => {
(isSonarCloud as jest.Mock).mockImplementation(() => true);
- const component = {} as Component;
+ const component = {} as T.Component;
const wrapper = shallow(
<ComponentNavBranch
branchLikes={[mainBranch]}
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBranchesMenu-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBranchesMenu-test.tsx
index b27d81ca72f..8f35a1c252f 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBranchesMenu-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBranchesMenu-test.tsx
@@ -20,17 +20,9 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import ComponentNavBranchesMenu from '../ComponentNavBranchesMenu';
-import {
- BranchType,
- MainBranch,
- ShortLivingBranch,
- LongLivingBranch,
- Component,
- PullRequest
-} from '../../../../types';
import { elementKeydown } from '../../../../../helpers/testUtils';
-const component = { key: 'component' } as Component;
+const component = { key: 'component' } as T.Component;
it('renders list', () => {
expect(
@@ -90,26 +82,26 @@ it('selects next & previous', () => {
expect(wrapper.state().selected).toEqual(shortBranch('foo'));
});
-function mainBranch(): MainBranch {
+function mainBranch(): T.MainBranch {
return { isMain: true, name: 'master' };
}
-function shortBranch(name: string, isOrphan?: true): ShortLivingBranch {
+function shortBranch(name: string, isOrphan?: true): T.ShortLivingBranch {
return {
isMain: false,
isOrphan,
mergeBranch: 'master',
name,
status: { bugs: 0, codeSmells: 0, qualityGateStatus: 'OK', vulnerabilities: 0 },
- type: BranchType.SHORT
+ type: 'SHORT'
};
}
-function longBranch(name: string): LongLivingBranch {
- return { isMain: false, name, type: BranchType.LONG };
+function longBranch(name: string): T.LongLivingBranch {
+ return { isMain: false, name, type: 'LONG' };
}
-function pullRequest(title: string): PullRequest {
+function pullRequest(title: string): T.PullRequest {
return {
base: 'master',
branch: 'feature',
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBranchesMenuItem-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBranchesMenuItem-test.tsx
index 01995e7f92d..7415b1ffa14 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBranchesMenuItem-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBranchesMenuItem-test.tsx
@@ -20,19 +20,18 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import ComponentNavBranchesMenuItem, { Props } from '../ComponentNavBranchesMenuItem';
-import { BranchType, MainBranch, ShortLivingBranch, Component } from '../../../../types';
-const component = { key: 'component' } as Component;
+const component = { key: 'component' } as T.Component;
-const shortBranch: ShortLivingBranch = {
+const shortBranch: T.ShortLivingBranch = {
isMain: false,
mergeBranch: 'master',
name: 'foo',
status: { bugs: 1, codeSmells: 2, qualityGateStatus: 'ERROR', vulnerabilities: 3 },
- type: BranchType.SHORT
+ type: 'SHORT'
};
-const mainBranch: MainBranch = { isMain: true, name: 'master' };
+const mainBranch: T.MainBranch = { isMain: true, name: 'master' };
it('renders main branch', () => {
expect(shallowRender({ branchLike: mainBranch })).toMatchSnapshot();
@@ -43,7 +42,7 @@ it('renders short-living branch', () => {
});
it('renders short-living orhpan branch', () => {
- const orhpan: ShortLivingBranch = { ...shortBranch, isOrphan: true };
+ const orhpan: T.ShortLivingBranch = { ...shortBranch, isOrphan: true };
expect(shallowRender({ branchLike: orhpan })).toMatchSnapshot();
});
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavHeader-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavHeader-test.tsx
index 2d1dd8d5f65..d28d94a1e11 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavHeader-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavHeader-test.tsx
@@ -20,26 +20,25 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import { ComponentNavHeader } from '../ComponentNavHeader';
-import { Visibility } from '../../../../types';
import { isSonarCloud } from '../../../../../helpers/system';
jest.mock('../../../../../helpers/system', () => ({
isSonarCloud: jest.fn().mockReturnValue(false)
}));
-const component = {
+const component: T.Component = {
breadcrumbs: [{ key: 'my-project', name: 'My Project', qualifier: 'TRK' }],
key: 'my-project',
name: 'My Project',
organization: 'foo',
qualifier: 'TRK',
- visibility: Visibility.Public
+ visibility: 'public'
};
-const organization = {
+const organization: T.Organization = {
key: 'foo',
name: 'The Foo Organization',
- projectVisibility: Visibility.Public
+ projectVisibility: 'public'
};
it('should not render breadcrumbs with one element', () => {
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavLicenseNotif-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavLicenseNotif-test.tsx
index c2440b8e197..8528a2701f7 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavLicenseNotif-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavLicenseNotif-test.tsx
@@ -22,7 +22,6 @@ import { shallow } from 'enzyme';
import ComponentNavLicenseNotif from '../ComponentNavLicenseNotif';
import { isValidLicense } from '../../../../../api/marketplace';
import { waitAndUpdate } from '../../../../../helpers/testUtils';
-import { Task } from '../../../../types';
jest.mock('../../../../../helpers/l10n', () => {
const l10n = require.requireActual('../../../../../helpers/l10n');
@@ -74,7 +73,7 @@ it('renders correctly for LICENSING_LOC error', async () => {
function getWrapper(props = {}, context = {}) {
return shallow(
<ComponentNavLicenseNotif
- currentTask={{ errorMessage: 'Foo', errorType: 'LICENSING' } as Task}
+ currentTask={{ errorMessage: 'Foo', errorType: 'LICENSING' } as T.Task}
{...props}
/>,
{ context: { canAdmin: true, ...context } }
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavMenu-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavMenu-test.tsx
index a7b7bb95953..992673fb9b3 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavMenu-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavMenu-test.tsx
@@ -20,9 +20,8 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import ComponentNavMenu from '../ComponentNavMenu';
-import { ShortLivingBranch, BranchType, LongLivingBranch, MainBranch } from '../../../../types';
-const mainBranch: MainBranch = { isMain: true, name: 'master' };
+const mainBranch: T.MainBranch = { isMain: true, name: 'master' };
const baseComponent = {
breadcrumbs: [],
@@ -65,11 +64,11 @@ it('should work with multiple extensions', () => {
});
it('should work for short-living branches', () => {
- const branch: ShortLivingBranch = {
+ const branch: T.ShortLivingBranch = {
isMain: false,
mergeBranch: 'master',
name: 'feature',
- type: BranchType.SHORT
+ type: 'SHORT'
};
const component = {
...baseComponent,
@@ -84,7 +83,7 @@ it('should work for short-living branches', () => {
});
it('should work for long-living branches', () => {
- const branch: LongLivingBranch = { isMain: false, name: 'release', type: BranchType.LONG };
+ const branch: T.LongLivingBranch = { isMain: false, name: 'release', type: 'LONG' };
[true, false].forEach(showSettings =>
expect(
shallow(
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavMeta-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavMeta-test.tsx
index fd9e6180817..6e0c12c3928 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavMeta-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavMeta-test.tsx
@@ -20,7 +20,6 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import { ComponentNavMeta } from '../ComponentNavMeta';
-import { BranchType, ShortLivingBranch, LongLivingBranch, PullRequest } from '../../../../types';
const COMPONENT = {
analysisDate: '2017-01-02T00:00:00.000Z',
@@ -38,12 +37,12 @@ const MEASURES = [
];
it('renders status of short-living branch', () => {
- const branch: ShortLivingBranch = {
+ const branch: T.ShortLivingBranch = {
isMain: false,
mergeBranch: 'master',
name: 'feature',
status: { bugs: 0, codeSmells: 2, qualityGateStatus: 'ERROR', vulnerabilities: 3 },
- type: BranchType.SHORT
+ type: 'SHORT'
};
expect(
shallow(
@@ -59,11 +58,11 @@ it('renders status of short-living branch', () => {
});
it('renders meta for long-living branch', () => {
- const branch: LongLivingBranch = {
+ const branch: T.LongLivingBranch = {
isMain: false,
name: 'release',
status: { qualityGateStatus: 'OK' },
- type: BranchType.LONG
+ type: 'LONG'
};
expect(
shallow(
@@ -78,7 +77,7 @@ it('renders meta for long-living branch', () => {
});
it('renders meta for pull request', () => {
- const pullRequest: PullRequest = {
+ const pullRequest: T.PullRequest = {
base: 'master',
branch: 'feature',
key: '1234',
diff --git a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNav.tsx b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNav.tsx
index 67cda337eae..e5b1ff86885 100644
--- a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNav.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNav.tsx
@@ -27,7 +27,6 @@ import GlobalNavUserContainer from './GlobalNavUserContainer';
import Search from '../../search/Search';
import EmbedDocsPopupHelper from '../../embed-docs-modal/EmbedDocsPopupHelper';
import * as theme from '../../../theme';
-import { CurrentUser, AppState } from '../../../types';
import NavBar from '../../../../components/nav/NavBar';
import { lazyLoad } from '../../../../components/lazyLoad';
import { getCurrentUser, getAppState, Store } from '../../../../store/rootReducer';
@@ -39,8 +38,8 @@ import './GlobalNav.css';
const GlobalNavPlus = lazyLoad(() => import('./GlobalNavPlus'), 'GlobalNavPlus');
interface StateProps {
- appState: Pick<AppState, 'canAdmin' | 'globalPages' | 'organizationsEnabled' | 'qualifiers'>;
- currentUser: CurrentUser;
+ appState: Pick<T.AppState, 'canAdmin' | 'globalPages' | 'organizationsEnabled' | 'qualifiers'>;
+ currentUser: T.CurrentUser;
}
interface OwnProps {
diff --git a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavMenu.tsx b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavMenu.tsx
index 418dd16875d..39cc87251a2 100644
--- a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavMenu.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavMenu.tsx
@@ -20,7 +20,6 @@
import * as React from 'react';
import * as classNames from 'classnames';
import { Link } from 'react-router';
-import { CurrentUser, AppState, Extension } from '../../../types';
import { translate } from '../../../../helpers/l10n';
import { getQualityGatesUrl, getBaseUrl } from '../../../../helpers/urls';
import { isMySet } from '../../../../apps/issues/utils';
@@ -30,8 +29,8 @@ import { isSonarCloud } from '../../../../helpers/system';
import { isLoggedIn } from '../../../../helpers/users';
interface Props {
- appState: Pick<AppState, 'canAdmin' | 'globalPages' | 'organizationsEnabled' | 'qualifiers'>;
- currentUser: CurrentUser;
+ appState: Pick<T.AppState, 'canAdmin' | 'globalPages' | 'organizationsEnabled' | 'qualifiers'>;
+ currentUser: T.CurrentUser;
location: { pathname: string };
}
@@ -144,7 +143,7 @@ export default class GlobalNavMenu extends React.PureComponent<Props> {
);
}
- renderGlobalPageLink = ({ key, name }: Extension) => {
+ renderGlobalPageLink = ({ key, name }: T.Extension) => {
return (
<li key={key}>
<Link to={`/extension/${key}`}>{name}</Link>
diff --git a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavPlus.tsx b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavPlus.tsx
index a0267f7197e..8017304aa58 100644
--- a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavPlus.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavPlus.tsx
@@ -22,7 +22,6 @@ import { Link, withRouter, WithRouterProps } from 'react-router';
import CreateFormShim from '../../../../apps/portfolio/components/CreateFormShim';
import Dropdown from '../../../../components/controls/Dropdown';
import PlusIcon from '../../../../components/icons-components/PlusIcon';
-import { AppState, LoggedInUser } from '../../../types';
import { getExtensionStart } from '../../extensions/utils';
import { getComponentNavigation } from '../../../../api/nav';
import { translate } from '../../../../helpers/l10n';
@@ -31,8 +30,8 @@ import { getPortfolioAdminUrl, getPortfolioUrl } from '../../../../helpers/urls'
import { hasGlobalPermission } from '../../../../helpers/users';
interface Props {
- appState: Pick<AppState, 'qualifiers'>;
- currentUser: LoggedInUser;
+ appState: Pick<T.AppState, 'qualifiers'>;
+ currentUser: T.LoggedInUser;
openProjectOnboarding: () => void;
}
diff --git a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavUser.tsx b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavUser.tsx
index 530f17d248f..488a642a771 100644
--- a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavUser.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavUser.tsx
@@ -22,7 +22,6 @@ import { sortBy } from 'lodash';
import * as PropTypes from 'prop-types';
import { Link } from 'react-router';
import * as theme from '../../../theme';
-import { CurrentUser, LoggedInUser, Organization } from '../../../types';
import Avatar from '../../../../components/ui/Avatar';
import OrganizationListItem from '../../../../components/ui/OrganizationListItem';
import { translate } from '../../../../helpers/l10n';
@@ -32,8 +31,8 @@ import { isLoggedIn } from '../../../../helpers/users';
interface Props {
appState: { organizationsEnabled?: boolean };
- currentUser: CurrentUser;
- organizations: Organization[];
+ currentUser: T.CurrentUser;
+ organizations: T.Organization[];
}
export default class GlobalNavUser extends React.PureComponent<Props> {
@@ -60,7 +59,7 @@ export default class GlobalNavUser extends React.PureComponent<Props> {
renderAuthenticated() {
const { organizations } = this.props;
- const currentUser = this.props.currentUser as LoggedInUser;
+ const currentUser = this.props.currentUser as T.LoggedInUser;
const hasOrganizations = this.props.appState.organizationsEnabled && organizations.length > 0;
return (
<Dropdown
diff --git a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavUserContainer.tsx b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavUserContainer.tsx
index 11f8f734dd7..eea20eb4d5e 100644
--- a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavUserContainer.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavUserContainer.tsx
@@ -19,11 +19,10 @@
*/
import { connect } from 'react-redux';
import GlobalNavUser from './GlobalNavUser';
-import { Organization } from '../../../types';
import { getMyOrganizations, Store } from '../../../../store/rootReducer';
interface StateProps {
- organizations: Organization[];
+ organizations: T.Organization[];
}
const mapStateToProps = (state: Store): StateProps => ({
diff --git a/server/sonar-web/src/main/js/app/components/nav/global/__tests__/GlobalNavPlus-test.tsx b/server/sonar-web/src/main/js/app/components/nav/global/__tests__/GlobalNavPlus-test.tsx
index 37f845fd4cc..ff36583b9e6 100644
--- a/server/sonar-web/src/main/js/app/components/nav/global/__tests__/GlobalNavPlus-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/global/__tests__/GlobalNavPlus-test.tsx
@@ -22,7 +22,6 @@ import { shallow, ShallowWrapper } from 'enzyme';
import { GlobalNavPlus } from '../GlobalNavPlus';
import { isSonarCloud } from '../../../../../helpers/system';
import { click, mockRouter } from '../../../../../helpers/testUtils';
-import { LoggedInUser } from '../../../../types';
jest.mock('../../../../../helpers/system', () => ({
isSonarCloud: jest.fn()
@@ -79,7 +78,7 @@ function getWrapper(props = {}, globalPermissions?: string[]) {
{
isLoggedIn: true,
permissions: { global: globalPermissions || ['provisioning'] }
- } as LoggedInUser
+ } as T.LoggedInUser
}
openProjectOnboarding={jest.fn()}
router={mockRouter()}
diff --git a/server/sonar-web/src/main/js/app/components/nav/global/__tests__/GlobalNavUser-test.tsx b/server/sonar-web/src/main/js/app/components/nav/global/__tests__/GlobalNavUser-test.tsx
index 152efb5d69c..49e6ef10666 100644
--- a/server/sonar-web/src/main/js/app/components/nav/global/__tests__/GlobalNavUser-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/global/__tests__/GlobalNavUser-test.tsx
@@ -20,13 +20,12 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import GlobalNavUser from '../GlobalNavUser';
-import { Visibility } from '../../../../types';
const currentUser = { avatar: 'abcd1234', isLoggedIn: true, name: 'foo', email: 'foo@bar.baz' };
-const organizations = [
- { key: 'myorg', name: 'MyOrg', projectVisibility: Visibility.Public },
- { key: 'foo', name: 'Foo', projectVisibility: Visibility.Public },
- { key: 'bar', name: 'bar', projectVisibility: Visibility.Public }
+const organizations: T.Organization[] = [
+ { key: 'myorg', name: 'MyOrg', projectVisibility: 'public' },
+ { key: 'foo', name: 'Foo', projectVisibility: 'public' },
+ { key: 'bar', name: 'bar', projectVisibility: 'public' }
];
const appState = { organizationsEnabled: true };
diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.tsx b/server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.tsx
index 378a5fc5afd..287825da12f 100644
--- a/server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.tsx
@@ -25,13 +25,12 @@ import * as theme from '../../../theme';
import ContextNavBar from '../../../../components/nav/ContextNavBar';
import Dropdown from '../../../../components/controls/Dropdown';
import NavBarTabs from '../../../../components/nav/NavBarTabs';
-import { Extension } from '../../../types';
import { PluginPendingResult } from '../../../../api/plugins';
import DropdownIcon from '../../../../components/icons-components/DropdownIcon';
import { translate } from '../../../../helpers/l10n';
interface Props {
- extensions: Extension[];
+ extensions: T.Extension[];
fetchPendingPlugins: () => void;
location: {};
organizationsEnabled?: boolean;
@@ -73,7 +72,7 @@ export default class SettingsNav extends React.PureComponent<Props> {
return this.isSomethingActive(urls);
}
- renderExtension = ({ key, name }: Extension) => {
+ renderExtension = ({ key, name }: T.Extension) => {
return (
<li key={key}>
<Link activeClassName="active" to={`/admin/extension/${key}`}>
diff --git a/server/sonar-web/src/main/js/app/components/search/Search.tsx b/server/sonar-web/src/main/js/app/components/search/Search.tsx
index 9d91d8b3acd..209b21795f5 100644
--- a/server/sonar-web/src/main/js/app/components/search/Search.tsx
+++ b/server/sonar-web/src/main/js/app/components/search/Search.tsx
@@ -34,15 +34,14 @@ import { getSuggestions } from '../../../api/components';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { scrollToElement } from '../../../helpers/scrolling';
import { getProjectUrl } from '../../../helpers/urls';
-import { AppState, CurrentUser } from '../../types';
import './Search.css';
const SearchResults = lazyLoad(() => import('./SearchResults'));
const SearchResult = lazyLoad(() => import('./SearchResult'));
interface OwnProps {
- appState: Pick<AppState, 'organizationsEnabled'>;
- currentUser: CurrentUser;
+ appState: Pick<T.AppState, 'organizationsEnabled'>;
+ currentUser: T.CurrentUser;
}
type Props = OwnProps & WithRouterProps;
diff --git a/server/sonar-web/src/main/js/app/components/search/SearchResult.tsx b/server/sonar-web/src/main/js/app/components/search/SearchResult.tsx
index 7dd26bd190d..c75fd6719b3 100644
--- a/server/sonar-web/src/main/js/app/components/search/SearchResult.tsx
+++ b/server/sonar-web/src/main/js/app/components/search/SearchResult.tsx
@@ -25,10 +25,9 @@ import QualifierIcon from '../../../components/icons-components/QualifierIcon';
import ClockIcon from '../../../components/icons-components/ClockIcon';
import Tooltip from '../../../components/controls/Tooltip';
import { getProjectUrl } from '../../../helpers/urls';
-import { AppState } from '../../types';
interface Props {
- appState: Pick<AppState, 'organizationsEnabled'>;
+ appState: Pick<T.AppState, 'organizationsEnabled'>;
component: ComponentResult;
innerRef: (componentKey: string, node: HTMLElement | null) => void;
onClose: () => void;
diff --git a/server/sonar-web/src/main/js/app/types.d.ts b/server/sonar-web/src/main/js/app/types.d.ts
new file mode 100644
index 00000000000..d96c74fb7d3
--- /dev/null
+++ b/server/sonar-web/src/main/js/app/types.d.ts
@@ -0,0 +1,865 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2018 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+declare namespace T {
+ export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
+
+ // Type ordered alphabetically to prevent merge conflicts
+
+ export interface AlmApplication extends IdentityProvider {
+ installationUrl: string;
+ }
+
+ export interface AlmOrganization extends OrganizationBase {
+ key: string;
+ personal: boolean;
+ }
+
+ export interface AlmRepository {
+ label: string;
+ installationKey: string;
+ linkedProjectKey?: string;
+ linkedProjectName?: string;
+ private?: boolean;
+ }
+
+ export interface AlmUnboundApplication {
+ installationId: string;
+ key: string;
+ name: string;
+ }
+
+ export interface Analysis {
+ date: string;
+ events: AnalysisEvent[];
+ key: string;
+ }
+
+ export interface AnalysisEvent {
+ category: string;
+ description?: string;
+ key: string;
+ name: string;
+ qualityGate?: {
+ failing: Array<{ branch: string; key: string; name: string }>;
+ status: string;
+ stillFailing: boolean;
+ };
+ definitionChange?: {
+ projects: Array<{
+ branch?: string;
+ changeType: string;
+ key: string;
+ name: string;
+ newBranch?: string;
+ oldBranch?: string;
+ }>;
+ };
+ }
+
+ export interface AppState {
+ adminPages?: Extension[];
+ authenticationError?: boolean;
+ authorizationError?: boolean;
+ branchesEnabled?: boolean;
+ canAdmin?: boolean;
+ defaultOrganization: string;
+ edition: EditionKey;
+ globalPages?: Extension[];
+ organizationsEnabled?: boolean;
+ productionDatabase: boolean;
+ qualifiers: string[];
+ settings: { [key: string]: string };
+ standalone?: boolean;
+ version: string;
+ }
+
+ export interface Branch {
+ analysisDate?: string;
+ isMain: boolean;
+ name: string;
+ }
+
+ export type BranchLike = Branch | PullRequest;
+
+ export type BranchParameters = { branch?: string } | { pullRequest?: string };
+
+ export type BranchType = 'LONG' | 'SHORT';
+
+ export interface Breadcrumb {
+ key: string;
+ name: string;
+ qualifier: string;
+ }
+
+ export interface Component extends LightComponent {
+ alm?: { key: string; url: string };
+ analysisDate?: string;
+ breadcrumbs: Breadcrumb[];
+ configuration?: ComponentConfiguration;
+ description?: string;
+ extensions?: Extension[];
+ isFavorite?: boolean;
+ leakPeriodDate?: string;
+ name: string;
+ path?: string;
+ refKey?: string;
+ qualityProfiles?: ComponentQualityProfile[];
+ qualityGate?: { isDefault?: boolean; key: string; name: string };
+ tags?: string[];
+ version?: string;
+ visibility?: Visibility;
+ }
+
+ interface ComponentConfiguration {
+ canApplyPermissionTemplate?: boolean;
+ canUpdateProjectVisibilityToPrivate?: boolean;
+ extensions?: Extension[];
+ showBackgroundTasks?: boolean;
+ showHistory?: boolean;
+ showLinks?: boolean;
+ showManualMeasures?: boolean;
+ showQualityGates?: boolean;
+ showQualityProfiles?: boolean;
+ showPermissions?: boolean;
+ showSettings?: boolean;
+ showUpdateKey?: boolean;
+ }
+
+ export interface ComponentQualityProfile {
+ deleted?: boolean;
+ key: string;
+ language: string;
+ name: string;
+ }
+
+ interface ComponentMeasureIntern {
+ branch?: string;
+ description?: string;
+ isFavorite?: boolean;
+ isRecentlyBrowsed?: boolean;
+ key: string;
+ match?: string;
+ name: string;
+ organization?: string;
+ path?: string;
+ project?: string;
+ qualifier: string;
+ refKey?: string;
+ }
+
+ export interface ComponentMeasure extends ComponentMeasureIntern {
+ measures?: Measure[];
+ }
+
+ export interface ComponentMeasureEnhanced extends ComponentMeasureIntern {
+ value?: string;
+ leak?: string;
+ measures: MeasureEnhanced[];
+ }
+
+ export interface Condition {
+ error: string;
+ id: number;
+ metric: string;
+ op?: string;
+ period?: number;
+ warning: string;
+ }
+
+ export interface CoveredFile {
+ key: string;
+ longName: string;
+ coveredLines: number;
+ }
+
+ export interface Coupon {
+ billing?: {
+ address?: string;
+ country?: string;
+ email?: string;
+ name?: string;
+ use?: string;
+ };
+ maxNcloc: number;
+ planActiveUntil: string;
+ }
+
+ export interface CurrentUser {
+ isLoggedIn: boolean;
+ permissions?: { global: string[] };
+ showOnboardingTutorial?: boolean;
+ }
+
+ export interface CustomMeasure {
+ createdAt?: string;
+ description?: string;
+ id: string;
+ metric: {
+ key: string;
+ name: string;
+ domain?: string;
+ type: string;
+ };
+ projectKey: string;
+ pending?: boolean;
+ user: {
+ active?: boolean;
+ email?: string;
+ login: string;
+ name: string;
+ };
+ value: string;
+ updatedAt?: string;
+ }
+
+ export interface Duplication {
+ blocks: DuplicationBlock[];
+ }
+
+ export interface DuplicationBlock {
+ _ref: string;
+ from: number;
+ size: number;
+ }
+
+ export interface DuplicatedFile {
+ key: string;
+ name: string;
+ project: string;
+ projectName: string;
+ subProject?: string;
+ subProjectName?: string;
+ }
+
+ export type EditionKey = 'community' | 'developer' | 'enterprise' | 'datacenter';
+
+ export interface Extension {
+ key: string;
+ name: string;
+ }
+
+ export interface FacetValue<T = string> {
+ count: number;
+ val: T;
+ }
+
+ export interface FlowLocation {
+ component: string;
+ componentName?: string;
+ msg?: string;
+ textRange: TextRange;
+ }
+
+ export interface Group {
+ default?: boolean;
+ description?: string;
+ id: number;
+ membersCount: number;
+ name: string;
+ }
+
+ export type HomePage =
+ | { type: 'APPLICATION'; branch: string | undefined; component: string }
+ | { type: 'ISSUES' }
+ | { type: 'MY_ISSUES' }
+ | { type: 'MY_PROJECTS' }
+ | { type: 'ORGANIZATION'; organization: string }
+ | { type: 'PORTFOLIO'; component: string }
+ | { type: 'PORTFOLIOS' }
+ | { type: 'PROJECT'; branch: string | undefined; component: string }
+ | { type: 'PROJECTS' };
+
+ export type HomePageType =
+ | 'APPLICATION'
+ | 'ISSUES'
+ | 'MY_ISSUES'
+ | 'MY_PROJECTS'
+ | 'ORGANIZATION'
+ | 'PORTFOLIO'
+ | 'PORTFOLIOS'
+ | 'PROJECT'
+ | 'PROJECTS';
+
+ export interface IdentityProvider {
+ backgroundColor: string;
+ helpMessage?: string;
+ iconPath: string;
+ key: string;
+ name: string;
+ }
+
+ export interface SecurityHotspot {
+ activeRules: number;
+ category?: string;
+ cwe?: string;
+ distribution?: Array<SecurityHotspot>;
+ openSecurityHotspots: number;
+ toReviewSecurityHotspots: number;
+ totalRules: number;
+ vulnerabilities: number;
+ vulnerabilityRating?: number;
+ wontFixSecurityHotspots: number;
+ }
+
+ export interface Issue {
+ actions: string[];
+ assignee?: string;
+ assigneeActive?: string;
+ assigneeAvatar?: string;
+ assigneeLogin?: string;
+ assigneeName?: string;
+ author?: string;
+ branch?: string;
+ comments?: IssueComment[];
+ component: string;
+ componentLongName: string;
+ componentQualifier: string;
+ componentUuid: string;
+ creationDate: string;
+ effort?: string;
+ externalRuleEngine?: string;
+ fromExternalRule?: boolean;
+ key: string;
+ flows: FlowLocation[][];
+ fromHotspot: boolean;
+ line?: number;
+ message: string;
+ organization: string;
+ project: string;
+ projectName: string;
+ projectOrganization: string;
+ projectKey: string;
+ pullRequest?: string;
+ resolution?: string;
+ rule: string;
+ ruleName: string;
+ secondaryLocations: FlowLocation[];
+ severity: string;
+ status: string;
+ subProject?: string;
+ subProjectName?: string;
+ subProjectUuid?: string;
+ tags?: string[];
+ textRange?: TextRange;
+ transitions: string[];
+ type: IssueType;
+ }
+
+ export interface IssueComment {
+ author?: string;
+ authorActive?: boolean;
+ authorAvatar?: string;
+ authorLogin?: string;
+ authorName?: string;
+ createdAt: string;
+ htmlText: string;
+ key: string;
+ markdown: string;
+ updatable: boolean;
+ }
+
+ export type IssueType = 'BUG' | 'VULNERABILITY' | 'CODE_SMELL' | 'SECURITY_HOTSPOT';
+
+ export interface Language {
+ key: string;
+ name: string;
+ }
+
+ export interface Languages {
+ [key: string]: Language;
+ }
+
+ export interface LightComponent {
+ key: string;
+ organization: string;
+ qualifier: string;
+ }
+
+ export interface LinearIssueLocation {
+ from: number;
+ index?: number;
+ line: number;
+ startLine?: number;
+ to: number;
+ }
+
+ export interface LoggedInUser extends CurrentUser {
+ avatar?: string;
+ email?: string;
+ externalIdentity?: string;
+ externalProvider?: string;
+ groups: string[];
+ homepage?: HomePage;
+ isLoggedIn: true;
+ local?: boolean;
+ login: string;
+ name: string;
+ personalOrganization?: string;
+ scmAccounts: string[];
+ }
+
+ export interface LongLivingBranch extends Branch {
+ isMain: false;
+ status?: { qualityGateStatus: string };
+ type: 'LONG';
+ }
+
+ export interface MainBranch extends Branch {
+ isMain: true;
+ status?: { qualityGateStatus: string };
+ }
+
+ export interface Measure extends MeasureIntern {
+ metric: string;
+ }
+
+ export interface MeasureEnhanced extends MeasureIntern {
+ metric: Metric;
+ leak?: string;
+ }
+
+ interface MeasureIntern {
+ bestValue?: boolean;
+ periods?: PeriodMeasure[];
+ value?: string;
+ }
+
+ export interface Metric {
+ bestValue?: string;
+ custom?: boolean;
+ decimalScale?: number;
+ description?: string;
+ direction?: number;
+ domain?: string;
+ hidden?: boolean;
+ higherValuesAreBetter?: boolean;
+ id: string;
+ key: string;
+ name: string;
+ qualitative?: boolean;
+ type: string;
+ worstValue?: string;
+ }
+
+ export interface MyProject {
+ description?: string;
+ key: string;
+ lastAnalysisDate?: string;
+ links: Array<{
+ name: string;
+ type: string;
+ href: string;
+ }>;
+ name: string;
+ qualityGate?: string;
+ }
+
+ export interface Notification {
+ channel: string;
+ organization?: string;
+ project?: string;
+ projectName?: string;
+ type: string;
+ }
+
+ export interface OrganizationActions {
+ admin?: boolean;
+ delete?: boolean;
+ provision?: boolean;
+ executeAnalysis?: boolean;
+ }
+
+ export interface Organization extends OrganizationBase {
+ actions?: OrganizationActions;
+ alm?: { key: string; url: string };
+ adminPages?: Extension[];
+ canUpdateProjectsVisibilityToPrivate?: boolean;
+ guarded?: boolean;
+ isDefault?: boolean;
+ key: string;
+ pages?: Extension[];
+ projectVisibility?: Visibility;
+ subscription?: OrganizationSubscription;
+ }
+
+ export interface OrganizationBase {
+ avatar?: string;
+ description?: string;
+ key?: string;
+ name: string;
+ url?: string;
+ }
+
+ export interface OrganizationMember {
+ login: string;
+ name: string;
+ avatar?: string;
+ groupCount?: number;
+ }
+
+ export type OrganizationSubscription = 'FREE' | 'PAID' | 'SONARQUBE';
+
+ export interface Paging {
+ pageIndex: number;
+ pageSize: number;
+ total: number;
+ }
+
+ export interface Period {
+ date: string;
+ index: number;
+ mode: PeriodMode;
+ modeParam?: string;
+ parameter?: string;
+ }
+
+ export interface PeriodMeasure {
+ bestValue?: boolean;
+ index: number;
+ value: string;
+ }
+
+ export type PeriodMode = 'days' | 'date' | 'version' | 'previous_analysis' | 'previous_version';
+
+ export interface PermissionDefinition {
+ key: string;
+ name: string;
+ description: string;
+ }
+
+ export type PermissionDefinitions = Array<PermissionDefinition | PermissionDefinitionGroup>;
+
+ export interface PermissionDefinitionGroup {
+ category: string;
+ permissions: PermissionDefinition[];
+ }
+
+ export interface PermissionGroup {
+ description?: string;
+ id?: string;
+ name: string;
+ permissions: string[];
+ }
+
+ export interface PermissionUser {
+ avatar?: string;
+ email?: string;
+ login: string;
+ name: string;
+ permissions: string[];
+ }
+
+ export interface PermissionTemplate {
+ defaultFor: string[];
+ id: string;
+ name: string;
+ description?: string;
+ projectKeyPattern?: string;
+ createdAt: string;
+ updatedAt?: string;
+ permissions: Array<{
+ key: string;
+ usersCount: number;
+ groupsCount: number;
+ withProjectCreator?: boolean;
+ }>;
+ }
+
+ export interface ProjectLink {
+ id: string;
+ name?: string;
+ type: string;
+ url: string;
+ }
+
+ export interface PullRequest {
+ analysisDate?: string;
+ base: string;
+ branch: string;
+ key: string;
+ isOrphan?: true;
+ status?: {
+ bugs: number;
+ codeSmells: number;
+ qualityGateStatus: string;
+ vulnerabilities: number;
+ };
+ title: string;
+ url?: string;
+ }
+
+ export interface QualityGate {
+ actions?: {
+ associateProjects?: boolean;
+ copy?: boolean;
+ delete?: boolean;
+ manageConditions?: boolean;
+ rename?: boolean;
+ setAsDefault?: boolean;
+ };
+ conditions?: Condition[];
+ id: number;
+ isBuiltIn?: boolean;
+ isDefault?: boolean;
+ name: string;
+ }
+
+ export interface Rule {
+ isTemplate?: boolean;
+ key: string;
+ lang?: string;
+ langName?: string;
+ name: string;
+ params?: RuleParameter[];
+ severity: string;
+ status: string;
+ sysTags?: string[];
+ tags?: string[];
+ type: RuleType;
+ }
+
+ export interface RuleActivation {
+ createdAt: string;
+ inherit: RuleInheritance;
+ params: { key: string; value: string }[];
+ qProfile: string;
+ severity: string;
+ }
+
+ export interface RuleDetails extends Rule {
+ createdAt: string;
+ debtOverloaded?: boolean;
+ debtRemFnCoeff?: string;
+ debtRemFnOffset?: string;
+ debtRemFnType?: string;
+ defaultDebtRemFnOffset?: string;
+ defaultDebtRemFnType?: string;
+ defaultRemFnBaseEffort?: string;
+ defaultRemFnType?: string;
+ effortToFixDescription?: string;
+ htmlDesc?: string;
+ htmlNote?: string;
+ internalKey?: string;
+ isExternal?: boolean;
+ mdDesc?: string;
+ mdNote?: string;
+ remFnBaseEffort?: string;
+ remFnOverloaded?: boolean;
+ remFnType?: string;
+ repo: string;
+ scope?: RuleScope;
+ templateKey?: string;
+ }
+
+ export type RuleInheritance = 'NONE' | 'INHERITED' | 'OVERRIDES';
+
+ export interface RuleParameter {
+ // TODO is this extra really returned?
+ extra?: string;
+ defaultValue?: string;
+ htmlDesc?: string;
+ key: string;
+ type: string;
+ }
+
+ export type RuleScope = 'MAIN' | 'TEST' | 'ALL';
+
+ export type RuleType = 'BUG' | 'VULNERABILITY' | 'CODE_SMELL' | 'SECURITY_HOTSPOT' | 'UNKNOWN';
+
+ export type Setting = SettingValue & { definition: SettingDefinition };
+
+ export type SettingType =
+ | 'STRING'
+ | 'TEXT'
+ | 'PASSWORD'
+ | 'BOOLEAN'
+ | 'FLOAT'
+ | 'INTEGER'
+ | 'LICENSE'
+ | 'LONG'
+ | 'SINGLE_SELECT_LIST'
+ | 'PROPERTY_SET';
+
+ export interface SettingDefinition {
+ description?: string;
+ key: string;
+ name?: string;
+ options: string[];
+ type?: SettingType;
+ }
+
+ export interface SettingFieldDefinition extends SettingDefinition {
+ description: string;
+ name: string;
+ }
+
+ export interface SettingCategoryDefinition extends SettingDefinition {
+ category: string;
+ defaultValue?: string;
+ deprecatedKey?: string;
+ fields: SettingFieldDefinition[];
+ multiValues?: boolean;
+ subCategory: string;
+ }
+
+ export interface SettingValue {
+ fieldValues?: Array<{ [key: string]: string }>;
+ inherited?: boolean;
+ key: string;
+ parentFieldValues?: Array<{ [key: string]: string }>;
+ parentValue?: string;
+ parentValues?: string[];
+ value?: string;
+ values?: string[];
+ }
+
+ export interface ShortLivingBranch extends Branch {
+ isMain: false;
+ isOrphan?: true;
+ mergeBranch: string;
+ status?: {
+ bugs: number;
+ codeSmells: number;
+ qualityGateStatus: string;
+ vulnerabilities: number;
+ };
+ type: 'SHORT';
+ }
+
+ export interface SourceLine {
+ code?: string;
+ conditions?: number;
+ coverageStatus?: string;
+ coveredConditions?: number;
+ duplicated?: boolean;
+ isNew?: boolean;
+ line: number;
+ lineHits?: number;
+ scmAuthor?: string;
+ scmDate?: string;
+ scmRevision?: string;
+ }
+
+ export interface SourceViewerFile {
+ canMarkAsFavorite?: boolean;
+ fav?: boolean;
+ key: string;
+ leakPeriodDate?: string;
+ measures: {
+ coverage?: string;
+ duplicationDensity?: string;
+ issues?: string;
+ lines?: string;
+ tests?: string;
+ };
+ path: string;
+ project: string;
+ projectName: string;
+ q: string;
+ subProject?: string;
+ subProjectName?: string;
+ uuid: string;
+ }
+
+ export interface SubscriptionPlan {
+ maxNcloc: number;
+ price: number;
+ }
+
+ export interface Task {
+ analysisId?: string;
+ branch?: string;
+ branchType?: string;
+ componentKey?: string;
+ componentName?: string;
+ componentQualifier?: string;
+ errorMessage?: string;
+ errorStacktrace?: string;
+ errorType?: string;
+ executedAt?: string;
+ executionTimeMs?: number;
+ hasErrorStacktrace?: boolean;
+ hasScannerContext?: boolean;
+ id: string;
+ logs?: boolean;
+ organization: string;
+ pullRequest?: string;
+ pullRequestTitle?: string;
+ scannerContext?: string;
+ startedAt?: string;
+ status: string;
+ submittedAt: string;
+ submitterLogin?: string;
+ type: string;
+ warningCount?: number;
+ warnings?: string[];
+ }
+
+ export interface TestCase {
+ coveredLines: number;
+ durationInMs: number;
+ fileId: string;
+ fileKey: string;
+ fileName: string;
+ id: string;
+ message?: string;
+ name: string;
+ stacktrace?: string;
+ status: string;
+ }
+
+ export interface TextRange {
+ startLine: number;
+ startOffset: number;
+ endLine: number;
+ endOffset: number;
+ }
+
+ export interface User {
+ active: boolean;
+ avatar?: string;
+ email?: string;
+ externalIdentity?: string;
+ externalProvider?: string;
+ groups?: string[];
+ local: boolean;
+ login: string;
+ name: string;
+ scmAccounts?: string[];
+ tokensCount?: number;
+ }
+
+ export type Visibility = 'public' | 'private';
+
+ export interface Webhook {
+ key: string;
+ latestDelivery?: WebhookDelivery;
+ name: string;
+ url: string;
+ }
+
+ export interface WebhookDelivery {
+ at: string;
+ durationMs: number;
+ httpStatus?: number;
+ id: string;
+ success: boolean;
+ }
+}
diff --git a/server/sonar-web/src/main/js/app/types.ts b/server/sonar-web/src/main/js/app/types.ts
deleted file mode 100644
index 427cfe2a463..00000000000
--- a/server/sonar-web/src/main/js/app/types.ts
+++ /dev/null
@@ -1,916 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2018 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { EditionKey } from '../apps/marketplace/utils';
-
-export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
-
-// Type ordered alphabetically to prevent merge conflicts
-
-export interface AlmApplication extends IdentityProvider {
- installationUrl: string;
-}
-
-export interface AlmOrganization extends OrganizationBase {
- key: string;
- personal: boolean;
-}
-
-export interface AlmRepository {
- label: string;
- installationKey: string;
- linkedProjectKey?: string;
- linkedProjectName?: string;
- private?: boolean;
-}
-
-export interface AlmUnboundApplication {
- installationId: string;
- key: string;
- name: string;
-}
-
-export interface Analysis {
- date: string;
- events: AnalysisEvent[];
- key: string;
-}
-
-export interface AnalysisEvent {
- category: string;
- description?: string;
- key: string;
- name: string;
- qualityGate?: {
- failing: Array<{ branch: string; key: string; name: string }>;
- status: string;
- stillFailing: boolean;
- };
- definitionChange?: {
- projects: Array<{
- branch?: string;
- changeType: string;
- key: string;
- name: string;
- newBranch?: string;
- oldBranch?: string;
- }>;
- };
-}
-
-export interface AppState {
- adminPages?: Extension[];
- authenticationError?: boolean;
- authorizationError?: boolean;
- branchesEnabled?: boolean;
- canAdmin?: boolean;
- defaultOrganization: string;
- edition: EditionKey;
- globalPages?: Extension[];
- organizationsEnabled?: boolean;
- productionDatabase: boolean;
- qualifiers: string[];
- settings: { [key: string]: string };
- standalone?: boolean;
- version: string;
-}
-
-export interface Branch {
- analysisDate?: string;
- isMain: boolean;
- name: string;
-}
-
-export type BranchLike = Branch | PullRequest;
-
-export type BranchParameters = { branch?: string } | { pullRequest?: string };
-
-export enum BranchType {
- LONG = 'LONG',
- SHORT = 'SHORT'
-}
-
-export interface Breadcrumb {
- key: string;
- name: string;
- qualifier: string;
-}
-
-export interface Component extends LightComponent {
- alm?: { key: string; url: string };
- analysisDate?: string;
- breadcrumbs: Breadcrumb[];
- configuration?: ComponentConfiguration;
- description?: string;
- extensions?: Extension[];
- isFavorite?: boolean;
- leakPeriodDate?: string;
- name: string;
- path?: string;
- refKey?: string;
- qualityProfiles?: ComponentQualityProfile[];
- qualityGate?: { isDefault?: boolean; key: string; name: string };
- tags?: string[];
- version?: string;
- visibility?: Visibility;
-}
-
-interface ComponentConfiguration {
- canApplyPermissionTemplate?: boolean;
- canUpdateProjectVisibilityToPrivate?: boolean;
- extensions?: Extension[];
- showBackgroundTasks?: boolean;
- showHistory?: boolean;
- showLinks?: boolean;
- showManualMeasures?: boolean;
- showQualityGates?: boolean;
- showQualityProfiles?: boolean;
- showPermissions?: boolean;
- showSettings?: boolean;
- showUpdateKey?: boolean;
-}
-
-export interface ComponentQualityProfile {
- deleted?: boolean;
- key: string;
- language: string;
- name: string;
-}
-
-interface ComponentMeasureIntern {
- branch?: string;
- description?: string;
- isFavorite?: boolean;
- isRecentlyBrowsed?: boolean;
- key: string;
- match?: string;
- name: string;
- organization?: string;
- path?: string;
- project?: string;
- qualifier: string;
- refKey?: string;
-}
-
-export interface ComponentMeasure extends ComponentMeasureIntern {
- measures?: Measure[];
-}
-
-export interface ComponentMeasureEnhanced extends ComponentMeasureIntern {
- value?: string;
- leak?: string;
- measures: MeasureEnhanced[];
-}
-
-export interface Condition {
- error: string;
- id: number;
- metric: string;
- op?: string;
- period?: number;
- warning: string;
-}
-
-export interface CoveredFile {
- key: string;
- longName: string;
- coveredLines: number;
-}
-
-export interface Coupon {
- billing?: {
- address?: string;
- country?: string;
- email?: string;
- name?: string;
- use?: string;
- };
- maxNcloc: number;
- planActiveUntil: string;
-}
-
-export interface CurrentUser {
- isLoggedIn: boolean;
- permissions?: { global: string[] };
- showOnboardingTutorial?: boolean;
-}
-
-export interface CustomMeasure {
- createdAt?: string;
- description?: string;
- id: string;
- metric: {
- key: string;
- name: string;
- domain?: string;
- type: string;
- };
- projectKey: string;
- pending?: boolean;
- user: {
- active?: boolean;
- email?: string;
- login: string;
- name: string;
- };
- value: string;
- updatedAt?: string;
-}
-
-export interface Duplication {
- blocks: DuplicationBlock[];
-}
-
-export interface DuplicationBlock {
- _ref: string;
- from: number;
- size: number;
-}
-
-export interface DuplicatedFile {
- key: string;
- name: string;
- project: string;
- projectName: string;
- subProject?: string;
- subProjectName?: string;
-}
-
-export interface Extension {
- key: string;
- name: string;
-}
-
-export interface FacetValue<T = string> {
- count: number;
- val: T;
-}
-
-export interface FlowLocation {
- component: string;
- componentName?: string;
- msg?: string;
- textRange: TextRange;
-}
-
-export interface Group {
- default?: boolean;
- description?: string;
- id: number;
- membersCount: number;
- name: string;
-}
-
-export type HomePage =
- | { type: HomePageType.Application; branch: string | undefined; component: string }
- | { type: HomePageType.Issues }
- | { type: HomePageType.MyIssues }
- | { type: HomePageType.MyProjects }
- | { type: HomePageType.Organization; organization: string }
- | { type: HomePageType.Portfolio; component: string }
- | { type: HomePageType.Portfolios }
- | { type: HomePageType.Project; branch: string | undefined; component: string }
- | { type: HomePageType.Projects };
-
-export enum HomePageType {
- Application = 'APPLICATION',
- Issues = 'ISSUES',
- MyIssues = 'MY_ISSUES',
- MyProjects = 'MY_PROJECTS',
- Organization = 'ORGANIZATION',
- Portfolio = 'PORTFOLIO',
- Portfolios = 'PORTFOLIOS',
- Project = 'PROJECT',
- Projects = 'PROJECTS'
-}
-
-export interface IdentityProvider {
- backgroundColor: string;
- helpMessage?: string;
- iconPath: string;
- key: string;
- name: string;
-}
-
-export function hasGlobalPermission(user: CurrentUser, permission: string): boolean {
- if (!user.permissions) {
- return false;
- }
- return user.permissions.global.includes(permission);
-}
-
-export function isSameHomePage(a: HomePage, b: HomePage) {
- return (
- a.type === b.type &&
- (a as any).branch === (b as any).branch &&
- (a as any).component === (b as any).component &&
- (a as any).organization === (b as any).organization
- );
-}
-
-export interface SecurityHotspot {
- activeRules: number;
- category?: string;
- cwe?: string;
- distribution?: Array<SecurityHotspot>;
- openSecurityHotspots: number;
- toReviewSecurityHotspots: number;
- totalRules: number;
- vulnerabilities: number;
- vulnerabilityRating?: number;
- wontFixSecurityHotspots: number;
-}
-
-export interface Issue {
- actions: string[];
- assignee?: string;
- assigneeActive?: string;
- assigneeAvatar?: string;
- assigneeLogin?: string;
- assigneeName?: string;
- author?: string;
- branch?: string;
- comments?: IssueComment[];
- component: string;
- componentLongName: string;
- componentQualifier: string;
- componentUuid: string;
- creationDate: string;
- effort?: string;
- externalRuleEngine?: string;
- fromExternalRule?: boolean;
- key: string;
- flows: FlowLocation[][];
- fromHotspot: boolean;
- line?: number;
- message: string;
- organization: string;
- project: string;
- projectName: string;
- projectOrganization: string;
- projectKey: string;
- pullRequest?: string;
- resolution?: string;
- rule: string;
- ruleName: string;
- secondaryLocations: FlowLocation[];
- severity: string;
- status: string;
- subProject?: string;
- subProjectName?: string;
- subProjectUuid?: string;
- tags?: string[];
- textRange?: TextRange;
- transitions: string[];
- type: IssueType;
-}
-
-export interface IssueComment {
- author?: string;
- authorActive?: boolean;
- authorAvatar?: string;
- authorLogin?: string;
- authorName?: string;
- createdAt: string;
- htmlText: string;
- key: string;
- markdown: string;
- updatable: boolean;
-}
-
-export enum IssueType {
- Bug = 'BUG',
- Vulnerability = 'VULNERABILITY',
- CodeSmell = 'CODE_SMELL',
- Hotspot = 'SECURITY_HOTSPOT'
-}
-
-export interface Language {
- key: string;
- name: string;
-}
-
-export interface Languages {
- [key: string]: Language;
-}
-
-export interface LightComponent {
- key: string;
- organization: string;
- qualifier: string;
-}
-
-export interface LinearIssueLocation {
- from: number;
- index?: number;
- line: number;
- startLine?: number;
- to: number;
-}
-
-export interface LoggedInUser extends CurrentUser {
- avatar?: string;
- email?: string;
- externalIdentity?: string;
- externalProvider?: string;
- groups: string[];
- homepage?: HomePage;
- isLoggedIn: true;
- local?: boolean;
- login: string;
- name: string;
- personalOrganization?: string;
- scmAccounts: string[];
-}
-
-export interface LongLivingBranch extends Branch {
- isMain: false;
- status?: { qualityGateStatus: string };
- type: BranchType.LONG;
-}
-
-export interface MainBranch extends Branch {
- isMain: true;
- status?: { qualityGateStatus: string };
-}
-
-export interface Measure extends MeasureIntern {
- metric: string;
-}
-
-export interface MeasureEnhanced extends MeasureIntern {
- metric: Metric;
- leak?: string;
-}
-
-interface MeasureIntern {
- bestValue?: boolean;
- periods?: PeriodMeasure[];
- value?: string;
-}
-
-export interface Metric {
- bestValue?: string;
- custom?: boolean;
- decimalScale?: number;
- description?: string;
- direction?: number;
- domain?: string;
- hidden?: boolean;
- higherValuesAreBetter?: boolean;
- id: string;
- key: string;
- name: string;
- qualitative?: boolean;
- type: string;
- worstValue?: string;
-}
-
-export interface MyProject {
- description?: string;
- key: string;
- lastAnalysisDate?: string;
- links: Array<{
- name: string;
- type: string;
- href: string;
- }>;
- name: string;
- qualityGate?: string;
-}
-
-export interface Notification {
- channel: string;
- organization?: string;
- project?: string;
- projectName?: string;
- type: string;
-}
-
-export interface OrganizationActions {
- admin?: boolean;
- delete?: boolean;
- provision?: boolean;
- executeAnalysis?: boolean;
-}
-
-export interface Organization extends OrganizationBase {
- actions?: OrganizationActions;
- alm?: { key: string; url: string };
- adminPages?: Extension[];
- canUpdateProjectsVisibilityToPrivate?: boolean;
- guarded?: boolean;
- isDefault?: boolean;
- key: string;
- pages?: Extension[];
- projectVisibility?: Visibility;
- subscription?: OrganizationSubscription;
-}
-
-export interface OrganizationBase {
- avatar?: string;
- description?: string;
- key?: string;
- name: string;
- url?: string;
-}
-
-export interface OrganizationMember {
- login: string;
- name: string;
- avatar?: string;
- groupCount?: number;
-}
-
-export enum OrganizationSubscription {
- Free = 'FREE',
- Paid = 'PAID',
- SonarQube = 'SONARQUBE'
-}
-
-export interface Paging {
- pageIndex: number;
- pageSize: number;
- total: number;
-}
-
-export interface Period {
- date: string;
- index: number;
- mode: PeriodMode;
- modeParam?: string;
- parameter?: string;
-}
-
-export interface PeriodMeasure {
- bestValue?: boolean;
- index: number;
- value: string;
-}
-
-export enum PeriodMode {
- Days = 'days',
- Date = 'date',
- Version = 'version',
- PreviousAnalysis = 'previous_analysis',
- PreviousVersion = 'previous_version'
-}
-
-export interface PermissionDefinition {
- key: string;
- name: string;
- description: string;
-}
-
-export type PermissionDefinitions = Array<PermissionDefinition | PermissionDefinitionGroup>;
-
-export interface PermissionDefinitionGroup {
- category: string;
- permissions: PermissionDefinition[];
-}
-
-export interface PermissionGroup {
- description?: string;
- id?: string;
- name: string;
- permissions: string[];
-}
-
-export interface PermissionUser {
- avatar?: string;
- email?: string;
- login: string;
- name: string;
- permissions: string[];
-}
-
-export interface PermissionTemplate {
- defaultFor: string[];
- id: string;
- name: string;
- description?: string;
- projectKeyPattern?: string;
- createdAt: string;
- updatedAt?: string;
- permissions: Array<{
- key: string;
- usersCount: number;
- groupsCount: number;
- withProjectCreator?: boolean;
- }>;
-}
-
-export interface ProjectLink {
- id: string;
- name?: string;
- type: string;
- url: string;
-}
-
-export interface PullRequest {
- analysisDate?: string;
- base: string;
- branch: string;
- key: string;
- isOrphan?: true;
- status?: {
- bugs: number;
- codeSmells: number;
- qualityGateStatus: string;
- vulnerabilities: number;
- };
- title: string;
- url?: string;
-}
-
-export interface QualityGate {
- actions?: {
- associateProjects?: boolean;
- copy?: boolean;
- delete?: boolean;
- manageConditions?: boolean;
- rename?: boolean;
- setAsDefault?: boolean;
- };
- conditions?: Condition[];
- id: number;
- isBuiltIn?: boolean;
- isDefault?: boolean;
- name: string;
-}
-
-export interface Rule {
- isTemplate?: boolean;
- key: string;
- lang?: string;
- langName?: string;
- name: string;
- params?: RuleParameter[];
- severity: string;
- status: string;
- sysTags?: string[];
- tags?: string[];
- type: RuleType;
-}
-
-export interface RuleActivation {
- createdAt: string;
- inherit: RuleInheritance;
- params: { key: string; value: string }[];
- qProfile: string;
- severity: string;
-}
-
-export interface RuleDetails extends Rule {
- createdAt: string;
- debtOverloaded?: boolean;
- debtRemFnCoeff?: string;
- debtRemFnOffset?: string;
- debtRemFnType?: string;
- defaultDebtRemFnOffset?: string;
- defaultDebtRemFnType?: string;
- defaultRemFnBaseEffort?: string;
- defaultRemFnType?: string;
- effortToFixDescription?: string;
- htmlDesc?: string;
- htmlNote?: string;
- internalKey?: string;
- isExternal?: boolean;
- mdDesc?: string;
- mdNote?: string;
- remFnBaseEffort?: string;
- remFnOverloaded?: boolean;
- remFnType?: string;
- repo: string;
- scope?: RuleScope;
- templateKey?: string;
-}
-
-export enum RuleInheritance {
- NotInherited = 'NONE',
- Inherited = 'INHERITED',
- Overridden = 'OVERRIDES'
-}
-
-export interface RuleParameter {
- // TODO is this extra really returned?
- extra?: string;
- defaultValue?: string;
- htmlDesc?: string;
- key: string;
- type: string;
-}
-
-export enum RuleScope {
- Main = 'MAIN',
- Test = 'TEST',
- All = 'ALL'
-}
-
-export enum RuleType {
- Bug = 'BUG',
- Vulnerability = 'VULNERABILITY',
- CodeSmell = 'CODE_SMELL',
- Hotspot = 'SECURITY_HOTSPOT',
- Unknown = 'UNKNOWN'
-}
-
-export type Setting = SettingValue & { definition: SettingDefinition };
-
-export enum SettingType {
- String = 'STRING',
- Text = 'TEXT',
- Password = 'PASSWORD',
- Boolean = 'BOOLEAN',
- Float = 'FLOAT',
- Integer = 'INTEGER',
- License = 'LICENSE',
- Long = 'LONG',
- SingleSelectList = 'SINGLE_SELECT_LIST',
- PropertySet = 'PROPERTY_SET'
-}
-
-export interface SettingDefinition {
- description?: string;
- key: string;
- name?: string;
- options: string[];
- type?: SettingType;
-}
-
-export interface SettingFieldDefinition extends SettingDefinition {
- description: string;
- name: string;
-}
-
-export interface SettingCategoryDefinition extends SettingDefinition {
- category: string;
- defaultValue?: string;
- deprecatedKey?: string;
- fields: SettingFieldDefinition[];
- multiValues?: boolean;
- subCategory: string;
-}
-
-export interface SettingValue {
- fieldValues?: Array<{ [key: string]: string }>;
- inherited?: boolean;
- key: string;
- parentFieldValues?: Array<{ [key: string]: string }>;
- parentValue?: string;
- parentValues?: string[];
- value?: string;
- values?: string[];
-}
-
-export interface ShortLivingBranch extends Branch {
- isMain: false;
- isOrphan?: true;
- mergeBranch: string;
- status?: {
- bugs: number;
- codeSmells: number;
- qualityGateStatus: string;
- vulnerabilities: number;
- };
- type: BranchType.SHORT;
-}
-
-export interface SourceLine {
- code?: string;
- conditions?: number;
- coverageStatus?: string;
- coveredConditions?: number;
- duplicated?: boolean;
- isNew?: boolean;
- line: number;
- lineHits?: number;
- scmAuthor?: string;
- scmDate?: string;
- scmRevision?: string;
-}
-
-export interface SourceViewerFile {
- canMarkAsFavorite?: boolean;
- fav?: boolean;
- key: string;
- leakPeriodDate?: string;
- measures: {
- coverage?: string;
- duplicationDensity?: string;
- issues?: string;
- lines?: string;
- tests?: string;
- };
- path: string;
- project: string;
- projectName: string;
- q: string;
- subProject?: string;
- subProjectName?: string;
- uuid: string;
-}
-
-export interface SubscriptionPlan {
- maxNcloc: number;
- price: number;
-}
-
-export interface Task {
- analysisId?: string;
- branch?: string;
- branchType?: string;
- componentKey?: string;
- componentName?: string;
- componentQualifier?: string;
- errorMessage?: string;
- errorStacktrace?: string;
- errorType?: string;
- executedAt?: string;
- executionTimeMs?: number;
- hasErrorStacktrace?: boolean;
- hasScannerContext?: boolean;
- id: string;
- logs?: boolean;
- organization: string;
- pullRequest?: string;
- pullRequestTitle?: string;
- scannerContext?: string;
- startedAt?: string;
- status: string;
- submittedAt: string;
- submitterLogin?: string;
- type: string;
- warningCount?: number;
- warnings?: string[];
-}
-
-export interface TestCase {
- coveredLines: number;
- durationInMs: number;
- fileId: string;
- fileKey: string;
- fileName: string;
- id: string;
- message?: string;
- name: string;
- stacktrace?: string;
- status: string;
-}
-
-export interface TextRange {
- startLine: number;
- startOffset: number;
- endLine: number;
- endOffset: number;
-}
-
-export interface User {
- active: boolean;
- avatar?: string;
- email?: string;
- externalIdentity?: string;
- externalProvider?: string;
- groups?: string[];
- local: boolean;
- login: string;
- name: string;
- scmAccounts?: string[];
- tokensCount?: number;
-}
-
-export enum Visibility {
- Public = 'public',
- Private = 'private'
-}
-
-export interface Webhook {
- key: string;
- latestDelivery?: WebhookDelivery;
- name: string;
- url: string;
-}
-
-export interface WebhookDelivery {
- at: string;
- durationMs: number;
- httpStatus?: number;
- id: string;
- success: boolean;
-}
diff --git a/server/sonar-web/src/main/js/app/utils/getStore.ts b/server/sonar-web/src/main/js/app/utils/getStore.ts
index 168447466d0..461438b987d 100644
--- a/server/sonar-web/src/main/js/app/utils/getStore.ts
+++ b/server/sonar-web/src/main/js/app/utils/getStore.ts
@@ -18,7 +18,6 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { Store } from 'redux';
-import { AppState, CurrentUser } from '../types';
import { setAppState } from '../../store/appState';
import rootReducer, { Store as State } from '../../store/rootReducer';
import { receiveCurrentUser } from '../../store/users';
@@ -26,7 +25,7 @@ import configureStore from '../../store/utils/configureStore';
let store: Store<State, any>;
-const createStore = (currentUser?: CurrentUser, appState?: AppState) => {
+const createStore = (currentUser?: T.CurrentUser, appState?: T.AppState) => {
store = configureStore(rootReducer);
if (currentUser) {
store.dispatch(receiveCurrentUser(currentUser));
@@ -37,5 +36,5 @@ const createStore = (currentUser?: CurrentUser, appState?: AppState) => {
return store;
};
-export default (currentUser?: CurrentUser, appState?: AppState) =>
+export default (currentUser?: T.CurrentUser, appState?: T.AppState) =>
store ? store : createStore(currentUser, appState);
diff --git a/server/sonar-web/src/main/js/app/utils/startReactApp.tsx b/server/sonar-web/src/main/js/app/utils/startReactApp.tsx
index 78bd52c4c53..721abda0ba5 100644
--- a/server/sonar-web/src/main/js/app/utils/startReactApp.tsx
+++ b/server/sonar-web/src/main/js/app/utils/startReactApp.tsx
@@ -69,7 +69,6 @@ import { maintenanceRoutes, setupRoutes } from '../../apps/maintenance/routes';
import { globalPermissionsRoutes, projectPermissionsRoutes } from '../../apps/permissions/routes';
import { lazyLoad } from '../../components/lazyLoad';
import { isSonarCloud } from '../../helpers/system';
-import { CurrentUser, AppState } from '../types';
function handleUpdate(this: { state: { location: Location } }) {
const { action } = this.state.location;
@@ -86,8 +85,8 @@ const RouteWithChildRoutes = Route as React.ComponentClass<
export default function startReactApp(
lang: string,
- currentUser?: CurrentUser,
- appState?: AppState
+ currentUser?: T.CurrentUser,
+ appState?: T.AppState
) {
const el = document.getElementById('content');
diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutApp.tsx b/server/sonar-web/src/main/js/apps/about/components/AboutApp.tsx
index 752000d6e13..eb452a2ff8b 100644
--- a/server/sonar-web/src/main/js/apps/about/components/AboutApp.tsx
+++ b/server/sonar-web/src/main/js/apps/about/components/AboutApp.tsx
@@ -42,12 +42,11 @@ import {
} from '../../../store/rootReducer';
import { translate } from '../../../helpers/l10n';
import { fetchAboutPageSettings } from '../actions';
-import { IssueType, AppState, CurrentUser } from '../../../app/types';
import '../styles.css';
interface Props {
- appState: Pick<AppState, 'defaultOrganization' | 'organizationsEnabled'>;
- currentUser: CurrentUser;
+ appState: Pick<T.AppState, 'defaultOrganization' | 'organizationsEnabled'>;
+ currentUser: T.CurrentUser;
customText?: string;
fetchAboutPageSettings: () => Promise<void>;
location: Location;
@@ -121,10 +120,9 @@ class AboutApp extends React.PureComponent<Props, State> {
let vulnerabilities;
let codeSmells;
if (!loading && issueTypes) {
- bugs = issueTypes[IssueType.Bug] && issueTypes[IssueType.Bug].count;
- vulnerabilities =
- issueTypes[IssueType.Vulnerability] && issueTypes[IssueType.Vulnerability].count;
- codeSmells = issueTypes[IssueType.CodeSmell] && issueTypes[IssueType.CodeSmell].count;
+ bugs = issueTypes['BUG'] && issueTypes['BUG'].count;
+ vulnerabilities = issueTypes['VULNERABILITY'] && issueTypes['VULNERABILITY'].count;
+ codeSmells = issueTypes['CODE_SMELL'] && issueTypes['CODE_SMELL'].count;
}
return (
diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutStandards.tsx b/server/sonar-web/src/main/js/apps/about/components/AboutStandards.tsx
index 07d58182fdb..c0e840db867 100644
--- a/server/sonar-web/src/main/js/apps/about/components/AboutStandards.tsx
+++ b/server/sonar-web/src/main/js/apps/about/components/AboutStandards.tsx
@@ -23,7 +23,6 @@ import ReadMore from './ReadMore';
import TagsIcon from '../../../components/icons-components/TagsIcon';
import { translate } from '../../../helpers/l10n';
import { getRulesUrl } from '../../../helpers/urls';
-import { AppState } from '../../../app/types';
const link = 'https://redirect.sonarsource.com/doc/rules.html';
@@ -32,7 +31,7 @@ const owaspTags =
const sans25Tags = 'sans-top25-porous,sans-top25-risky,sans-top25-insecure';
interface Props {
- appState: Pick<AppState, 'defaultOrganization' | 'organizationsEnabled'>;
+ appState: Pick<T.AppState, 'defaultOrganization' | 'organizationsEnabled'>;
}
export default function AboutStandards({ appState }: Props) {
diff --git a/server/sonar-web/src/main/js/apps/about/components/EntryIssueTypes.tsx b/server/sonar-web/src/main/js/apps/about/components/EntryIssueTypes.tsx
index 5361e0ef438..7010f1ff027 100644
--- a/server/sonar-web/src/main/js/apps/about/components/EntryIssueTypes.tsx
+++ b/server/sonar-web/src/main/js/apps/about/components/EntryIssueTypes.tsx
@@ -25,7 +25,6 @@ import { getIssuesUrl } from '../../../helpers/urls';
import BugIcon from '../../../components/icons-components/BugIcon';
import VulnerabilityIcon from '../../../components/icons-components/VulnerabilityIcon';
import CodeSmellIcon from '../../../components/icons-components/CodeSmellIcon';
-import { IssueType } from '../../../app/types';
interface Props {
bugs?: number;
@@ -46,11 +45,7 @@ export default function EntryIssueTypes({ bugs, codeSmells, loading, vulnerabili
<td className="about-page-issue-type-number">
<Link
className="about-page-issue-type-link"
- to={getIssuesUrl({
- resolved: 'false',
- types: IssueType.Bug,
- s: 'CREATION_DATE'
- })}>
+ to={getIssuesUrl({ resolved: 'false', types: 'BUG', s: 'CREATION_DATE' })}>
{formatMeasure(bugs, 'SHORT_INT')}
</Link>
</td>
@@ -67,7 +62,7 @@ export default function EntryIssueTypes({ bugs, codeSmells, loading, vulnerabili
className="about-page-issue-type-link"
to={getIssuesUrl({
resolved: 'false',
- types: IssueType.Vulnerability,
+ types: 'VULNERABILITY',
s: 'CREATION_DATE'
})}>
{formatMeasure(vulnerabilities, 'SHORT_INT')}
@@ -84,11 +79,7 @@ export default function EntryIssueTypes({ bugs, codeSmells, loading, vulnerabili
<td className="about-page-issue-type-number">
<Link
className="about-page-issue-type-link"
- to={getIssuesUrl({
- resolved: 'false',
- types: IssueType.CodeSmell,
- s: 'CREATION_DATE'
- })}>
+ to={getIssuesUrl({ resolved: 'false', types: 'CODE_SMELL', s: 'CREATION_DATE' })}>
{formatMeasure(codeSmells, 'SHORT_INT')}
</Link>
</td>
diff --git a/server/sonar-web/src/main/js/apps/about/sonarcloud/Contact.tsx b/server/sonar-web/src/main/js/apps/about/sonarcloud/Contact.tsx
index 9153e103b18..1b9ef436568 100644
--- a/server/sonar-web/src/main/js/apps/about/sonarcloud/Contact.tsx
+++ b/server/sonar-web/src/main/js/apps/about/sonarcloud/Contact.tsx
@@ -24,7 +24,6 @@ import { Location } from 'history';
import SQPageContainer from './components/SQPageContainer';
import Select from '../../../components/controls/Select';
import { Alert } from '../../../components/ui/Alert';
-import { Organization } from '../../../app/types';
import { isLoggedIn } from '../../../helpers/users';
import './style.css';
@@ -57,7 +56,7 @@ export default class Contact extends React.PureComponent<Props, State> {
};
}
- getOrganizations = (organizations?: Organization[]) => {
+ getOrganizations = (organizations?: T.Organization[]) => {
return (organizations || []).map(org => ({
label: org.name,
value: org.key
diff --git a/server/sonar-web/src/main/js/apps/about/sonarcloud/components/SQPageContainer.tsx b/server/sonar-web/src/main/js/apps/about/sonarcloud/components/SQPageContainer.tsx
index 97030a220ae..dee101afa87 100644
--- a/server/sonar-web/src/main/js/apps/about/sonarcloud/components/SQPageContainer.tsx
+++ b/server/sonar-web/src/main/js/apps/about/sonarcloud/components/SQPageContainer.tsx
@@ -22,12 +22,11 @@ import { connect } from 'react-redux';
import { withRouter, WithRouterProps } from 'react-router';
import Footer from './Footer';
import { getCurrentUser, getMyOrganizations, Store } from '../../../../store/rootReducer';
-import { CurrentUser, Organization } from '../../../../app/types';
import GlobalContainer from '../../../../app/components/GlobalContainer';
interface StateProps {
- currentUser: CurrentUser;
- userOrganizations?: Organization[];
+ currentUser: T.CurrentUser;
+ userOrganizations?: T.Organization[];
}
interface OwnProps {
diff --git a/server/sonar-web/src/main/js/apps/account/components/Account.tsx b/server/sonar-web/src/main/js/apps/account/components/Account.tsx
index 02711b9d407..4018f461da5 100644
--- a/server/sonar-web/src/main/js/apps/account/components/Account.tsx
+++ b/server/sonar-web/src/main/js/apps/account/components/Account.tsx
@@ -22,7 +22,6 @@ import { connect } from 'react-redux';
import Helmet from 'react-helmet';
import Nav from './Nav';
import UserCard from './UserCard';
-import { CurrentUser, LoggedInUser } from '../../../app/types';
import { getCurrentUser, areThereCustomOrganizations, Store } from '../../../store/rootReducer';
import { translate } from '../../../helpers/l10n';
import handleRequiredAuthentication from '../../../app/utils/handleRequiredAuthentication';
@@ -30,7 +29,7 @@ import Suggestions from '../../../app/components/embed-docs-modal/Suggestions';
import '../account.css';
interface Props {
- currentUser: CurrentUser;
+ currentUser: T.CurrentUser;
customOrganizations?: boolean;
}
@@ -55,7 +54,7 @@ class Account extends React.PureComponent<Props> {
<Helmet defaultTitle={title} titleTemplate={'%s - ' + title} />
<header className="account-header">
<div className="account-container clearfix">
- <UserCard user={currentUser as LoggedInUser} />
+ <UserCard user={currentUser as T.LoggedInUser} />
<Nav customOrganizations={this.props.customOrganizations} />
</div>
</header>
diff --git a/server/sonar-web/src/main/js/apps/account/components/Password.tsx b/server/sonar-web/src/main/js/apps/account/components/Password.tsx
index b3cc2f831ae..38a241b0f6a 100644
--- a/server/sonar-web/src/main/js/apps/account/components/Password.tsx
+++ b/server/sonar-web/src/main/js/apps/account/components/Password.tsx
@@ -21,11 +21,10 @@ import * as React from 'react';
import { changePassword } from '../../../api/users';
import { SubmitButton } from '../../../components/ui/buttons';
import { translate } from '../../../helpers/l10n';
-import { LoggedInUser } from '../../../app/types';
import { Alert } from '../../../components/ui/Alert';
interface Props {
- user: LoggedInUser;
+ user: T.LoggedInUser;
}
interface State {
diff --git a/server/sonar-web/src/main/js/apps/account/components/Security.tsx b/server/sonar-web/src/main/js/apps/account/components/Security.tsx
index bca85261333..1286898bdac 100644
--- a/server/sonar-web/src/main/js/apps/account/components/Security.tsx
+++ b/server/sonar-web/src/main/js/apps/account/components/Security.tsx
@@ -24,10 +24,9 @@ import Password from './Password';
import Tokens from './Tokens';
import { translate } from '../../../helpers/l10n';
import { getCurrentUser, Store } from '../../../store/rootReducer';
-import { LoggedInUser } from '../../../app/types';
interface Props {
- user: LoggedInUser;
+ user: T.LoggedInUser;
}
function Security({ user }: Props) {
@@ -41,7 +40,7 @@ function Security({ user }: Props) {
}
const mapStateToProps = (state: Store) => ({
- user: getCurrentUser(state) as LoggedInUser
+ user: getCurrentUser(state) as T.LoggedInUser
});
export default connect(mapStateToProps)(Security);
diff --git a/server/sonar-web/src/main/js/apps/account/components/UserCard.tsx b/server/sonar-web/src/main/js/apps/account/components/UserCard.tsx
index 6afeeaaf967..550522f5a86 100644
--- a/server/sonar-web/src/main/js/apps/account/components/UserCard.tsx
+++ b/server/sonar-web/src/main/js/apps/account/components/UserCard.tsx
@@ -19,10 +19,9 @@
*/
import * as React from 'react';
import Avatar from '../../../components/ui/Avatar';
-import { LoggedInUser } from '../../../app/types';
interface Props {
- user: LoggedInUser;
+ user: T.LoggedInUser;
}
export default function UserCard({ user }: Props) {
diff --git a/server/sonar-web/src/main/js/apps/account/notifications/GlobalNotifications.tsx b/server/sonar-web/src/main/js/apps/account/notifications/GlobalNotifications.tsx
index 0ac75ce0151..5ca04b775f8 100644
--- a/server/sonar-web/src/main/js/apps/account/notifications/GlobalNotifications.tsx
+++ b/server/sonar-web/src/main/js/apps/account/notifications/GlobalNotifications.tsx
@@ -19,14 +19,13 @@
*/
import * as React from 'react';
import NotificationsList from './NotificationsList';
-import { Notification } from '../../../app/types';
import { translate } from '../../../helpers/l10n';
interface Props {
- addNotification: (n: Notification) => void;
+ addNotification: (n: T.Notification) => void;
channels: string[];
- notifications: Notification[];
- removeNotification: (n: Notification) => void;
+ notifications: T.Notification[];
+ removeNotification: (n: T.Notification) => void;
types: string[];
}
diff --git a/server/sonar-web/src/main/js/apps/account/notifications/Notifications.tsx b/server/sonar-web/src/main/js/apps/account/notifications/Notifications.tsx
index 949b0285c7e..a6eadc5ff65 100644
--- a/server/sonar-web/src/main/js/apps/account/notifications/Notifications.tsx
+++ b/server/sonar-web/src/main/js/apps/account/notifications/Notifications.tsx
@@ -25,7 +25,6 @@ import GlobalNotifications from './GlobalNotifications';
import Projects from './Projects';
import { NotificationProject } from './types';
import * as api from '../../../api/notifications';
-import { Notification } from '../../../app/types';
import DeferredSpinner from '../../../components/common/DeferredSpinner';
import { translate } from '../../../helpers/l10n';
import { Alert } from '../../../components/ui/Alert';
@@ -38,7 +37,7 @@ interface State {
channels: string[];
globalTypes: string[];
loading: boolean;
- notifications: Notification[];
+ notifications: T.Notification[];
perProjectTypes: string[];
}
@@ -94,13 +93,13 @@ export default class Notifications extends React.PureComponent<Props, State> {
);
};
- addNotificationToState = (added: Notification) => {
+ addNotificationToState = (added: T.Notification) => {
this.setState(state => ({
notifications: uniqWith([...state.notifications, added], areNotificationsEqual)
}));
};
- removeNotificationFromState = (removed: Notification) => {
+ removeNotificationFromState = (removed: T.Notification) => {
this.setState(state => ({
notifications: state.notifications.filter(
notification => !areNotificationsEqual(notification, removed)
@@ -108,7 +107,7 @@ export default class Notifications extends React.PureComponent<Props, State> {
}));
};
- addNotification = (added: Notification) => {
+ addNotification = (added: T.Notification) => {
// optimistic update
this.addNotificationToState(added);
@@ -119,7 +118,7 @@ export default class Notifications extends React.PureComponent<Props, State> {
});
};
- removeNotification = (removed: Notification) => {
+ removeNotification = (removed: T.Notification) => {
// optimistic update
this.removeNotificationFromState(removed);
@@ -175,6 +174,6 @@ export default class Notifications extends React.PureComponent<Props, State> {
}
}
-function areNotificationsEqual(a: Notification, b: Notification) {
+function areNotificationsEqual(a: T.Notification, b: T.Notification) {
return a.channel === b.channel && a.type === b.type && a.project === b.project;
}
diff --git a/server/sonar-web/src/main/js/apps/account/notifications/NotificationsList.tsx b/server/sonar-web/src/main/js/apps/account/notifications/NotificationsList.tsx
index 35915a0f4f1..c091dbde451 100644
--- a/server/sonar-web/src/main/js/apps/account/notifications/NotificationsList.tsx
+++ b/server/sonar-web/src/main/js/apps/account/notifications/NotificationsList.tsx
@@ -18,18 +18,17 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { Notification } from '../../../app/types';
import Checkbox from '../../../components/controls/Checkbox';
import { translate, hasMessage } from '../../../helpers/l10n';
interface Props {
- onAdd: (n: Notification) => void;
- onRemove: (n: Notification) => void;
+ onAdd: (n: T.Notification) => void;
+ onRemove: (n: T.Notification) => void;
channels: string[];
checkboxId: (type: string, channel: string) => string;
project?: boolean;
types: string[];
- notifications: Notification[];
+ notifications: T.Notification[];
}
export default class NotificationsList extends React.PureComponent<Props> {
diff --git a/server/sonar-web/src/main/js/apps/account/notifications/ProjectNotifications.tsx b/server/sonar-web/src/main/js/apps/account/notifications/ProjectNotifications.tsx
index f5e29f76ba1..1031b6afc1f 100644
--- a/server/sonar-web/src/main/js/apps/account/notifications/ProjectNotifications.tsx
+++ b/server/sonar-web/src/main/js/apps/account/notifications/ProjectNotifications.tsx
@@ -21,17 +21,16 @@ import * as React from 'react';
import { Link } from 'react-router';
import NotificationsList from './NotificationsList';
import { NotificationProject } from './types';
-import { Notification } from '../../../app/types';
import Organization from '../../../components/shared/Organization';
import { translate } from '../../../helpers/l10n';
import { getProjectUrl } from '../../../helpers/urls';
interface Props {
- addNotification: (n: Notification) => void;
+ addNotification: (n: T.Notification) => void;
channels: string[];
- notifications: Notification[];
+ notifications: T.Notification[];
project: NotificationProject;
- removeNotification: (n: Notification) => void;
+ removeNotification: (n: T.Notification) => void;
types: string[];
}
diff --git a/server/sonar-web/src/main/js/apps/account/notifications/Projects.tsx b/server/sonar-web/src/main/js/apps/account/notifications/Projects.tsx
index 87534d86b24..dedd0456093 100644
--- a/server/sonar-web/src/main/js/apps/account/notifications/Projects.tsx
+++ b/server/sonar-web/src/main/js/apps/account/notifications/Projects.tsx
@@ -22,17 +22,16 @@ import { differenceWith } from 'lodash';
import ProjectNotifications from './ProjectNotifications';
import { NotificationProject } from './types';
import { getSuggestions } from '../../../api/components';
-import { Notification } from '../../../app/types';
import { AsyncSelect } from '../../../components/controls/Select';
import Organization from '../../../components/shared/Organization';
import { translate } from '../../../helpers/l10n';
export interface Props {
- addNotification: (n: Notification) => void;
+ addNotification: (n: T.Notification) => void;
channels: string[];
- notificationsByProject: { [project: string]: Notification[] };
+ notificationsByProject: { [project: string]: T.Notification[] };
projects: NotificationProject[];
- removeNotification: (n: Notification) => void;
+ removeNotification: (n: T.Notification) => void;
types: string[];
}
diff --git a/server/sonar-web/src/main/js/apps/account/organizations/OrganizationCard.tsx b/server/sonar-web/src/main/js/apps/account/organizations/OrganizationCard.tsx
index 99cc1b00272..4648d2fd377 100644
--- a/server/sonar-web/src/main/js/apps/account/organizations/OrganizationCard.tsx
+++ b/server/sonar-web/src/main/js/apps/account/organizations/OrganizationCard.tsx
@@ -21,10 +21,9 @@ import * as React from 'react';
import OrganizationAvatar from '../../../components/common/OrganizationAvatar';
import OrganizationLink from '../../../components/ui/OrganizationLink';
import { translate } from '../../../helpers/l10n';
-import { Organization } from '../../../app/types';
interface Props {
- organization: Organization;
+ organization: T.Organization;
}
export default function OrganizationCard({ organization }: Props) {
diff --git a/server/sonar-web/src/main/js/apps/account/organizations/OrganizationsList.tsx b/server/sonar-web/src/main/js/apps/account/organizations/OrganizationsList.tsx
index fa9cbfe6052..13681b72508 100644
--- a/server/sonar-web/src/main/js/apps/account/organizations/OrganizationsList.tsx
+++ b/server/sonar-web/src/main/js/apps/account/organizations/OrganizationsList.tsx
@@ -20,11 +20,10 @@
import * as React from 'react';
import { sortBy } from 'lodash';
import OrganizationCard from './OrganizationCard';
-import { Organization } from '../../../app/types';
import { translate } from '../../../helpers/l10n';
interface Props {
- organizations: Organization[];
+ organizations: T.Organization[];
}
export default function OrganizationsList({ organizations }: Props) {
diff --git a/server/sonar-web/src/main/js/apps/account/organizations/UserOrganizations.tsx b/server/sonar-web/src/main/js/apps/account/organizations/UserOrganizations.tsx
index 3ec744841b8..22ccbe76fdf 100644
--- a/server/sonar-web/src/main/js/apps/account/organizations/UserOrganizations.tsx
+++ b/server/sonar-web/src/main/js/apps/account/organizations/UserOrganizations.tsx
@@ -30,12 +30,11 @@ import {
getGlobalSettingValue,
Store
} from '../../../store/rootReducer';
-import { Organization } from '../../../app/types';
interface StateProps {
anyoneCanCreate: boolean;
canAdmin?: boolean;
- organizations: Organization[];
+ organizations: T.Organization[];
}
interface DispatchProps {
diff --git a/server/sonar-web/src/main/js/apps/account/profile/Profile.tsx b/server/sonar-web/src/main/js/apps/account/profile/Profile.tsx
index f03d64cac11..a156f980763 100644
--- a/server/sonar-web/src/main/js/apps/account/profile/Profile.tsx
+++ b/server/sonar-web/src/main/js/apps/account/profile/Profile.tsx
@@ -24,11 +24,10 @@ import UserGroups from './UserGroups';
import UserScmAccounts from './UserScmAccounts';
import { getCurrentUser, areThereCustomOrganizations, Store } from '../../../store/rootReducer';
import { translate } from '../../../helpers/l10n';
-import { LoggedInUser } from '../../../app/types';
interface Props {
customOrganizations?: boolean;
- user: LoggedInUser;
+ user: T.LoggedInUser;
}
function Profile({ customOrganizations, user }: Props) {
@@ -69,7 +68,7 @@ function Profile({ customOrganizations, user }: Props) {
const mapStateToProps = (state: Store) => ({
customOrganizations: areThereCustomOrganizations(state),
- user: getCurrentUser(state) as LoggedInUser
+ user: getCurrentUser(state) as T.LoggedInUser
});
export default connect(mapStateToProps)(Profile);
diff --git a/server/sonar-web/src/main/js/apps/account/profile/UserExternalIdentity.tsx b/server/sonar-web/src/main/js/apps/account/profile/UserExternalIdentity.tsx
index a71dad75ff4..0441ae13aac 100644
--- a/server/sonar-web/src/main/js/apps/account/profile/UserExternalIdentity.tsx
+++ b/server/sonar-web/src/main/js/apps/account/profile/UserExternalIdentity.tsx
@@ -21,15 +21,14 @@ import * as React from 'react';
import { getIdentityProviders } from '../../../api/users';
import * as theme from '../../../app/theme';
import { getTextColor } from '../../../helpers/colors';
-import { LoggedInUser, IdentityProvider } from '../../../app/types';
import { getBaseUrl } from '../../../helpers/urls';
interface Props {
- user: LoggedInUser;
+ user: T.LoggedInUser;
}
interface State {
- identityProvider?: IdentityProvider;
+ identityProvider?: T.IdentityProvider;
loading: boolean;
}
diff --git a/server/sonar-web/src/main/js/apps/account/profile/UserScmAccounts.tsx b/server/sonar-web/src/main/js/apps/account/profile/UserScmAccounts.tsx
index 13be6a89f97..39d0240bb7c 100644
--- a/server/sonar-web/src/main/js/apps/account/profile/UserScmAccounts.tsx
+++ b/server/sonar-web/src/main/js/apps/account/profile/UserScmAccounts.tsx
@@ -19,11 +19,10 @@
*/
import * as React from 'react';
import { translate } from '../../../helpers/l10n';
-import { LoggedInUser } from '../../../app/types';
interface Props {
scmAccounts: string[];
- user: LoggedInUser;
+ user: T.LoggedInUser;
}
export default function UserScmAccounts({ user, scmAccounts }: Props) {
diff --git a/server/sonar-web/src/main/js/apps/account/projects/ProjectCard.tsx b/server/sonar-web/src/main/js/apps/account/projects/ProjectCard.tsx
index f9946715f89..dbbe4e2ce6f 100644
--- a/server/sonar-web/src/main/js/apps/account/projects/ProjectCard.tsx
+++ b/server/sonar-web/src/main/js/apps/account/projects/ProjectCard.tsx
@@ -26,10 +26,9 @@ import DateTimeFormatter from '../../../components/intl/DateTimeFormatter';
import Level from '../../../components/ui/Level';
import Tooltip from '../../../components/controls/Tooltip';
import { translateWithParameters, translate } from '../../../helpers/l10n';
-import { MyProject } from '../../../app/types';
interface Props {
- project: MyProject;
+ project: T.MyProject;
}
export default function ProjectCard({ project }: Props) {
diff --git a/server/sonar-web/src/main/js/apps/account/projects/Projects.tsx b/server/sonar-web/src/main/js/apps/account/projects/Projects.tsx
index 15a00318c4b..071e23289ce 100644
--- a/server/sonar-web/src/main/js/apps/account/projects/Projects.tsx
+++ b/server/sonar-web/src/main/js/apps/account/projects/Projects.tsx
@@ -21,12 +21,11 @@ import * as React from 'react';
import ProjectCard from './ProjectCard';
import ListFooter from '../../../components/controls/ListFooter';
import { translate } from '../../../helpers/l10n';
-import { MyProject } from '../../../app/types';
interface Props {
loading: boolean;
loadMore: () => void;
- projects: MyProject[];
+ projects: T.MyProject[];
total?: number;
}
diff --git a/server/sonar-web/src/main/js/apps/account/projects/ProjectsContainer.tsx b/server/sonar-web/src/main/js/apps/account/projects/ProjectsContainer.tsx
index a5d62ac64a3..115b2954cae 100644
--- a/server/sonar-web/src/main/js/apps/account/projects/ProjectsContainer.tsx
+++ b/server/sonar-web/src/main/js/apps/account/projects/ProjectsContainer.tsx
@@ -22,12 +22,11 @@ import Helmet from 'react-helmet';
import Projects from './Projects';
import { getMyProjects } from '../../../api/components';
import { translate } from '../../../helpers/l10n';
-import { MyProject } from '../../../app/types';
interface State {
loading: boolean;
page: number;
- projects?: MyProject[];
+ projects?: T.MyProject[];
total?: number;
}
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.tsx
index 4542c958b05..4f5bb8c92d4 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.tsx
@@ -43,7 +43,6 @@ import { translate } from '../../../helpers/l10n';
import { parseAsDate } from '../../../helpers/query';
import { toShortNotSoISOString } from '../../../helpers/dates';
import '../background-tasks.css';
-import { Task } from '../../../app/types';
interface Props {
component?: { id: string };
@@ -54,7 +53,7 @@ interface Props {
interface State {
loading: boolean;
- tasks: Task[];
+ tasks: T.Task[];
types?: string[];
query: string;
pendingCount: number;
@@ -171,7 +170,7 @@ class BackgroundTasksApp extends React.PureComponent<Props, State> {
});
};
- handleCancelTask = (task: Task) => {
+ handleCancelTask = (task: T.Task) => {
this.setState({ loading: true });
return cancelTaskAPI(task.id).then(nextTask => {
@@ -184,7 +183,7 @@ class BackgroundTasksApp extends React.PureComponent<Props, State> {
}, this.stopLoading);
};
- handleFilterTask = (task: Task) => {
+ handleFilterTask = (task: T.Task) => {
this.handleFilterUpdate({ query: task.componentKey });
};
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/Footer.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/Footer.tsx
index 4242bb2b3e3..b36390ae51c 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/Footer.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/Footer.tsx
@@ -19,12 +19,11 @@
*/
import * as React from 'react';
import { translateWithParameters } from '../../../helpers/l10n';
-import { Task } from '../../../app/types';
const LIMIT = 1000;
interface Props {
- tasks: Task[];
+ tasks: T.Task[];
}
export default function Footer({ tasks }: Props) {
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/ScannerContext.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/ScannerContext.tsx
index 6fc2bb4e920..77ccdf6edcf 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/ScannerContext.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/ScannerContext.tsx
@@ -21,11 +21,10 @@ import * as React from 'react';
import { getTask } from '../../../api/ce';
import { translate } from '../../../helpers/l10n';
import Modal from '../../../components/controls/Modal';
-import { Task } from '../../../app/types';
interface Props {
onClose: () => void;
- task: Pick<Task, 'componentName' | 'id' | 'type'>;
+ task: Pick<T.Task, 'componentName' | 'id' | 'type'>;
}
interface State {
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/Stacktrace.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/Stacktrace.tsx
index 51d2c99875b..f0801d47b41 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/Stacktrace.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/Stacktrace.tsx
@@ -21,11 +21,10 @@ import * as React from 'react';
import { getTask } from '../../../api/ce';
import { translate } from '../../../helpers/l10n';
import Modal from '../../../components/controls/Modal';
-import { Task } from '../../../app/types';
interface Props {
onClose: () => void;
- task: Pick<Task, 'componentName' | 'errorMessage' | 'id' | 'type'>;
+ task: Pick<T.Task, 'componentName' | 'errorMessage' | 'id' | 'type'>;
}
interface State {
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/Task.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/Task.tsx
index 903dad8de13..418496e699d 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/Task.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/Task.tsx
@@ -26,14 +26,13 @@ import TaskDate from './TaskDate';
import TaskId from './TaskId';
import TaskStatus from './TaskStatus';
import TaskSubmitter from './TaskSubmitter';
-import { Task as TaskType } from '../../../app/types';
interface Props {
component?: unknown;
- onCancelTask: (task: TaskType) => Promise<void>;
- onFilterTask: (task: TaskType) => void;
- task: TaskType;
- previousTask?: TaskType;
+ onCancelTask: (task: T.Task) => Promise<void>;
+ onFilterTask: (task: T.Task) => void;
+ task: T.Task;
+ previousTask?: T.Task;
}
export default function Task(props: Props) {
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskActions.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskActions.tsx
index fbabb073096..774a810251e 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskActions.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskActions.tsx
@@ -23,7 +23,6 @@ import Stacktrace from './Stacktrace';
import { STATUSES } from '../constants';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import ActionsDropdown, { ActionsDropdownItem } from '../../../components/controls/ActionsDropdown';
-import { Task } from '../../../app/types';
import { lazyLoad } from '../../../components/lazyLoad';
import ConfirmModal from '../../../components/controls/ConfirmModal';
@@ -34,9 +33,9 @@ const AnalysisWarningsModal = lazyLoad(
interface Props {
component?: unknown;
- onCancelTask: (task: Task) => Promise<void>;
- onFilterTask: (task: Task) => void;
- task: Task;
+ onCancelTask: (task: T.Task) => Promise<void>;
+ onFilterTask: (task: T.Task) => void;
+ task: T.Task;
}
interface State {
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx
index 363fb4eae7a..cbc531d4bcf 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx
@@ -31,10 +31,9 @@ import {
import ShortLivingBranchIcon from '../../../components/icons-components/ShortLivingBranchIcon';
import LongLivingBranchIcon from '../../../components/icons-components/LongLivingBranchIcon';
import PullRequestIcon from '../../../components/icons-components/PullRequestIcon';
-import { Task } from '../../../app/types';
interface Props {
- task: Task;
+ task: T.Task;
}
export default function TaskComponent({ task }: Props) {
@@ -88,7 +87,7 @@ export default function TaskComponent({ task }: Props) {
);
}
-function getTaskComponentUrl(componentKey: string, task: Task) {
+function getTaskComponentUrl(componentKey: string, task: T.Task) {
if (task.branch) {
if (task.branchType === 'SHORT') {
return getShortLivingBranchUrl(componentKey, task.branch);
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.tsx
index 3f803849b55..1b458aac1c7 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.tsx
@@ -20,15 +20,14 @@
import * as React from 'react';
import * as classNames from 'classnames';
import Task from './Task';
-import { Task as TaskType } from '../../../app/types';
import { translate } from '../../../helpers/l10n';
interface Props {
- tasks: TaskType[];
+ tasks: T.Task[];
component?: unknown;
loading: boolean;
- onCancelTask: (task: TaskType) => Promise<void>;
- onFilterTask: (task: TaskType) => void;
+ onCancelTask: (task: T.Task) => Promise<void>;
+ onFilterTask: (task: T.Task) => void;
}
export default function Tasks({ tasks, component, loading, onCancelTask, onFilterTask }: Props) {
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskActions-test.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskActions-test.tsx
index 5ce2e4bcf58..6adc36ed287 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskActions-test.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskActions-test.tsx
@@ -21,7 +21,6 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import TaskActions from '../TaskActions';
import { click } from '../../../../helpers/testUtils';
-import { Task } from '../../../../app/types';
it('renders', () => {
expect(shallowRender()).toMatchSnapshot();
@@ -58,7 +57,7 @@ it('shows warnings', () => {
expect(wrapper.find('AnalysisWarningsModal').exists()).toBeFalsy();
});
-function shallowRender(fields?: Partial<Task>, props?: Partial<TaskActions['props']>) {
+function shallowRender(fields?: Partial<T.Task>, props?: Partial<TaskActions['props']>) {
return shallow(
<TaskActions
onCancelTask={jest.fn()}
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/utils.ts b/server/sonar-web/src/main/js/apps/background-tasks/utils.ts
index 848e240109f..ec3db153a2f 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/utils.ts
+++ b/server/sonar-web/src/main/js/apps/background-tasks/utils.ts
@@ -19,7 +19,6 @@
*/
import { STATUSES, CURRENTS, ALL_TYPES } from './constants';
import { toShortNotSoISOString } from '../../helpers/dates';
-import { Task } from '../../app/types';
export interface Query {
currents: string;
@@ -30,7 +29,7 @@ export interface Query {
taskType: string;
}
-export function updateTask(tasks: Task[], newTask: Task) {
+export function updateTask(tasks: T.Task[], newTask: T.Task) {
return tasks.map(task => (task.id === newTask.id ? newTask : task));
}
diff --git a/server/sonar-web/src/main/js/apps/code/__tests__/buckets-test.tsx b/server/sonar-web/src/main/js/apps/code/__tests__/buckets-test.tsx
index 5eeb0c80896..01bc714f817 100644
--- a/server/sonar-web/src/main/js/apps/code/__tests__/buckets-test.tsx
+++ b/server/sonar-web/src/main/js/apps/code/__tests__/buckets-test.tsx
@@ -18,16 +18,15 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { addComponent, getComponent, addComponentChildren, getComponentChildren } from '../bucket';
-import { ComponentMeasure } from '../../../app/types';
-const component: ComponentMeasure = { key: 'frodo', name: 'frodo', qualifier: 'frodo' };
+const component: T.ComponentMeasure = { key: 'frodo', name: 'frodo', qualifier: 'frodo' };
const componentKey: string = 'foo';
-const childrenA: ComponentMeasure[] = [
+const childrenA: T.ComponentMeasure[] = [
{ key: 'foo', name: 'foo', qualifier: 'foo' },
{ key: 'bar', name: 'bar', qualifier: 'bar' }
];
-const childrenB: ComponentMeasure[] = [
+const childrenB: T.ComponentMeasure[] = [
{ key: 'bart', name: 'bart', qualifier: 'bart' },
{ key: 'simpson', name: 'simpson', qualifier: 'simpson' }
];
diff --git a/server/sonar-web/src/main/js/apps/code/bucket.ts b/server/sonar-web/src/main/js/apps/code/bucket.ts
index 3e1600fbde7..1298507fd0e 100644
--- a/server/sonar-web/src/main/js/apps/code/bucket.ts
+++ b/server/sonar-web/src/main/js/apps/code/bucket.ts
@@ -17,29 +17,28 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { ComponentMeasure, Breadcrumb } from '../../app/types';
-let bucket: { [key: string]: ComponentMeasure } = {};
+let bucket: { [key: string]: T.ComponentMeasure } = {};
let childrenBucket: {
[key: string]: {
- children: ComponentMeasure[];
+ children: T.ComponentMeasure[];
page: number;
total: number;
};
} = {};
-let breadcrumbsBucket: { [key: string]: Breadcrumb[] } = {};
+let breadcrumbsBucket: { [key: string]: T.Breadcrumb[] } = {};
-export function addComponent(component: ComponentMeasure): void {
+export function addComponent(component: T.ComponentMeasure): void {
bucket[component.key] = component;
}
-export function getComponent(componentKey: string): ComponentMeasure {
+export function getComponent(componentKey: string): T.ComponentMeasure {
return bucket[componentKey];
}
export function addComponentChildren(
componentKey: string,
- children: ComponentMeasure[],
+ children: T.ComponentMeasure[],
total: number,
page: number
): void {
@@ -53,18 +52,18 @@ export function addComponentChildren(
export function getComponentChildren(
componentKey: string
): {
- children: ComponentMeasure[];
+ children: T.ComponentMeasure[];
page: number;
total: number;
} {
return childrenBucket[componentKey];
}
-export function addComponentBreadcrumbs(componentKey: string, breadcrumbs: Breadcrumb[]): void {
+export function addComponentBreadcrumbs(componentKey: string, breadcrumbs: T.Breadcrumb[]): void {
breadcrumbsBucket[componentKey] = breadcrumbs;
}
-export function getComponentBreadcrumbs(componentKey: string): Breadcrumb[] {
+export function getComponentBreadcrumbs(componentKey: string): T.Breadcrumb[] {
return breadcrumbsBucket[componentKey];
}
diff --git a/server/sonar-web/src/main/js/apps/code/components/App.tsx b/server/sonar-web/src/main/js/apps/code/components/App.tsx
index e4a25accdc5..9aa8d3a9e97 100644
--- a/server/sonar-web/src/main/js/apps/code/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/code/components/App.tsx
@@ -26,7 +26,6 @@ import Breadcrumbs from './Breadcrumbs';
import Search from './Search';
import { addComponent, addComponentBreadcrumbs, clearBucket } from '../bucket';
import { retrieveComponentChildren, retrieveComponent, loadMoreChildren } from '../utils';
-import { Breadcrumb, Component, ComponentMeasure, BranchLike, Metric } from '../../../app/types';
import ListFooter from '../../../components/controls/ListFooter';
import SourceViewer from '../../../components/SourceViewer/SourceViewer';
import Suggestions from '../../../app/components/embed-docs-modal/Suggestions';
@@ -37,7 +36,7 @@ import { translate } from '../../../helpers/l10n';
import '../code.css';
interface StateToProps {
- metrics: { [metric: string]: Metric };
+ metrics: { [metric: string]: T.Metric };
}
interface DispatchToProps {
@@ -45,21 +44,21 @@ interface DispatchToProps {
}
interface OwnProps {
- branchLike?: BranchLike;
- component: Component;
+ branchLike?: T.BranchLike;
+ component: T.Component;
location: { query: { [x: string]: string } };
}
type Props = StateToProps & DispatchToProps & OwnProps;
interface State {
- baseComponent?: ComponentMeasure;
- breadcrumbs: Breadcrumb[];
- components?: ComponentMeasure[];
+ baseComponent?: T.ComponentMeasure;
+ breadcrumbs: T.Breadcrumb[];
+ components?: T.ComponentMeasure[];
loading: boolean;
page: number;
- searchResults?: ComponentMeasure[];
- sourceViewer?: ComponentMeasure;
+ searchResults?: T.ComponentMeasure[];
+ sourceViewer?: T.ComponentMeasure;
total: number;
}
diff --git a/server/sonar-web/src/main/js/apps/code/components/Breadcrumbs.tsx b/server/sonar-web/src/main/js/apps/code/components/Breadcrumbs.tsx
index c1fca8d200b..5aadebbdb85 100644
--- a/server/sonar-web/src/main/js/apps/code/components/Breadcrumbs.tsx
+++ b/server/sonar-web/src/main/js/apps/code/components/Breadcrumbs.tsx
@@ -19,12 +19,11 @@
*/
import * as React from 'react';
import ComponentName from './ComponentName';
-import { BranchLike, Breadcrumb, ComponentMeasure } from '../../../app/types';
interface Props {
- branchLike?: BranchLike;
- breadcrumbs: Breadcrumb[];
- rootComponent: ComponentMeasure;
+ branchLike?: T.BranchLike;
+ breadcrumbs: T.Breadcrumb[];
+ rootComponent: T.ComponentMeasure;
}
export default function Breadcrumbs({ branchLike, breadcrumbs, rootComponent }: Props) {
diff --git a/server/sonar-web/src/main/js/apps/code/components/Component.tsx b/server/sonar-web/src/main/js/apps/code/components/Component.tsx
index 81b80ea3591..9352241bd26 100644
--- a/server/sonar-web/src/main/js/apps/code/components/Component.tsx
+++ b/server/sonar-web/src/main/js/apps/code/components/Component.tsx
@@ -23,19 +23,18 @@ import ComponentName from './ComponentName';
import ComponentMeasure from './ComponentMeasure';
import ComponentLink from './ComponentLink';
import ComponentPin from './ComponentPin';
-import { BranchLike, Metric, ComponentMeasure as IComponentMeasure } from '../../../app/types';
const TOP_OFFSET = 200;
const BOTTOM_OFFSET = 10;
interface Props {
- branchLike?: BranchLike;
+ branchLike?: T.BranchLike;
canBrowse?: boolean;
- component: IComponentMeasure;
+ component: T.ComponentMeasure;
isLeak: boolean;
- metrics: Metric[];
- previous?: IComponentMeasure;
- rootComponent: IComponentMeasure;
+ metrics: T.Metric[];
+ previous?: T.ComponentMeasure;
+ rootComponent: T.ComponentMeasure;
selected?: boolean;
}
diff --git a/server/sonar-web/src/main/js/apps/code/components/ComponentLink.tsx b/server/sonar-web/src/main/js/apps/code/components/ComponentLink.tsx
index eb6e931c945..e60a57cc2e9 100644
--- a/server/sonar-web/src/main/js/apps/code/components/ComponentLink.tsx
+++ b/server/sonar-web/src/main/js/apps/code/components/ComponentLink.tsx
@@ -19,14 +19,13 @@
*/
import * as React from 'react';
import { Link } from 'react-router';
-import { BranchLike, ComponentMeasure } from '../../../app/types';
import LinkIcon from '../../../components/icons-components/LinkIcon';
import { translate } from '../../../helpers/l10n';
import { getBranchLikeUrl } from '../../../helpers/urls';
interface Props {
- branchLike?: BranchLike;
- component: ComponentMeasure;
+ branchLike?: T.BranchLike;
+ component: T.ComponentMeasure;
}
export default function ComponentLink({ component, branchLike }: Props) {
diff --git a/server/sonar-web/src/main/js/apps/code/components/ComponentMeasure.tsx b/server/sonar-web/src/main/js/apps/code/components/ComponentMeasure.tsx
index e33ff7e5d68..fdc492f8e1e 100644
--- a/server/sonar-web/src/main/js/apps/code/components/ComponentMeasure.tsx
+++ b/server/sonar-web/src/main/js/apps/code/components/ComponentMeasure.tsx
@@ -19,13 +19,12 @@
*/
import * as React from 'react';
import Measure from '../../../components/measure/Measure';
-import { Metric, ComponentMeasure as IComponentMeasure } from '../../../app/types';
import { isDiffMetric } from '../../../helpers/measures';
import { getLeakValue } from '../../../components/measure/utils';
interface Props {
- component: IComponentMeasure;
- metric: Metric;
+ component: T.ComponentMeasure;
+ metric: T.Metric;
}
export default function ComponentMeasure({ component, metric }: Props) {
diff --git a/server/sonar-web/src/main/js/apps/code/components/ComponentName.tsx b/server/sonar-web/src/main/js/apps/code/components/ComponentName.tsx
index e303cffef93..55a25d0371f 100644
--- a/server/sonar-web/src/main/js/apps/code/components/ComponentName.tsx
+++ b/server/sonar-web/src/main/js/apps/code/components/ComponentName.tsx
@@ -21,13 +21,12 @@ import * as React from 'react';
import { Link } from 'react-router';
import Truncated from './Truncated';
import * as theme from '../../../app/theme';
-import { BranchLike, ComponentMeasure } from '../../../app/types';
import QualifierIcon from '../../../components/icons-components/QualifierIcon';
import { getBranchLikeQuery } from '../../../helpers/branches';
import LongLivingBranchIcon from '../../../components/icons-components/LongLivingBranchIcon';
import { translate } from '../../../helpers/l10n';
-function getTooltip(component: ComponentMeasure) {
+function getTooltip(component: T.ComponentMeasure) {
const isFile = component.qualifier === 'FIL' || component.qualifier === 'UTS';
if (isFile && component.path) {
return component.path + '\n\n' + component.key;
@@ -52,11 +51,11 @@ function mostCommitPrefix(strings: string[]) {
}
interface Props {
- branchLike?: BranchLike;
+ branchLike?: T.BranchLike;
canBrowse?: boolean;
- component: ComponentMeasure;
- previous?: ComponentMeasure;
- rootComponent: ComponentMeasure;
+ component: T.ComponentMeasure;
+ previous?: T.ComponentMeasure;
+ rootComponent: T.ComponentMeasure;
}
export default function ComponentName(props: Props) {
diff --git a/server/sonar-web/src/main/js/apps/code/components/ComponentPin.tsx b/server/sonar-web/src/main/js/apps/code/components/ComponentPin.tsx
index 24ef4d65621..f486ce21bf3 100644
--- a/server/sonar-web/src/main/js/apps/code/components/ComponentPin.tsx
+++ b/server/sonar-web/src/main/js/apps/code/components/ComponentPin.tsx
@@ -19,14 +19,13 @@
*/
import * as React from 'react';
import * as PropTypes from 'prop-types';
-import { BranchLike, ComponentMeasure } from '../../../app/types';
import PinIcon from '../../../components/icons-components/PinIcon';
import { WorkspaceContext } from '../../../components/workspace/context';
import { translate } from '../../../helpers/l10n';
interface Props {
- branchLike?: BranchLike;
- component: ComponentMeasure;
+ branchLike?: T.BranchLike;
+ component: T.ComponentMeasure;
}
export default class ComponentPin extends React.PureComponent<Props> {
diff --git a/server/sonar-web/src/main/js/apps/code/components/Components.tsx b/server/sonar-web/src/main/js/apps/code/components/Components.tsx
index 2a6bcf6e9f0..c8672d01b7e 100644
--- a/server/sonar-web/src/main/js/apps/code/components/Components.tsx
+++ b/server/sonar-web/src/main/js/apps/code/components/Components.tsx
@@ -22,16 +22,15 @@ import * as classNames from 'classnames';
import Component from './Component';
import ComponentsEmpty from './ComponentsEmpty';
import ComponentsHeader from './ComponentsHeader';
-import { BranchLike, ComponentMeasure, Metric } from '../../../app/types';
import { getCodeMetrics, showLeakMeasure } from '../utils';
interface Props {
- baseComponent?: ComponentMeasure;
- branchLike?: BranchLike;
- components: ComponentMeasure[];
- metrics: { [metric: string]: Metric };
- rootComponent: ComponentMeasure;
- selected?: ComponentMeasure;
+ baseComponent?: T.ComponentMeasure;
+ branchLike?: T.BranchLike;
+ components: T.ComponentMeasure[];
+ metrics: { [metric: string]: T.Metric };
+ rootComponent: T.ComponentMeasure;
+ selected?: T.ComponentMeasure;
}
export default function Components(props: Props) {
diff --git a/server/sonar-web/src/main/js/apps/code/components/ComponentsHeader.tsx b/server/sonar-web/src/main/js/apps/code/components/ComponentsHeader.tsx
index 04360721e2d..cf518c06f80 100644
--- a/server/sonar-web/src/main/js/apps/code/components/ComponentsHeader.tsx
+++ b/server/sonar-web/src/main/js/apps/code/components/ComponentsHeader.tsx
@@ -20,13 +20,12 @@
import * as React from 'react';
import * as classNames from 'classnames';
import { translate } from '../../../helpers/l10n';
-import { ComponentMeasure } from '../../../app/types';
interface Props {
- baseComponent?: ComponentMeasure;
+ baseComponent?: T.ComponentMeasure;
isLeak: boolean;
metrics: string[];
- rootComponent: ComponentMeasure;
+ rootComponent: T.ComponentMeasure;
}
const SHORT_NAME_METRICS = [
diff --git a/server/sonar-web/src/main/js/apps/code/components/Search.tsx b/server/sonar-web/src/main/js/apps/code/components/Search.tsx
index 291ff86d533..f8ae8822fd5 100644
--- a/server/sonar-web/src/main/js/apps/code/components/Search.tsx
+++ b/server/sonar-web/src/main/js/apps/code/components/Search.tsx
@@ -22,22 +22,21 @@ import * as PropTypes from 'prop-types';
import * as classNames from 'classnames';
import Components from './Components';
import { getTree } from '../../../api/components';
-import { BranchLike, ComponentMeasure } from '../../../app/types';
import SearchBox from '../../../components/controls/SearchBox';
import { getBranchLikeQuery } from '../../../helpers/branches';
import { translate } from '../../../helpers/l10n';
import { getProjectUrl } from '../../../helpers/urls';
interface Props {
- branchLike?: BranchLike;
- component: ComponentMeasure;
+ branchLike?: T.BranchLike;
+ component: T.ComponentMeasure;
location: {};
}
interface State {
query: string;
loading: boolean;
- results?: ComponentMeasure[];
+ results?: T.ComponentMeasure[];
selectedIndex?: number;
}
diff --git a/server/sonar-web/src/main/js/apps/code/components/__tests__/Components-test.tsx b/server/sonar-web/src/main/js/apps/code/components/__tests__/Components-test.tsx
index f2dee8de3cd..c5388d552a7 100644
--- a/server/sonar-web/src/main/js/apps/code/components/__tests__/Components-test.tsx
+++ b/server/sonar-web/src/main/js/apps/code/components/__tests__/Components-test.tsx
@@ -20,7 +20,6 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import Components from '../Components';
-import { BranchType } from '../../../../app/types';
const COMPONENT = { key: 'foo', name: 'Foo', qualifier: 'TRK' };
const PORTFOLIO = { key: 'bar', name: 'Bar', qualifier: 'VW' };
@@ -29,7 +28,7 @@ const BRANCH = {
isMain: false,
name: 'feature',
mergeBranch: 'master',
- type: BranchType.SHORT
+ type: 'SHORT'
};
it('renders correctly', () => {
diff --git a/server/sonar-web/src/main/js/apps/code/utils.ts b/server/sonar-web/src/main/js/apps/code/utils.ts
index cb2d2045cf3..73987dc66c0 100644
--- a/server/sonar-web/src/main/js/apps/code/utils.ts
+++ b/server/sonar-web/src/main/js/apps/code/utils.ts
@@ -27,7 +27,6 @@ import {
getComponentBreadcrumbs
} from './bucket';
import { getChildren, getComponent, getBreadcrumbs } from '../../api/components';
-import { BranchLike, ComponentMeasure, Breadcrumb } from '../../app/types';
import { getBranchLikeQuery, isShortLivingBranch, isPullRequest } from '../../helpers/branches';
const METRICS = [
@@ -64,8 +63,8 @@ function requestChildren(
componentKey: string,
metrics: string[],
page: number,
- branchLike?: BranchLike
-): Promise<ComponentMeasure[]> {
+ branchLike?: T.BranchLike
+): Promise<T.ComponentMeasure[]> {
return getChildren(componentKey, metrics, {
p: page,
ps: PAGE_SIZE,
@@ -83,13 +82,13 @@ function requestChildren(
function requestAllChildren(
componentKey: string,
metrics: string[],
- branchLike?: BranchLike
-): Promise<ComponentMeasure[]> {
+ branchLike?: T.BranchLike
+): Promise<T.ComponentMeasure[]> {
return requestChildren(componentKey, metrics, 1, branchLike);
}
interface Children {
- components: ComponentMeasure[];
+ components: T.ComponentMeasure[];
page: number;
total: number;
}
@@ -98,10 +97,10 @@ interface ExpandRootDirFunc {
(children: Children): Promise<Children>;
}
-function expandRootDir(metrics: string[], branchLike?: BranchLike): ExpandRootDirFunc {
+function expandRootDir(metrics: string[], branchLike?: T.BranchLike): ExpandRootDirFunc {
return function({ components, total, ...other }) {
const rootDir = components.find(
- (component: ComponentMeasure) => component.qualifier === 'DIR' && component.name === '/'
+ (component: T.ComponentMeasure) => component.qualifier === 'DIR' && component.name === '/'
);
if (rootDir) {
return requestAllChildren(rootDir.key, metrics, branchLike).then(rootDirComponents => {
@@ -123,21 +122,21 @@ function prepareChildren(r: any): Children {
};
}
-export function showLeakMeasure(branchLike?: BranchLike) {
+export function showLeakMeasure(branchLike?: T.BranchLike) {
return isShortLivingBranch(branchLike) || isPullRequest(branchLike);
}
-function skipRootDir(breadcrumbs: ComponentMeasure[]) {
+function skipRootDir(breadcrumbs: T.ComponentMeasure[]) {
return breadcrumbs.filter(component => {
return !(component.qualifier === 'DIR' && component.name === '/');
});
}
-function storeChildrenBase(children: ComponentMeasure[]) {
+function storeChildrenBase(children: T.ComponentMeasure[]) {
children.forEach(addComponent);
}
-function storeChildrenBreadcrumbs(parentComponentKey: string, children: Breadcrumb[]) {
+function storeChildrenBreadcrumbs(parentComponentKey: string, children: T.Breadcrumb[]) {
const parentBreadcrumbs = getComponentBreadcrumbs(parentComponentKey);
if (parentBreadcrumbs) {
children.forEach(child => {
@@ -147,7 +146,7 @@ function storeChildrenBreadcrumbs(parentComponentKey: string, children: Breadcru
}
}
-export function getCodeMetrics(qualifier: string, branchLike?: BranchLike) {
+export function getCodeMetrics(qualifier: string, branchLike?: T.BranchLike) {
if (['VW', 'SVW'].includes(qualifier)) {
return PORTFOLIO_METRICS;
}
@@ -160,7 +159,7 @@ export function getCodeMetrics(qualifier: string, branchLike?: BranchLike) {
return METRICS;
}
-function retrieveComponentBase(componentKey: string, qualifier: string, branchLike?: BranchLike) {
+function retrieveComponentBase(componentKey: string, qualifier: string, branchLike?: T.BranchLike) {
const existing = getComponentFromBucket(componentKey);
if (existing) {
return Promise.resolve(existing);
@@ -181,8 +180,8 @@ function retrieveComponentBase(componentKey: string, qualifier: string, branchLi
export function retrieveComponentChildren(
componentKey: string,
qualifier: string,
- branchLike?: BranchLike
-): Promise<{ components: ComponentMeasure[]; page: number; total: number }> {
+ branchLike?: T.BranchLike
+): Promise<{ components: T.ComponentMeasure[]; page: number; total: number }> {
const existing = getComponentChildren(componentKey);
if (existing) {
return Promise.resolve({
@@ -211,8 +210,8 @@ export function retrieveComponentChildren(
function retrieveComponentBreadcrumbs(
component: string,
- branchLike?: BranchLike
-): Promise<Breadcrumb[]> {
+ branchLike?: T.BranchLike
+): Promise<T.Breadcrumb[]> {
const existing = getComponentBreadcrumbs(component);
if (existing) {
return Promise.resolve(existing);
@@ -229,11 +228,11 @@ function retrieveComponentBreadcrumbs(
export function retrieveComponent(
componentKey: string,
qualifier: string,
- branchLike?: BranchLike
+ branchLike?: T.BranchLike
): Promise<{
- breadcrumbs: Breadcrumb[];
- component: ComponentMeasure;
- components: ComponentMeasure[];
+ breadcrumbs: T.Breadcrumb[];
+ component: T.ComponentMeasure;
+ components: T.ComponentMeasure[];
page: number;
total: number;
}> {
@@ -256,7 +255,7 @@ export function loadMoreChildren(
componentKey: string,
page: number,
qualifier: string,
- branchLike?: BranchLike
+ branchLike?: T.BranchLike
): Promise<Children> {
const metrics = getCodeMetrics(qualifier, branchLike);
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/ActivationButton.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/ActivationButton.tsx
index 043d71b134a..be5294254e7 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/ActivationButton.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/ActivationButton.tsx
@@ -20,18 +20,17 @@
import * as React from 'react';
import ActivationFormModal from './ActivationFormModal';
import { Profile as BaseProfile } from '../../../api/quality-profiles';
-import { Rule, RuleDetails, RuleActivation } from '../../../app/types';
import { Button } from '../../../components/ui/buttons';
interface Props {
- activation?: RuleActivation;
+ activation?: T.RuleActivation;
buttonText: string;
className?: string;
modalHeader: string;
onDone: (severity: string) => Promise<void>;
organization: string | undefined;
profiles: BaseProfile[];
- rule: Rule | RuleDetails;
+ rule: T.Rule | T.RuleDetails;
updateMode?: boolean;
}
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/ActivationFormModal.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/ActivationFormModal.tsx
index d72adba3402..b60724a2a60 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/ActivationFormModal.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/ActivationFormModal.tsx
@@ -22,7 +22,6 @@ import Modal from '../../../components/controls/Modal';
import Select from '../../../components/controls/Select';
import SeverityHelper from '../../../components/shared/SeverityHelper';
import { activateRule, Profile as BaseProfile } from '../../../api/quality-profiles';
-import { Rule, RuleDetails, RuleActivation } from '../../../app/types';
import { SEVERITIES } from '../../../helpers/constants';
import { translate } from '../../../helpers/l10n';
import { sortProfiles } from '../../quality-profiles/utils';
@@ -30,13 +29,13 @@ import { SubmitButton, ResetButtonLink } from '../../../components/ui/buttons';
import { Alert } from '../../../components/ui/Alert';
interface Props {
- activation?: RuleActivation;
+ activation?: T.RuleActivation;
modalHeader: string;
onClose: () => void;
onDone: (severity: string) => Promise<void>;
organization: string | undefined;
profiles: BaseProfile[];
- rule: Rule | RuleDetails;
+ rule: T.Rule | T.RuleDetails;
updateMode?: boolean;
}
@@ -150,7 +149,7 @@ export default class ActivationFormModal extends React.PureComponent<Props, Stat
const { profile, severity, submitting } = this.state;
const { params = [] } = rule;
const profilesWithDepth = this.getQualityProfilesWithDepth();
- const isCustomRule = !!(rule as RuleDetails).templateKey;
+ const isCustomRule = !!(rule as T.RuleDetails).templateKey;
const activeInAllProfiles = profilesWithDepth.length <= 0;
const isUpdateMode = !!activation;
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/App.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/App.tsx
index 0a2b74983cc..89d1f04d5de 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/App.tsx
@@ -60,14 +60,6 @@ import {
import { translate } from '../../../helpers/l10n';
import { RawQuery } from '../../../helpers/query';
import { scrollToElement } from '../../../helpers/scrolling';
-import {
- CurrentUser,
- Languages,
- Paging,
- Organization,
- Rule,
- RuleActivation
-} from '../../../app/types';
import '../../../components/search-navigator.css';
import '../styles.css';
import { hasPrivateAccess } from '../../../helpers/organizations';
@@ -76,13 +68,13 @@ const PAGE_SIZE = 100;
const LIMIT_BEFORE_LOAD_MORE = 5;
interface StateToProps {
- currentUser: CurrentUser;
- languages: Languages;
- userOrganizations: Organization[];
+ currentUser: T.CurrentUser;
+ languages: T.Languages;
+ userOrganizations: T.Organization[];
}
interface OwnProps extends WithRouterProps {
- organization: Organization | undefined;
+ organization: T.Organization | undefined;
}
type Props = OwnProps & StateToProps;
@@ -93,12 +85,12 @@ interface State {
facets?: Facets;
loading: boolean;
openFacets: OpenFacets;
- openRule?: Rule;
- paging?: Paging;
+ openRule?: T.Rule;
+ paging?: T.Paging;
query: Query;
referencedProfiles: { [profile: string]: Profile };
referencedRepositories: { [repository: string]: { key: string; language: string; name: string } };
- rules: Rule[];
+ rules: T.Rule[];
selected?: string;
}
@@ -197,7 +189,7 @@ export class App extends React.PureComponent<Props, State> {
detachShortcuts = () => key.deleteScope('coding-rules');
- getOpenRule = (props: Props, rules: Rule[]) => {
+ getOpenRule = (props: Props, rules: T.Rule[]) => {
const open = getOpen(props.location.query);
return open && rules.find(rule => rule.key === open);
};
@@ -450,7 +442,7 @@ export class App extends React.PureComponent<Props, State> {
handleReset = () => this.props.router.push({ pathname: this.props.location.pathname });
/** Tries to take rule by index, or takes the last one */
- pickRuleAround = (rules: Rule[], selectedIndex: number | undefined) => {
+ pickRuleAround = (rules: T.Rule[], selectedIndex: number | undefined) => {
if (selectedIndex === undefined || rules.length === 0) {
return undefined;
}
@@ -627,7 +619,7 @@ export class App extends React.PureComponent<Props, State> {
}
}
-function parseActives(rawActives: { [rule: string]: RuleActivation[] }) {
+function parseActives(rawActives: { [rule: string]: T.RuleActivation[] }) {
const actives: Actives = {};
for (const [rule, activations] of Object.entries(rawActives)) {
actives[rule] = {};
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/BulkChange.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/BulkChange.tsx
index 80a997a3f16..c12c55e53b3 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/BulkChange.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/BulkChange.tsx
@@ -24,10 +24,9 @@ import { Profile } from '../../../api/quality-profiles';
import Dropdown from '../../../components/controls/Dropdown';
import { Button } from '../../../components/ui/buttons';
import { translate } from '../../../helpers/l10n';
-import { Languages } from '../../../app/types';
interface Props {
- languages: Languages;
+ languages: T.Languages;
organization: string | undefined;
query: Query;
referencedProfiles: { [profile: string]: Profile };
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/BulkChangeModal.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/BulkChangeModal.tsx
index e16077643e7..ee8abcf59b5 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/BulkChangeModal.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/BulkChangeModal.tsx
@@ -25,12 +25,11 @@ import Select from '../../../components/controls/Select';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { formatMeasure } from '../../../helpers/measures';
import { SubmitButton, ResetButtonLink } from '../../../components/ui/buttons';
-import { Languages } from '../../../app/types';
import { Alert } from '../../../components/ui/Alert';
interface Props {
action: string;
- languages: Languages;
+ languages: T.Languages;
onClose: () => void;
organization: string | undefined;
profile?: Profile;
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleButton.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleButton.tsx
index 6c8e466d200..4927fc99538 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleButton.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleButton.tsx
@@ -19,14 +19,13 @@
*/
import * as React from 'react';
import CustomRuleFormModal from './CustomRuleFormModal';
-import { RuleDetails } from '../../../app/types';
interface Props {
children: (props: { onClick: () => void }) => React.ReactNode;
- customRule?: RuleDetails;
- onDone: (newRuleDetails: RuleDetails) => void;
+ customRule?: T.RuleDetails;
+ onDone: (newRuleDetails: T.RuleDetails) => void;
organization: string | undefined;
- templateRule: RuleDetails;
+ templateRule: T.RuleDetails;
}
interface State {
@@ -55,7 +54,7 @@ export default class CustomRuleButton extends React.PureComponent<Props, State>
}
};
- handleDone = (newRuleDetails: RuleDetails) => {
+ handleDone = (newRuleDetails: T.RuleDetails) => {
this.handleModalClose();
this.props.onDone(newRuleDetails);
};
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormModal.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormModal.tsx
index 43433e1c308..4bfbbd12c42 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormModal.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormModal.tsx
@@ -18,7 +18,6 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { RuleDetails, RuleParameter, RuleType } from '../../../app/types';
import Modal from '../../../components/controls/Modal';
import { translate } from '../../../helpers/l10n';
import MarkdownTips from '../../../components/common/MarkdownTips';
@@ -33,11 +32,11 @@ import { SubmitButton, ResetButtonLink } from '../../../components/ui/buttons';
import { Alert } from '../../../components/ui/Alert';
interface Props {
- customRule?: RuleDetails;
+ customRule?: T.RuleDetails;
onClose: () => void;
- onDone: (newRuleDetails: RuleDetails) => void;
+ onDone: (newRuleDetails: T.RuleDetails) => void;
organization: string | undefined;
- templateRule: RuleDetails;
+ templateRule: T.RuleDetails;
}
interface State {
@@ -226,7 +225,7 @@ export default class CustomRuleFormModal extends React.PureComponent<Props, Stat
</tr>
);
- renderTypeOption = ({ value }: { value: RuleType }) => {
+ renderTypeOption = ({ value }: { value: T.RuleType }) => {
return <TypeHelper type={value} />;
};
@@ -302,7 +301,7 @@ export default class CustomRuleFormModal extends React.PureComponent<Props, Stat
</tr>
);
- renderParameterField = (param: RuleParameter) => (
+ renderParameterField = (param: T.RuleParameter) => (
<tr className="property" key={param.key}>
<th className="nowrap">
<h3>{param.key}</h3>
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/InheritanceFacet.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/InheritanceFacet.tsx
index c4c1102db07..21f968d133b 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/InheritanceFacet.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/InheritanceFacet.tsx
@@ -19,16 +19,15 @@
*/
import * as React from 'react';
import Facet, { BasicProps } from './Facet';
-import { RuleInheritance, Omit } from '../../../app/types';
import { translate } from '../../../helpers/l10n';
-interface Props extends Omit<BasicProps, 'values'> {
+interface Props extends T.Omit<BasicProps, 'values'> {
disabled: boolean;
- value: RuleInheritance | undefined;
+ value: T.RuleInheritance | undefined;
}
export default class InheritanceFacet extends React.PureComponent<Props> {
- renderName = (value: RuleInheritance) =>
+ renderName = (value: T.RuleInheritance) =>
translate('coding_rules.filters.inheritance', value.toLowerCase());
render() {
@@ -39,7 +38,7 @@ export default class InheritanceFacet extends React.PureComponent<Props> {
{...props}
disabled={this.props.disabled}
disabledHelper={translate('coding_rules.filters.inheritance.inactive')}
- options={Object.values(RuleInheritance)}
+ options={['NONE', 'INHERITED', 'OVERRIDES']}
property="inheritance"
renderName={this.renderName}
renderTextName={this.renderName}
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/PageActions.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/PageActions.tsx
index 3341efb884c..ff8078cc940 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/PageActions.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/PageActions.tsx
@@ -18,7 +18,6 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { Paging } from '../../../app/types';
import { translate } from '../../../helpers/l10n';
import DeferredSpinner from '../../../components/common/DeferredSpinner';
import PageCounter from '../../../components/common/PageCounter';
@@ -27,7 +26,7 @@ import ReloadButton from '../../../components/controls/ReloadButton';
interface Props {
loading: boolean;
onReload: () => void;
- paging?: Paging;
+ paging?: T.Paging;
selectedIndex?: number;
}
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetails.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetails.tsx
index fabcfaf39ee..9cc1230db9d 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetails.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetails.tsx
@@ -28,7 +28,6 @@ import RuleDetailsProfiles from './RuleDetailsProfiles';
import { Query, Activation } from '../query';
import { Profile } from '../../../api/quality-profiles';
import { getRuleDetails, deleteRule, updateRule } from '../../../api/rules';
-import { RuleActivation, RuleDetails as IRuleDetails } from '../../../app/types';
import DeferredSpinner from '../../../components/common/DeferredSpinner';
import ConfirmButton from '../../../components/controls/ConfirmButton';
import DocTooltip from '../../../components/docs/DocTooltip';
@@ -51,9 +50,9 @@ interface Props {
}
interface State {
- actives?: RuleActivation[];
+ actives?: T.RuleActivation[];
loading: boolean;
- ruleDetails?: IRuleDetails;
+ ruleDetails?: T.RuleDetails;
}
export default class RuleDetails extends React.PureComponent<Props, State> {
@@ -95,7 +94,7 @@ export default class RuleDetails extends React.PureComponent<Props, State> {
}
);
- handleRuleChange = (ruleDetails: IRuleDetails) => {
+ handleRuleChange = (ruleDetails: T.RuleDetails) => {
if (this.mounted) {
this.setState({ ruleDetails });
}
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsCustomRules.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsCustomRules.tsx
index 3e5a9bebcac..a7117591fc4 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsCustomRules.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsCustomRules.tsx
@@ -22,7 +22,6 @@ import { Link } from 'react-router';
import { sortBy } from 'lodash';
import CustomRuleButton from './CustomRuleButton';
import { searchRules, deleteRule } from '../../../api/rules';
-import { Rule, RuleDetails } from '../../../app/types';
import DeferredSpinner from '../../../components/common/DeferredSpinner';
import ConfirmButton from '../../../components/controls/ConfirmButton';
import SeverityHelper from '../../../components/shared/SeverityHelper';
@@ -33,12 +32,12 @@ import { getRuleUrl } from '../../../helpers/urls';
interface Props {
canChange?: boolean;
organization: string | undefined;
- ruleDetails: RuleDetails;
+ ruleDetails: T.RuleDetails;
}
interface State {
loading: boolean;
- rules?: Rule[];
+ rules?: T.Rule[];
}
export default class RuleDetailsCustomRules extends React.PureComponent<Props, State> {
@@ -80,7 +79,7 @@ export default class RuleDetailsCustomRules extends React.PureComponent<Props, S
);
};
- handleRuleCreate = (newRuleDetails: RuleDetails) => {
+ handleRuleCreate = (newRuleDetails: T.RuleDetails) => {
if (this.mounted) {
this.setState(({ rules = [] }: State) => ({
rules: [...rules, newRuleDetails]
@@ -98,7 +97,7 @@ export default class RuleDetailsCustomRules extends React.PureComponent<Props, S
});
};
- renderRule = (rule: Rule) => (
+ renderRule = (rule: T.Rule) => (
<tr data-rule={rule.key} key={rule.key}>
<td className="coding-rules-detail-list-name">
<Link to={getRuleUrl(rule.key, this.props.organization)}>{rule.name}</Link>
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsDescription.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsDescription.tsx
index 1b9ae650cb4..349f6976b4f 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsDescription.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsDescription.tsx
@@ -20,16 +20,15 @@
import * as React from 'react';
import RemoveExtendedDescriptionModal from './RemoveExtendedDescriptionModal';
import { updateRule } from '../../../api/rules';
-import { RuleDetails } from '../../../app/types';
import MarkdownTips from '../../../components/common/MarkdownTips';
import { Button, ResetButtonLink } from '../../../components/ui/buttons';
import { translate, translateWithParameters } from '../../../helpers/l10n';
interface Props {
canWrite: boolean | undefined;
- onChange: (newRuleDetails: RuleDetails) => void;
+ onChange: (newRuleDetails: T.RuleDetails) => void;
organization: string | undefined;
- ruleDetails: RuleDetails;
+ ruleDetails: T.RuleDetails;
}
interface State {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsIssues.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsIssues.tsx
index 9bcca9b529a..8f0d290c3eb 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsIssues.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsIssues.tsx
@@ -23,14 +23,13 @@ import { Link } from 'react-router';
import DeferredSpinner from '../../../components/common/DeferredSpinner';
import Tooltip from '../../../components/controls/Tooltip';
import { getFacet } from '../../../api/issues';
-import { RuleDetails, RuleType } from '../../../app/types';
import { getIssuesUrl } from '../../../helpers/urls';
import { formatMeasure } from '../../../helpers/measures';
import { translate } from '../../../helpers/l10n';
interface Props {
organization: string | undefined;
- ruleDetails: Pick<RuleDetails, 'key' | 'type'>;
+ ruleDetails: Pick<T.RuleDetails, 'key' | 'type'>;
}
interface Project {
@@ -73,8 +72,8 @@ export default class RuleDetailsIssues extends React.PureComponent<Props, State>
resolved: 'false',
rules: this.props.ruleDetails.key,
types:
- this.props.ruleDetails.type === RuleType.Hotspot
- ? [RuleType.Vulnerability, RuleType.Hotspot].join()
+ this.props.ruleDetails.type === 'SECURITY_HOTSPOT'
+ ? ['VULNERABILITY', 'SECURITY_HOTSPOT'].join()
: undefined
});
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsMeta.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsMeta.tsx
index 1e7c69c3ea1..fdf418212fe 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsMeta.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsMeta.tsx
@@ -22,7 +22,6 @@ import { Link } from 'react-router';
import RuleDetailsTagsPopup from './RuleDetailsTagsPopup';
import SimilarRulesFilter from './SimilarRulesFilter';
import { Query } from '../query';
-import { RuleDetails, RuleScope } from '../../../app/types';
import { getRuleUrl } from '../../../helpers/urls';
import LinkIcon from '../../../components/icons-components/LinkIcon';
import RuleScopeIcon from '../../../components/icons-components/RuleScopeIcon';
@@ -44,7 +43,7 @@ interface Props {
onTagsChange: (tags: string[]) => void;
organization: string | undefined;
referencedRepositories: { [repository: string]: { key: string; language: string; name: string } };
- ruleDetails: RuleDetails;
+ ruleDetails: T.RuleDetails;
}
const EXTERNAL_RULE_REPO_PREFIX = 'external_';
@@ -201,7 +200,7 @@ export default class RuleDetailsMeta extends React.PureComponent<Props> {
};
renderScope = () => {
- const scope = this.props.ruleDetails.scope || RuleScope.Main;
+ const scope = this.props.ruleDetails.scope || 'MAIN';
return (
<Tooltip overlay={translate('coding_rules.scope.title')}>
<li className="coding-rules-detail-property">
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsParameters.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsParameters.tsx
index a7385653070..6e3efa4ae36 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsParameters.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsParameters.tsx
@@ -18,15 +18,14 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { RuleParameter } from '../../../app/types';
import { translate } from '../../../helpers/l10n';
interface Props {
- params: RuleParameter[];
+ params: T.RuleParameter[];
}
export default class RuleDetailsParameters extends React.PureComponent<Props> {
- renderParameter = (param: RuleParameter) => (
+ renderParameter = (param: T.RuleParameter) => (
<tr className="coding-rules-detail-parameter" key={param.key}>
<td className="coding-rules-detail-parameter-name">{param.key}</td>
<td className="coding-rules-detail-parameter-description">
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsProfiles.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsProfiles.tsx
index 3026fac6e3e..f5800a3b282 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsProfiles.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsProfiles.tsx
@@ -23,7 +23,6 @@ import { Link } from 'react-router';
import ActivationButton from './ActivationButton';
import RuleInheritanceIcon from './RuleInheritanceIcon';
import { Profile, deactivateRule, activateRule } from '../../../api/quality-profiles';
-import { RuleActivation, RuleDetails, RuleInheritance } from '../../../app/types';
import ConfirmButton from '../../../components/controls/ConfirmButton';
import BuiltInQualityProfileBadge from '../../quality-profiles/components/BuiltInQualityProfileBadge';
import InstanceMessage from '../../../components/common/InstanceMessage';
@@ -34,13 +33,13 @@ import { getQualityProfileUrl } from '../../../helpers/urls';
import { translate, translateWithParameters } from '../../../helpers/l10n';
interface Props {
- activations: RuleActivation[] | undefined;
+ activations: T.RuleActivation[] | undefined;
canWrite: boolean | undefined;
onActivate: () => Promise<void>;
onDeactivate: () => Promise<void>;
organization: string | undefined;
referencedProfiles: { [profile: string]: Profile };
- ruleDetails: RuleDetails;
+ ruleDetails: T.RuleDetails;
}
interface State {
@@ -90,7 +89,7 @@ export default class RuleDetailsProfiles extends React.PureComponent<Props, Stat
}
};
- renderInheritedProfile = (activation: RuleActivation, profile: Profile) => {
+ renderInheritedProfile = (activation: T.RuleActivation, profile: Profile) => {
if (!profile.parentName) {
return null;
}
@@ -101,8 +100,7 @@ export default class RuleDetailsProfiles extends React.PureComponent<Props, Stat
);
return (
<div className="coding-rules-detail-quality-profile-inheritance">
- {(activation.inherit === RuleInheritance.Overridden ||
- activation.inherit === RuleInheritance.Inherited) && (
+ {(activation.inherit === 'OVERRIDES' || activation.inherit === 'INHERITED') && (
<>
<RuleInheritanceIcon className="text-middle" inheritance={activation.inherit} />
<Link className="link-base-color little-spacer-left text-middle" to={profilePath}>
@@ -114,7 +112,7 @@ export default class RuleDetailsProfiles extends React.PureComponent<Props, Stat
);
};
- renderSeverity = (activation: RuleActivation, parentActivation?: RuleActivation) => (
+ renderSeverity = (activation: T.RuleActivation, parentActivation?: T.RuleActivation) => (
<td className="coding-rules-detail-quality-profile-severity">
<Tooltip overlay={translate('coding_rules.activation_severity')}>
<span>
@@ -130,7 +128,10 @@ export default class RuleDetailsProfiles extends React.PureComponent<Props, Stat
</td>
);
- renderParameter = (param: { key: string; value: string }, parentActivation?: RuleActivation) => {
+ renderParameter = (
+ param: { key: string; value: string },
+ parentActivation?: T.RuleActivation
+ ) => {
const originalParam =
parentActivation && parentActivation.params.find(p => p.key === param.key);
const originalValue = originalParam && originalParam.value;
@@ -152,16 +153,16 @@ export default class RuleDetailsProfiles extends React.PureComponent<Props, Stat
);
};
- renderParameters = (activation: RuleActivation, parentActivation?: RuleActivation) => (
+ renderParameters = (activation: T.RuleActivation, parentActivation?: T.RuleActivation) => (
<td className="coding-rules-detail-quality-profile-parameters">
{activation.params.map(param => this.renderParameter(param, parentActivation))}
</td>
);
- renderActions = (activation: RuleActivation, profile: Profile) => {
+ renderActions = (activation: T.RuleActivation, profile: Profile) => {
const canEdit = profile.actions && profile.actions.edit && !profile.isBuiltIn;
const { ruleDetails } = this.props;
- const hasParent = activation.inherit !== RuleInheritance.NotInherited && profile.parentKey;
+ const hasParent = activation.inherit !== 'NONE' && profile.parentKey;
return (
<td className="coding-rules-detail-quality-profile-actions">
{canEdit && (
@@ -179,7 +180,7 @@ export default class RuleDetailsProfiles extends React.PureComponent<Props, Stat
/>
)}
{hasParent ? (
- activation.inherit === RuleInheritance.Overridden &&
+ activation.inherit === 'OVERRIDES' &&
profile.parentName && (
<ConfirmButton
confirmButtonText={translate('yes')}
@@ -221,7 +222,7 @@ export default class RuleDetailsProfiles extends React.PureComponent<Props, Stat
);
};
- renderActivation = (activation: RuleActivation) => {
+ renderActivation = (activation: T.RuleActivation) => {
const { activations = [], ruleDetails } = this.props;
const profile = this.props.referencedProfiles[activation.qProfile];
if (!profile) {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleInheritanceIcon.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleInheritanceIcon.tsx
index 6ac38d6a51e..cf12ec2adc1 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleInheritanceIcon.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleInheritanceIcon.tsx
@@ -19,15 +19,14 @@
*/
import * as React from 'react';
import * as theme from '../../../app/theme';
-import { RuleInheritance } from '../../../app/types';
interface Props {
className?: string;
- inheritance: RuleInheritance.Inherited | RuleInheritance.Overridden;
+ inheritance: T.RuleInheritance;
}
export default function RuleInheritanceIcon({ className, inheritance, ...other }: Props) {
- const fill = inheritance === RuleInheritance.Overridden ? theme.red : theme.baseFontColor;
+ const fill = inheritance === 'OVERRIDES' ? theme.red : theme.baseFontColor;
return (
<svg
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleListItem.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleListItem.tsx
index c2dc3380618..6e0658be8c3 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleListItem.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleListItem.tsx
@@ -25,7 +25,6 @@ import RuleInheritanceIcon from './RuleInheritanceIcon';
import SimilarRulesFilter from './SimilarRulesFilter';
import { Activation, Query } from '../query';
import { Profile, deactivateRule } from '../../../api/quality-profiles';
-import { Rule, RuleInheritance } from '../../../app/types';
import { Button } from '../../../components/ui/buttons';
import ConfirmButton from '../../../components/controls/ConfirmButton';
import IssueTypeIcon from '../../../components/ui/IssueTypeIcon';
@@ -42,7 +41,7 @@ interface Props {
onFilterChange: (changes: Partial<Query>) => void;
onOpen: (ruleKey: string) => void;
organization: string | undefined;
- rule: Rule;
+ rule: T.Rule;
selected: boolean;
selectedProfile?: Profile;
}
@@ -63,7 +62,7 @@ export default class RuleListItem extends React.PureComponent<Props> {
if (this.props.selectedProfile) {
this.props.onActivate(this.props.selectedProfile.key, this.props.rule.key, {
severity,
- inherit: RuleInheritance.NotInherited
+ inherit: 'NONE'
});
}
return Promise.resolve();
@@ -93,7 +92,7 @@ export default class RuleListItem extends React.PureComponent<Props> {
{selectedProfile &&
selectedProfile.parentName && (
<>
- {activation.inherit === RuleInheritance.Overridden && (
+ {activation.inherit === 'OVERRIDES' && (
<Tooltip
overlay={translateWithParameters(
'coding_rules.overrides',
@@ -106,7 +105,7 @@ export default class RuleListItem extends React.PureComponent<Props> {
/>
</Tooltip>
)}
- {activation.inherit === RuleInheritance.Inherited && (
+ {activation.inherit === 'INHERITED' && (
<Tooltip
overlay={translateWithParameters(
'coding_rules.inherits',
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/SimilarRulesFilter.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/SimilarRulesFilter.tsx
index 0ec38b7e1ff..ee729ba6609 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/SimilarRulesFilter.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/SimilarRulesFilter.tsx
@@ -19,7 +19,6 @@
*/
import * as React from 'react';
import { Query } from '../query';
-import { Rule } from '../../../app/types';
import Dropdown from '../../../components/controls/Dropdown';
import { translate } from '../../../helpers/l10n';
import SeverityHelper from '../../../components/shared/SeverityHelper';
@@ -29,7 +28,7 @@ import TagsIcon from '../../../components/icons-components/TagsIcon';
interface Props {
onFilterChange: (changes: Partial<Query>) => void;
- rule: Rule;
+ rule: T.Rule;
}
export default class SimilarRulesFilter extends React.PureComponent<Props> {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/TemplateFacet.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/TemplateFacet.tsx
index ed473536094..aa0d4d0675d 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/TemplateFacet.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/TemplateFacet.tsx
@@ -19,11 +19,10 @@
*/
import * as React from 'react';
import Facet, { BasicProps } from './Facet';
-import { Omit } from '../../../app/types';
import DocTooltip from '../../../components/docs/DocTooltip';
import { translate } from '../../../helpers/l10n';
-interface Props extends Omit<BasicProps, 'onChange' | 'values'> {
+interface Props extends T.Omit<BasicProps, 'onChange' | 'values'> {
onChange: (changes: { template: boolean | undefined }) => void;
value: boolean | undefined;
}
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/TypeFacet.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/TypeFacet.tsx
index 0a08bf5587f..ff2accac97f 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/TypeFacet.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/TypeFacet.tsx
@@ -21,7 +21,6 @@ import * as React from 'react';
import Facet, { BasicProps } from './Facet';
import IssueTypeIcon from '../../../components/ui/IssueTypeIcon';
import { translate } from '../../../helpers/l10n';
-import { RuleType } from '../../../app/types';
export default class TypeFacet extends React.PureComponent<BasicProps> {
renderName = (type: string) => (
@@ -34,7 +33,7 @@ export default class TypeFacet extends React.PureComponent<BasicProps> {
renderTextName = (type: string) => translate('issue.type', type);
render() {
- const options = [RuleType.Bug, RuleType.Vulnerability, RuleType.CodeSmell, RuleType.Hotspot];
+ const options = ['BUG', 'VULNERABILITY', 'CODE_SMELL', 'SECURITY_HOTSPOT'];
return (
<Facet
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleDetailsDescription-test.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleDetailsDescription-test.tsx
index 03c58dbe12d..eeda812537c 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleDetailsDescription-test.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleDetailsDescription-test.tsx
@@ -21,13 +21,12 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import RuleDetailsDescription from '../RuleDetailsDescription';
import { click, change, waitAndUpdate } from '../../../../helpers/testUtils';
-import { RuleType } from '../../../../app/types';
jest.mock('../../../../api/rules', () => ({
updateRule: jest.fn().mockResolvedValue('updatedrule')
}));
-const RULE = {
+const RULE: T.RuleDetails = {
key: 'squid:S1133',
repo: 'squid',
name: 'Deprecated code should be removed',
@@ -38,27 +37,30 @@ const RULE = {
status: 'READY',
lang: 'java',
langName: 'Java',
- type: RuleType.CodeSmell
+ type: 'CODE_SMELL'
};
-const EXTERNAL_RULE = {
+const EXTERNAL_RULE: T.RuleDetails = {
+ createdAt: '2013-07-26T09:40:51+0200',
key: 'external_xoo:OneExternalIssuePerLine',
repo: 'external_xoo',
name: 'xoo:OneExternalIssuePerLine',
+ severity: 'MAJOR',
status: 'READY',
isExternal: true,
- type: RuleType.Unknown
+ type: 'UNKNOWN'
};
-const EXTERNAL_RULE_WITH_DATA = {
+const EXTERNAL_RULE_WITH_DATA: T.RuleDetails = {
key: 'external_xoo:OneExternalIssueWithDetailsPerLine',
repo: 'external_xoo',
name: 'One external issue per line',
createdAt: '2018-05-31T11:19:51+0200',
htmlDesc: '<p>Html Description</p>',
+ severity: 'MAJOR',
status: 'READY',
isExternal: true,
- type: RuleType.Bug
+ type: 'BUG'
};
it('should display correctly', () => {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleDetailsIssues-test.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleDetailsIssues-test.tsx
index cbd77073ed2..731cddcfeed 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleDetailsIssues-test.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleDetailsIssues-test.tsx
@@ -22,7 +22,6 @@ import { shallow } from 'enzyme';
import RuleDetailsIssues from '../RuleDetailsIssues';
import { waitAndUpdate } from '../../../../helpers/testUtils';
import { getFacet } from '../../../../api/issues';
-import { RuleType } from '../../../../app/types';
jest.mock('../../../../api/issues', () => ({
getFacet: jest.fn().mockResolvedValue({
@@ -39,14 +38,14 @@ beforeEach(() => {
});
it('should fetch issues and render', async () => {
- await check(RuleType.Bug, undefined);
+ await check('BUG', undefined);
});
it('should handle hotspot rules', async () => {
- await check(RuleType.Hotspot, [RuleType.Vulnerability, RuleType.Hotspot]);
+ await check('SECURITY_HOTSPOT', ['VULNERABILITY', 'SECURITY_HOTSPOT']);
});
-async function check(ruleType: RuleType, requestedTypes: RuleType[] | undefined) {
+async function check(ruleType: T.RuleType, requestedTypes: T.RuleType[] | undefined) {
const wrapper = shallow(
<RuleDetailsIssues organization="org" ruleDetails={{ key: 'foo', type: ruleType }} />
);
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleDetailsMeta-test.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleDetailsMeta-test.tsx
index 137e8b91a1a..d0a62e669c9 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleDetailsMeta-test.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleDetailsMeta-test.tsx
@@ -20,10 +20,9 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import RuleDetailsMeta from '../RuleDetailsMeta';
-import { RuleScope, RuleType } from '../../../../app/types';
import RuleDetailsTagsPopup from '../RuleDetailsTagsPopup';
-const RULE = {
+const RULE: T.RuleDetails = {
key: 'squid:S1133',
repo: 'squid',
name: 'Deprecated code should be removed',
@@ -32,22 +31,23 @@ const RULE = {
status: 'READY',
lang: 'java',
langName: 'Java',
- scope: RuleScope.Main,
- type: RuleType.CodeSmell
+ scope: 'MAIN',
+ type: 'CODE_SMELL'
};
-const EXTERNAL_RULE = {
+const EXTERNAL_RULE: T.RuleDetails = {
key: 'external_xoo:OneExternalIssuePerLine',
repo: 'external_xoo',
name: 'xoo:OneExternalIssuePerLine',
createdAt: '2018-05-31T11:22:13+0200',
+ severity: 'MAJOR',
status: 'READY',
- scope: RuleScope.All,
+ scope: 'ALL',
isExternal: true,
- type: RuleType.Unknown
+ type: 'UNKNOWN'
};
-const EXTERNAL_RULE_WITH_DATA = {
+const EXTERNAL_RULE_WITH_DATA: T.RuleDetails = {
key: 'external_xoo:OneExternalIssueWithDetailsPerLine',
repo: 'external_xoo',
name: 'One external issue per line',
@@ -57,9 +57,9 @@ const EXTERNAL_RULE_WITH_DATA = {
tags: ['tag'],
lang: 'xoo',
langName: 'Xoo',
- scope: RuleScope.All,
+ scope: 'ALL',
isExternal: true,
- type: RuleType.Bug
+ type: 'BUG'
};
it('should display right meta info', () => {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleListItem-test.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleListItem-test.tsx
index 0772c6afe30..8d7ba0a1daf 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleListItem-test.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleListItem-test.tsx
@@ -20,10 +20,9 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import RuleListItem from '../RuleListItem';
-import { Rule, RuleType } from '../../../../app/types';
import { mockEvent } from '../../../../helpers/testUtils';
-const rule: Rule = {
+const rule: T.Rule = {
key: 'foo',
lang: 'js',
langName: 'JavaScript',
@@ -32,7 +31,7 @@ const rule: Rule = {
status: 'READY',
sysTags: ['a', 'b'],
tags: ['x'],
- type: RuleType.CodeSmell
+ type: 'CODE_SMELL'
};
it('should render', () => {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/query.ts b/server/sonar-web/src/main/js/apps/coding-rules/query.ts
index 6fc8f3c0209..c6d16277e8b 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/query.ts
+++ b/server/sonar-web/src/main/js/apps/coding-rules/query.ts
@@ -17,7 +17,6 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { RuleInheritance } from '../../app/types';
import {
RawQuery,
parseAsString,
@@ -38,7 +37,7 @@ export interface Query {
activationSeverities: string[];
availableSince: Date | undefined;
compareToProfile: string | undefined;
- inheritance: RuleInheritance | undefined;
+ inheritance: T.RuleInheritance | undefined;
languages: string[];
profile: string | undefined;
repositories: string[];
@@ -62,7 +61,7 @@ export type Facets = { [F in FacetKey]?: Facet };
export type OpenFacets = { [F in FacetKey]?: boolean };
export interface Activation {
- inherit: string;
+ inherit: T.RuleInheritance;
severity: string;
}
@@ -141,18 +140,14 @@ export function getOpen(query: RawQuery) {
return query.open;
}
-function parseAsInheritance(value?: string): RuleInheritance | undefined {
- if (value === RuleInheritance.Inherited) {
- return RuleInheritance.Inherited;
- } else if (value === RuleInheritance.NotInherited) {
- return RuleInheritance.NotInherited;
- } else if (value === RuleInheritance.Overridden) {
- return RuleInheritance.Overridden;
+function parseAsInheritance(value?: string): T.RuleInheritance | undefined {
+ if (value === 'INHERITED' || value === 'NONE' || value === 'OVERRIDES') {
+ return value;
} else {
return undefined;
}
}
-function serializeInheritance(value: RuleInheritance | undefined): string | undefined {
+function serializeInheritance(value: T.RuleInheritance | undefined): string | undefined {
return value;
}
diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/App.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/App.tsx
index 3ecb85b9786..25348fb55db 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/components/App.tsx
@@ -50,37 +50,33 @@ import {
translate
} from '../../../helpers/l10n';
import { RawQuery } from '../../../helpers/query';
-import {
- BranchLike,
- ComponentMeasure,
- CurrentUser,
- MeasureEnhanced,
- Metric,
- Period
-} from '../../../app/types';
import '../../../components/search-navigator.css';
import '../style.css';
interface Props {
- branchLike?: BranchLike;
- component: ComponentMeasure;
- currentUser: CurrentUser;
+ branchLike?: T.BranchLike;
+ component: T.ComponentMeasure;
+ currentUser: T.CurrentUser;
location: { pathname: string; query: RawQuery };
fetchMeasures: (
component: string,
metricsKey: string[],
- branchLike?: BranchLike
- ) => Promise<{ component: ComponentMeasure; measures: MeasureEnhanced[]; leakPeriod?: Period }>;
+ branchLike?: T.BranchLike
+ ) => Promise<{
+ component: T.ComponentMeasure;
+ measures: T.MeasureEnhanced[];
+ leakPeriod?: T.Period;
+ }>;
fetchMetrics: () => void;
- metrics: { [metric: string]: Metric };
+ metrics: { [metric: string]: T.Metric };
metricsKey: string[];
router: InjectedRouter;
}
interface State {
loading: boolean;
- measures: MeasureEnhanced[];
- leakPeriod?: Period;
+ measures: T.MeasureEnhanced[];
+ leakPeriod?: T.Period;
}
export default class App extends React.PureComponent<Props, State> {
@@ -162,7 +158,7 @@ export default class App extends React.PureComponent<Props, State> {
);
};
- getHelmetTitle = (query: Query, displayOverview: boolean, metric?: Metric) => {
+ getHelmetTitle = (query: Query, displayOverview: boolean, metric?: T.Metric) => {
if (displayOverview && query.metric) {
return isProjectOverview(query.metric)
? translate('component_measures.overview.project_overview.facet')
@@ -205,7 +201,7 @@ export default class App extends React.PureComponent<Props, State> {
});
};
- renderContent = (displayOverview: boolean, query: Query, metric?: Metric) => {
+ renderContent = (displayOverview: boolean, query: Query, metric?: T.Metric) => {
const { branchLike, component, fetchMeasures, metrics } = this.props;
const { leakPeriod } = this.state;
if (displayOverview) {
diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/AppContainer.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/AppContainer.tsx
index 5f332e09455..ae7a599a5aa 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/components/AppContainer.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/components/AppContainer.tsx
@@ -28,19 +28,10 @@ import { getMeasuresAndMeta } from '../../../api/measures';
import { getLeakPeriod } from '../../../helpers/periods';
import { enhanceMeasure } from '../../../components/measure/utils';
import { getBranchLikeQuery } from '../../../helpers/branches';
-import {
- BranchLike,
- ComponentMeasure,
- CurrentUser,
- Measure,
- MeasureEnhanced,
- Metric,
- Period
-} from '../../../app/types';
interface StateToProps {
- currentUser: CurrentUser;
- metrics: { [metric: string]: Metric };
+ currentUser: T.CurrentUser;
+ metrics: { [metric: string]: T.Metric };
metricsKey: string[];
}
@@ -48,14 +39,18 @@ interface DispatchToProps {
fetchMeasures: (
component: string,
metricsKey: string[],
- branchLike?: BranchLike
- ) => Promise<{ component: ComponentMeasure; measures: MeasureEnhanced[]; leakPeriod?: Period }>;
+ branchLike?: T.BranchLike
+ ) => Promise<{
+ component: T.ComponentMeasure;
+ measures: T.MeasureEnhanced[];
+ leakPeriod?: T.Period;
+ }>;
fetchMetrics: () => void;
}
interface OwnProps {
- branchLike?: BranchLike;
- component: ComponentMeasure;
+ branchLike?: T.BranchLike;
+ component: T.ComponentMeasure;
}
const mapStateToProps = (state: any): StateToProps => ({
@@ -64,7 +59,7 @@ const mapStateToProps = (state: any): StateToProps => ({
metricsKey: getMetricsKey(state)
});
-function banQualityGate({ measures = [], qualifier }: ComponentMeasure): Measure[] {
+function banQualityGate({ measures = [], qualifier }: T.ComponentMeasure): T.Measure[] {
const bannedMetrics: string[] = [];
if (!['VW', 'SVW'].includes(qualifier)) {
bannedMetrics.push('alert_status');
@@ -75,7 +70,7 @@ function banQualityGate({ measures = [], qualifier }: ComponentMeasure): Measure
return measures.filter(measure => !bannedMetrics.includes(measure.metric));
}
-const fetchMeasures = (component: string, metricsKey: string[], branchLike?: BranchLike) => (
+const fetchMeasures = (component: string, metricsKey: string[], branchLike?: T.BranchLike) => (
_dispatch: Dispatch,
getState: () => any
) => {
@@ -92,7 +87,7 @@ const fetchMeasures = (component: string, metricsKey: string[], branchLike?: Bra
);
const newBugs = measures.find(measure => measure.metric.key === 'new_bugs');
- const applicationPeriods = newBugs ? [{ index: 1 } as Period] : [];
+ const applicationPeriods = newBugs ? [{ index: 1 } as T.Period] : [];
const leakPeriod = getLeakPeriod(component.qualifier === 'APP' ? applicationPeriods : periods);
return { component, measures, leakPeriod };
}, throwGlobalError);
diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/Breadcrumb.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/Breadcrumb.tsx
index 326401a8377..17e53750aaa 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/components/Breadcrumb.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/components/Breadcrumb.tsx
@@ -20,11 +20,10 @@
import * as React from 'react';
import Tooltip from '../../../components/controls/Tooltip';
import { collapsePath, limitComponentName } from '../../../helpers/path';
-import { ComponentMeasure } from '../../../app/types';
interface Props {
canBrowse: boolean;
- component: ComponentMeasure;
+ component: T.ComponentMeasure;
isLast: boolean;
handleSelect: (component: string) => void;
}
diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/Breadcrumbs.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/Breadcrumbs.tsx
index f90d46e7550..926f96c80b8 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/components/Breadcrumbs.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/components/Breadcrumbs.tsx
@@ -22,19 +22,18 @@ import * as key from 'keymaster';
import Breadcrumb from './Breadcrumb';
import { getBreadcrumbs } from '../../../api/components';
import { getBranchLikeQuery } from '../../../helpers/branches';
-import { BranchLike, ComponentMeasure } from '../../../app/types';
interface Props {
backToFirst: boolean;
- branchLike?: BranchLike;
+ branchLike?: T.BranchLike;
className?: string;
- component: ComponentMeasure;
+ component: T.ComponentMeasure;
handleSelect: (component: string) => void;
- rootComponent: ComponentMeasure;
+ rootComponent: T.ComponentMeasure;
}
interface State {
- breadcrumbs: ComponentMeasure[];
+ breadcrumbs: T.ComponentMeasure[];
}
export default class Breadcrumbs extends React.PureComponent<Props, State> {
diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/LeakPeriodLegend.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/LeakPeriodLegend.tsx
index 57362e1933f..9f145e734af 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/components/LeakPeriodLegend.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/components/LeakPeriodLegend.tsx
@@ -27,12 +27,11 @@ import Tooltip from '../../../components/controls/Tooltip';
import { getPeriodLabel, getPeriodDate } from '../../../helpers/periods';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { differenceInDays } from '../../../helpers/dates';
-import { ComponentMeasure, Period, PeriodMode } from '../../../app/types';
interface Props {
className?: string;
- component: ComponentMeasure;
- period: Period;
+ component: T.ComponentMeasure;
+ period: T.Period;
}
export default class LeakPeriodLegend extends React.PureComponent<Props> {
@@ -62,7 +61,7 @@ export default class LeakPeriodLegend extends React.PureComponent<Props> {
</div>
);
- if (period.mode === PeriodMode.Days) {
+ if (period.mode === 'days') {
return label;
}
diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.tsx
index 7d795c8d1f8..c9ddae92ee3 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.tsx
@@ -36,33 +36,23 @@ import { getProjectUrl } from '../../../helpers/urls';
import { isDiffMetric } from '../../../helpers/measures';
import { isSameBranchLike, getBranchLikeQuery } from '../../../helpers/branches';
import DeferredSpinner from '../../../components/common/DeferredSpinner';
-import {
- BranchLike,
- ComponentMeasure,
- ComponentMeasureEnhanced,
- CurrentUser,
- Metric,
- Paging,
- MeasureEnhanced,
- Period
-} from '../../../app/types';
import { RequestData } from '../../../helpers/request';
import { isLoggedIn } from '../../../helpers/users';
interface Props {
- branchLike?: BranchLike;
+ branchLike?: T.BranchLike;
className?: string;
- component: ComponentMeasure;
- currentUser: CurrentUser;
+ component: T.ComponentMeasure;
+ currentUser: T.CurrentUser;
loading: boolean;
loadingMore: boolean;
- leakPeriod?: Period;
- measure?: MeasureEnhanced;
- metric: Metric;
- metrics: { [metric: string]: Metric };
- rootComponent: ComponentMeasure;
+ leakPeriod?: T.Period;
+ measure?: T.MeasureEnhanced;
+ metric: T.Metric;
+ metrics: { [metric: string]: T.Metric };
+ rootComponent: T.ComponentMeasure;
router: InjectedRouter;
- secondaryMeasure?: MeasureEnhanced;
+ secondaryMeasure?: T.MeasureEnhanced;
updateLoading: (param: { [key: string]: boolean }) => void;
updateSelected: (component: string) => void;
updateView: (view: string) => void;
@@ -70,9 +60,9 @@ interface Props {
}
interface State {
- components: ComponentMeasureEnhanced[];
- metric?: Metric;
- paging?: Paging;
+ components: T.ComponentMeasureEnhanced[];
+ metric?: T.Metric;
+ paging?: T.Paging;
selected?: string;
view?: string;
}
@@ -109,7 +99,7 @@ export default class MeasureContent extends React.PureComponent<Props, State> {
return index !== -1 ? index : undefined;
};
- getComponentRequestParams = (view: string, metric: Metric, options: Object = {}) => {
+ getComponentRequestParams = (view: string, metric: T.Metric, options: Object = {}) => {
const strategy = view === 'list' ? 'leaves' : 'children';
const metricKeys = [metric.key];
const opts: RequestData = {
diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContentContainer.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContentContainer.tsx
index c8a1301038d..0a756d3b8ad 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContentContainer.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContentContainer.tsx
@@ -21,28 +21,20 @@ import * as React from 'react';
import { InjectedRouter } from 'react-router';
import MeasureContent from './MeasureContent';
import { Query } from '../utils';
-import {
- ComponentMeasure,
- Metric,
- BranchLike,
- CurrentUser,
- MeasureEnhanced,
- Period
-} from '../../../app/types';
interface Props {
- branchLike?: BranchLike;
+ branchLike?: T.BranchLike;
className?: string;
- currentUser: CurrentUser;
- rootComponent: ComponentMeasure;
+ currentUser: T.CurrentUser;
+ rootComponent: T.ComponentMeasure;
fetchMeasures: (
component: string,
metricsKey: string[],
- branchLike?: BranchLike
- ) => Promise<{ component: ComponentMeasure; measures: MeasureEnhanced[] }>;
- leakPeriod?: Period;
- metric: Metric;
- metrics: { [metric: string]: Metric };
+ branchLike?: T.BranchLike
+ ) => Promise<{ component: T.ComponentMeasure; measures: T.MeasureEnhanced[] }>;
+ leakPeriod?: T.Period;
+ metric: T.Metric;
+ metrics: { [metric: string]: T.Metric };
router: InjectedRouter;
selected?: string;
updateQuery: (query: Partial<Query>) => void;
@@ -56,10 +48,10 @@ interface LoadingState {
}
interface State {
- component?: ComponentMeasure;
+ component?: T.ComponentMeasure;
loading: LoadingState;
- measure?: MeasureEnhanced;
- secondaryMeasure?: MeasureEnhanced;
+ measure?: T.MeasureEnhanced;
+ secondaryMeasure?: T.MeasureEnhanced;
}
export default class MeasureContentContainer extends React.PureComponent<Props, State> {
diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureFavoriteContainer.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureFavoriteContainer.tsx
index d062ad6af50..43e4148b94d 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureFavoriteContainer.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureFavoriteContainer.tsx
@@ -21,12 +21,11 @@ import * as React from 'react';
import Favorite from '../../../components/controls/Favorite';
import { getComponentForSourceViewer } from '../../../api/components';
import { isMainBranch } from '../../../helpers/branches';
-import { BranchLike, SourceViewerFile } from '../../../app/types';
-type FavComponent = Pick<SourceViewerFile, 'canMarkAsFavorite' | 'fav' | 'key' | 'q'>;
+type FavComponent = Pick<T.SourceViewerFile, 'canMarkAsFavorite' | 'fav' | 'key' | 'q'>;
interface Props {
- branchLike?: BranchLike;
+ branchLike?: T.BranchLike;
className?: string;
component: string;
}
diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureHeader.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureHeader.tsx
index d85dcc4a067..59e894f6aae 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureHeader.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureHeader.tsx
@@ -28,16 +28,15 @@ import Tooltip from '../../../components/controls/Tooltip';
import { getLocalizedMetricName, translate } from '../../../helpers/l10n';
import { getMeasureHistoryUrl } from '../../../helpers/urls';
import { isDiffMetric } from '../../../helpers/measures';
-import { BranchLike, ComponentMeasure, MeasureEnhanced, Metric, Period } from '../../../app/types';
import { hasFullMeasures } from '../utils';
interface Props {
- branchLike?: BranchLike;
- component: ComponentMeasure;
- leakPeriod?: Period;
- measure?: MeasureEnhanced;
- metric: Metric;
- secondaryMeasure?: MeasureEnhanced;
+ branchLike?: T.BranchLike;
+ component: T.ComponentMeasure;
+ leakPeriod?: T.Period;
+ measure?: T.MeasureEnhanced;
+ metric: T.Metric;
+ secondaryMeasure?: T.MeasureEnhanced;
}
export default function MeasureHeader(props: Props) {
diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureOverview.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureOverview.tsx
index 18c34ea5d4a..7c049607c45 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureOverview.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureOverview.tsx
@@ -28,33 +28,24 @@ import { getComponentLeaves } from '../../../api/components';
import { enhanceComponent, getBubbleMetrics, isFileType } from '../utils';
import { getBranchLikeQuery } from '../../../helpers/branches';
import DeferredSpinner from '../../../components/common/DeferredSpinner';
-import {
- BranchLike,
- ComponentMeasure,
- ComponentMeasureEnhanced,
- CurrentUser,
- Metric,
- Paging,
- Period
-} from '../../../app/types';
interface Props {
- branchLike?: BranchLike;
+ branchLike?: T.BranchLike;
className?: string;
- component: ComponentMeasure;
- currentUser: CurrentUser;
+ component: T.ComponentMeasure;
+ currentUser: T.CurrentUser;
domain: string;
- leakPeriod?: Period;
+ leakPeriod?: T.Period;
loading: boolean;
- metrics: { [metric: string]: Metric };
- rootComponent: ComponentMeasure;
+ metrics: { [metric: string]: T.Metric };
+ rootComponent: T.ComponentMeasure;
updateLoading: (param: { [key: string]: boolean }) => void;
updateSelected: (component: string) => void;
}
interface State {
- components: ComponentMeasureEnhanced[];
- paging?: Paging;
+ components: T.ComponentMeasureEnhanced[];
+ paging?: T.Paging;
}
const BUBBLES_LIMIT = 500;
diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureOverviewContainer.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureOverviewContainer.tsx
index 642cde71e20..db3a5229e37 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureOverviewContainer.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureOverviewContainer.tsx
@@ -24,16 +24,15 @@ import { getComponentShow } from '../../../api/components';
import { getProjectUrl } from '../../../helpers/urls';
import { isViewType, Query } from '../utils';
import { getBranchLikeQuery } from '../../../helpers/branches';
-import { BranchLike, ComponentMeasure, CurrentUser, Metric, Period } from '../../../app/types';
interface Props {
- branchLike?: BranchLike;
+ branchLike?: T.BranchLike;
className?: string;
- currentUser: CurrentUser;
+ currentUser: T.CurrentUser;
domain: string;
- leakPeriod?: Period;
- metrics: { [metric: string]: Metric };
- rootComponent: ComponentMeasure;
+ leakPeriod?: T.Period;
+ metrics: { [metric: string]: T.Metric };
+ rootComponent: T.ComponentMeasure;
router: InjectedRouter;
selected?: string;
updateQuery: (query: Partial<Query>) => void;
@@ -45,7 +44,7 @@ interface LoadingState {
}
interface State {
- component?: ComponentMeasure;
+ component?: T.ComponentMeasure;
loading: LoadingState;
}
diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureViewSelect.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureViewSelect.tsx
index 69347353959..cd84ac1c88d 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureViewSelect.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureViewSelect.tsx
@@ -24,11 +24,10 @@ import TreemapIcon from '../../../components/icons-components/TreemapIcon';
import Select from '../../../components/controls/Select';
import { hasList, hasTree, hasTreemap } from '../utils';
import { translate } from '../../../helpers/l10n';
-import { Metric } from '../../../app/types';
interface Props {
className?: string;
- metric: Metric;
+ metric: T.Metric;
handleViewChange: (view: string) => void;
view: string;
}
diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/PageActions.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/PageActions.tsx
index 75078edb21a..8417f05b294 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/components/PageActions.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/components/PageActions.tsx
@@ -20,12 +20,11 @@
import * as React from 'react';
import FilesCounter from './FilesCounter';
import { translate } from '../../../helpers/l10n';
-import { Paging } from '../../../app/types';
interface Props {
current?: number;
isFile?: boolean;
- paging?: Paging;
+ paging?: T.Paging;
totalLoadedComponents?: number;
view?: string;
}
diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/LeakPeriodLegend-test.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/LeakPeriodLegend-test.tsx
index be616b62017..3aa1046f6dc 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/LeakPeriodLegend-test.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/LeakPeriodLegend-test.tsx
@@ -21,7 +21,6 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import LeakPeriodLegend from '../LeakPeriodLegend';
import { differenceInDays } from '../../../../helpers/dates';
-import { ComponentMeasure, Period, PeriodMode } from '../../../../app/types';
jest.mock('../../../../helpers/dates', () => {
const dates = require.requireActual('../../../../helpers/dates');
@@ -41,17 +40,17 @@ const APP = {
qualifier: 'APP'
};
-const PERIOD = {
+const PERIOD: T.Period = {
date: '2017-05-16T13:50:02+0200',
index: 1,
- mode: PeriodMode.PreviousVersion,
+ mode: 'previous_version',
parameter: '6,4'
};
-const PERIOD_DAYS = {
+const PERIOD_DAYS: T.Period = {
date: '2017-05-16T13:50:02+0200',
index: 1,
- mode: PeriodMode.Days,
+ mode: 'days',
parameter: '18'
};
@@ -69,7 +68,7 @@ it('should render a more precise date', () => {
expect(getWrapper(PROJECT, PERIOD)).toMatchSnapshot();
});
-function getWrapper(component: ComponentMeasure, period: Period) {
+function getWrapper(component: T.ComponentMeasure, period: T.Period) {
return shallow(<LeakPeriodLegend component={component} period={period} />, {
context: {
intl: { formatDate: (date: string) => 'formatted.' + date }
diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureHeader-test.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureHeader-test.tsx
index 2df222654bd..9b43b1ce72b 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureHeader-test.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureHeader-test.tsx
@@ -20,7 +20,6 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import MeasureHeader from '../MeasureHeader';
-import { PeriodMode } from '../../../../app/types';
const METRIC = {
id: '1',
@@ -64,9 +63,9 @@ const PROPS = {
leakPeriod: {
date: '2017-05-16T13:50:02+0200',
index: 1,
- mode: PeriodMode.PreviousVersion,
+ mode: 'previous_version',
parameter: '6,4'
- },
+ } as T.Period,
measure: MEASURE,
metric: METRIC
};
diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureViewSelect-test.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureViewSelect-test.tsx
index a54ea14a3a1..c1d6e7cfda8 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureViewSelect-test.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureViewSelect-test.tsx
@@ -20,14 +20,13 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import MeasureViewSelect from '../MeasureViewSelect';
-import { Metric } from '../../../../app/types';
it('should display correctly with treemap option', () => {
expect(
shallow(
<MeasureViewSelect
handleViewChange={() => {}}
- metric={{ type: 'PERCENT' } as Metric}
+ metric={{ type: 'PERCENT' } as T.Metric}
view="tree"
/>
)
diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/BubbleChart.tsx b/server/sonar-web/src/main/js/apps/component-measures/drilldown/BubbleChart.tsx
index 0c07b5a249f..c52981c4872 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/BubbleChart.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/BubbleChart.tsx
@@ -31,20 +31,19 @@ import {
} from '../../../helpers/l10n';
import { getBubbleMetrics, getBubbleYDomain, isProjectOverview } from '../utils';
import { RATING_COLORS } from '../../../helpers/constants';
-import { ComponentMeasure, ComponentMeasureEnhanced, Metric } from '../../../app/types';
const HEIGHT = 500;
interface Props {
- component: ComponentMeasure;
- components: ComponentMeasureEnhanced[];
+ component: T.ComponentMeasure;
+ components: T.ComponentMeasureEnhanced[];
domain: string;
- metrics: { [metric: string]: Metric };
+ metrics: { [metric: string]: T.Metric };
updateSelected: (component: string) => void;
}
export default class BubbleChart extends React.PureComponent<Props> {
- getMeasureVal = (component: ComponentMeasureEnhanced, metric: Metric) => {
+ getMeasureVal = (component: T.ComponentMeasureEnhanced, metric: T.Metric) => {
const measure = component.measures.find(measure => measure.metric.key === metric.key);
if (!measure) {
return undefined;
@@ -55,7 +54,7 @@ export default class BubbleChart extends React.PureComponent<Props> {
getTooltip(
componentName: string,
values: { x: number; y: number; size: number; colors?: Array<number | undefined> },
- metrics: { x: Metric; y: Metric; size: Metric; colors?: Array<Metric> }
+ metrics: { x: T.Metric; y: T.Metric; size: T.Metric; colors?: T.Metric[] }
) {
const inner = [
componentName,
@@ -85,7 +84,7 @@ export default class BubbleChart extends React.PureComponent<Props> {
);
}
- handleBubbleClick = (component: ComponentMeasureEnhanced) =>
+ handleBubbleClick = (component: T.ComponentMeasureEnhanced) =>
this.props.updateSelected(component.refKey || component.key);
getDescription(domain: string) {
@@ -97,7 +96,7 @@ export default class BubbleChart extends React.PureComponent<Props> {
return translatedDescription;
}
- renderBubbleChart(metrics: { x: Metric; y: Metric; size: Metric; colors?: Metric[] }) {
+ renderBubbleChart(metrics: { x: T.Metric; y: T.Metric; size: T.Metric; colors?: T.Metric[] }) {
const items = this.props.components
.map(component => {
const x = this.getMeasureVal(component, metrics.x);
@@ -120,13 +119,13 @@ export default class BubbleChart extends React.PureComponent<Props> {
tooltip: this.getTooltip(component.name, { x, y, size, colors }, metrics)
};
})
- .filter(Boolean) as BubbleItem<ComponentMeasureEnhanced>[];
+ .filter(Boolean) as BubbleItem<T.ComponentMeasureEnhanced>[];
const formatXTick = (tick: string | number | undefined) => formatMeasure(tick, metrics.x.type);
const formatYTick = (tick: string | number | undefined) => formatMeasure(tick, metrics.y.type);
return (
- <OriginalBubbleChart<ComponentMeasureEnhanced>
+ <OriginalBubbleChart<T.ComponentMeasureEnhanced>
formatXTick={formatXTick}
formatYTick={formatYTick}
height={HEIGHT}
@@ -138,7 +137,7 @@ export default class BubbleChart extends React.PureComponent<Props> {
);
}
- renderChartHeader(domain: string, sizeMetric: Metric, colorsMetric?: Metric[]) {
+ renderChartHeader(domain: string, sizeMetric: T.Metric, colorsMetric?: T.Metric[]) {
const title = isProjectOverview(domain)
? translate('component_measures.overview', domain, 'title')
: translateWithParameters(
diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/CodeView.tsx b/server/sonar-web/src/main/js/apps/component-measures/drilldown/CodeView.tsx
index a07eb4710c2..9dd42f1299f 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/CodeView.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/CodeView.tsx
@@ -20,20 +20,13 @@
import * as React from 'react';
import * as key from 'keymaster';
import SourceViewer from '../../../components/SourceViewer/SourceViewer';
-import {
- BranchLike,
- ComponentMeasure,
- ComponentMeasureEnhanced,
- Metric,
- Period
-} from '../../../app/types';
interface Props {
- branchLike?: BranchLike;
- component: ComponentMeasure;
- components: Array<ComponentMeasureEnhanced>;
- leakPeriod?: Period;
- metric: Metric;
+ branchLike?: T.BranchLike;
+ component: T.ComponentMeasure;
+ components: T.ComponentMeasureEnhanced[];
+ leakPeriod?: T.Period;
+ metric: T.Metric;
selectedIdx?: number;
updateSelected: (component: string) => void;
}
diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentCell.tsx b/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentCell.tsx
index 4ddcd665e7b..071f6f2c7b6 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentCell.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentCell.tsx
@@ -30,14 +30,13 @@ import {
getProjectUrl
} from '../../../helpers/urls';
import { translate } from '../../../helpers/l10n';
-import { BranchLike, ComponentMeasure, ComponentMeasureEnhanced, Metric } from '../../../app/types';
interface Props {
- branchLike?: BranchLike;
- component: ComponentMeasureEnhanced;
+ branchLike?: T.BranchLike;
+ component: T.ComponentMeasureEnhanced;
onClick: (component: string) => void;
- metric: Metric;
- rootComponent: ComponentMeasure;
+ metric: T.Metric;
+ rootComponent: T.ComponentMeasure;
}
export default class ComponentCell extends React.PureComponent<Props> {
diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsList.tsx b/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsList.tsx
index 957fdc7b3e5..01cf98e452d 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsList.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsList.tsx
@@ -22,15 +22,14 @@ import ComponentsListRow from './ComponentsListRow';
import EmptyResult from './EmptyResult';
import { complementary } from '../config/complementary';
import { getLocalizedMetricName } from '../../../helpers/l10n';
-import { ComponentMeasure, ComponentMeasureEnhanced, Metric, BranchLike } from '../../../app/types';
interface Props {
- branchLike?: BranchLike;
- components: ComponentMeasureEnhanced[];
+ branchLike?: T.BranchLike;
+ components: T.ComponentMeasureEnhanced[];
onClick: (component: string) => void;
- metric: Metric;
- metrics: { [metric: string]: Metric };
- rootComponent: ComponentMeasure;
+ metric: T.Metric;
+ metrics: { [metric: string]: T.Metric };
+ rootComponent: T.ComponentMeasure;
selectedComponent?: string;
}
diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsListRow.tsx b/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsListRow.tsx
index 6ae4c80b619..e19138b2bdf 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsListRow.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsListRow.tsx
@@ -21,16 +21,15 @@ import * as React from 'react';
import * as classNames from 'classnames';
import ComponentCell from './ComponentCell';
import MeasureCell from './MeasureCell';
-import { ComponentMeasure, Metric, ComponentMeasureEnhanced, BranchLike } from '../../../app/types';
interface Props {
- branchLike?: BranchLike;
- component: ComponentMeasureEnhanced;
+ branchLike?: T.BranchLike;
+ component: T.ComponentMeasureEnhanced;
isSelected: boolean;
onClick: (component: string) => void;
- otherMetrics: Metric[];
- metric: Metric;
- rootComponent: ComponentMeasure;
+ otherMetrics: T.Metric[];
+ metric: T.Metric;
+ rootComponent: T.ComponentMeasure;
}
export default function ComponentsListRow(props: Props) {
diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/FilesView.tsx b/server/sonar-web/src/main/js/apps/component-measures/drilldown/FilesView.tsx
index 0413514857e..8d106bc29fd 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/FilesView.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/FilesView.tsx
@@ -23,29 +23,22 @@ import { throttle } from 'lodash';
import ComponentsList from './ComponentsList';
import ListFooter from '../../../components/controls/ListFooter';
import { Button } from '../../../components/ui/buttons';
-import {
- ComponentMeasure,
- ComponentMeasureEnhanced,
- Metric,
- Paging,
- BranchLike
-} from '../../../app/types';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { isPeriodBestValue, isDiffMetric, formatMeasure } from '../../../helpers/measures';
import { scrollToElement } from '../../../helpers/scrolling';
import { Alert } from '../../../components/ui/Alert';
interface Props {
- branchLike?: BranchLike;
- components: ComponentMeasureEnhanced[];
+ branchLike?: T.BranchLike;
+ components: T.ComponentMeasureEnhanced[];
fetchMore: () => void;
handleSelect: (component: string) => void;
handleOpen: (component: string) => void;
loadingMore: boolean;
- metric: Metric;
- metrics: { [metric: string]: Metric };
- paging?: Paging;
- rootComponent: ComponentMeasure;
+ metric: T.Metric;
+ metrics: { [metric: string]: T.Metric };
+ paging?: T.Paging;
+ rootComponent: T.ComponentMeasure;
selectedKey?: string;
selectedIdx?: number;
}
@@ -103,7 +96,7 @@ export default class ListView extends React.PureComponent<Props, State> {
['up', 'down', 'right'].forEach(action => key.unbind(action, 'measures-files'));
}
- getVisibleComponents = (components: ComponentMeasureEnhanced[], showBestMeasures: boolean) => {
+ getVisibleComponents = (components: T.ComponentMeasureEnhanced[], showBestMeasures: boolean) => {
if (showBestMeasures) {
return components;
}
@@ -118,7 +111,7 @@ export default class ListView extends React.PureComponent<Props, State> {
this.setState({ showBestMeasures: true });
};
- hasBestValue = (component: ComponentMeasureEnhanced) => {
+ hasBestValue = (component: T.ComponentMeasureEnhanced) => {
const { metric } = this.props;
const focusedMeasure = component.measures.find(measure => measure.metric.key === metric.key);
if (focusedMeasure && isDiffMetric(metric.key)) {
diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/MeasureCell.tsx b/server/sonar-web/src/main/js/apps/component-measures/drilldown/MeasureCell.tsx
index 951bb590f62..fb1f210e2b2 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/MeasureCell.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/MeasureCell.tsx
@@ -20,12 +20,11 @@
import * as React from 'react';
import Measure from '../../../components/measure/Measure';
import { isDiffMetric } from '../../../helpers/measures';
-import { Metric, MeasureEnhanced, ComponentMeasureEnhanced } from '../../../app/types';
interface Props {
- component: ComponentMeasureEnhanced;
- measure?: MeasureEnhanced;
- metric: Metric;
+ component: T.ComponentMeasureEnhanced;
+ measure?: T.MeasureEnhanced;
+ metric: T.Metric;
}
export default function MeasureCell({ component, measure, metric }: Props) {
diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.tsx b/server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.tsx
index 61a35f44ace..2f07bb3545a 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.tsx
@@ -30,13 +30,12 @@ import TreeMap, { TreeMapItem } from '../../../components/charts/TreeMap';
import { translate, translateWithParameters, getLocalizedMetricName } from '../../../helpers/l10n';
import { formatMeasure, isDiffMetric } from '../../../helpers/measures';
import { getBranchLikeUrl } from '../../../helpers/urls';
-import { BranchLike, ComponentMeasureEnhanced, Metric } from '../../../app/types';
interface Props {
- branchLike?: BranchLike;
- components: ComponentMeasureEnhanced[];
+ branchLike?: T.BranchLike;
+ components: T.ComponentMeasureEnhanced[];
handleSelect: (component: string) => void;
- metric: Metric;
+ metric: T.Metric;
}
interface State {
@@ -105,7 +104,7 @@ export default class TreeMapView extends React.PureComponent<Props, State> {
.domain(['ERROR', 'WARN', 'OK', 'NONE'])
.range(LEVEL_COLORS);
- getPercentColorScale = (metric: Metric) => {
+ getPercentColorScale = (metric: T.Metric) => {
const color = scaleLinear<string, string>().domain([0, 25, 50, 75, 100]);
color.range(metric.direction === 1 ? [...COLORS].reverse() : COLORS);
return color;
@@ -116,7 +115,7 @@ export default class TreeMapView extends React.PureComponent<Props, State> {
.domain([1, 2, 3, 4, 5])
.range(COLORS);
- getColorScale = (metric: Metric) => {
+ getColorScale = (metric: T.Metric) => {
if (metric.type === 'LEVEL') {
return this.getLevelColorScale();
}
@@ -133,10 +132,10 @@ export default class TreeMapView extends React.PureComponent<Props, State> {
sizeMetric,
sizeValue
}: {
- colorMetric: Metric;
+ colorMetric: T.Metric;
colorValue?: string;
componentName: string;
- sizeMetric: Metric;
+ sizeMetric: T.Metric;
sizeValue: number;
}) => {
const formatted =
diff --git a/server/sonar-web/src/main/js/apps/component-measures/sidebar/DomainFacet.tsx b/server/sonar-web/src/main/js/apps/component-measures/sidebar/DomainFacet.tsx
index 1a52f8c80c5..675e94cfaf5 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/sidebar/DomainFacet.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/sidebar/DomainFacet.tsx
@@ -37,10 +37,9 @@ import {
getLocalizedMetricName,
translate
} from '../../../helpers/l10n';
-import { MeasureEnhanced } from '../../../app/types';
interface Props {
- domain: { name: string; measures: MeasureEnhanced[] };
+ domain: { name: string; measures: T.MeasureEnhanced[] };
hasOverview: boolean;
onChange: (metric: string) => void;
onToggle: (property: string) => void;
@@ -63,7 +62,11 @@ export default class DomainFacet extends React.PureComponent<Props> {
this.props.onToggle(this.props.domain.name);
};
- hasFacetSelected = (domain: { name: string }, measures: MeasureEnhanced[], selected: string) => {
+ hasFacetSelected = (
+ domain: { name: string },
+ measures: T.MeasureEnhanced[],
+ selected: string
+ ) => {
const measureSelected = measures.find(measure => measure.metric.key === selected);
const overviewSelected = domain.name === selected && this.hasOverview(domain.name);
return measureSelected || overviewSelected;
@@ -73,7 +76,7 @@ export default class DomainFacet extends React.PureComponent<Props> {
return this.props.hasOverview && hasBubbleChart(domain);
};
- renderItemFacetStat = (item: MeasureEnhanced) => {
+ renderItemFacetStat = (item: T.MeasureEnhanced) => {
return hasFacetStat(item.metric.key) ? <FacetMeasureValue measure={item} /> : null;
};
diff --git a/server/sonar-web/src/main/js/apps/component-measures/sidebar/FacetMeasureValue.tsx b/server/sonar-web/src/main/js/apps/component-measures/sidebar/FacetMeasureValue.tsx
index 473b287cbd7..a9ac8816935 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/sidebar/FacetMeasureValue.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/sidebar/FacetMeasureValue.tsx
@@ -20,10 +20,9 @@
import * as React from 'react';
import Measure from '../../../components/measure/Measure';
import { isDiffMetric } from '../../../helpers/measures';
-import { MeasureEnhanced } from '../../../app/types';
interface Props {
- measure: MeasureEnhanced;
+ measure: T.MeasureEnhanced;
}
export default function FacetMeasureValue({ measure }: Props) {
diff --git a/server/sonar-web/src/main/js/apps/component-measures/sidebar/Sidebar.tsx b/server/sonar-web/src/main/js/apps/component-measures/sidebar/Sidebar.tsx
index 09683497982..6aed80029c9 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/sidebar/Sidebar.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/sidebar/Sidebar.tsx
@@ -21,11 +21,10 @@ import * as React from 'react';
import ProjectOverviewFacet from './ProjectOverviewFacet';
import DomainFacet from './DomainFacet';
import { getDefaultView, groupByDomains, KNOWN_DOMAINS, PROJECT_OVERVEW, Query } from '../utils';
-import { MeasureEnhanced } from '../../../app/types';
interface Props {
hasOverview: boolean;
- measures: MeasureEnhanced[];
+ measures: T.MeasureEnhanced[];
selectedMetric: string;
updateQuery: (query: Partial<Query>) => void;
}
diff --git a/server/sonar-web/src/main/js/apps/component-measures/utils.ts b/server/sonar-web/src/main/js/apps/component-measures/utils.ts
index 05f0713f257..9ea4c49bc28 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/utils.ts
+++ b/server/sonar-web/src/main/js/apps/component-measures/utils.ts
@@ -21,13 +21,6 @@ import { groupBy, memoize, sortBy, toPairs } from 'lodash';
import { domains } from './config/domains';
import { bubbles } from './config/bubbles';
import { getLocalizedMetricName } from '../../helpers/l10n';
-import {
- ComponentMeasure,
- ComponentMeasureEnhanced,
- Metric,
- MeasureEnhanced,
- BranchLike
-} from '../../app/types';
import { enhanceMeasure } from '../../components/measure/utils';
import { cleanQuery, parseAsString, RawQuery, serializeString } from '../../helpers/query';
import { isLongLivingBranch, isMainBranch } from '../../helpers/branches';
@@ -59,30 +52,30 @@ const BANNED_MEASURES = [
'new_info_violations'
];
-export function filterMeasures(measures: MeasureEnhanced[]): MeasureEnhanced[] {
+export function filterMeasures(measures: T.MeasureEnhanced[]): T.MeasureEnhanced[] {
return measures.filter(measure => !BANNED_MEASURES.includes(measure.metric.key));
}
export function sortMeasures(
domainName: string,
- measures: Array<MeasureEnhanced | string>
-): Array<MeasureEnhanced | string> {
+ measures: Array<T.MeasureEnhanced | string>
+): Array<T.MeasureEnhanced | string> {
const config = domains[domainName] || {};
const configOrder = config.order || [];
return sortBy(measures, [
- (item: MeasureEnhanced | string) => {
+ (item: T.MeasureEnhanced | string) => {
if (typeof item === 'string') {
return configOrder.indexOf(item);
}
const idx = configOrder.indexOf(item.metric.key);
return idx >= 0 ? idx : configOrder.length;
},
- (item: MeasureEnhanced | string) =>
+ (item: T.MeasureEnhanced | string) =>
typeof item === 'string' ? item : getLocalizedMetricName(item.metric)
]);
}
-export function addMeasureCategories(domainName: string, measures: MeasureEnhanced[]) {
+export function addMeasureCategories(domainName: string, measures: T.MeasureEnhanced[]) {
const categories = domains[domainName] && domains[domainName].categories;
if (categories && categories.length > 0) {
return [...categories, ...measures];
@@ -91,10 +84,10 @@ export function addMeasureCategories(domainName: string, measures: MeasureEnhanc
}
export function enhanceComponent(
- component: ComponentMeasure,
- metric: Metric | undefined,
- metrics: { [key: string]: Metric }
-): ComponentMeasureEnhanced {
+ component: T.ComponentMeasure,
+ metric: T.Metric | undefined,
+ metrics: { [key: string]: T.Metric }
+): T.ComponentMeasureEnhanced {
if (!component.measures) {
return { ...component, measures: [] };
}
@@ -106,22 +99,22 @@ export function enhanceComponent(
return { ...component, value, leak, measures: enhancedMeasures };
}
-export function isFileType(component: ComponentMeasure): boolean {
+export function isFileType(component: T.ComponentMeasure): boolean {
return ['FIL', 'UTS'].includes(component.qualifier);
}
-export function isViewType(component: ComponentMeasure): boolean {
+export function isViewType(component: T.ComponentMeasure): boolean {
return ['VW', 'SVW', 'APP'].includes(component.qualifier);
}
-export const groupByDomains = memoize((measures: MeasureEnhanced[]) => {
+export const groupByDomains = memoize((measures: T.MeasureEnhanced[]) => {
const domains = toPairs(groupBy(measures, measure => measure.metric.domain)).map(r => ({
name: r[0],
measures: r[1]
}));
return sortBy(domains, [
- (domain: { name: string; measures: MeasureEnhanced[] }) => {
+ (domain: { name: string; measures: T.MeasureEnhanced[] }) => {
const idx = KNOWN_DOMAINS.indexOf(domain.name);
return idx >= 0 ? idx : KNOWN_DOMAINS.length;
},
@@ -156,11 +149,14 @@ export function hasFacetStat(metric: string): boolean {
return metric !== 'alert_status';
}
-export function hasFullMeasures(branch?: BranchLike) {
+export function hasFullMeasures(branch?: T.BranchLike) {
return !branch || isLongLivingBranch(branch) || isMainBranch(branch);
}
-export function getMeasuresPageMetricKeys(metrics: { [key: string]: Metric }, branch?: BranchLike) {
+export function getMeasuresPageMetricKeys(
+ metrics: { [key: string]: T.Metric },
+ branch?: T.BranchLike
+) {
if (!hasFullMeasures(branch)) {
return [
'coverage',
@@ -182,7 +178,7 @@ export function getMeasuresPageMetricKeys(metrics: { [key: string]: Metric }, br
return getDisplayMetrics(Object.values(metrics)).map(metric => metric.key);
}
-export function getBubbleMetrics(domain: string, metrics: { [key: string]: Metric }) {
+export function getBubbleMetrics(domain: string, metrics: { [key: string]: T.Metric }) {
const conf = bubbles[domain];
return {
x: metrics[conf.x],
diff --git a/server/sonar-web/src/main/js/apps/create/components/OrganizationSelect.tsx b/server/sonar-web/src/main/js/apps/create/components/OrganizationSelect.tsx
index 321548ec75d..84751b58556 100644
--- a/server/sonar-web/src/main/js/apps/create/components/OrganizationSelect.tsx
+++ b/server/sonar-web/src/main/js/apps/create/components/OrganizationSelect.tsx
@@ -20,16 +20,15 @@
import * as React from 'react';
import { sortBy } from 'lodash';
import Select from '../../../components/controls/Select';
-import { Organization } from '../../../app/types';
import { translate } from '../../../helpers/l10n';
import { sanitizeAlmId } from '../../../helpers/almIntegrations';
import { getBaseUrl } from '../../../helpers/urls';
interface Props {
hideIcons?: boolean;
- onChange: (organization: Organization) => void;
+ onChange: (organization: T.Organization) => void;
organization: string;
- organizations: Organization[];
+ organizations: T.Organization[];
}
export default function OrganizationSelect({
@@ -59,7 +58,7 @@ export default function OrganizationSelect({
}
export function getOptionRenderer(hideIcons?: boolean) {
- return function optionRenderer(organization: Organization) {
+ return function optionRenderer(organization: T.Organization) {
const icon = organization.alm
? `sonarcloud/${sanitizeAlmId(organization.alm.key)}`
: 'sonarcloud-square-logo';
diff --git a/server/sonar-web/src/main/js/apps/create/organization/AutoOrganizationBind.tsx b/server/sonar-web/src/main/js/apps/create/organization/AutoOrganizationBind.tsx
index f8275990c8d..0436f276ce7 100644
--- a/server/sonar-web/src/main/js/apps/create/organization/AutoOrganizationBind.tsx
+++ b/server/sonar-web/src/main/js/apps/create/organization/AutoOrganizationBind.tsx
@@ -20,13 +20,12 @@
import * as React from 'react';
import DeferredSpinner from '../../../components/common/DeferredSpinner';
import OrganizationSelect from '../components/OrganizationSelect';
-import { Organization } from '../../../app/types';
import { SubmitButton } from '../../../components/ui/buttons';
import { translate } from '../../../helpers/l10n';
interface Props {
onBindOrganization: (organization: string) => Promise<void>;
- unboundOrganizations: Organization[];
+ unboundOrganizations: T.Organization[];
}
interface State {
@@ -57,7 +56,7 @@ export default class AutoOrganizationBind extends React.PureComponent<Props, Sta
return '';
}
- handleChange = ({ key }: Organization) => {
+ handleChange = ({ key }: T.Organization) => {
this.setState({ organization: key });
};
diff --git a/server/sonar-web/src/main/js/apps/create/organization/AutoOrganizationCreate.tsx b/server/sonar-web/src/main/js/apps/create/organization/AutoOrganizationCreate.tsx
index 178e1e12d41..06fa37b4e9d 100644
--- a/server/sonar-web/src/main/js/apps/create/organization/AutoOrganizationCreate.tsx
+++ b/server/sonar-web/src/main/js/apps/create/organization/AutoOrganizationCreate.tsx
@@ -26,13 +26,6 @@ import OrganizationDetailsForm from './OrganizationDetailsForm';
import { Query } from './utils';
import RadioToggle from '../../../components/controls/RadioToggle';
import { DeleteButton } from '../../../components/ui/buttons';
-import {
- AlmApplication,
- AlmOrganization,
- AlmUnboundApplication,
- Organization,
- OrganizationBase
-} from '../../../app/types';
import { bindAlmOrganization } from '../../../api/alm-integration';
import { sanitizeAlmId } from '../../../helpers/almIntegrations';
import { translate } from '../../../helpers/l10n';
@@ -44,17 +37,17 @@ export enum Filters {
}
interface Props {
- almApplication: AlmApplication;
+ almApplication: T.AlmApplication;
almInstallId?: string;
- almOrganization?: AlmOrganization;
- almUnboundApplications: AlmUnboundApplication[];
- boundOrganization?: OrganizationBase;
+ almOrganization?: T.AlmOrganization;
+ almUnboundApplications: T.AlmUnboundApplication[];
+ boundOrganization?: T.OrganizationBase;
className?: string;
createOrganization: (
- organization: OrganizationBase & { installationId?: string }
- ) => Promise<Organization>;
+ organization: T.OrganizationBase & { installationId?: string }
+ ) => Promise<T.Organization>;
onOrgCreated: (organization: string, justCreated?: boolean) => void;
- unboundOrganizations: Organization[];
+ unboundOrganizations: T.Organization[];
updateUrlQuery: (query: Partial<Query>) => void;
}
@@ -84,7 +77,7 @@ export default class AutoOrganizationCreate extends React.PureComponent<Props, S
this.props.updateUrlQuery({ almInstallId: undefined, almKey: undefined });
};
- handleCreateOrganization = (organization: Required<OrganizationBase>) => {
+ handleCreateOrganization = (organization: Required<T.OrganizationBase>) => {
return this.props
.createOrganization({
avatar: organization.avatar,
@@ -101,7 +94,7 @@ export default class AutoOrganizationCreate extends React.PureComponent<Props, S
this.setState({ filter });
};
- renderContent = (almOrganization: AlmOrganization) => {
+ renderContent = (almOrganization: T.AlmOrganization) => {
const { almApplication, unboundOrganizations } = this.props;
const { filter } = this.state;
diff --git a/server/sonar-web/src/main/js/apps/create/organization/AutoPersonalOrganizationBind.tsx b/server/sonar-web/src/main/js/apps/create/organization/AutoPersonalOrganizationBind.tsx
index 5191bbee8be..875e0b8555b 100644
--- a/server/sonar-web/src/main/js/apps/create/organization/AutoPersonalOrganizationBind.tsx
+++ b/server/sonar-web/src/main/js/apps/create/organization/AutoPersonalOrganizationBind.tsx
@@ -22,26 +22,20 @@ import { FormattedMessage } from 'react-intl';
import OrganizationDetailsForm from './OrganizationDetailsForm';
import { Query } from './utils';
import { DeleteButton } from '../../../components/ui/buttons';
-import {
- AlmApplication,
- AlmOrganization,
- OrganizationBase,
- Organization
-} from '../../../app/types';
import { getBaseUrl } from '../../../helpers/urls';
import { translate } from '../../../helpers/l10n';
import { sanitizeAlmId } from '../../../helpers/almIntegrations';
import OrganizationAvatar from '../../../components/common/OrganizationAvatar';
interface Props {
- almApplication: AlmApplication;
+ almApplication: T.AlmApplication;
almInstallId?: string;
- almOrganization: AlmOrganization;
- importPersonalOrg: Organization;
+ almOrganization: T.AlmOrganization;
+ importPersonalOrg: T.Organization;
onOrgCreated: (organization: string) => void;
updateOrganization: (
- organization: OrganizationBase & { installationId?: string }
- ) => Promise<Organization>;
+ organization: T.OrganizationBase & { installationId?: string }
+ ) => Promise<T.Organization>;
updateUrlQuery: (query: Partial<Query>) => void;
}
@@ -50,7 +44,7 @@ export default class AutoPersonalOrganizationBind extends React.PureComponent<Pr
this.props.updateUrlQuery({ almInstallId: undefined, almKey: undefined });
};
- handleCreateOrganization = (organization: Required<OrganizationBase>) => {
+ handleCreateOrganization = (organization: Required<T.OrganizationBase>) => {
return this.props
.updateOrganization({
avatar: organization.avatar,
diff --git a/server/sonar-web/src/main/js/apps/create/organization/BillingFormShim.tsx b/server/sonar-web/src/main/js/apps/create/organization/BillingFormShim.tsx
index df4a59ebce6..ce44586f84a 100644
--- a/server/sonar-web/src/main/js/apps/create/organization/BillingFormShim.tsx
+++ b/server/sonar-web/src/main/js/apps/create/organization/BillingFormShim.tsx
@@ -18,7 +18,6 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { CurrentUser, SubscriptionPlan } from '../../../app/types';
interface ChildrenProps {
onSubmit: React.FormEventHandler;
@@ -29,11 +28,11 @@ interface ChildrenProps {
interface Props {
children: (props: ChildrenProps) => React.ReactElement<any>;
initialCountry?: string;
- currentUser: CurrentUser;
+ currentUser: T.CurrentUser;
onCommit: () => void;
onFailToUpgrade?: () => void;
organizationKey: string | (() => Promise<string>);
- subscriptionPlans: SubscriptionPlan[];
+ subscriptionPlans: T.SubscriptionPlan[];
}
export default class BillingFormShim extends React.Component<Props> {
diff --git a/server/sonar-web/src/main/js/apps/create/organization/CreateOrganization.tsx b/server/sonar-web/src/main/js/apps/create/organization/CreateOrganization.tsx
index 8c4b57192ea..1de0e054c9b 100644
--- a/server/sonar-web/src/main/js/apps/create/organization/CreateOrganization.tsx
+++ b/server/sonar-web/src/main/js/apps/create/organization/CreateOrganization.tsx
@@ -50,15 +50,6 @@ import {
listUnboundApplications
} from '../../../api/alm-integration';
import { getSubscriptionPlans } from '../../../api/billing';
-import {
- AlmApplication,
- AlmOrganization,
- AlmUnboundApplication,
- LoggedInUser,
- Organization,
- OrganizationBase,
- SubscriptionPlan
-} from '../../../app/types';
import { hasAdvancedALMIntegration, isPersonal } from '../../../helpers/almIntegrations';
import { translate } from '../../../helpers/l10n';
import { get, remove } from '../../../helpers/storage';
@@ -72,26 +63,26 @@ import '../../tutorials/styles.css'; // TODO remove me
interface Props {
createOrganization: (
- organization: OrganizationBase & { installationId?: string }
- ) => Promise<Organization>;
- currentUser: LoggedInUser;
+ organization: T.OrganizationBase & { installationId?: string }
+ ) => Promise<T.Organization>;
+ currentUser: T.LoggedInUser;
deleteOrganization: (key: string) => Promise<void>;
updateOrganization: (
- organization: OrganizationBase & { installationId?: string }
- ) => Promise<Organization>;
- userOrganizations: Organization[];
+ organization: T.OrganizationBase & { installationId?: string }
+ ) => Promise<T.Organization>;
+ userOrganizations: T.Organization[];
skipOnboarding: () => void;
}
interface State {
- almApplication?: AlmApplication;
- almOrganization?: AlmOrganization;
+ almApplication?: T.AlmApplication;
+ almOrganization?: T.AlmOrganization;
almOrgLoading: boolean;
- almUnboundApplications: AlmUnboundApplication[];
- boundOrganization?: OrganizationBase;
+ almUnboundApplications: T.AlmUnboundApplication[];
+ boundOrganization?: T.OrganizationBase;
loading: boolean;
- organization?: Organization;
- subscriptionPlans?: SubscriptionPlan[];
+ organization?: T.Organization;
+ subscriptionPlans?: T.SubscriptionPlan[];
}
type StateWithAutoImport = State & Required<Pick<State, 'almApplication'>>;
@@ -168,7 +159,7 @@ export class CreateOrganization extends React.PureComponent<Props & WithRouterPr
return Boolean(state.almApplication && !paid);
}
- setValidOrgKey = (almOrganization: AlmOrganization) => {
+ setValidOrgKey = (almOrganization: T.AlmOrganization) => {
const key = slugify(almOrganization.key);
const keys = [key, ...times(9, i => `${key}-${i + 1}`)];
return api
@@ -273,7 +264,7 @@ export class CreateOrganization extends React.PureComponent<Props & WithRouterPr
});
};
- renderContent = (almInstallId?: string, importPersonalOrg?: Organization) => {
+ renderContent = (almInstallId?: string, importPersonalOrg?: T.Organization) => {
const { currentUser, location } = this.props;
const { state } = this;
const { almOrganization } = state;
@@ -396,9 +387,9 @@ export class CreateOrganization extends React.PureComponent<Props & WithRouterPr
}
}
-function createOrganization(organization: OrganizationBase & { installationId?: string }) {
+function createOrganization(organization: T.OrganizationBase & { installationId?: string }) {
return (dispatch: Dispatch) => {
- return api.createOrganization(organization).then((organization: Organization) => {
+ return api.createOrganization(organization).then((organization: T.Organization) => {
dispatch(actions.createOrganization(organization));
return organization;
});
@@ -406,7 +397,7 @@ function createOrganization(organization: OrganizationBase & { installationId?:
}
function updateOrganization(
- organization: OrganizationBase & { key: string; installationId?: string }
+ organization: T.OrganizationBase & { key: string; installationId?: string }
) {
return (dispatch: Dispatch) => {
const { key, installationId, ...changes } = organization;
diff --git a/server/sonar-web/src/main/js/apps/create/organization/ManualOrganizationCreate.tsx b/server/sonar-web/src/main/js/apps/create/organization/ManualOrganizationCreate.tsx
index 4f67564ddbf..ea69f4ad3a5 100644
--- a/server/sonar-web/src/main/js/apps/create/organization/ManualOrganizationCreate.tsx
+++ b/server/sonar-web/src/main/js/apps/create/organization/ManualOrganizationCreate.tsx
@@ -22,16 +22,15 @@ import OrganizationDetailsForm from './OrganizationDetailsForm';
import OrganizationDetailsStep from './OrganizationDetailsStep';
import PlanStep from './PlanStep';
import { formatPrice } from './utils';
-import { OrganizationBase, Organization, SubscriptionPlan } from '../../../app/types';
import { translate } from '../../../helpers/l10n';
interface Props {
- createOrganization: (organization: OrganizationBase) => Promise<Organization>;
+ createOrganization: (organization: T.OrganizationBase) => Promise<T.Organization>;
className?: string;
deleteOrganization: (key: string) => Promise<void>;
onOrgCreated: (organization: string) => void;
onlyPaid?: boolean;
- subscriptionPlans?: SubscriptionPlan[];
+ subscriptionPlans?: T.SubscriptionPlan[];
}
enum Step {
@@ -40,7 +39,7 @@ enum Step {
}
interface State {
- organization?: Organization;
+ organization?: T.Organization;
step: Step;
}
@@ -60,7 +59,7 @@ export default class ManualOrganizationCreate extends React.PureComponent<Props,
this.setState({ step: Step.OrganizationDetails });
};
- handleOrganizationDetailsFinish = (organization: Required<OrganizationBase>) => {
+ handleOrganizationDetailsFinish = (organization: Required<T.OrganizationBase>) => {
this.setState({ organization, step: Step.Plan });
return Promise.resolve();
};
diff --git a/server/sonar-web/src/main/js/apps/create/organization/OrganizationDetailsForm.tsx b/server/sonar-web/src/main/js/apps/create/organization/OrganizationDetailsForm.tsx
index de7330f912f..a3dbc4e49a9 100644
--- a/server/sonar-web/src/main/js/apps/create/organization/OrganizationDetailsForm.tsx
+++ b/server/sonar-web/src/main/js/apps/create/organization/OrganizationDetailsForm.tsx
@@ -25,16 +25,15 @@ import OrganizationDescriptionInput from '../components/OrganizationDescriptionI
import OrganizationKeyInput from '../components/OrganizationKeyInput';
import OrganizationNameInput from '../components/OrganizationNameInput';
import OrganizationUrlInput from '../components/OrganizationUrlInput';
-import { OrganizationBase } from '../../../app/types';
import { ResetButtonLink, SubmitButton } from '../../../components/ui/buttons';
import { translate } from '../../../helpers/l10n';
-type RequiredOrganization = Required<OrganizationBase>;
+type RequiredOrganization = Required<T.OrganizationBase>;
interface Props {
keyReadOnly?: boolean;
onContinue: (organization: RequiredOrganization) => Promise<void>;
- organization?: OrganizationBase & { key: string };
+ organization?: T.OrganizationBase & { key: string };
submitText: string;
}
diff --git a/server/sonar-web/src/main/js/apps/create/organization/OrganizationDetailsStep.tsx b/server/sonar-web/src/main/js/apps/create/organization/OrganizationDetailsStep.tsx
index b10abe71323..978b7faa200 100644
--- a/server/sonar-web/src/main/js/apps/create/organization/OrganizationDetailsStep.tsx
+++ b/server/sonar-web/src/main/js/apps/create/organization/OrganizationDetailsStep.tsx
@@ -21,14 +21,13 @@ import * as React from 'react';
import Step from '../../tutorials/components/Step';
import { translate } from '../../../helpers/l10n';
import AlertSuccessIcon from '../../../components/icons-components/AlertSuccessIcon';
-import { OrganizationBase } from '../../../app/types';
interface Props {
children: React.ReactNode;
finished: boolean;
onOpen: () => void;
open: boolean;
- organization?: OrganizationBase & { key: string };
+ organization?: T.OrganizationBase & { key: string };
}
export default class OrganizationDetailsStep extends React.PureComponent<Props> {
renderForm = () => {
diff --git a/server/sonar-web/src/main/js/apps/create/organization/PlanStep.tsx b/server/sonar-web/src/main/js/apps/create/organization/PlanStep.tsx
index 8a5517068c8..ffb191a0e68 100644
--- a/server/sonar-web/src/main/js/apps/create/organization/PlanStep.tsx
+++ b/server/sonar-web/src/main/js/apps/create/organization/PlanStep.tsx
@@ -24,7 +24,6 @@ import Step from '../../tutorials/components/Step';
import { withCurrentUser } from '../../../components/hoc/withCurrentUser';
import { translate } from '../../../helpers/l10n';
import { getExtensionStart } from '../../../app/components/extensions/utils';
-import { SubscriptionPlan } from '../../../app/types';
import { SubmitButton } from '../../../components/ui/buttons';
import DeferredSpinner from '../../../components/common/DeferredSpinner';
@@ -38,7 +37,7 @@ interface Props {
onlyPaid?: boolean;
open: boolean;
startingPrice: string;
- subscriptionPlans: SubscriptionPlan[];
+ subscriptionPlans: T.SubscriptionPlan[];
}
interface State {
diff --git a/server/sonar-web/src/main/js/apps/create/organization/RemoteOrganizationChoose.tsx b/server/sonar-web/src/main/js/apps/create/organization/RemoteOrganizationChoose.tsx
index 8ac73dfba21..199fa8899e9 100644
--- a/server/sonar-web/src/main/js/apps/create/organization/RemoteOrganizationChoose.tsx
+++ b/server/sonar-web/src/main/js/apps/create/organization/RemoteOrganizationChoose.tsx
@@ -27,23 +27,17 @@ import OrganizationAvatar from '../../../components/common/OrganizationAvatar';
import Select from '../../../components/controls/Select';
import { Alert } from '../../../components/ui/Alert';
import { SubmitButton } from '../../../components/ui/buttons';
-import {
- AlmApplication,
- AlmOrganization,
- AlmUnboundApplication,
- OrganizationBase
-} from '../../../app/types';
import { sanitizeAlmId } from '../../../helpers/almIntegrations';
import { translate } from '../../../helpers/l10n';
import { save } from '../../../helpers/storage';
import { getBaseUrl } from '../../../helpers/urls';
interface Props {
- almApplication: AlmApplication;
+ almApplication: T.AlmApplication;
almInstallId?: string;
- almOrganization?: AlmOrganization;
- almUnboundApplications: AlmUnboundApplication[];
- boundOrganization?: OrganizationBase;
+ almOrganization?: T.AlmOrganization;
+ almUnboundApplications: T.AlmUnboundApplication[];
+ boundOrganization?: T.OrganizationBase;
}
interface State {
@@ -72,11 +66,11 @@ export class RemoteOrganizationChoose extends React.PureComponent<Props & WithRo
save(ORGANIZATION_IMPORT_BINDING_IN_PROGRESS_TIMESTAMP, Date.now().toString(10));
};
- handleInstallationChange = ({ installationId }: AlmUnboundApplication) => {
+ handleInstallationChange = ({ installationId }: T.AlmUnboundApplication) => {
this.setState({ unboundInstallationId: installationId });
};
- renderOption = (organization: AlmUnboundApplication) => {
+ renderOption = (organization: T.AlmUnboundApplication) => {
const { almApplication } = this.props;
return (
<span>
diff --git a/server/sonar-web/src/main/js/apps/create/organization/__tests__/CreateOrganization-test.tsx b/server/sonar-web/src/main/js/apps/create/organization/__tests__/CreateOrganization-test.tsx
index ece50179d3f..f4471222b68 100644
--- a/server/sonar-web/src/main/js/apps/create/organization/__tests__/CreateOrganization-test.tsx
+++ b/server/sonar-web/src/main/js/apps/create/organization/__tests__/CreateOrganization-test.tsx
@@ -23,7 +23,6 @@ import { Location } from 'history';
import { shallow } from 'enzyme';
import { CreateOrganization } from '../CreateOrganization';
import { mockRouter, waitAndUpdate } from '../../../../helpers/testUtils';
-import { LoggedInUser } from '../../../../app/types';
import {
getAlmAppInfo,
getAlmOrganization,
@@ -71,7 +70,7 @@ jest.mock('../../../../helpers/storage', () => ({
remove: jest.fn()
}));
-const user: LoggedInUser = {
+const user: T.LoggedInUser = {
groups: [],
isLoggedIn: true,
login: 'luke',
diff --git a/server/sonar-web/src/main/js/apps/create/project/AlmRepositoryItem.tsx b/server/sonar-web/src/main/js/apps/create/project/AlmRepositoryItem.tsx
index cf360366a10..aa700e4ce57 100644
--- a/server/sonar-web/src/main/js/apps/create/project/AlmRepositoryItem.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/AlmRepositoryItem.tsx
@@ -24,15 +24,14 @@ import * as theme from '../../../app/theme';
import Checkbox from '../../../components/controls/Checkbox';
import CheckIcon from '../../../components/icons-components/CheckIcon';
import Tooltip from '../../../components/controls/Tooltip';
-import { AlmRepository, IdentityProvider } from '../../../app/types';
import { getBaseUrl, getProjectUrl } from '../../../helpers/urls';
import { translate } from '../../../helpers/l10n';
interface Props {
- identityProvider: IdentityProvider;
- repository: AlmRepository;
+ identityProvider: T.IdentityProvider;
+ repository: T.AlmRepository;
selected: boolean;
- toggleRepository: (repository: AlmRepository) => void;
+ toggleRepository: (repository: T.AlmRepository) => void;
}
export default class AlmRepositoryItem extends React.PureComponent<Props> {
diff --git a/server/sonar-web/src/main/js/apps/create/project/AutoProjectCreate.tsx b/server/sonar-web/src/main/js/apps/create/project/AutoProjectCreate.tsx
index 1440a56ab88..70f4f76cacd 100644
--- a/server/sonar-web/src/main/js/apps/create/project/AutoProjectCreate.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/AutoProjectCreate.tsx
@@ -21,7 +21,6 @@ import * as React from 'react';
import RemoteRepositories from './RemoteRepositories';
import OrganizationInput from './OrganizationInput';
import IdentityProviderLink from '../../../components/ui/IdentityProviderLink';
-import { AlmApplication, Organization } from '../../../app/types';
import {
ORGANIZATION_IMPORT_BINDING_IN_PROGRESS_TIMESTAMP,
ORGANIZATION_IMPORT_REDIRECT_TO_PROJECT_TIMESTAMP
@@ -30,8 +29,8 @@ import { translate } from '../../../helpers/l10n';
import { save } from '../../../helpers/storage';
interface Props {
- almApplication: AlmApplication;
- boundOrganizations: Organization[];
+ almApplication: T.AlmApplication;
+ boundOrganizations: T.Organization[];
onProjectCreate: (projectKeys: string[], organization: string) => void;
organization?: string;
}
@@ -61,7 +60,7 @@ export default class AutoProjectCreate extends React.PureComponent<Props, State>
save(ORGANIZATION_IMPORT_REDIRECT_TO_PROJECT_TIMESTAMP, Date.now().toString(10));
};
- handleOrganizationSelect = ({ key }: Organization) => {
+ handleOrganizationSelect = ({ key }: T.Organization) => {
this.setState({ selectedOrganization: key });
};
diff --git a/server/sonar-web/src/main/js/apps/create/project/CreateProjectPage.tsx b/server/sonar-web/src/main/js/apps/create/project/CreateProjectPage.tsx
index d6e6cdab45e..882bf5b36a9 100644
--- a/server/sonar-web/src/main/js/apps/create/project/CreateProjectPage.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/CreateProjectPage.tsx
@@ -28,7 +28,6 @@ import Tabs from '../../../components/controls/Tabs';
import { whenLoggedIn } from '../../../components/hoc/whenLoggedIn';
import { withUserOrganizations } from '../../../components/hoc/withUserOrganizations';
import { skipOnboarding } from '../../../store/users';
-import { LoggedInUser, AlmApplication, Organization } from '../../../app/types';
import { getAlmAppInfo } from '../../../api/alm-integration';
import { hasAdvancedALMIntegration } from '../../../helpers/almIntegrations';
import { translate } from '../../../helpers/l10n';
@@ -36,13 +35,13 @@ import { getProjectUrl, getOrganizationUrl } from '../../../helpers/urls';
import '../../../app/styles/sonarcloud.css';
interface Props {
- currentUser: LoggedInUser;
+ currentUser: T.LoggedInUser;
skipOnboarding: () => void;
- userOrganizations: Organization[];
+ userOrganizations: T.Organization[];
}
interface State {
- almApplication?: AlmApplication;
+ almApplication?: T.AlmApplication;
loading: boolean;
}
diff --git a/server/sonar-web/src/main/js/apps/create/project/ManualProjectCreate.tsx b/server/sonar-web/src/main/js/apps/create/project/ManualProjectCreate.tsx
index 2fc7cb8d183..a9551883464 100644
--- a/server/sonar-web/src/main/js/apps/create/project/ManualProjectCreate.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/ManualProjectCreate.tsx
@@ -22,16 +22,15 @@ import OrganizationInput from './OrganizationInput';
import DeferredSpinner from '../../../components/common/DeferredSpinner';
import { SubmitButton } from '../../../components/ui/buttons';
import { createProject } from '../../../api/components';
-import { LoggedInUser, Organization } from '../../../app/types';
import { translate } from '../../../helpers/l10n';
import ProjectKeyInput from '../components/ProjectKeyInput';
import ProjectNameInput from '../components/ProjectNameInput';
interface Props {
- currentUser: LoggedInUser;
+ currentUser: T.LoggedInUser;
onProjectCreate: (projectKeys: string[]) => void;
organization?: string;
- userOrganizations: Organization[];
+ userOrganizations: T.Organization[];
}
interface State {
@@ -96,7 +95,7 @@ export default class ManualProjectCreate extends React.PureComponent<Props, Stat
}
};
- handleOrganizationSelect = ({ key }: Organization) => {
+ handleOrganizationSelect = ({ key }: T.Organization) => {
this.setState({ selectedOrganization: key });
};
diff --git a/server/sonar-web/src/main/js/apps/create/project/OrganizationInput.tsx b/server/sonar-web/src/main/js/apps/create/project/OrganizationInput.tsx
index 6a52175bfcb..a4d3b7e3f96 100644
--- a/server/sonar-web/src/main/js/apps/create/project/OrganizationInput.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/OrganizationInput.tsx
@@ -21,15 +21,14 @@ import * as React from 'react';
import { WithRouterProps, withRouter } from 'react-router';
import OrganizationSelect from '../components/OrganizationSelect';
import { ORGANIZATION_IMPORT_REDIRECT_TO_PROJECT_TIMESTAMP } from '../organization/utils';
-import { Organization } from '../../../app/types';
import { translate } from '../../../helpers/l10n';
import { save } from '../../../helpers/storage';
interface Props {
autoImport?: boolean;
- onChange: (organization: Organization) => void;
+ onChange: (organization: T.Organization) => void;
organization: string;
- organizations: Organization[];
+ organizations: T.Organization[];
}
export class OrganizationInput extends React.PureComponent<Props & WithRouterProps> {
diff --git a/server/sonar-web/src/main/js/apps/create/project/RemoteRepositories.tsx b/server/sonar-web/src/main/js/apps/create/project/RemoteRepositories.tsx
index dd5c5bd2d84..c2a895ecc60 100644
--- a/server/sonar-web/src/main/js/apps/create/project/RemoteRepositories.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/RemoteRepositories.tsx
@@ -21,21 +21,20 @@ import * as React from 'react';
import AlmRepositoryItem from './AlmRepositoryItem';
import DeferredSpinner from '../../../components/common/DeferredSpinner';
import { getRepositories, provisionProject } from '../../../api/alm-integration';
-import { AlmApplication, AlmRepository } from '../../../app/types';
import { SubmitButton } from '../../../components/ui/buttons';
import { translate } from '../../../helpers/l10n';
interface Props {
- almApplication: AlmApplication;
+ almApplication: T.AlmApplication;
onProjectCreate: (projectKeys: string[], organization: string) => void;
organization: string;
}
-type SelectedRepositories = { [key: string]: AlmRepository | undefined };
+type SelectedRepositories = { [key: string]: T.AlmRepository | undefined };
interface State {
loading: boolean;
- repositories: AlmRepository[];
+ repositories: T.AlmRepository[];
selectedRepositories: SelectedRepositories;
submitting: boolean;
}
@@ -123,7 +122,7 @@ export default class RemoteRepositories extends React.PureComponent<Props, State
);
};
- toggleRepository = (repository: AlmRepository) => {
+ toggleRepository = (repository: T.AlmRepository) => {
this.setState(({ selectedRepositories }) => ({
selectedRepositories: {
...selectedRepositories,
diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/CreateProjectPage-test.tsx b/server/sonar-web/src/main/js/apps/create/project/__tests__/CreateProjectPage-test.tsx
index 95f3a5eabcb..707e1871d7d 100644
--- a/server/sonar-web/src/main/js/apps/create/project/__tests__/CreateProjectPage-test.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/CreateProjectPage-test.tsx
@@ -20,7 +20,6 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import { CreateProjectPage } from '../CreateProjectPage';
-import { LoggedInUser } from '../../../../app/types';
import { waitAndUpdate, mockRouter } from '../../../../helpers/testUtils';
import { getAlmAppInfo } from '../../../../api/alm-integration';
@@ -36,7 +35,7 @@ jest.mock('../../../../api/alm-integration', () => ({
})
}));
-const user: LoggedInUser = {
+const user: T.LoggedInUser = {
externalProvider: 'github',
groups: [],
isLoggedIn: true,
diff --git a/server/sonar-web/src/main/js/apps/custom-measures/components/App.tsx b/server/sonar-web/src/main/js/apps/custom-measures/components/App.tsx
index 620b3f6a528..8d23734dc0a 100644
--- a/server/sonar-web/src/main/js/apps/custom-measures/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/custom-measures/components/App.tsx
@@ -27,7 +27,6 @@ import {
updateCustomMeasure,
deleteCustomMeasure
} from '../../../api/measures';
-import { Paging, CustomMeasure } from '../../../app/types';
import Suggestions from '../../../app/components/embed-docs-modal/Suggestions';
import ListFooter from '../../../components/controls/ListFooter';
import { translate } from '../../../helpers/l10n';
@@ -38,8 +37,8 @@ interface Props {
interface State {
loading: boolean;
- measures?: CustomMeasure[];
- paging?: Paging;
+ measures?: T.CustomMeasure[];
+ paging?: T.Paging;
}
const PAGE_SIZE = 50;
diff --git a/server/sonar-web/src/main/js/apps/custom-measures/components/DeleteForm.tsx b/server/sonar-web/src/main/js/apps/custom-measures/components/DeleteForm.tsx
index f8da5faad95..e23131b5dd8 100644
--- a/server/sonar-web/src/main/js/apps/custom-measures/components/DeleteForm.tsx
+++ b/server/sonar-web/src/main/js/apps/custom-measures/components/DeleteForm.tsx
@@ -18,14 +18,13 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { CustomMeasure } from '../../../app/types';
import SimpleModal from '../../../components/controls/SimpleModal';
import DeferredSpinner from '../../../components/common/DeferredSpinner';
import { SubmitButton, ResetButtonLink } from '../../../components/ui/buttons';
import { translate, translateWithParameters } from '../../../helpers/l10n';
interface Props {
- measure: CustomMeasure;
+ measure: T.CustomMeasure;
onClose: () => void;
onSubmit: () => Promise<void>;
}
diff --git a/server/sonar-web/src/main/js/apps/custom-measures/components/Form.tsx b/server/sonar-web/src/main/js/apps/custom-measures/components/Form.tsx
index 40c2a87f64e..2ab28d4ec84 100644
--- a/server/sonar-web/src/main/js/apps/custom-measures/components/Form.tsx
+++ b/server/sonar-web/src/main/js/apps/custom-measures/components/Form.tsx
@@ -19,7 +19,6 @@
*/
import * as React from 'react';
import { getAllMetrics } from '../../../api/metrics';
-import { CustomMeasure, Metric } from '../../../app/types';
import DeferredSpinner from '../../../components/common/DeferredSpinner';
import Select from '../../../components/controls/Select';
import SimpleModal from '../../../components/controls/SimpleModal';
@@ -30,7 +29,7 @@ import { Alert } from '../../../components/ui/Alert';
interface Props {
confirmButtonText: string;
header: string;
- measure?: CustomMeasure;
+ measure?: T.CustomMeasure;
onClose: () => void;
onSubmit: (data: { description: string; metricKey: string; value: string }) => Promise<void>;
skipMetrics?: string[];
@@ -40,7 +39,7 @@ interface State {
description: string;
loading: boolean;
metricKey?: string;
- metrics?: Metric[];
+ metrics?: T.Metric[];
value: string;
}
diff --git a/server/sonar-web/src/main/js/apps/custom-measures/components/Item.tsx b/server/sonar-web/src/main/js/apps/custom-measures/components/Item.tsx
index 335d89faacd..a34438f6679 100644
--- a/server/sonar-web/src/main/js/apps/custom-measures/components/Item.tsx
+++ b/server/sonar-web/src/main/js/apps/custom-measures/components/Item.tsx
@@ -21,7 +21,6 @@ import * as React from 'react';
import DeleteForm from './DeleteForm';
import Form from './Form';
import MeasureDate from './MeasureDate';
-import { CustomMeasure } from '../../../app/types';
import ActionsDropdown, {
ActionsDropdownDivider,
ActionsDropdownItem
@@ -31,7 +30,7 @@ import { translate } from '../../../helpers/l10n';
import { formatMeasure } from '../../../helpers/measures';
interface Props {
- measure: CustomMeasure;
+ measure: T.CustomMeasure;
onDelete: (measureId: string) => Promise<void>;
onEdit: (data: { description: string; id: string; value: string }) => Promise<void>;
}
diff --git a/server/sonar-web/src/main/js/apps/custom-measures/components/List.tsx b/server/sonar-web/src/main/js/apps/custom-measures/components/List.tsx
index f26474192d1..4d691d38a4b 100644
--- a/server/sonar-web/src/main/js/apps/custom-measures/components/List.tsx
+++ b/server/sonar-web/src/main/js/apps/custom-measures/components/List.tsx
@@ -20,11 +20,10 @@
import * as React from 'react';
import { sortBy } from 'lodash';
import Item from './Item';
-import { CustomMeasure } from '../../../app/types';
import { translate } from '../../../helpers/l10n';
interface Props {
- measures: CustomMeasure[];
+ measures: T.CustomMeasure[];
onDelete: (measureId: string) => Promise<void>;
onEdit: (data: { description: string; id: string; value: string }) => Promise<void>;
}
diff --git a/server/sonar-web/src/main/js/apps/custom-measures/components/MeasureDate.tsx b/server/sonar-web/src/main/js/apps/custom-measures/components/MeasureDate.tsx
index cde3f66e28d..8fd76ecebb0 100644
--- a/server/sonar-web/src/main/js/apps/custom-measures/components/MeasureDate.tsx
+++ b/server/sonar-web/src/main/js/apps/custom-measures/components/MeasureDate.tsx
@@ -18,12 +18,11 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { CustomMeasure } from '../../../app/types';
import DateFormatter from '../../../components/intl/DateFormatter';
import { translate } from '../../../helpers/l10n';
interface Props {
- measure: CustomMeasure;
+ measure: T.CustomMeasure;
}
export default function MeasureDate({ measure }: Props) {
diff --git a/server/sonar-web/src/main/js/apps/custom-metrics/components/App.tsx b/server/sonar-web/src/main/js/apps/custom-metrics/components/App.tsx
index a8f87cf9941..e55a24a065c 100644
--- a/server/sonar-web/src/main/js/apps/custom-metrics/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/custom-metrics/components/App.tsx
@@ -32,7 +32,6 @@ import {
createMetric,
MetricsResponse
} from '../../../api/metrics';
-import { Metric, Paging } from '../../../app/types';
import ListFooter from '../../../components/controls/ListFooter';
import { translate } from '../../../helpers/l10n';
@@ -41,8 +40,8 @@ interface Props {}
interface State {
domains?: string[];
loading: boolean;
- metrics?: Metric[];
- paging?: Paging;
+ metrics?: T.Metric[];
+ paging?: T.Paging;
types?: string[];
}
@@ -104,7 +103,7 @@ export default class App extends React.PureComponent<Props, State> {
}
};
- getPaging = (response: MetricsResponse): Paging => ({
+ getPaging = (response: MetricsResponse): T.Paging => ({
pageIndex: response.p,
pageSize: response.ps,
total: response.total
diff --git a/server/sonar-web/src/main/js/apps/custom-metrics/components/DeleteForm.tsx b/server/sonar-web/src/main/js/apps/custom-metrics/components/DeleteForm.tsx
index c799bcb1a56..8ab5fdd1990 100644
--- a/server/sonar-web/src/main/js/apps/custom-metrics/components/DeleteForm.tsx
+++ b/server/sonar-web/src/main/js/apps/custom-metrics/components/DeleteForm.tsx
@@ -18,14 +18,13 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { Metric } from '../../../app/types';
import SimpleModal from '../../../components/controls/SimpleModal';
import DeferredSpinner from '../../../components/common/DeferredSpinner';
import { SubmitButton, ResetButtonLink } from '../../../components/ui/buttons';
import { translate, translateWithParameters } from '../../../helpers/l10n';
interface Props {
- metric: Metric;
+ metric: T.Metric;
onClose: () => void;
onSubmit: () => Promise<void>;
}
diff --git a/server/sonar-web/src/main/js/apps/custom-metrics/components/Form.tsx b/server/sonar-web/src/main/js/apps/custom-metrics/components/Form.tsx
index c6d4e5ee4c3..ca804ea571f 100644
--- a/server/sonar-web/src/main/js/apps/custom-metrics/components/Form.tsx
+++ b/server/sonar-web/src/main/js/apps/custom-metrics/components/Form.tsx
@@ -18,7 +18,6 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { Metric } from '../../../app/types';
import DeferredSpinner from '../../../components/common/DeferredSpinner';
import SimpleModal from '../../../components/controls/SimpleModal';
import { translate } from '../../../helpers/l10n';
@@ -36,7 +35,7 @@ export interface MetricProps {
interface Props {
confirmButtonText: string;
domains: string[];
- metric?: Metric;
+ metric?: T.Metric;
header: string;
onClose: () => void;
onSubmit: (data: MetricProps) => Promise<void>;
diff --git a/server/sonar-web/src/main/js/apps/custom-metrics/components/Item.tsx b/server/sonar-web/src/main/js/apps/custom-metrics/components/Item.tsx
index 7f31c648bf3..6fc4002a09f 100644
--- a/server/sonar-web/src/main/js/apps/custom-metrics/components/Item.tsx
+++ b/server/sonar-web/src/main/js/apps/custom-metrics/components/Item.tsx
@@ -20,7 +20,6 @@
import * as React from 'react';
import DeleteForm from './DeleteForm';
import Form, { MetricProps } from './Form';
-import { Metric } from '../../../app/types';
import ActionsDropdown, {
ActionsDropdownDivider,
ActionsDropdownItem
@@ -29,7 +28,7 @@ import { translate } from '../../../helpers/l10n';
interface Props {
domains?: string[];
- metric: Metric;
+ metric: T.Metric;
onDelete: (metricKey: string) => Promise<void>;
onEdit: (data: { id: string } & MetricProps) => Promise<void>;
types?: string[];
diff --git a/server/sonar-web/src/main/js/apps/custom-metrics/components/List.tsx b/server/sonar-web/src/main/js/apps/custom-metrics/components/List.tsx
index ddbf383ec2d..4a21e16fd63 100644
--- a/server/sonar-web/src/main/js/apps/custom-metrics/components/List.tsx
+++ b/server/sonar-web/src/main/js/apps/custom-metrics/components/List.tsx
@@ -21,12 +21,11 @@ import * as React from 'react';
import { sortBy } from 'lodash';
import { MetricProps } from './Form';
import Item from './Item';
-import { Metric } from '../../../app/types';
import { translate } from '../../../helpers/l10n';
interface Props {
domains?: string[];
- metrics: Metric[];
+ metrics: T.Metric[];
onDelete: (metricKey: string) => Promise<void>;
onEdit: (data: { id: string } & MetricProps) => Promise<void>;
types?: string[];
diff --git a/server/sonar-web/src/main/js/apps/groups/components/App.tsx b/server/sonar-web/src/main/js/apps/groups/components/App.tsx
index 3742549abdb..78af399e5a5 100644
--- a/server/sonar-web/src/main/js/apps/groups/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/groups/components/App.tsx
@@ -24,7 +24,6 @@ import List from './List';
import forSingleOrganization from '../../organizations/forSingleOrganization';
import Suggestions from '../../../app/components/embed-docs-modal/Suggestions';
import { searchUsersGroups, deleteGroup, updateGroup, createGroup } from '../../../api/user_groups';
-import { Group, Paging } from '../../../app/types';
import ListFooter from '../../../components/controls/ListFooter';
import SearchBox from '../../../components/controls/SearchBox';
import { translate } from '../../../helpers/l10n';
@@ -34,9 +33,9 @@ interface Props {
}
interface State {
- groups?: Group[];
+ groups?: T.Group[];
loading: boolean;
- paging?: Paging;
+ paging?: T.Paging;
query: string;
}
diff --git a/server/sonar-web/src/main/js/apps/groups/components/DeleteForm.tsx b/server/sonar-web/src/main/js/apps/groups/components/DeleteForm.tsx
index a1a3a495677..27510f29e35 100644
--- a/server/sonar-web/src/main/js/apps/groups/components/DeleteForm.tsx
+++ b/server/sonar-web/src/main/js/apps/groups/components/DeleteForm.tsx
@@ -18,14 +18,13 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { Group } from '../../../app/types';
import SimpleModal from '../../../components/controls/SimpleModal';
import DeferredSpinner from '../../../components/common/DeferredSpinner';
import { SubmitButton, ResetButtonLink } from '../../../components/ui/buttons';
import { translate, translateWithParameters } from '../../../helpers/l10n';
interface Props {
- group: Group;
+ group: T.Group;
onClose: () => void;
onSubmit: () => Promise<void>;
}
diff --git a/server/sonar-web/src/main/js/apps/groups/components/EditMembers.tsx b/server/sonar-web/src/main/js/apps/groups/components/EditMembers.tsx
index b149628988d..f9ba6d44efc 100644
--- a/server/sonar-web/src/main/js/apps/groups/components/EditMembers.tsx
+++ b/server/sonar-web/src/main/js/apps/groups/components/EditMembers.tsx
@@ -19,12 +19,11 @@
*/
import * as React from 'react';
import EditMembersModal from './EditMembersModal';
-import { Group } from '../../../app/types';
import BulletListIcon from '../../../components/icons-components/BulletListIcon';
import { ButtonIcon } from '../../../components/ui/buttons';
interface Props {
- group: Group;
+ group: T.Group;
onEdit: () => void;
organization: string | undefined;
}
diff --git a/server/sonar-web/src/main/js/apps/groups/components/EditMembersModal.tsx b/server/sonar-web/src/main/js/apps/groups/components/EditMembersModal.tsx
index 097ff47354b..0118f637394 100644
--- a/server/sonar-web/src/main/js/apps/groups/components/EditMembersModal.tsx
+++ b/server/sonar-web/src/main/js/apps/groups/components/EditMembersModal.tsx
@@ -29,11 +29,10 @@ import {
addUserToGroup,
getUsersInGroup
} from '../../../api/user_groups';
-import { Group } from '../../../app/types';
import DeferredSpinner from '../../../components/common/DeferredSpinner';
interface Props {
- group: Group;
+ group: T.Group;
onClose: () => void;
organization: string | undefined;
}
diff --git a/server/sonar-web/src/main/js/apps/groups/components/Form.tsx b/server/sonar-web/src/main/js/apps/groups/components/Form.tsx
index 8d1e4fc8434..b17b6d86d98 100644
--- a/server/sonar-web/src/main/js/apps/groups/components/Form.tsx
+++ b/server/sonar-web/src/main/js/apps/groups/components/Form.tsx
@@ -18,7 +18,6 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { Group } from '../../../app/types';
import DeferredSpinner from '../../../components/common/DeferredSpinner';
import SimpleModal from '../../../components/controls/SimpleModal';
import { ResetButtonLink, SubmitButton } from '../../../components/ui/buttons';
@@ -26,7 +25,7 @@ import { translate } from '../../../helpers/l10n';
interface Props {
confirmButtonText: string;
- group?: Group;
+ group?: T.Group;
header: string;
onClose: () => void;
onSubmit: (data: { description: string; name: string }) => Promise<void>;
diff --git a/server/sonar-web/src/main/js/apps/groups/components/List.tsx b/server/sonar-web/src/main/js/apps/groups/components/List.tsx
index 1971e243c15..ba46b2a2844 100644
--- a/server/sonar-web/src/main/js/apps/groups/components/List.tsx
+++ b/server/sonar-web/src/main/js/apps/groups/components/List.tsx
@@ -20,11 +20,10 @@
import * as React from 'react';
import { sortBy } from 'lodash';
import ListItem from './ListItem';
-import { Group } from '../../../app/types';
import { translate } from '../../../helpers/l10n';
interface Props {
- groups: Group[];
+ groups: T.Group[];
onDelete: (name: string) => Promise<void>;
onEdit: (data: { description?: string; id: number; name?: string }) => Promise<void>;
onEditMembers: () => void;
diff --git a/server/sonar-web/src/main/js/apps/groups/components/ListItem.tsx b/server/sonar-web/src/main/js/apps/groups/components/ListItem.tsx
index a1f2f8ba611..c6275faa960 100644
--- a/server/sonar-web/src/main/js/apps/groups/components/ListItem.tsx
+++ b/server/sonar-web/src/main/js/apps/groups/components/ListItem.tsx
@@ -21,7 +21,6 @@ import * as React from 'react';
import DeleteForm from './DeleteForm';
import EditMembers from './EditMembers';
import Form from './Form';
-import { Group } from '../../../app/types';
import ActionsDropdown, {
ActionsDropdownItem,
ActionsDropdownDivider
@@ -30,7 +29,7 @@ import { translate } from '../../../helpers/l10n';
import { omitNil } from '../../../helpers/request';
interface Props {
- group: Group;
+ group: T.Group;
onDelete: (name: string) => Promise<void>;
onEdit: (data: { description?: string; id: number; name?: string }) => Promise<void>;
onEditMembers: () => void;
diff --git a/server/sonar-web/src/main/js/apps/issues/IssuesPageSelector.tsx b/server/sonar-web/src/main/js/apps/issues/IssuesPageSelector.tsx
index 2025d4bb7f1..b8e7c7dbd5b 100644
--- a/server/sonar-web/src/main/js/apps/issues/IssuesPageSelector.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/IssuesPageSelector.tsx
@@ -20,14 +20,13 @@
import * as React from 'react';
import { connect } from 'react-redux';
import AppContainer from './components/AppContainer';
-import { CurrentUser } from '../../app/types';
import { RawQuery } from '../../helpers/query';
import { getCurrentUser, Store } from '../../store/rootReducer';
import { isSonarCloud } from '../../helpers/system';
import { isLoggedIn } from '../../helpers/users';
interface StateProps {
- currentUser: CurrentUser;
+ currentUser: T.CurrentUser;
}
interface Props extends StateProps {
diff --git a/server/sonar-web/src/main/js/apps/issues/components/App.tsx b/server/sonar-web/src/main/js/apps/issues/components/App.tsx
index cfb4f7bee79..4faebc2f57f 100644
--- a/server/sonar-web/src/main/js/apps/issues/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/components/App.tsx
@@ -53,14 +53,6 @@ import {
STANDARDS,
ReferencedRule
} from '../utils';
-import {
- Component,
- CurrentUser,
- Issue,
- Paging,
- BranchLike,
- Organization
-} from '../../../app/types';
import handleRequiredAuthentication from '../../../app/utils/handleRequiredAuthentication';
import Dropdown from '../../../components/controls/Dropdown';
import ListFooter from '../../../components/controls/ListFooter';
@@ -89,24 +81,24 @@ interface FetchIssuesPromise {
components: ReferencedComponent[];
effortTotal: number;
facets: RawFacet[];
- issues: Issue[];
+ issues: T.Issue[];
languages: ReferencedLanguage[];
- paging: Paging;
+ paging: T.Paging;
rules: ReferencedRule[];
users: ReferencedUser[];
}
interface Props {
- branchLike?: BranchLike;
- component?: Component;
- currentUser: CurrentUser;
+ branchLike?: T.BranchLike;
+ component?: T.Component;
+ currentUser: T.CurrentUser;
fetchIssues: (query: RawQuery, requestOrganizations?: boolean) => Promise<FetchIssuesPromise>;
hideAuthorFacet?: boolean;
location: { pathname: string; query: RawQuery };
myIssues?: boolean;
onBranchesChange: () => void;
organization?: { key: string };
- userOrganizations: Organization[];
+ userOrganizations: T.Organization[];
}
export interface State {
@@ -114,7 +106,7 @@ export interface State {
checked: string[];
effortTotal?: number;
facets: { [facet: string]: Facet };
- issues: Issue[];
+ issues: T.Issue[];
lastChecked?: string;
loading: boolean;
loadingFacets: { [key: string]: boolean };
@@ -122,9 +114,9 @@ export interface State {
locationsNavigator: boolean;
myIssues: boolean;
openFacets: { [facet: string]: boolean };
- openIssue?: Issue;
+ openIssue?: T.Issue;
openPopup?: { issue: string; name: string };
- paging?: Paging;
+ paging?: T.Paging;
query: Query;
referencedComponentsById: { [id: string]: ReferencedComponent };
referencedComponentsByKey: { [key: string]: ReferencedComponent };
@@ -321,7 +313,7 @@ export default class App extends React.PureComponent<Props, State> {
return index !== -1 ? index : undefined;
}
- getOpenIssue = (props: Props, issues: Issue[]) => {
+ getOpenIssue = (props: Props, issues: T.Issue[]) => {
const open = getOpen(props.location.query);
return open ? issues.find(issue => issue.key === open) : undefined;
};
@@ -508,8 +500,8 @@ export default class App extends React.PureComponent<Props, State> {
fetchIssuesUntil = (
p: number,
- done: (issues: Issue[], paging: Paging) => boolean
- ): Promise<{ issues: Issue[]; paging: Paging }> => {
+ done: (issues: T.Issue[], paging: T.Paging) => boolean
+ ): Promise<{ issues: T.Issue[]; paging: T.Paging }> => {
return this.fetchIssuesPage(p).then(response => {
const { issues, paging } = response;
@@ -559,9 +551,9 @@ export default class App extends React.PureComponent<Props, State> {
return Promise.reject(undefined);
}
- const isSameComponent = (issue: Issue) => issue.component === openIssue.component;
+ const isSameComponent = (issue: T.Issue) => issue.component === openIssue.component;
- const done = (issues: Issue[], paging: Paging) => {
+ const done = (issues: T.Issue[], paging: T.Paging) => {
if (paging.total <= paging.pageIndex * paging.pageSize) {
return true;
}
@@ -636,7 +628,7 @@ export default class App extends React.PureComponent<Props, State> {
getCheckedIssues = () => {
const issues = this.state.checked
.map(checked => this.state.issues.find(issue => issue.key === checked))
- .filter((issue): issue is Issue => issue !== undefined);
+ .filter((issue): issue is T.Issue => issue !== undefined);
const paging = { pageIndex: 1, pageSize: issues.length, total: issues.length };
return Promise.resolve({ issues, paging });
};
@@ -769,7 +761,7 @@ export default class App extends React.PureComponent<Props, State> {
}
};
- handleIssueChange = (issue: Issue) => {
+ handleIssueChange = (issue: T.Issue) => {
this.setState(state => ({
issues: state.issues.map(candidate => (candidate.key === issue.key ? issue : candidate))
}));
@@ -850,7 +842,7 @@ export default class App extends React.PureComponent<Props, State> {
this.setState(actions.selectPreviousFlow);
};
- renderBulkChange(openIssue: Issue | undefined) {
+ renderBulkChange(openIssue: T.Issue | undefined) {
const { component, currentUser } = this.props;
const { bulkChange, checked, paging, issues } = this.state;
@@ -999,7 +991,7 @@ export default class App extends React.PureComponent<Props, State> {
);
}
- renderSide(openIssue: Issue | undefined) {
+ renderSide(openIssue: T.Issue | undefined) {
return (
<ScreenPositionHelper className="layout-page-side-outer">
{({ top }) => (
diff --git a/server/sonar-web/src/main/js/apps/issues/components/AppContainer.tsx b/server/sonar-web/src/main/js/apps/issues/components/AppContainer.tsx
index 00e0522766c..bd92e5ee7ad 100644
--- a/server/sonar-web/src/main/js/apps/issues/components/AppContainer.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/components/AppContainer.tsx
@@ -22,7 +22,6 @@ import { Dispatch } from 'redux';
import { uniq } from 'lodash';
import { searchIssues } from '../../../api/issues';
import { getOrganizations } from '../../../api/organizations';
-import { CurrentUser, Organization } from '../../../app/types';
import throwGlobalError from '../../../app/utils/throwGlobalError';
import {
getCurrentUser,
@@ -36,8 +35,8 @@ import { RawQuery } from '../../../helpers/query';
import { receiveOrganizations } from '../../../store/organizations';
interface StateProps {
- currentUser: CurrentUser;
- userOrganizations: Organization[];
+ currentUser: T.CurrentUser;
+ userOrganizations: T.Organization[];
}
const mapStateToProps = (state: Store): StateProps => ({
diff --git a/server/sonar-web/src/main/js/apps/issues/components/BulkChangeModal.tsx b/server/sonar-web/src/main/js/apps/issues/components/BulkChangeModal.tsx
index 0438b4d4c13..49f0642ddb1 100644
--- a/server/sonar-web/src/main/js/apps/issues/components/BulkChangeModal.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/components/BulkChangeModal.tsx
@@ -21,7 +21,6 @@ import * as React from 'react';
import { pickBy, sortBy } from 'lodash';
import { searchAssignees } from '../utils';
import { searchIssueTags, bulkChangeIssues } from '../../../api/issues';
-import { Component, CurrentUser, Issue, Paging, IssueType } from '../../../app/types';
import throwGlobalError from '../../../app/utils/throwGlobalError';
import MarkdownTips from '../../../components/common/MarkdownTips';
import SearchSelect from '../../../components/controls/SearchSelect';
@@ -50,9 +49,9 @@ interface TagOption {
}
interface Props {
- component: Component | undefined;
- currentUser: CurrentUser;
- fetchIssues: (x: {}) => Promise<{ issues: Issue[]; paging: Paging }>;
+ component: T.Component | undefined;
+ currentUser: T.CurrentUser;
+ fetchIssues: (x: {}) => Promise<{ issues: T.Issue[]; paging: T.Paging }>;
onClose: () => void;
onDone: () => void;
organization: { key: string } | undefined;
@@ -72,10 +71,10 @@ interface FormFields {
interface State extends FormFields {
initialTags: Array<{ label: string; value: string }>;
- issues: Issue[];
+ issues: T.Issue[];
// used for initial loading of issues
loading: boolean;
- paging?: Paging;
+ paging?: T.Paging;
// used when submitting a form
submitting: boolean;
}
@@ -232,7 +231,7 @@ export default class BulkChangeModal extends React.PureComponent<Props, State> {
);
};
- getAvailableTransitions(issues: Issue[]) {
+ getAvailableTransitions(issues: T.Issue[]) {
const transitions: { [x: string]: number } = {};
issues.forEach(issue => {
if (issue.transitions) {
@@ -334,7 +333,7 @@ export default class BulkChangeModal extends React.PureComponent<Props, State> {
return null;
}
- const types = [IssueType.Bug, IssueType.Vulnerability, IssueType.CodeSmell];
+ const types: T.IssueType[] = ['BUG', 'VULNERABILITY', 'CODE_SMELL'];
const options = types.map(type => ({ label: translate('issue.type', type), value: type }));
const optionRenderer = (option: { label: string; value: string }) => (
@@ -542,7 +541,7 @@ export default class BulkChangeModal extends React.PureComponent<Props, State> {
}
function hasAction(action: string) {
- return (issue: Issue) => issue.actions && issue.actions.includes(action);
+ return (issue: T.Issue) => issue.actions && issue.actions.includes(action);
}
function promptCreateTag(label: string) {
diff --git a/server/sonar-web/src/main/js/apps/issues/components/ComponentBreadcrumbs.tsx b/server/sonar-web/src/main/js/apps/issues/components/ComponentBreadcrumbs.tsx
index 3e3adfad26d..cc1560bb9a3 100644
--- a/server/sonar-web/src/main/js/apps/issues/components/ComponentBreadcrumbs.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/components/ComponentBreadcrumbs.tsx
@@ -20,16 +20,15 @@
import * as React from 'react';
import { Link } from 'react-router';
import { getSelectedLocation } from '../utils';
-import { BranchLike, Component, Issue } from '../../../app/types';
import Organization from '../../../components/shared/Organization';
import { collapsePath, limitComponentName } from '../../../helpers/path';
import { getBranchLikeUrl, getCodeUrl } from '../../../helpers/urls';
interface Props {
- branchLike?: BranchLike;
- component?: Component;
+ branchLike?: T.BranchLike;
+ component?: T.Component;
issue: Pick<
- Issue,
+ T.Issue,
| 'component'
| 'componentLongName'
| 'flows'
diff --git a/server/sonar-web/src/main/js/apps/issues/components/IssuesList.tsx b/server/sonar-web/src/main/js/apps/issues/components/IssuesList.tsx
index e748494a653..3cfcad6534a 100644
--- a/server/sonar-web/src/main/js/apps/issues/components/IssuesList.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/components/IssuesList.tsx
@@ -20,21 +20,20 @@
import * as React from 'react';
import ListItem from './ListItem';
import { Query } from '../utils';
-import { BranchLike, Component, Issue } from '../../../app/types';
interface Props {
- branchLike: BranchLike | undefined;
+ branchLike: T.BranchLike | undefined;
checked: string[];
- component: Component | undefined;
- issues: Issue[];
+ component: T.Component | undefined;
+ issues: T.Issue[];
onFilterChange: (changes: Partial<Query>) => void;
- onIssueChange: (issue: Issue) => void;
+ onIssueChange: (issue: T.Issue) => void;
onIssueCheck: ((issueKey: string, event: { shiftKey?: boolean }) => void) | undefined;
onIssueClick: (issueKey: string) => void;
onPopupToggle: (issue: string, popupName: string, open?: boolean) => void;
openPopup: { issue: string; name: string } | undefined;
organization: { key: string } | undefined;
- selectedIssue: Issue | undefined;
+ selectedIssue: T.Issue | undefined;
}
export default class IssuesList extends React.PureComponent<Props> {
diff --git a/server/sonar-web/src/main/js/apps/issues/components/IssuesSourceViewer.tsx b/server/sonar-web/src/main/js/apps/issues/components/IssuesSourceViewer.tsx
index 6266c18322c..2ac7e78287d 100644
--- a/server/sonar-web/src/main/js/apps/issues/components/IssuesSourceViewer.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/components/IssuesSourceViewer.tsx
@@ -19,18 +19,17 @@
*/
import * as React from 'react';
import { getLocations, getSelectedLocation } from '../utils';
-import { BranchLike, Issue } from '../../../app/types';
import SourceViewer from '../../../components/SourceViewer/SourceViewer';
import { scrollToElement } from '../../../helpers/scrolling';
interface Props {
- branchLike: BranchLike | undefined;
- loadIssues: (component: string, from: number, to: number) => Promise<Issue[]>;
+ branchLike: T.BranchLike | undefined;
+ loadIssues: (component: string, from: number, to: number) => Promise<T.Issue[]>;
locationsNavigator: boolean;
- onIssueChange: (issue: Issue) => void;
+ onIssueChange: (issue: T.Issue) => void;
onIssueSelect: (issueKey: string) => void;
onLocationSelect: (index: number) => void;
- openIssue: Issue;
+ openIssue: T.Issue;
selectedFlowIndex: number | undefined;
selectedLocationIndex: number | undefined;
}
diff --git a/server/sonar-web/src/main/js/apps/issues/components/ListItem.tsx b/server/sonar-web/src/main/js/apps/issues/components/ListItem.tsx
index 65cf89e269f..e8db92cc557 100644
--- a/server/sonar-web/src/main/js/apps/issues/components/ListItem.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/components/ListItem.tsx
@@ -20,22 +20,21 @@
import * as React from 'react';
import ComponentBreadcrumbs from './ComponentBreadcrumbs';
import { Query } from '../utils';
-import { BranchLike, Issue as IssueType, Component } from '../../../app/types';
import Issue from '../../../components/issue/Issue';
interface Props {
- branchLike: BranchLike | undefined;
+ branchLike: T.BranchLike | undefined;
checked: boolean;
- component: Component | undefined;
- issue: IssueType;
- onChange: (issue: IssueType) => void;
+ component: T.Component | undefined;
+ issue: T.Issue;
+ onChange: (issue: T.Issue) => void;
onCheck: ((issueKey: string, event: { shiftKey?: boolean }) => void) | undefined;
onClick: (issueKey: string) => void;
onFilterChange: (changes: Partial<Query>) => void;
onPopupToggle: (issue: string, popupName: string, open?: boolean) => void;
openPopup: string | undefined;
organization: { key: string } | undefined;
- previousIssue: IssueType | undefined;
+ previousIssue: T.Issue | undefined;
selected: boolean;
}
@@ -46,7 +45,7 @@ interface State {
export default class ListItem extends React.PureComponent<Props, State> {
state: State = { similarIssues: false };
- handleFilter = (property: string, issue: IssueType) => {
+ handleFilter = (property: string, issue: T.Issue) => {
const { onFilterChange } = this.props;
const issuesReset = { issues: [] };
diff --git a/server/sonar-web/src/main/js/apps/issues/components/PageActions.tsx b/server/sonar-web/src/main/js/apps/issues/components/PageActions.tsx
index 31eb0f06472..b890f9868c9 100644
--- a/server/sonar-web/src/main/js/apps/issues/components/PageActions.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/components/PageActions.tsx
@@ -20,7 +20,6 @@
import * as React from 'react';
import IssuesCounter from './IssuesCounter';
import TotalEffort from './TotalEffort';
-import { HomePageType, Paging } from '../../../app/types';
import HomePageSelect from '../../../components/controls/HomePageSelect';
import ReloadButton from '../../../components/controls/ReloadButton';
import { translate } from '../../../helpers/l10n';
@@ -30,7 +29,7 @@ interface Props {
canSetHome: boolean;
effortTotal: number | undefined;
onReload: () => void;
- paging: Paging | undefined;
+ paging: T.Paging | undefined;
selectedIndex: number | undefined;
}
@@ -71,9 +70,7 @@ export default class PageActions extends React.PureComponent<Props> {
{this.props.canSetHome && (
<HomePageSelect
className="huge-spacer-left"
- currentPage={
- isSonarCloud() ? { type: HomePageType.MyIssues } : { type: HomePageType.Issues }
- }
+ currentPage={isSonarCloud() ? { type: 'MY_ISSUES' } : { type: 'ISSUES' }}
/>
)}
</div>
diff --git a/server/sonar-web/src/main/js/apps/issues/components/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/issues/components/__tests__/App-test.tsx
index 4255ab774d9..7a14512a402 100644
--- a/server/sonar-web/src/main/js/apps/issues/components/__tests__/App-test.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/components/__tests__/App-test.tsx
@@ -20,14 +20,13 @@
import * as React from 'react';
import App from '../App';
import { shallowWithIntl, waitAndUpdate } from '../../../../helpers/testUtils';
-import { Issue } from '../../../../app/types';
const replace = jest.fn();
const issues = [
- { key: 'foo' } as Issue,
- { key: 'bar' } as Issue,
- { key: 'third' } as Issue,
- { key: 'fourth' } as Issue
+ { key: 'foo' } as T.Issue,
+ { key: 'bar' } as T.Issue,
+ { key: 'third' } as T.Issue,
+ { key: 'fourth' } as T.Issue
];
const facets = [{ property: 'severities', values: [{ val: 'MINOR', count: 4 }] }];
const paging = { pageIndex: 1, pageSize: 100, total: 4 };
diff --git a/server/sonar-web/src/main/js/apps/issues/components/__tests__/BulkChangeModal-test.tsx b/server/sonar-web/src/main/js/apps/issues/components/__tests__/BulkChangeModal-test.tsx
index e6fa64c3464..f9105feba82 100644
--- a/server/sonar-web/src/main/js/apps/issues/components/__tests__/BulkChangeModal-test.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/components/__tests__/BulkChangeModal-test.tsx
@@ -21,7 +21,6 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import BulkChangeModal from '../BulkChangeModal';
import { waitAndUpdate } from '../../../../helpers/testUtils';
-import { Issue, IssueType } from '../../../../app/types';
jest.mock('../../../../api/issues', () => ({
searchIssueTags: () => Promise.resolve([undefined, []])
@@ -57,14 +56,14 @@ it('should display form when issues are present', async () => {
severity: 'foo',
status: 'foo',
transitions: [],
- type: IssueType.Bug
+ type: 'BUG'
}
]);
await waitAndUpdate(wrapper);
expect(wrapper).toMatchSnapshot();
});
-const getWrapper = (issues: Issue[]) => {
+const getWrapper = (issues: T.Issue[]) => {
return shallow(
<BulkChangeModal
component={undefined}
diff --git a/server/sonar-web/src/main/js/apps/issues/components/__tests__/ComponentBreadcrumbs-test.tsx b/server/sonar-web/src/main/js/apps/issues/components/__tests__/ComponentBreadcrumbs-test.tsx
index 0e6fd7f9652..d168f6de38f 100644
--- a/server/sonar-web/src/main/js/apps/issues/components/__tests__/ComponentBreadcrumbs-test.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/components/__tests__/ComponentBreadcrumbs-test.tsx
@@ -20,7 +20,6 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import ComponentBreadcrumbs from '../ComponentBreadcrumbs';
-import { ShortLivingBranch, BranchType } from '../../../../app/types';
const baseIssue = {
component: 'comp',
@@ -61,11 +60,11 @@ it('renders with sub-project', () => {
it('renders with branch', () => {
const issue = { ...baseIssue, subProject: 'sub-proj', subProjectName: 'sub-proj-name' };
- const shortBranch: ShortLivingBranch = {
+ const shortBranch: T.ShortLivingBranch = {
isMain: false,
mergeBranch: '',
name: 'feature',
- type: BranchType.SHORT
+ type: 'SHORT'
};
expect(
shallow(
diff --git a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssue.tsx b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssue.tsx
index 2109ebb181d..79a1ef82afc 100644
--- a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssue.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssue.tsx
@@ -20,14 +20,13 @@
import * as React from 'react';
import ConciseIssueBox from './ConciseIssueBox';
import ConciseIssueComponent from './ConciseIssueComponent';
-import { Issue } from '../../../app/types';
interface Props {
- issue: Issue;
+ issue: T.Issue;
onFlowSelect: (index: number) => void;
onLocationSelect: (index: number) => void;
onSelect: (issueKey: string) => void;
- previousIssue: Issue | undefined;
+ previousIssue: T.Issue | undefined;
scroll: (element: Element) => void;
selected: boolean;
selectedFlowIndex: number | undefined;
diff --git a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueBox.tsx b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueBox.tsx
index c8201f79b0e..57aa1b89620 100644
--- a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueBox.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueBox.tsx
@@ -21,12 +21,11 @@ import * as React from 'react';
import * as classNames from 'classnames';
import ConciseIssueLocations from './ConciseIssueLocations';
import ConciseIssueLocationsNavigator from './ConciseIssueLocationsNavigator';
-import { Issue } from '../../../app/types';
import SeverityHelper from '../../../components/shared/SeverityHelper';
import TypeHelper from '../../../components/shared/TypeHelper';
interface Props {
- issue: Issue;
+ issue: T.Issue;
onClick: (issueKey: string) => void;
onFlowSelect: (index: number) => void;
onLocationSelect: (index: number) => void;
diff --git a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueLocations.tsx b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueLocations.tsx
index 3a2cdb9885f..72ec5133ec4 100644
--- a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueLocations.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueLocations.tsx
@@ -19,10 +19,9 @@
*/
import * as React from 'react';
import ConciseIssueLocationBadge from './ConciseIssueLocationBadge';
-import { Issue } from '../../../app/types';
interface Props {
- issue: Pick<Issue, 'flows' | 'secondaryLocations'>;
+ issue: Pick<T.Issue, 'flows' | 'secondaryLocations'>;
onFlowSelect: (index: number) => void;
selectedFlowIndex: number | undefined;
}
diff --git a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueLocationsNavigator.tsx b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueLocationsNavigator.tsx
index 60946f692f5..313d13070da 100644
--- a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueLocationsNavigator.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueLocationsNavigator.tsx
@@ -22,10 +22,9 @@ import { uniq } from 'lodash';
import ConciseIssueLocationsNavigatorLocation from './ConciseIssueLocationsNavigatorLocation';
import CrossFileLocationsNavigator from './CrossFileLocationsNavigator';
import { getLocations } from '../utils';
-import { Issue } from '../../../app/types';
interface Props {
- issue: Pick<Issue, 'component' | 'key' | 'flows' | 'secondaryLocations'>;
+ issue: Pick<T.Issue, 'component' | 'key' | 'flows' | 'secondaryLocations'>;
onLocationSelect: (index: number) => void;
scroll: (element: Element) => void;
selectedFlowIndex: number | undefined;
diff --git a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssuesList.tsx b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssuesList.tsx
index 4b5045d09ae..546dfe9ea2c 100644
--- a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssuesList.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssuesList.tsx
@@ -19,11 +19,10 @@
*/
import * as React from 'react';
import ConciseIssue from './ConciseIssue';
-import { Issue } from '../../../app/types';
import { scrollToElement } from '../../../helpers/scrolling';
interface Props {
- issues: Issue[];
+ issues: T.Issue[];
onFlowSelect: (index: number) => void;
onIssueSelect: (issueKey: string) => void;
onLocationSelect: (index: number) => void;
diff --git a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssuesListHeader.tsx b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssuesListHeader.tsx
index ffffdeb0a55..0c79994ab33 100644
--- a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssuesListHeader.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssuesListHeader.tsx
@@ -21,14 +21,13 @@ import * as React from 'react';
import BackButton from '../../../components/controls/BackButton';
import ReloadButton from '../../../components/controls/ReloadButton';
import IssuesCounter from '../components/IssuesCounter';
-import { Paging } from '../../../app/types';
interface Props {
displayBackButton?: boolean;
loading: boolean;
onBackClick: () => void;
onReload: () => void;
- paging: Paging | undefined;
+ paging: T.Paging | undefined;
selectedIndex: number | undefined;
}
diff --git a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/CrossFileLocationsNavigator.tsx b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/CrossFileLocationsNavigator.tsx
index 295ffe694fa..b6990775caa 100644
--- a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/CrossFileLocationsNavigator.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/CrossFileLocationsNavigator.tsx
@@ -19,13 +19,12 @@
*/
import * as React from 'react';
import ConciseIssueLocationsNavigatorLocation from './ConciseIssueLocationsNavigatorLocation';
-import { Issue, FlowLocation } from '../../../app/types';
import { translateWithParameters } from '../../../helpers/l10n';
import { collapsePath } from '../../../helpers/path';
interface Props {
- issue: Pick<Issue, 'key'>;
- locations: FlowLocation[];
+ issue: Pick<T.Issue, 'key'>;
+ locations: T.FlowLocation[];
onLocationSelect: (index: number) => void;
scroll: (element: Element) => void;
selectedLocationIndex: number | undefined;
@@ -39,7 +38,7 @@ interface LocationGroup {
component: string | undefined;
componentName: string | undefined;
firstLocationIndex: number;
- locations: FlowLocation[];
+ locations: T.FlowLocation[];
}
export default class CrossFileLocationsNavigator extends React.PureComponent<Props, State> {
@@ -68,10 +67,10 @@ export default class CrossFileLocationsNavigator extends React.PureComponent<Pro
this.setState({ collapsed: false });
};
- groupByFile = (locations: FlowLocation[]) => {
+ groupByFile = (locations: T.FlowLocation[]) => {
const groups: LocationGroup[] = [];
- let currentLocations: FlowLocation[] = [];
+ let currentLocations: T.FlowLocation[] = [];
let currentComponent: string | undefined;
let currentComponentName: string | undefined;
let currentFirstLocationIndex = 0;
diff --git a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/ConciseIssue-test.tsx b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/ConciseIssue-test.tsx
index 094dc233472..ce4db1c68bc 100644
--- a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/ConciseIssue-test.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/ConciseIssue-test.tsx
@@ -20,9 +20,8 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import ConciseIssue from '../ConciseIssue';
-import { Issue, IssueType } from '../../../../app/types';
-const issue: Issue = {
+const issue: T.Issue = {
actions: [],
component: '',
componentLongName: 'src/file.js',
@@ -44,7 +43,7 @@ const issue: Issue = {
severity: '',
status: '',
transitions: [],
- type: IssueType.Bug
+ type: 'BUG'
};
it('should render', () => {
diff --git a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/ConciseIssueLocationsNavigator-test.tsx b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/ConciseIssueLocationsNavigator-test.tsx
index 9ae00c5b9c4..16c29302df3 100644
--- a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/ConciseIssueLocationsNavigator-test.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/ConciseIssueLocationsNavigator-test.tsx
@@ -20,23 +20,22 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import ConciseIssueLocationsNavigator from '../ConciseIssueLocationsNavigator';
-import { FlowLocation } from '../../../../app/types';
-const location1: FlowLocation = {
+const location1: T.FlowLocation = {
component: 'foo',
componentName: 'src/foo.js',
msg: 'Do not use foo',
textRange: { startLine: 7, endLine: 7, startOffset: 5, endOffset: 8 }
};
-const location2: FlowLocation = {
+const location2: T.FlowLocation = {
component: 'foo',
componentName: 'src/foo.js',
msg: 'Do not use foo',
textRange: { startLine: 8, endLine: 8, startOffset: 0, endOffset: 5 }
};
-const location3: FlowLocation = {
+const location3: T.FlowLocation = {
component: 'bar',
componentName: 'src/bar.js',
msg: 'Do not use bar',
diff --git a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/ConciseIssuesList-test.tsx b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/ConciseIssuesList-test.tsx
index 07c082a2439..1115a917bfb 100644
--- a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/ConciseIssuesList-test.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/ConciseIssuesList-test.tsx
@@ -20,10 +20,9 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import ConciseIssuesList from '../ConciseIssuesList';
-import { Issue } from '../../../../app/types';
it('should render', () => {
- const issues = [{ key: 'foo' }, { key: 'bar' }] as Issue[];
+ const issues = [{ key: 'foo' }, { key: 'bar' }] as T.Issue[];
expect(
shallow(
<ConciseIssuesList
diff --git a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/CrossFileLocationsNavigator-test.tsx b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/CrossFileLocationsNavigator-test.tsx
index f09e6d090d6..fe94e0352da 100644
--- a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/CrossFileLocationsNavigator-test.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/CrossFileLocationsNavigator-test.tsx
@@ -20,24 +20,23 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import CrossFileLocationsNavigator from '../CrossFileLocationsNavigator';
-import { FlowLocation } from '../../../../app/types';
import { click } from '../../../../helpers/testUtils';
-const location1: FlowLocation = {
+const location1: T.FlowLocation = {
component: 'foo',
componentName: 'src/foo.js',
msg: 'Do not use foo',
textRange: { startLine: 7, endLine: 7, startOffset: 5, endOffset: 8 }
};
-const location2: FlowLocation = {
+const location2: T.FlowLocation = {
component: 'foo',
componentName: 'src/foo.js',
msg: 'Do not use foo',
textRange: { startLine: 8, endLine: 8, startOffset: 0, endOffset: 5 }
};
-const location3: FlowLocation = {
+const location3: T.FlowLocation = {
component: 'bar',
componentName: 'src/bar.js',
msg: 'Do not use bar',
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/AuthorFacet.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/AuthorFacet.tsx
index 081a059661d..7f9a902bfd4 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/AuthorFacet.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/AuthorFacet.tsx
@@ -24,10 +24,9 @@ import { translate } from '../../../helpers/l10n';
import ListStyleFacet from '../../../components/facet/ListStyleFacet';
import { searchIssueAuthors } from '../../../api/issues';
import { highlightTerm } from '../../../helpers/search';
-import { Component } from '../../../app/types';
interface Props {
- component: Component | undefined;
+ component: T.Component | undefined;
fetching: boolean;
loadSearchResultCount: (property: string, changes: Partial<Query>) => Promise<Facet>;
onChange: (changes: Partial<Query>) => void;
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/CreationDateFacet.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/CreationDateFacet.tsx
index 5e049e522ae..240d69eaf98 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/CreationDateFacet.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/CreationDateFacet.tsx
@@ -21,7 +21,6 @@ import * as React from 'react';
import { max } from 'lodash';
import { intlShape } from 'react-intl';
import { Query } from '../utils';
-import { Component } from '../../../app/types';
import FacetBox from '../../../components/facet/FacetBox';
import FacetHeader from '../../../components/facet/FacetHeader';
import FacetItem from '../../../components/facet/FacetItem';
@@ -36,7 +35,7 @@ import { formatMeasure } from '../../../helpers/measures';
import DeferredSpinner from '../../../components/common/DeferredSpinner';
interface Props {
- component: Component | undefined;
+ component: T.Component | undefined;
createdAfter: Date | undefined;
createdAt: string;
createdBefore: Date | undefined;
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/ProjectFacet.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/ProjectFacet.tsx
index a88080345c5..b321275922d 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/ProjectFacet.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/ProjectFacet.tsx
@@ -22,14 +22,13 @@ import { omit } from 'lodash';
import ListStyleFacet from '../../../components/facet/ListStyleFacet';
import { Query, ReferencedComponent, Facet } from '../utils';
import { searchProjects, getTree } from '../../../api/components';
-import { Component, Paging } from '../../../app/types';
import Organization from '../../../components/shared/Organization';
import QualifierIcon from '../../../components/icons-components/QualifierIcon';
import { translate } from '../../../helpers/l10n';
import { highlightTerm } from '../../../helpers/search';
interface Props {
- component: Component | undefined;
+ component: T.Component | undefined;
loadSearchResultCount: (property: string, changes: Partial<Query>) => Promise<Facet>;
fetching: boolean;
onChange: (changes: Partial<Query>) => void;
@@ -52,7 +51,7 @@ export default class ProjectFacet extends React.PureComponent<Props> {
handleSearch = (
query: string,
page = 1
- ): Promise<{ results: SearchedProject[]; paging: Paging }> => {
+ ): Promise<{ results: SearchedProject[]; paging: T.Paging }> => {
const { component, organization } = this.props;
if (component && ['VW', 'SVW', 'APP'].includes(component.qualifier)) {
return getTree({
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/RuleFacet.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/RuleFacet.tsx
index 645fe829f73..ff67f02db4e 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/RuleFacet.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/RuleFacet.tsx
@@ -22,7 +22,6 @@ import { omit } from 'lodash';
import ListStyleFacet from '../../../components/facet/ListStyleFacet';
import { Query, ReferencedRule, Facet } from '../utils';
import { searchRules } from '../../../api/rules';
-import { Rule } from '../../../app/types';
import { translate } from '../../../helpers/l10n';
interface Props {
@@ -57,7 +56,7 @@ export default class RuleFacet extends React.PureComponent<Props> {
}));
};
- loadSearchResultCount = (rules: Rule[]) => {
+ loadSearchResultCount = (rules: T.Rule[]) => {
return this.props.loadSearchResultCount('rules', { rules: rules.map(rule => rule.key) });
};
@@ -72,13 +71,13 @@ export default class RuleFacet extends React.PureComponent<Props> {
return langName ? `(${langName}) ${name}` : name;
};
- renderSearchResult = (rule: Rule) => {
+ renderSearchResult = (rule: T.Rule) => {
return this.formatRuleName(rule.name, rule.langName);
};
render() {
return (
- <ListStyleFacet<Rule>
+ <ListStyleFacet<T.Rule>
facetHeader={translate('issues.facet.rules')}
fetching={this.props.fetching}
getFacetItemText={this.getRuleName}
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/Sidebar.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/Sidebar.tsx
index 1e37378bab5..a69c660691d 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/Sidebar.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/Sidebar.tsx
@@ -42,10 +42,9 @@ import {
ReferencedRule,
STANDARDS
} from '../utils';
-import { Component } from '../../../app/types';
export interface Props {
- component: Component | undefined;
+ component: T.Component | undefined;
facets: { [facet: string]: Facet };
hideAuthorFacet?: boolean;
loadSearchResultCount: (property: string, changes: Partial<Query>) => Promise<Facet>;
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/TagFacet.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/TagFacet.tsx
index 8b73c81e71b..1799db279a5 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/TagFacet.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/TagFacet.tsx
@@ -22,14 +22,13 @@ import { omit } from 'lodash';
import { Query, Facet } from '../utils';
import { searchIssueTags } from '../../../api/issues';
import * as theme from '../../../app/theme';
-import { Component } from '../../../app/types';
import TagsIcon from '../../../components/icons-components/TagsIcon';
import { translate } from '../../../helpers/l10n';
import ListStyleFacet from '../../../components/facet/ListStyleFacet';
import { highlightTerm } from '../../../helpers/search';
interface Props {
- component: Component | undefined;
+ component: T.Component | undefined;
fetching: boolean;
loadSearchResultCount: (property: string, changes: Partial<Query>) => Promise<Facet>;
onChange: (changes: Partial<Query>) => void;
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/TypeFacet.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/TypeFacet.tsx
index e246dc28202..7656884a799 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/TypeFacet.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/TypeFacet.tsx
@@ -28,7 +28,7 @@ import IssueTypeIcon from '../../../components/ui/IssueTypeIcon';
import { translate } from '../../../helpers/l10n';
import DeferredSpinner from '../../../components/common/DeferredSpinner';
import MultipleSelectionHint from '../../../components/facet/MultipleSelectionHint';
-import { IssueType } from '../../../app/types';
+import { ISSUE_TYPES } from '../../../helpers/constants';
interface Props {
fetching: boolean;
@@ -39,8 +39,6 @@ interface Props {
types: string[];
}
-const TYPES = [IssueType.Bug, IssueType.Vulnerability, IssueType.CodeSmell, IssueType.Hotspot];
-
export default class TypeFacet extends React.PureComponent<Props> {
property = 'types';
@@ -81,8 +79,7 @@ export default class TypeFacet extends React.PureComponent<Props> {
// type is selected explicitly
types.includes(type) ||
// bugs, vulnerabilities and code smells are selected implicitly by default
- (types.length === 0 &&
- [IssueType.Bug, IssueType.Vulnerability, IssueType.CodeSmell].includes(type as IssueType))
+ (types.length === 0 && ['BUG', 'VULNERABILITY', 'CODE_SMELL'].includes(type))
);
}
@@ -126,7 +123,7 @@ export default class TypeFacet extends React.PureComponent<Props> {
<DeferredSpinner loading={this.props.fetching} />
{this.props.open && (
<>
- <FacetItemsList>{TYPES.map(this.renderItem)}</FacetItemsList>
+ <FacetItemsList>{ISSUE_TYPES.map(this.renderItem)}</FacetItemsList>
<MultipleSelectionHint options={Object.keys(stats).length} values={types.length} />
</>
)}
diff --git a/server/sonar-web/src/main/js/apps/issues/utils.ts b/server/sonar-web/src/main/js/apps/issues/utils.ts
index ee1412f78f8..7d20dc76483 100644
--- a/server/sonar-web/src/main/js/apps/issues/utils.ts
+++ b/server/sonar-web/src/main/js/apps/issues/utils.ts
@@ -19,7 +19,6 @@
*/
import { searchMembers } from '../../api/organizations';
import { searchUsers } from '../../api/users';
-import { Issue, Paging } from '../../app/types';
import { formatMeasure } from '../../helpers/measures';
import { get, save } from '../../helpers/storage';
import {
@@ -215,7 +214,7 @@ export const searchAssignees = (
query: string,
organization: string | undefined,
page = 1
-): Promise<{ paging: Paging; results: SearchedAssignee[] }> => {
+): Promise<{ paging: T.Paging; results: SearchedAssignee[] }> => {
return organization
? searchMembers({ organization, p: page, ps: 50, q: query }).then(({ paging, users }) => ({
paging,
@@ -235,7 +234,7 @@ export const saveMyIssues = (myIssues: boolean) =>
save(ISSUES_DEFAULT, myIssues ? LOCALSTORAGE_MY : LOCALSTORAGE_ALL);
export function getLocations(
- { flows, secondaryLocations }: Pick<Issue, 'flows' | 'secondaryLocations'>,
+ { flows, secondaryLocations }: Pick<T.Issue, 'flows' | 'secondaryLocations'>,
selectedFlowIndex: number | undefined
) {
if (selectedFlowIndex !== undefined) {
@@ -246,7 +245,7 @@ export function getLocations(
}
export function getSelectedLocation(
- issue: Pick<Issue, 'flows' | 'secondaryLocations'>,
+ issue: Pick<T.Issue, 'flows' | 'secondaryLocations'>,
selectedFlowIndex: number | undefined,
selectedLocationIndex: number | undefined
) {
@@ -263,7 +262,7 @@ export function getSelectedLocation(
}
export function allLocationsEmpty(
- issue: Pick<Issue, 'flows' | 'secondaryLocations'>,
+ issue: Pick<T.Issue, 'flows' | 'secondaryLocations'>,
selectedFlowIndex: number | undefined
) {
return getLocations(issue, selectedFlowIndex).every(location => !location.msg);
diff --git a/server/sonar-web/src/main/js/apps/marketplace/App.tsx b/server/sonar-web/src/main/js/apps/marketplace/App.tsx
index 2233c8542e1..ca09d9a5ddf 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/App.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/App.tsx
@@ -26,7 +26,7 @@ import EditionBoxes from './EditionBoxes';
import Footer from './Footer';
import PluginsList from './PluginsList';
import Search from './Search';
-import { filterPlugins, parseQuery, Query, serializeQuery, EditionKey } from './utils';
+import { filterPlugins, parseQuery, Query, serializeQuery } from './utils';
import Suggestions from '../../app/components/embed-docs-modal/Suggestions';
import {
getAvailablePlugins,
@@ -41,7 +41,7 @@ import { translate } from '../../helpers/l10n';
import './style.css';
export interface Props {
- currentEdition?: EditionKey;
+ currentEdition?: T.EditionKey;
fetchPendingPlugins: () => void;
location: { pathname: string; query: RawQuery };
pendingPlugins: PluginPendingResult;
diff --git a/server/sonar-web/src/main/js/apps/marketplace/AppContainer.tsx b/server/sonar-web/src/main/js/apps/marketplace/AppContainer.tsx
index 463d28dacbe..1c400266d68 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/AppContainer.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/AppContainer.tsx
@@ -20,7 +20,6 @@
import * as React from 'react';
import { connect } from 'react-redux';
import App from './App';
-import { EditionKey } from './utils';
import { getAppState, getGlobalSettingValue, Store } from '../../store/rootReducer';
import { RawQuery } from '../../helpers/query';
import MarketplaceContext from '../../app/components/MarketplaceContext';
@@ -30,7 +29,7 @@ interface OwnProps {
}
interface StateToProps {
- currentEdition?: EditionKey;
+ currentEdition?: T.EditionKey;
standaloneMode?: boolean;
updateCenterActive: boolean;
}
diff --git a/server/sonar-web/src/main/js/apps/marketplace/EditionBoxes.tsx b/server/sonar-web/src/main/js/apps/marketplace/EditionBoxes.tsx
index 6f1064db849..b42bc304622 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/EditionBoxes.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/EditionBoxes.tsx
@@ -20,11 +20,11 @@
import * as React from 'react';
import EditionBox from './components/EditionBox';
-import { EDITIONS, EditionKey } from './utils';
+import { EDITIONS } from './utils';
import { getMarketplaceNavigation } from '../../api/nav';
export interface Props {
- currentEdition?: EditionKey;
+ currentEdition?: T.EditionKey;
}
interface State {
diff --git a/server/sonar-web/src/main/js/apps/marketplace/Header.tsx b/server/sonar-web/src/main/js/apps/marketplace/Header.tsx
index cfff7fe32ad..44f5941aa5e 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/Header.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/Header.tsx
@@ -18,11 +18,10 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { EditionKey } from './utils';
import { translate } from '../../helpers/l10n';
interface Props {
- currentEdition?: EditionKey;
+ currentEdition?: T.EditionKey;
}
export default function Header({ currentEdition }: Props) {
@@ -35,7 +34,7 @@ export default function Header({ currentEdition }: Props) {
</h3>
)}
<p className="page-description">
- {currentEdition === EditionKey.datacenter
+ {currentEdition === 'datacenter'
? translate('marketplace.page.description_best_edition')
: translate('marketplace.page.description')}
</p>
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/EditionBox.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/EditionBox.tsx
index 1d59ca8d8e6..56304f8337b 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/EditionBox.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/EditionBox.tsx
@@ -21,14 +21,14 @@ import * as React from 'react';
import tooltipDCE from 'Docs/tooltips/editions/datacenter.md';
import tooltipDE from 'Docs/tooltips/editions/developer.md';
import tooltipEE from 'Docs/tooltips/editions/enterprise.md';
-import { Edition, getEditionUrl, EditionKey } from '../utils';
+import { Edition, getEditionUrl } from '../utils';
import { translate } from '../../../helpers/l10n';
import { lazyLoad } from '../../../components/lazyLoad';
const DocMarkdownBlock = lazyLoad(() => import('../../../components/docs/DocMarkdownBlock'));
interface Props {
- currentEdition?: EditionKey;
+ currentEdition?: T.EditionKey;
edition: Edition;
ncloc?: number;
serverId?: string;
diff --git a/server/sonar-web/src/main/js/apps/marketplace/utils.ts b/server/sonar-web/src/main/js/apps/marketplace/utils.ts
index ef9097d577d..2db6169b2ac 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/utils.ts
+++ b/server/sonar-web/src/main/js/apps/marketplace/utils.ts
@@ -73,7 +73,7 @@ export const EDITIONS: Edition[] = [
export function getEditionUrl(
edition: Edition,
- data: { serverId?: string; ncloc?: number; sourceEdition?: string }
+ data: { serverId?: string; ncloc?: number; sourceEdition?: T.EditionKey }
) {
let url = edition.homeUrl;
const query = stringify(omitNil(data));
diff --git a/server/sonar-web/src/main/js/apps/organizationMembers/AddMemberForm.tsx b/server/sonar-web/src/main/js/apps/organizationMembers/AddMemberForm.tsx
index 2617234955e..f5d802f3e63 100644
--- a/server/sonar-web/src/main/js/apps/organizationMembers/AddMemberForm.tsx
+++ b/server/sonar-web/src/main/js/apps/organizationMembers/AddMemberForm.tsx
@@ -23,17 +23,16 @@ import { searchMembers } from '../../api/organizations';
import Modal from '../../components/controls/Modal';
import { translate } from '../../helpers/l10n';
import { SubmitButton, ResetButtonLink, Button } from '../../components/ui/buttons';
-import { Organization, OrganizationMember } from '../../app/types';
interface Props {
- addMember: (member: OrganizationMember) => void;
- organization: Organization;
+ addMember: (member: T.OrganizationMember) => void;
+ organization: T.Organization;
memberLogins: string[];
}
interface State {
open: boolean;
- selectedMember?: OrganizationMember;
+ selectedMember?: T.OrganizationMember;
}
export default class AddMemberForm extends React.PureComponent<Props, State> {
@@ -65,7 +64,7 @@ export default class AddMemberForm extends React.PureComponent<Props, State> {
}
};
- selectedMemberChange = (member: OrganizationMember) => {
+ selectedMemberChange = (member: T.OrganizationMember) => {
this.setState({ selectedMember: member });
};
diff --git a/server/sonar-web/src/main/js/apps/organizationMembers/ManageMemberGroupsForm.tsx b/server/sonar-web/src/main/js/apps/organizationMembers/ManageMemberGroupsForm.tsx
index 6d92e7fce8b..132bab70289 100644
--- a/server/sonar-web/src/main/js/apps/organizationMembers/ManageMemberGroupsForm.tsx
+++ b/server/sonar-web/src/main/js/apps/organizationMembers/ManageMemberGroupsForm.tsx
@@ -24,14 +24,13 @@ import Modal from '../../components/controls/Modal';
import { translate, translateWithParameters } from '../../helpers/l10n';
import OrganizationGroupCheckbox from '../organizations/components/OrganizationGroupCheckbox';
import { SubmitButton, ResetButtonLink } from '../../components/ui/buttons';
-import { Organization, OrganizationMember, Group } from '../../app/types';
interface Props {
onClose: () => void;
- member: OrganizationMember;
- organization: Organization;
- organizationGroups: Group[];
- updateMemberGroups: (member: OrganizationMember, add: string[], remove: string[]) => void;
+ member: T.OrganizationMember;
+ organization: T.Organization;
+ organizationGroups: T.Group[];
+ updateMemberGroups: (member: T.OrganizationMember, add: string[], remove: string[]) => void;
}
interface State {
diff --git a/server/sonar-web/src/main/js/apps/organizationMembers/MembersList.tsx b/server/sonar-web/src/main/js/apps/organizationMembers/MembersList.tsx
index 676478bbbff..ae87c282014 100644
--- a/server/sonar-web/src/main/js/apps/organizationMembers/MembersList.tsx
+++ b/server/sonar-web/src/main/js/apps/organizationMembers/MembersList.tsx
@@ -20,16 +20,15 @@
import * as React from 'react';
import { sortBy } from 'lodash';
import MembersListItem from './MembersListItem';
-import { Group, Organization, OrganizationMember } from '../../app/types';
import { translate } from '../../helpers/l10n';
interface Props {
- members: OrganizationMember[];
- organizationGroups: Group[];
- organization: Organization;
- removeMember: (member: OrganizationMember) => void;
+ members: T.OrganizationMember[];
+ organizationGroups: T.Group[];
+ organization: T.Organization;
+ removeMember: (member: T.OrganizationMember) => void;
updateMemberGroups: (
- member: OrganizationMember,
+ member: T.OrganizationMember,
add: Array<string>,
remove: Array<string>
) => void;
diff --git a/server/sonar-web/src/main/js/apps/organizationMembers/MembersListItem.tsx b/server/sonar-web/src/main/js/apps/organizationMembers/MembersListItem.tsx
index 4b586b366d9..75c43550d7c 100644
--- a/server/sonar-web/src/main/js/apps/organizationMembers/MembersListItem.tsx
+++ b/server/sonar-web/src/main/js/apps/organizationMembers/MembersListItem.tsx
@@ -27,14 +27,13 @@ import ActionsDropdown, {
ActionsDropdownDivider,
ActionsDropdownItem
} from '../../components/controls/ActionsDropdown';
-import { Group, Organization, OrganizationMember } from '../../app/types';
interface Props {
- member: OrganizationMember;
- organization: Organization;
- organizationGroups: Group[];
- removeMember: (member: OrganizationMember) => void;
- updateMemberGroups: (member: OrganizationMember, add: string[], remove: string[]) => void;
+ member: T.OrganizationMember;
+ organization: T.Organization;
+ organizationGroups: T.Group[];
+ removeMember: (member: T.OrganizationMember) => void;
+ updateMemberGroups: (member: T.OrganizationMember, add: string[], remove: string[]) => void;
}
interface State {
diff --git a/server/sonar-web/src/main/js/apps/organizationMembers/OrganizationMembers.tsx b/server/sonar-web/src/main/js/apps/organizationMembers/OrganizationMembers.tsx
index 1769a76333a..ab567cda6b7 100644
--- a/server/sonar-web/src/main/js/apps/organizationMembers/OrganizationMembers.tsx
+++ b/server/sonar-web/src/main/js/apps/organizationMembers/OrganizationMembers.tsx
@@ -27,19 +27,18 @@ import Suggestions from '../../app/components/embed-docs-modal/Suggestions';
import ListFooter from '../../components/controls/ListFooter';
import DocTooltip from '../../components/docs/DocTooltip';
import { translate } from '../../helpers/l10n';
-import { Group, Organization, OrganizationMember, Paging } from '../../app/types';
import { searchMembers, addMember, removeMember } from '../../api/organizations';
import { searchUsersGroups, addUserToGroup, removeUserFromGroup } from '../../api/user_groups';
interface Props {
- organization: Organization;
+ organization: T.Organization;
}
interface State {
- groups: Group[];
+ groups: T.Group[];
loading: boolean;
- members?: OrganizationMember[];
- paging?: Paging;
+ members?: T.OrganizationMember[];
+ paging?: T.Paging;
query: string;
}
@@ -123,7 +122,7 @@ export default class OrganizationMembers extends React.PureComponent<Props, Stat
}, this.stopLoading);
};
- handleAddMember = ({ login }: OrganizationMember) => {
+ handleAddMember = ({ login }: T.OrganizationMember) => {
// TODO optimistic update
addMember({ login, organization: this.props.organization.key }).then(
member => {
@@ -138,7 +137,7 @@ export default class OrganizationMembers extends React.PureComponent<Props, Stat
);
};
- handleRemoveMember = ({ login }: OrganizationMember) => {
+ handleRemoveMember = ({ login }: T.OrganizationMember) => {
// TODO optimistic update
removeMember({ login, organization: this.props.organization.key }).then(
() => {
@@ -153,13 +152,16 @@ export default class OrganizationMembers extends React.PureComponent<Props, Stat
);
};
- updateGroup = (login: string, updater: (member: OrganizationMember) => OrganizationMember) => {
+ updateGroup = (
+ login: string,
+ updater: (member: T.OrganizationMember) => T.OrganizationMember
+ ) => {
this.setState(({ members }) => ({
members: members && members.map(member => (member.login === login ? updater(member) : member))
}));
};
- updateMemberGroups = ({ login }: OrganizationMember, add: string[], remove: string[]) => {
+ updateMemberGroups = ({ login }: T.OrganizationMember, add: string[], remove: string[]) => {
// TODO optimistic update
const promises = [
...add.map(name =>
diff --git a/server/sonar-web/src/main/js/apps/organizationMembers/OrganizationMembersContainer.tsx b/server/sonar-web/src/main/js/apps/organizationMembers/OrganizationMembersContainer.tsx
index c2b0821b83e..86db8266dc3 100644
--- a/server/sonar-web/src/main/js/apps/organizationMembers/OrganizationMembersContainer.tsx
+++ b/server/sonar-web/src/main/js/apps/organizationMembers/OrganizationMembersContainer.tsx
@@ -19,7 +19,6 @@
*/
import { connect } from 'react-redux';
import OrganizationMembers from './OrganizationMembers';
-import { Organization } from '../../app/types';
import { getOrganizationByKey, Store } from '../../store/rootReducer';
interface OwnProps {
@@ -27,7 +26,7 @@ interface OwnProps {
}
interface StateProps {
- organization: Organization;
+ organization: T.Organization;
}
const mapStateToProps = (state: Store, ownProps: OwnProps): StateProps => {
diff --git a/server/sonar-web/src/main/js/apps/organizationMembers/RemoveMemberForm.tsx b/server/sonar-web/src/main/js/apps/organizationMembers/RemoveMemberForm.tsx
index 636ae892a31..ec6494d4fbc 100644
--- a/server/sonar-web/src/main/js/apps/organizationMembers/RemoveMemberForm.tsx
+++ b/server/sonar-web/src/main/js/apps/organizationMembers/RemoveMemberForm.tsx
@@ -21,13 +21,12 @@ import * as React from 'react';
import Modal from '../../components/controls/Modal';
import { translate, translateWithParameters } from '../../helpers/l10n';
import { SubmitButton, ResetButtonLink } from '../../components/ui/buttons';
-import { Organization, OrganizationMember } from '../../app/types';
interface Props {
onClose: () => void;
- member: OrganizationMember;
- organization: Organization;
- removeMember: (member: OrganizationMember) => void;
+ member: T.OrganizationMember;
+ organization: T.Organization;
+ removeMember: (member: T.OrganizationMember) => void;
}
export default class RemoveMemberForm extends React.PureComponent<Props> {
diff --git a/server/sonar-web/src/main/js/apps/organizationMembers/__tests__/OrganizationMembers-test.tsx b/server/sonar-web/src/main/js/apps/organizationMembers/__tests__/OrganizationMembers-test.tsx
index 429e6d34767..b99236cd1a0 100644
--- a/server/sonar-web/src/main/js/apps/organizationMembers/__tests__/OrganizationMembers-test.tsx
+++ b/server/sonar-web/src/main/js/apps/organizationMembers/__tests__/OrganizationMembers-test.tsx
@@ -23,7 +23,6 @@ import OrganizationMembers from '../OrganizationMembers';
import { waitAndUpdate } from '../../../helpers/testUtils';
import { searchMembers, addMember, removeMember } from '../../../api/organizations';
import { searchUsersGroups, addUserToGroup, removeUserFromGroup } from '../../../api/user_groups';
-import { OrganizationMember } from '../../../app/types';
jest.mock('../../../api/organizations', () => ({
addMember: jest.fn().mockResolvedValue({ login: 'bar', name: 'Bar', groupCount: 1 }),
@@ -103,7 +102,7 @@ it('should add new member', async () => {
expect(
wrapper
.find('MembersList')
- .prop<OrganizationMember[]>('members')
+ .prop<T.OrganizationMember[]>('members')
.find(m => m.login === 'bar')
).toBeDefined();
expect(wrapper.find('ListFooter').prop('total')).toEqual(4);
@@ -120,7 +119,7 @@ it('should remove member', async () => {
expect(
wrapper
.find('MembersList')
- .prop<OrganizationMember[]>('members')
+ .prop<T.OrganizationMember[]>('members')
.find(m => m.login === 'john')
).toBeUndefined();
expect(wrapper.find('ListFooter').prop('total')).toEqual(2);
@@ -140,7 +139,7 @@ it('should update groups', async () => {
await waitAndUpdate(wrapper);
const john = wrapper
.find('MembersList')
- .prop<OrganizationMember[]>('members')
+ .prop<T.OrganizationMember[]>('members')
.find(m => m.login === 'john');
expect(john && john.groupCount).toBe(2);
expect(addUserToGroup).toHaveBeenCalledTimes(2);
diff --git a/server/sonar-web/src/main/js/apps/organizations/actions.ts b/server/sonar-web/src/main/js/apps/organizations/actions.ts
index e843cda6344..6d72a0b9318 100644
--- a/server/sonar-web/src/main/js/apps/organizations/actions.ts
+++ b/server/sonar-web/src/main/js/apps/organizations/actions.ts
@@ -22,7 +22,6 @@ import * as api from '../../api/organizations';
import * as actions from '../../store/organizations';
import { addGlobalSuccessMessage } from '../../store/globalMessages';
import { translate, translateWithParameters } from '../../helpers/l10n';
-import { Organization, OrganizationBase } from '../../app/types';
export const fetchOrganization = (key: string) => (dispatch: Dispatch) => {
return Promise.all([api.getOrganization(key), api.getOrganizationNavigation(key)]).then(
@@ -35,8 +34,10 @@ export const fetchOrganization = (key: string) => (dispatch: Dispatch) => {
);
};
-export const createOrganization = (organization: OrganizationBase) => (dispatch: Dispatch<any>) => {
- return api.createOrganization(organization).then((organization: Organization) => {
+export const createOrganization = (organization: T.OrganizationBase) => (
+ dispatch: Dispatch<any>
+) => {
+ return api.createOrganization(organization).then((organization: T.Organization) => {
dispatch(actions.createOrganization(organization));
dispatch(
addGlobalSuccessMessage(translateWithParameters('organization.created', organization.name))
@@ -45,7 +46,7 @@ export const createOrganization = (organization: OrganizationBase) => (dispatch:
});
};
-export const updateOrganization = (key: string, changes: OrganizationBase) => (
+export const updateOrganization = (key: string, changes: T.OrganizationBase) => (
dispatch: Dispatch<any>
) => {
return api.updateOrganization(key, changes).then(() => {
diff --git a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationAccessContainer.tsx b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationAccessContainer.tsx
index 72263ccf372..5c579857e13 100644
--- a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationAccessContainer.tsx
+++ b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationAccessContainer.tsx
@@ -22,12 +22,11 @@ import { connect } from 'react-redux';
import { RouterState } from 'react-router';
import { getCurrentUser, getOrganizationByKey, Store } from '../../../store/rootReducer';
import handleRequiredAuthorization from '../../../app/utils/handleRequiredAuthorization';
-import { Organization, CurrentUser } from '../../../app/types';
import { isLoggedIn } from '../../../helpers/users';
interface StateToProps {
- currentUser: CurrentUser;
- organization?: Organization;
+ currentUser: T.CurrentUser;
+ organization?: T.Organization;
}
interface OwnProps extends RouterState {
diff --git a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationContainer.tsx b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationContainer.tsx
index baadb3fd4cd..0b12f8035e8 100644
--- a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationContainer.tsx
+++ b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationContainer.tsx
@@ -21,11 +21,10 @@ import * as React from 'react';
import { connect } from 'react-redux';
import { RouterState } from 'react-router';
import { getCurrentUser, getOrganizationByKey, Store } from '../../../store/rootReducer';
-import { Organization, CurrentUser } from '../../../app/types';
interface StateToProps {
- organization?: Organization;
- currentUser: CurrentUser;
+ organization?: T.Organization;
+ currentUser: T.CurrentUser;
}
interface OwnProps extends RouterState {
diff --git a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationDelete.tsx b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationDelete.tsx
index 7e506f92d8c..613f2e8a631 100644
--- a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationDelete.tsx
+++ b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationDelete.tsx
@@ -25,7 +25,6 @@ import ConfirmButton from '../../../components/controls/ConfirmButton';
import InstanceMessage from '../../../components/common/InstanceMessage';
import { translate } from '../../../helpers/l10n';
import { deleteOrganization } from '../actions';
-import { Organization } from '../../../app/types';
import { Button } from '../../../components/ui/buttons';
import { getOrganizationBilling } from '../../../api/organizations';
import { isSonarCloud } from '../../../helpers/system';
@@ -36,7 +35,7 @@ interface DispatchToProps {
}
interface OwnProps {
- organization: Pick<Organization, 'key' | 'name'>;
+ organization: Pick<T.Organization, 'key' | 'name'>;
}
type Props = OwnProps & DispatchToProps;
diff --git a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationEdit.tsx b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationEdit.tsx
index 46d57d52361..8b3cb46ca54 100644
--- a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationEdit.tsx
+++ b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationEdit.tsx
@@ -24,15 +24,14 @@ import { debounce } from 'lodash';
import OrganizationAvatar from '../../../components/common/OrganizationAvatar';
import { SubmitButton } from '../../../components/ui/buttons';
import { updateOrganization } from '../actions';
-import { Organization, OrganizationBase } from '../../../app/types';
import { translate } from '../../../helpers/l10n';
interface DispatchProps {
- updateOrganization: (organization: string, changes: OrganizationBase) => Promise<any>;
+ updateOrganization: (organization: string, changes: T.OrganizationBase) => Promise<any>;
}
interface OwnProps {
- organization: Organization;
+ organization: T.Organization;
}
type Props = OwnProps & DispatchProps;
diff --git a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationGroupCheckbox.tsx b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationGroupCheckbox.tsx
index a1209ecbb9c..8a04bbe77fa 100644
--- a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationGroupCheckbox.tsx
+++ b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationGroupCheckbox.tsx
@@ -20,10 +20,9 @@
import * as React from 'react';
import * as classNames from 'classnames';
import Checkbox from '../../../components/controls/Checkbox';
-import { Group } from '../../../app/types';
interface Props {
- group: Group;
+ group: T.Group;
checked: boolean;
onCheck: (name: string, checked: boolean) => void;
}
diff --git a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationJustCreated.tsx b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationJustCreated.tsx
index 71a96eb4e8d..23751fc6dc4 100644
--- a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationJustCreated.tsx
+++ b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationJustCreated.tsx
@@ -19,7 +19,6 @@
*/
import * as React from 'react';
import { withRouter, WithRouterProps } from 'react-router';
-import { Organization } from '../../../app/types';
import { Button } from '../../../components/ui/buttons';
import OnboardingProjectIcon from '../../../components/icons-components/OnboardingProjectIcon';
import OnboardingAddMembersIcon from '../../../components/icons-components/OnboardingAddMembersIcon';
@@ -28,7 +27,7 @@ import '../../tutorials/styles.css';
import './OrganizationJustCreated.css';
interface Props {
- organization: Organization;
+ organization: T.Organization;
}
export class OrganizationJustCreated extends React.PureComponent<Props & WithRouterProps> {
diff --git a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationPage.tsx b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationPage.tsx
index b78929a9040..f0d281877eb 100644
--- a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationPage.tsx
+++ b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationPage.tsx
@@ -26,7 +26,6 @@ import OrganizationNavigation from '../navigation/OrganizationNavigation';
import { fetchOrganization } from '../actions';
import NotFound from '../../../app/components/NotFound';
import Suggestions from '../../../app/components/embed-docs-modal/Suggestions';
-import { Organization, CurrentUser } from '../../../app/types';
import {
getOrganizationByKey,
getCurrentUser,
@@ -41,9 +40,9 @@ interface OwnProps {
}
interface StateProps {
- currentUser: CurrentUser;
- organization?: Organization;
- userOrganizations: Organization[];
+ currentUser: T.CurrentUser;
+ organization?: T.Organization;
+ userOrganizations: T.Organization[];
}
interface DispatchToProps {
@@ -86,7 +85,7 @@ export class OrganizationPage extends React.PureComponent<Props, State> {
this.props.fetchOrganization(organizationKey).then(this.stopLoading, this.stopLoading);
};
- renderChildren(organization: Organization) {
+ renderChildren(organization: T.Organization) {
const { location } = this.props;
const justCreated = Boolean(location.state && location.state.justCreated);
return justCreated ? (
diff --git a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationProjects.tsx b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationProjects.tsx
index ce54a3eea92..ebce36467e1 100644
--- a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationProjects.tsx
+++ b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationProjects.tsx
@@ -20,11 +20,10 @@
import * as React from 'react';
import AllProjectsContainer from '../../projects/components/AllProjectsContainer';
import Suggestions from '../../../app/components/embed-docs-modal/Suggestions';
-import { Organization } from '../../../app/types';
interface Props {
location: { pathname: string; query: { [x: string]: string } };
- organization: Organization;
+ organization: T.Organization;
}
export default function OrganizationProjects(props: Props) {
diff --git a/server/sonar-web/src/main/js/apps/organizations/components/__tests__/OrganizationAccessContainer-test.tsx b/server/sonar-web/src/main/js/apps/organizations/components/__tests__/OrganizationAccessContainer-test.tsx
index 961b7f6bc4b..33794e419ee 100644
--- a/server/sonar-web/src/main/js/apps/organizations/components/__tests__/OrganizationAccessContainer-test.tsx
+++ b/server/sonar-web/src/main/js/apps/organizations/components/__tests__/OrganizationAccessContainer-test.tsx
@@ -21,7 +21,6 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import { Location } from 'history';
import { hasAdminAccess, OrganizationAccess } from '../OrganizationAccessContainer';
-import { Visibility } from '../../../../app/types';
jest.mock('../../../../app/utils/handleRequiredAuthorization', () => ({ default: jest.fn() }));
@@ -38,14 +37,14 @@ const loggedInUser = {
showOnboardingTutorial: false
};
-const organization = {
+const organization: T.Organization = {
actions: { admin: false },
key: 'foo',
name: 'Foo',
- projectVisibility: Visibility.Public
+ projectVisibility: 'public'
};
-const adminOrganization = { ...organization, actions: { admin: true } };
+const adminOrganization: T.Organization = { ...organization, actions: { admin: true } };
describe('component', () => {
it('should render children', () => {
diff --git a/server/sonar-web/src/main/js/apps/organizations/components/__tests__/OrganizationJustCreated-test.tsx b/server/sonar-web/src/main/js/apps/organizations/components/__tests__/OrganizationJustCreated-test.tsx
index ef6c0c10ea6..08ee42d00db 100644
--- a/server/sonar-web/src/main/js/apps/organizations/components/__tests__/OrganizationJustCreated-test.tsx
+++ b/server/sonar-web/src/main/js/apps/organizations/components/__tests__/OrganizationJustCreated-test.tsx
@@ -20,10 +20,9 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import { OrganizationJustCreated } from '../OrganizationJustCreated';
-import { Organization } from '../../../../app/types';
import { click } from '../../../../helpers/testUtils';
-const organization: Organization = { key: 'foo', name: 'Foo' };
+const organization: T.Organization = { key: 'foo', name: 'Foo' };
it('should render', () => {
// @ts-ignore
diff --git a/server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigation.tsx b/server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigation.tsx
index d74444d133b..64f216b78e3 100644
--- a/server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigation.tsx
+++ b/server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigation.tsx
@@ -23,13 +23,12 @@ import OrganizationNavigationMeta from './OrganizationNavigationMeta';
import OrganizationNavigationMenuContainer from './OrganizationNavigationMenuContainer';
import * as theme from '../../../app/theme';
import ContextNavBar from '../../../components/nav/ContextNavBar';
-import { Organization, CurrentUser } from '../../../app/types';
interface Props {
- currentUser: CurrentUser;
+ currentUser: T.CurrentUser;
location: { pathname: string };
- organization: Organization;
- userOrganizations: Organization[];
+ organization: T.Organization;
+ userOrganizations: T.Organization[];
}
export default function OrganizationNavigation({
diff --git a/server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigationAdministration.tsx b/server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigationAdministration.tsx
index e890a54eb11..b4baf580895 100644
--- a/server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigationAdministration.tsx
+++ b/server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigationAdministration.tsx
@@ -20,14 +20,13 @@
import * as React from 'react';
import { Link } from 'react-router';
import * as classNames from 'classnames';
-import { Organization } from '../../../app/types';
import { translate } from '../../../helpers/l10n';
import Dropdown from '../../../components/controls/Dropdown';
import DropdownIcon from '../../../components/icons-components/DropdownIcon';
interface Props {
location: { pathname: string };
- organization: Organization;
+ organization: T.Organization;
}
const ADMIN_PATHS = [
diff --git a/server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigationExtensions.tsx b/server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigationExtensions.tsx
index 67eac961218..4d81a048639 100644
--- a/server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigationExtensions.tsx
+++ b/server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigationExtensions.tsx
@@ -20,14 +20,13 @@
import * as React from 'react';
import { Link } from 'react-router';
import * as classNames from 'classnames';
-import { Organization } from '../../../app/types';
import { translate } from '../../../helpers/l10n';
import Dropdown from '../../../components/controls/Dropdown';
import DropdownIcon from '../../../components/icons-components/DropdownIcon';
interface Props {
location: { pathname: string };
- organization: Organization;
+ organization: T.Organization;
}
export default function OrganizationNavigationExtensions({ location, organization }: Props) {
diff --git a/server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigationHeader.tsx b/server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigationHeader.tsx
index 4d7bb7f71e1..435bd6e2df3 100644
--- a/server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigationHeader.tsx
+++ b/server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigationHeader.tsx
@@ -19,7 +19,6 @@
*/
import * as React from 'react';
import { sortBy } from 'lodash';
-import { Organization } from '../../../app/types';
import OrganizationAvatar from '../../../components/common/OrganizationAvatar';
import Dropdown from '../../../components/controls/Dropdown';
import DropdownIcon from '../../../components/icons-components/DropdownIcon';
@@ -28,8 +27,8 @@ import { sanitizeAlmId } from '../../../helpers/almIntegrations';
import { getBaseUrl } from '../../../helpers/urls';
interface Props {
- organization: Organization;
- organizations: Organization[];
+ organization: T.Organization;
+ organizations: T.Organization[];
}
export default function OrganizationNavigationHeader({ organization, organizations }: Props) {
diff --git a/server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigationHeaderContainer.tsx b/server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigationHeaderContainer.tsx
index fb6b23e087b..9a3538713a8 100644
--- a/server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigationHeaderContainer.tsx
+++ b/server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigationHeaderContainer.tsx
@@ -19,11 +19,10 @@
*/
import { connect } from 'react-redux';
import OrganizationNavigationHeader from './OrganizationNavigationHeader';
-import { Organization } from '../../../app/types';
import { getMyOrganizations, Store } from '../../../store/rootReducer';
interface StateProps {
- organizations: Organization[];
+ organizations: T.Organization[];
}
const mapStateToProps = (state: Store): StateProps => ({
diff --git a/server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigationMenuContainer.tsx b/server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigationMenuContainer.tsx
index ba5160c5baa..6814a2127a1 100644
--- a/server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigationMenuContainer.tsx
+++ b/server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigationMenuContainer.tsx
@@ -22,7 +22,6 @@ import { connect } from 'react-redux';
import { Link } from 'react-router';
import OrganizationNavigationExtensions from './OrganizationNavigationExtensions';
import OrganizationNavigationAdministration from './OrganizationNavigationAdministration';
-import { Organization, CurrentUser } from '../../../app/types';
import NavBarTabs from '../../../components/nav/NavBarTabs';
import { translate } from '../../../helpers/l10n';
import { getQualityGatesUrl } from '../../../helpers/urls';
@@ -30,13 +29,13 @@ import { hasPrivateAccess, isCurrentUserMemberOf } from '../../../helpers/organi
import { getCurrentUser, getMyOrganizations, Store } from '../../../store/rootReducer';
interface StateToProps {
- currentUser: CurrentUser;
- userOrganizations: Organization[];
+ currentUser: T.CurrentUser;
+ userOrganizations: T.Organization[];
}
interface OwnProps {
location: { pathname: string };
- organization: Organization;
+ organization: T.Organization;
}
type Props = OwnProps & StateToProps;
diff --git a/server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigationMeta.tsx b/server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigationMeta.tsx
index ed6bfdd185e..8ec2a861f30 100644
--- a/server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigationMeta.tsx
+++ b/server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigationMeta.tsx
@@ -23,12 +23,11 @@ import DocTooltip from '../../../components/docs/DocTooltip';
import { translate } from '../../../helpers/l10n';
import { isSonarCloud } from '../../../helpers/system';
import { hasPrivateAccess, isPaidOrganization } from '../../../helpers/organizations';
-import { CurrentUser, HomePageType, Organization } from '../../../app/types';
interface Props {
- currentUser: CurrentUser;
- organization: Organization;
- userOrganizations: Organization[];
+ currentUser: T.CurrentUser;
+ organization: T.Organization;
+ userOrganizations: T.Organization[];
}
export default function OrganizationNavigationMeta({
@@ -62,9 +61,7 @@ export default function OrganizationNavigationMeta({
</div>
{onSonarCloud && (
<div className="navbar-context-meta-secondary">
- <HomePageSelect
- currentPage={{ type: HomePageType.Organization, organization: organization.key }}
- />
+ <HomePageSelect currentPage={{ type: 'ORGANIZATION', organization: organization.key }} />
</div>
)}
</div>
diff --git a/server/sonar-web/src/main/js/apps/organizations/navigation/__tests__/OrganizationNavigation-test.tsx b/server/sonar-web/src/main/js/apps/organizations/navigation/__tests__/OrganizationNavigation-test.tsx
index ecfdd94f780..bdc8387e4ad 100644
--- a/server/sonar-web/src/main/js/apps/organizations/navigation/__tests__/OrganizationNavigation-test.tsx
+++ b/server/sonar-web/src/main/js/apps/organizations/navigation/__tests__/OrganizationNavigation-test.tsx
@@ -20,7 +20,6 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import OrganizationNavigation from '../OrganizationNavigation';
-import { Visibility } from '../../../../app/types';
it('render', () => {
expect(
@@ -31,7 +30,7 @@ it('render', () => {
organization={{
key: 'foo',
name: 'Foo',
- projectVisibility: Visibility.Public
+ projectVisibility: 'public'
}}
userOrganizations={[]}
/>
diff --git a/server/sonar-web/src/main/js/apps/organizations/navigation/__tests__/OrganizationNavigationAdministration-test.tsx b/server/sonar-web/src/main/js/apps/organizations/navigation/__tests__/OrganizationNavigationAdministration-test.tsx
index eb8baeef190..4672359959e 100644
--- a/server/sonar-web/src/main/js/apps/organizations/navigation/__tests__/OrganizationNavigationAdministration-test.tsx
+++ b/server/sonar-web/src/main/js/apps/organizations/navigation/__tests__/OrganizationNavigationAdministration-test.tsx
@@ -20,7 +20,6 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import OrganizationNavigationAdministration from '../OrganizationNavigationAdministration';
-import { Visibility } from '../../../../app/types';
it('renders', () => {
const wrapper = shallow(
@@ -29,7 +28,7 @@ it('renders', () => {
organization={{
key: 'foo',
name: 'Foo',
- projectVisibility: Visibility.Public
+ projectVisibility: 'public'
}}
/>
);
diff --git a/server/sonar-web/src/main/js/apps/organizations/navigation/__tests__/OrganizationNavigationHeader-test.tsx b/server/sonar-web/src/main/js/apps/organizations/navigation/__tests__/OrganizationNavigationHeader-test.tsx
index 6b08b874b9e..11f682b73d0 100644
--- a/server/sonar-web/src/main/js/apps/organizations/navigation/__tests__/OrganizationNavigationHeader-test.tsx
+++ b/server/sonar-web/src/main/js/apps/organizations/navigation/__tests__/OrganizationNavigationHeader-test.tsx
@@ -20,13 +20,12 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import OrganizationNavigationHeader from '../OrganizationNavigationHeader';
-import { Visibility } from '../../../../app/types';
it('renders', () => {
expect(
shallow(
<OrganizationNavigationHeader
- organization={{ key: 'foo', name: 'Foo', projectVisibility: Visibility.Public }}
+ organization={{ key: 'foo', name: 'Foo', projectVisibility: 'public' }}
organizations={[]}
/>
)
@@ -41,7 +40,7 @@ it('renders with alm integration', () => {
alm: { key: 'github', url: 'https://github.com/foo' },
key: 'foo',
name: 'Foo',
- projectVisibility: Visibility.Public
+ projectVisibility: 'public'
}}
organizations={[]}
/>
@@ -50,16 +49,16 @@ it('renders with alm integration', () => {
});
it('renders dropdown', () => {
- const organizations = [
- { actions: { admin: true }, key: 'org1', name: 'org1', projectVisibility: Visibility.Public },
- { actions: { admin: false }, key: 'org2', name: 'org2', projectVisibility: Visibility.Public }
+ const organizations: T.Organization[] = [
+ { actions: { admin: true }, key: 'org1', name: 'org1', projectVisibility: 'public' },
+ { actions: { admin: false }, key: 'org2', name: 'org2', projectVisibility: 'public' }
];
const wrapper = shallow(
<OrganizationNavigationHeader
organization={{
key: 'foo',
name: 'Foo',
- projectVisibility: Visibility.Public
+ projectVisibility: 'public'
}}
organizations={organizations}
/>
diff --git a/server/sonar-web/src/main/js/apps/organizations/navigation/__tests__/OrganizationNavigationMenuContainer-test.tsx b/server/sonar-web/src/main/js/apps/organizations/navigation/__tests__/OrganizationNavigationMenuContainer-test.tsx
index e2c37db5866..3c326c97a3f 100644
--- a/server/sonar-web/src/main/js/apps/organizations/navigation/__tests__/OrganizationNavigationMenuContainer-test.tsx
+++ b/server/sonar-web/src/main/js/apps/organizations/navigation/__tests__/OrganizationNavigationMenuContainer-test.tsx
@@ -20,7 +20,6 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import { OrganizationNavigationMenu } from '../OrganizationNavigationMenuContainer';
-import { Visibility } from '../../../../app/types';
import { isCurrentUserMemberOf, hasPrivateAccess } from '../../../../helpers/organizations';
jest.mock('../../../../helpers/organizations', () => ({
@@ -28,10 +27,10 @@ jest.mock('../../../../helpers/organizations', () => ({
hasPrivateAccess: jest.fn().mockReturnValue(true)
}));
-const organization = {
+const organization: T.Organization = {
key: 'foo',
name: 'Foo',
- projectVisibility: Visibility.Public
+ projectVisibility: 'public'
};
const loggedInUser = {
diff --git a/server/sonar-web/src/main/js/apps/organizations/navigation/__tests__/OrganizationNavigationMeta-test.tsx b/server/sonar-web/src/main/js/apps/organizations/navigation/__tests__/OrganizationNavigationMeta-test.tsx
index 5009da6beb4..c402be1352c 100644
--- a/server/sonar-web/src/main/js/apps/organizations/navigation/__tests__/OrganizationNavigationMeta-test.tsx
+++ b/server/sonar-web/src/main/js/apps/organizations/navigation/__tests__/OrganizationNavigationMeta-test.tsx
@@ -20,11 +20,10 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import OrganizationNavigationMeta from '../OrganizationNavigationMeta';
-import { OrganizationSubscription } from '../../../../app/types';
jest.mock('../../../../helpers/system', () => ({ isSonarCloud: () => true }));
-const organization = { key: 'foo', name: 'Foo', subscription: OrganizationSubscription.Free };
+const organization: T.Organization = { key: 'foo', name: 'Foo', subscription: 'FREE' };
it('renders', () => {
expect(
@@ -43,7 +42,7 @@ it('renders with private badge', () => {
shallow(
<OrganizationNavigationMeta
currentUser={{ isLoggedIn: true }}
- organization={{ ...organization, subscription: OrganizationSubscription.Paid }}
+ organization={{ ...organization, subscription: 'PAID' }}
userOrganizations={[organization]}
/>
)
diff --git a/server/sonar-web/src/main/js/apps/overview/badges/BadgeParams.tsx b/server/sonar-web/src/main/js/apps/overview/badges/BadgeParams.tsx
index 6c5a6613d61..ddb7de1f365 100644
--- a/server/sonar-web/src/main/js/apps/overview/badges/BadgeParams.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/badges/BadgeParams.tsx
@@ -22,11 +22,10 @@ import { BadgeColors, BadgeType, BadgeOptions } from './utils';
import Select from '../../../components/controls/Select';
import { fetchWebApi } from '../../../api/web-api';
import { getLocalizedMetricName, translate } from '../../../helpers/l10n';
-import { Metric } from '../../../app/types';
interface Props {
className?: string;
- metrics: { [key: string]: Metric };
+ metrics: { [key: string]: T.Metric };
options: BadgeOptions;
type: BadgeType;
updateOptions: (options: Partial<BadgeOptions>) => void;
diff --git a/server/sonar-web/src/main/js/apps/overview/badges/BadgesModal.tsx b/server/sonar-web/src/main/js/apps/overview/badges/BadgesModal.tsx
index 9898a4f2b01..1962e6f73f0 100644
--- a/server/sonar-web/src/main/js/apps/overview/badges/BadgesModal.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/badges/BadgesModal.tsx
@@ -21,7 +21,6 @@ import * as React from 'react';
import BadgeButton from './BadgeButton';
import BadgeParams from './BadgeParams';
import { BadgeType, BadgeOptions, getBadgeUrl } from './utils';
-import { Metric, BranchLike } from '../../../app/types';
import CodeSnippet from '../../../components/common/CodeSnippet';
import Modal from '../../../components/controls/Modal';
import { getBranchLikeQuery } from '../../../helpers/branches';
@@ -31,8 +30,8 @@ import { isSonarCloud } from '../../../helpers/system';
import './styles.css';
interface Props {
- branchLike?: BranchLike;
- metrics: { [key: string]: Metric };
+ branchLike?: T.BranchLike;
+ metrics: { [key: string]: T.Metric };
project: string;
qualifier: string;
}
diff --git a/server/sonar-web/src/main/js/apps/overview/badges/__tests__/BadgeParams-test.tsx b/server/sonar-web/src/main/js/apps/overview/badges/__tests__/BadgeParams-test.tsx
index 5e8936739b3..7656a4ac629 100644
--- a/server/sonar-web/src/main/js/apps/overview/badges/__tests__/BadgeParams-test.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/badges/__tests__/BadgeParams-test.tsx
@@ -21,7 +21,6 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import BadgeParams from '../BadgeParams';
import { BadgeType } from '../utils';
-import { Metric } from '../../../../app/types';
jest.mock('../../../../api/web-api', () => ({
fetchWebApi: () =>
@@ -39,8 +38,8 @@ jest.mock('../../../../api/web-api', () => ({
}));
const METRICS = {
- alert_status: { key: 'alert_status', name: 'Quality Gate' } as Metric,
- coverage: { key: 'coverage', name: 'Coverage' } as Metric
+ alert_status: { key: 'alert_status', name: 'Quality Gate' } as T.Metric,
+ coverage: { key: 'coverage', name: 'Coverage' } as T.Metric
};
it('should display marketing badge params', () => {
diff --git a/server/sonar-web/src/main/js/apps/overview/badges/__tests__/BadgesModal-test.tsx b/server/sonar-web/src/main/js/apps/overview/badges/__tests__/BadgesModal-test.tsx
index 23555a9a631..eedcb7913f0 100644
--- a/server/sonar-web/src/main/js/apps/overview/badges/__tests__/BadgesModal-test.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/badges/__tests__/BadgesModal-test.tsx
@@ -21,17 +21,16 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import BadgesModal from '../BadgesModal';
import { click } from '../../../../helpers/testUtils';
-import { ShortLivingBranch, BranchType } from '../../../../app/types';
import { isSonarCloud } from '../../../../helpers/system';
jest.mock('../../../../helpers/urls', () => ({ getHostUrl: () => 'host' }));
jest.mock('../../../../helpers/system', () => ({ isSonarCloud: jest.fn() }));
-const shortBranch: ShortLivingBranch = {
+const shortBranch: T.ShortLivingBranch = {
isMain: false,
mergeBranch: '',
name: 'branch-6.6',
- type: BranchType.SHORT
+ type: 'SHORT'
};
it('should display the modal after click on sonar cloud', () => {
diff --git a/server/sonar-web/src/main/js/apps/overview/components/App.tsx b/server/sonar-web/src/main/js/apps/overview/components/App.tsx
index 68c8238c23c..74ec5533243 100644
--- a/server/sonar-web/src/main/js/apps/overview/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/components/App.tsx
@@ -24,7 +24,6 @@ import EmptyOverview from './EmptyOverview';
import OverviewApp from './OverviewApp';
import SonarCloudEmptyOverview from './SonarCloudEmptyOverview';
import Suggestions from '../../../app/components/embed-docs-modal/Suggestions';
-import { Component, BranchLike } from '../../../app/types';
import { isShortLivingBranch } from '../../../helpers/branches';
import {
getShortLivingBranchUrl,
@@ -36,12 +35,12 @@ import {
import { isSonarCloud } from '../../../helpers/system';
interface Props {
- branchLike?: BranchLike;
- branchLikes: BranchLike[];
- component: Component;
+ branchLike?: T.BranchLike;
+ branchLikes: T.BranchLike[];
+ component: T.Component;
isInProgress?: boolean;
isPending?: boolean;
- onComponentChange: (changes: Partial<Component>) => void;
+ onComponentChange: (changes: Partial<T.Component>) => void;
}
export default class App extends React.PureComponent<Props> {
diff --git a/server/sonar-web/src/main/js/apps/overview/components/ApplicationLeakPeriodLegend.tsx b/server/sonar-web/src/main/js/apps/overview/components/ApplicationLeakPeriodLegend.tsx
index 9fb9e9a51e2..2e9f7123d60 100644
--- a/server/sonar-web/src/main/js/apps/overview/components/ApplicationLeakPeriodLegend.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/components/ApplicationLeakPeriodLegend.tsx
@@ -25,11 +25,10 @@ import DateTooltipFormatter from '../../../components/intl/DateTooltipFormatter'
import { getApplicationLeak } from '../../../api/application';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import DateFromNow from '../../../components/intl/DateFromNow';
-import { LightComponent, LongLivingBranch } from '../../../app/types';
interface Props {
- branch?: LongLivingBranch;
- component: LightComponent;
+ branch?: T.LongLivingBranch;
+ component: T.LightComponent;
}
interface State {
diff --git a/server/sonar-web/src/main/js/apps/overview/components/EmptyOverview.tsx b/server/sonar-web/src/main/js/apps/overview/components/EmptyOverview.tsx
index a5db1cb7e6a..c862b97b0e4 100644
--- a/server/sonar-web/src/main/js/apps/overview/components/EmptyOverview.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/components/EmptyOverview.tsx
@@ -21,13 +21,12 @@ import * as React from 'react';
import { Link } from 'react-router';
import { FormattedMessage } from 'react-intl';
import { translate } from '../../../helpers/l10n';
-import { BranchLike } from '../../../app/types';
import { isBranch, isLongLivingBranch } from '../../../helpers/branches';
import { Alert } from '../../../components/ui/Alert';
interface Props {
- branchLike?: BranchLike;
- branchLikes: BranchLike[];
+ branchLike?: T.BranchLike;
+ branchLikes: T.BranchLike[];
component: string;
showWarning?: boolean;
}
diff --git a/server/sonar-web/src/main/js/apps/overview/components/LeakPeriodLegend.tsx b/server/sonar-web/src/main/js/apps/overview/components/LeakPeriodLegend.tsx
index 7e1c17777dd..fd3615653aa 100644
--- a/server/sonar-web/src/main/js/apps/overview/components/LeakPeriodLegend.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/components/LeakPeriodLegend.tsx
@@ -26,10 +26,9 @@ import Tooltip from '../../../components/controls/Tooltip';
import { getPeriodDate, getPeriodLabel } from '../../../helpers/periods';
import { translateWithParameters } from '../../../helpers/l10n';
import { differenceInDays } from '../../../helpers/dates';
-import { Period, PeriodMode } from '../../../app/types';
interface Props {
- period: Period;
+ period: T.Period;
}
export default class LeakPeriodLegend extends React.PureComponent<Props> {
@@ -48,7 +47,7 @@ export default class LeakPeriodLegend extends React.PureComponent<Props> {
return null;
}
- if (period.mode === PeriodMode.Days) {
+ if (period.mode === 'days') {
return (
<div className="overview-legend overview-legend-spaced-line">
{translateWithParameters('overview.new_code_period_x', leakPeriodLabel)}
@@ -64,7 +63,7 @@ export default class LeakPeriodLegend extends React.PureComponent<Props> {
const formattedDateFunction = (formattedLeakPeriodDate: string) => (
<span>
{translateWithParameters(
- period.mode === PeriodMode.PreviousAnalysis
+ period.mode === 'previous_analysis'
? 'overview.previous_analysis_on_x'
: 'overview.started_on_x',
formattedLeakPeriodDate
@@ -90,7 +89,7 @@ export default class LeakPeriodLegend extends React.PureComponent<Props> {
{fromNow => (
<span className="note">
{translateWithParameters(
- period.mode === PeriodMode.PreviousAnalysis
+ period.mode === 'previous_analysis'
? 'overview.previous_analysis_x'
: 'overview.started_x',
fromNow
diff --git a/server/sonar-web/src/main/js/apps/overview/components/OverviewApp.tsx b/server/sonar-web/src/main/js/apps/overview/components/OverviewApp.tsx
index aa82ff5837f..611b3f5087f 100644
--- a/server/sonar-web/src/main/js/apps/overview/components/OverviewApp.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/components/OverviewApp.tsx
@@ -48,18 +48,17 @@ import {
} from '../../../helpers/branches';
import { fetchMetrics } from '../../../store/rootActions';
import { getMetrics, Store } from '../../../store/rootReducer';
-import { BranchLike, Component, Metric, MeasureEnhanced, Period } from '../../../app/types';
import { translate } from '../../../helpers/l10n';
import '../styles.css';
interface OwnProps {
- branchLike?: BranchLike;
- component: Component;
+ branchLike?: T.BranchLike;
+ component: T.Component;
onComponentChange: (changes: {}) => void;
}
interface StateToProps {
- metrics: { [key: string]: Metric };
+ metrics: { [key: string]: T.Metric };
}
interface DispatchToProps {
@@ -74,8 +73,8 @@ interface State {
};
historyStartDate?: Date;
loading: boolean;
- measures: MeasureEnhanced[];
- periods?: Period[];
+ measures: T.MeasureEnhanced[];
+ periods?: T.Period[];
}
export class OverviewApp extends React.PureComponent<Props, State> {
@@ -162,7 +161,7 @@ export class OverviewApp extends React.PureComponent<Props, State> {
getApplicationLeakPeriod = () =>
this.state.measures.find(measure => measure.metric.key === 'new_bugs')
- ? ({ index: 1 } as Period)
+ ? ({ index: 1 } as T.Period)
: undefined;
isEmpty = () =>
diff --git a/server/sonar-web/src/main/js/apps/overview/components/SonarCloudEmptyOverview.tsx b/server/sonar-web/src/main/js/apps/overview/components/SonarCloudEmptyOverview.tsx
index 46ebf59c072..d1be8f47023 100644
--- a/server/sonar-web/src/main/js/apps/overview/components/SonarCloudEmptyOverview.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/components/SonarCloudEmptyOverview.tsx
@@ -22,7 +22,6 @@ import { connect } from 'react-redux';
import { FormattedMessage } from 'react-intl';
import AnalyzeTutorial from '../../tutorials/analyzeProject/AnalyzeTutorial';
import MetaContainer from '../meta/MetaContainer';
-import { BranchLike, Component, CurrentUser } from '../../../app/types';
import { isLongLivingBranch, isBranch, isMainBranch } from '../../../helpers/branches';
import { translate } from '../../../helpers/l10n';
import { isLoggedIn } from '../../../helpers/users';
@@ -31,15 +30,15 @@ import '../../../app/styles/sonarcloud.css';
import { Alert } from '../../../components/ui/Alert';
interface OwnProps {
- branchLike?: BranchLike;
- branchLikes: BranchLike[];
- component: Component;
+ branchLike?: T.BranchLike;
+ branchLikes: T.BranchLike[];
+ component: T.Component;
hasAnalyses?: boolean;
onComponentChange: (changes: {}) => void;
}
interface StateProps {
- currentUser: CurrentUser;
+ currentUser: T.CurrentUser;
}
type Props = OwnProps & StateProps;
@@ -99,7 +98,7 @@ export function WarningMessage({
branchLike,
message
}: {
- branchLike?: BranchLike;
+ branchLike?: T.BranchLike;
message: string;
}) {
if (!isBranch(branchLike)) {
diff --git a/server/sonar-web/src/main/js/apps/overview/components/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/overview/components/__tests__/App-test.tsx
index 73eb99d9350..afac1a5750e 100644
--- a/server/sonar-web/src/main/js/apps/overview/components/__tests__/App-test.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/components/__tests__/App-test.tsx
@@ -20,7 +20,6 @@
import * as React from 'react';
import { mount, shallow } from 'enzyme';
import App from '../App';
-import { BranchType, LongLivingBranch } from '../../../../app/types';
import { isSonarCloud } from '../../../../helpers/system';
jest.mock('../../../../helpers/system', () => ({ isSonarCloud: jest.fn() }));
@@ -66,7 +65,7 @@ it('should render SonarCloudEmptyOverview', () => {
});
it('redirects on Code page for files', () => {
- const branch: LongLivingBranch = { isMain: false, name: 'b', type: BranchType.LONG };
+ const branch: T.LongLivingBranch = { isMain: false, name: 'b', type: 'LONG' };
const newComponent = {
...component,
breadcrumbs: [
diff --git a/server/sonar-web/src/main/js/apps/overview/components/__tests__/EmptyOverview-test.tsx b/server/sonar-web/src/main/js/apps/overview/components/__tests__/EmptyOverview-test.tsx
index 6fd204472ab..593c512198b 100644
--- a/server/sonar-web/src/main/js/apps/overview/components/__tests__/EmptyOverview-test.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/components/__tests__/EmptyOverview-test.tsx
@@ -20,9 +20,8 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import EmptyOverview from '../EmptyOverview';
-import { BranchType } from '../../../../app/types';
-const branch = { isMain: true, name: 'b', type: BranchType.LONG };
+const branch = { isMain: true, name: 'b', type: 'LONG' };
it('renders', () => {
expect(
diff --git a/server/sonar-web/src/main/js/apps/overview/components/__tests__/LeakPeriodLegend-test.tsx b/server/sonar-web/src/main/js/apps/overview/components/__tests__/LeakPeriodLegend-test.tsx
index 77a2ddc8cca..f4a39fd5f13 100644
--- a/server/sonar-web/src/main/js/apps/overview/components/__tests__/LeakPeriodLegend-test.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/components/__tests__/LeakPeriodLegend-test.tsx
@@ -21,7 +21,6 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import LeakPeriodLegend from '../LeakPeriodLegend';
import { differenceInDays } from '../../../../helpers/dates';
-import { Period, PeriodMode } from '../../../../app/types';
jest.mock('../../../../helpers/dates', () => {
const dates = require.requireActual('../../../../helpers/dates');
@@ -34,7 +33,7 @@ it('10 days', () => {
getWrapper({
date: '2013-09-22T00:00:00+0200',
index: 0,
- mode: PeriodMode.Days,
+ mode: 'days',
parameter: '10'
})
).toMatchSnapshot();
@@ -45,7 +44,7 @@ it('date', () => {
getWrapper({
date: '2013-09-22T00:00:00+0200',
index: 0,
- mode: PeriodMode.Date,
+ mode: 'date',
parameter: '2013-01-01'
})
).toMatchSnapshot();
@@ -56,7 +55,7 @@ it('version', () => {
getWrapper({
date: '2013-09-22T00:00:00+0200',
index: 0,
- mode: PeriodMode.Version,
+ mode: 'version',
parameter: '0.1'
}).find('.overview-legend')
).toMatchSnapshot();
@@ -67,7 +66,7 @@ it('previous_version', () => {
getWrapper({
date: '2013-09-22T00:00:00+0200',
index: 0,
- mode: PeriodMode.PreviousVersion
+ mode: 'previous_version'
}).find('.overview-legend')
).toMatchSnapshot();
});
@@ -77,7 +76,7 @@ it('previous_analysis', () => {
getWrapper({
date: '2013-09-22T00:00:00+0200',
index: 0,
- mode: PeriodMode.PreviousAnalysis
+ mode: 'previous_analysis'
}).find('.overview-legend')
).toMatchSnapshot();
});
@@ -88,12 +87,12 @@ it('should render a more precise date', () => {
getWrapper({
date: '2018-08-17T00:00:00+0200',
index: 0,
- mode: PeriodMode.PreviousVersion
+ mode: 'previous_version'
})
).toMatchSnapshot();
});
-function getWrapper(period: Period) {
+function getWrapper(period: T.Period) {
return shallow(<LeakPeriodLegend period={period} />, {
context: {
intl: { formatDate: (date: string) => 'formatted.' + date }
diff --git a/server/sonar-web/src/main/js/apps/overview/components/__tests__/SonarCloudEmptyOverview-test.tsx b/server/sonar-web/src/main/js/apps/overview/components/__tests__/SonarCloudEmptyOverview-test.tsx
index 278fca079d1..f971b2dbe9f 100644
--- a/server/sonar-web/src/main/js/apps/overview/components/__tests__/SonarCloudEmptyOverview-test.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/components/__tests__/SonarCloudEmptyOverview-test.tsx
@@ -20,9 +20,8 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import { SonarCloudEmptyOverview, WarningMessage } from '../SonarCloudEmptyOverview';
-import { BranchType } from '../../../../app/types';
-const branch = { isMain: true, name: 'b', type: BranchType.LONG };
+const branch = { isMain: true, name: 'b', type: 'LONG' };
const component = {
key: 'foo',
diff --git a/server/sonar-web/src/main/js/apps/overview/events/AnalysesList.tsx b/server/sonar-web/src/main/js/apps/overview/events/AnalysesList.tsx
index 1de1bc02ba4..849706cdc88 100644
--- a/server/sonar-web/src/main/js/apps/overview/events/AnalysesList.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/events/AnalysesList.tsx
@@ -23,22 +23,21 @@ import Analysis from './Analysis';
import { getProjectActivity } from '../../../api/projectActivity';
import PreviewGraph from '../../../components/preview-graph/PreviewGraph';
import { translate } from '../../../helpers/l10n';
-import { Metric, Component, BranchLike, Analysis as AnalysisType } from '../../../app/types';
import { getBranchLikeQuery, isSameBranchLike } from '../../../helpers/branches';
import { getActivityUrl } from '../../../helpers/urls';
interface Props {
- branchLike?: BranchLike;
- component: Component;
+ branchLike?: T.BranchLike;
+ component: T.Component;
history?: {
[metric: string]: Array<{ date: Date; value?: string }>;
};
- metrics: { [key: string]: Metric };
+ metrics: { [key: string]: T.Metric };
qualifier: string;
}
interface State {
- analyses: AnalysisType[];
+ analyses: T.Analysis[];
loading: boolean;
}
@@ -99,7 +98,7 @@ export default class AnalysesList extends React.PureComponent<Props, State> {
);
};
- renderList(analyses: AnalysisType[]) {
+ renderList(analyses: T.Analysis[]) {
if (!analyses.length) {
return <p className="spacer-top note">{translate('no_results')}</p>;
}
diff --git a/server/sonar-web/src/main/js/apps/overview/events/Analysis.tsx b/server/sonar-web/src/main/js/apps/overview/events/Analysis.tsx
index aa00c270b34..615bccad2de 100644
--- a/server/sonar-web/src/main/js/apps/overview/events/Analysis.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/events/Analysis.tsx
@@ -21,11 +21,10 @@ import * as React from 'react';
import { sortBy } from 'lodash';
import Event from './Event';
import DateTooltipFormatter from '../../../components/intl/DateTooltipFormatter';
-import { Analysis as AnalysisType } from '../../../app/types';
import { translate } from '../../../helpers/l10n';
interface Props {
- analysis: AnalysisType;
+ analysis: T.Analysis;
qualifier: string;
}
diff --git a/server/sonar-web/src/main/js/apps/overview/events/Event.tsx b/server/sonar-web/src/main/js/apps/overview/events/Event.tsx
index b7fc148533a..262ff7c78a9 100644
--- a/server/sonar-web/src/main/js/apps/overview/events/Event.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/events/Event.tsx
@@ -19,14 +19,13 @@
*/
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
-import { AnalysisEvent } from '../../../app/types';
import { isRichQualityGateEvent } from '../../projectActivity/components/RichQualityGateEventInner';
import Level from '../../../components/ui/Level';
import { translate } from '../../../helpers/l10n';
import { isDefinitionChangeEvent } from '../../projectActivity/components/DefinitionChangeEventInner';
interface Props {
- event: AnalysisEvent;
+ event: T.AnalysisEvent;
}
export default function Event({ event }: Props) {
diff --git a/server/sonar-web/src/main/js/apps/overview/main/BugsAndVulnerabilities.tsx b/server/sonar-web/src/main/js/apps/overview/main/BugsAndVulnerabilities.tsx
index 146158a5b61..3c7de94b878 100644
--- a/server/sonar-web/src/main/js/apps/overview/main/BugsAndVulnerabilities.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/main/BugsAndVulnerabilities.tsx
@@ -29,7 +29,6 @@ import { getMetricName } from '../utils';
import { getComponentDrilldownUrl } from '../../../helpers/urls';
import { translate } from '../../../helpers/l10n';
import { isLongLivingBranch } from '../../../helpers/branches';
-import { IssueType } from '../../../app/types';
export class BugsAndVulnerabilities extends React.PureComponent<ComposedProps> {
renderHeader() {
@@ -82,9 +81,7 @@ export class BugsAndVulnerabilities extends React.PureComponent<ComposedProps> {
<div className="overview-domain-measures">
<div className="overview-domain-measure">
<div className="overview-domain-measure-value">
- <span style={{ marginLeft: 30 }}>
- {this.props.renderIssues('new_bugs', IssueType.Bug)}
- </span>
+ <span style={{ marginLeft: 30 }}>{this.props.renderIssues('new_bugs', 'BUG')}</span>
{this.props.renderRating('new_reliability_rating')}
</div>
<div className="overview-domain-measure-label">
@@ -95,7 +92,7 @@ export class BugsAndVulnerabilities extends React.PureComponent<ComposedProps> {
<div className="overview-domain-measure">
<div className="overview-domain-measure-value">
<span style={{ marginLeft: 30 }}>
- {this.props.renderIssues('new_vulnerabilities', IssueType.Vulnerability)}
+ {this.props.renderIssues('new_vulnerabilities', 'VULNERABILITY')}
</span>
{this.props.renderRating('new_security_rating')}
</div>
@@ -115,7 +112,7 @@ export class BugsAndVulnerabilities extends React.PureComponent<ComposedProps> {
<div className="overview-domain-measures">
<div className="overview-domain-measure">
<div className="overview-domain-measure-value">
- {this.props.renderIssues('bugs', IssueType.Bug)}
+ {this.props.renderIssues('bugs', 'BUG')}
{this.props.renderRating('reliability_rating')}
</div>
<div className="overview-domain-measure-label">
@@ -126,7 +123,7 @@ export class BugsAndVulnerabilities extends React.PureComponent<ComposedProps> {
</div>
<div className="overview-domain-measure">
<div className="overview-domain-measure-value">
- {this.props.renderIssues('vulnerabilities', IssueType.Vulnerability)}
+ {this.props.renderIssues('vulnerabilities', 'VULNERABILITY')}
{this.props.renderRating('security_rating')}
</div>
<div className="overview-domain-measure-label">
diff --git a/server/sonar-web/src/main/js/apps/overview/main/CodeSmells.tsx b/server/sonar-web/src/main/js/apps/overview/main/CodeSmells.tsx
index c49704368f0..f5adea6c517 100644
--- a/server/sonar-web/src/main/js/apps/overview/main/CodeSmells.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/main/CodeSmells.tsx
@@ -25,7 +25,6 @@ import { translate, translateWithParameters } from '../../../helpers/l10n';
import { formatMeasure } from '../../../helpers/measures';
import CodeSmellIcon from '../../../components/icons-components/CodeSmellIcon';
import DrilldownLink from '../../../components/shared/DrilldownLink';
-import { IssueType } from '../../../app/types';
export class CodeSmells extends React.PureComponent<ComposedProps> {
renderHeader() {
@@ -85,7 +84,7 @@ export class CodeSmells extends React.PureComponent<ComposedProps> {
</div>
<div className="overview-domain-measure">
<div className="overview-domain-measure-value">
- {this.props.renderIssues('new_code_smells', IssueType.CodeSmell)}
+ {this.props.renderIssues('new_code_smells', 'CODE_SMELL')}
</div>
<div className="overview-domain-measure-label">
<CodeSmellIcon className="little-spacer-right" />
@@ -115,7 +114,7 @@ export class CodeSmells extends React.PureComponent<ComposedProps> {
</div>
<div className="overview-domain-measure">
<div className="overview-domain-measure-value">
- {this.props.renderIssues('code_smells', IssueType.CodeSmell)}
+ {this.props.renderIssues('code_smells', 'CODE_SMELL')}
</div>
<div className="overview-domain-measure-label offset-left">
<CodeSmellIcon className="little-spacer-right " />
diff --git a/server/sonar-web/src/main/js/apps/overview/main/enhance.tsx b/server/sonar-web/src/main/js/apps/overview/main/enhance.tsx
index d583ae979d8..3bad649a3ea 100644
--- a/server/sonar-web/src/main/js/apps/overview/main/enhance.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/main/enhance.tsx
@@ -39,14 +39,13 @@ import {
getComponentIssuesUrl,
getMeasureHistoryUrl
} from '../../../helpers/urls';
-import { Component, BranchLike, MeasureEnhanced, Period } from '../../../app/types';
import { getBranchLikeQuery } from '../../../helpers/branches';
export interface EnhanceProps {
- branchLike?: BranchLike;
- component: Component;
- measures: MeasureEnhanced[];
- leakPeriod?: Period;
+ branchLike?: T.BranchLike;
+ component: T.Component;
+ measures: T.MeasureEnhanced[];
+ leakPeriod?: T.Period;
history?: {
[metric: string]: Array<{ date: Date; value?: string }>;
};
@@ -54,11 +53,11 @@ export interface EnhanceProps {
}
export interface ComposedProps extends EnhanceProps {
- getValue: (measure: MeasureEnhanced) => string | undefined;
+ getValue: (measure: T.MeasureEnhanced) => string | undefined;
renderHeader: (domain: string, label: string) => React.ReactNode;
renderMeasure: (metricKey: string) => React.ReactNode;
renderRating: (metricKey: string) => React.ReactNode;
- renderIssues: (metric: string, type: string) => React.ReactNode;
+ renderIssues: (metric: string, type: T.IssueType) => React.ReactNode;
renderHistoryLink: (metricKey: string) => React.ReactNode;
renderTimeline: (metricKey: string, range: string, children?: React.ReactNode) => React.ReactNode;
}
@@ -67,7 +66,7 @@ export default function enhance(ComposedComponent: React.ComponentType<ComposedP
return class extends React.PureComponent<EnhanceProps> {
static displayName = `enhance(${ComposedComponent.displayName})}`;
- getValue = (measure: MeasureEnhanced) => {
+ getValue = (measure: T.MeasureEnhanced) => {
const { leakPeriod } = this.props;
if (!measure) {
return '0';
diff --git a/server/sonar-web/src/main/js/apps/overview/meta/MetaContainer.tsx b/server/sonar-web/src/main/js/apps/overview/meta/MetaContainer.tsx
index 80fe882f3d9..f4a9b938b37 100644
--- a/server/sonar-web/src/main/js/apps/overview/meta/MetaContainer.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/meta/MetaContainer.tsx
@@ -29,15 +29,6 @@ import MetaSize from './MetaSize';
import MetaTags from './MetaTags';
import BadgesModal from '../badges/BadgesModal';
import AnalysesList from '../events/AnalysesList';
-import {
- Visibility,
- Component,
- Metric,
- BranchLike,
- CurrentUser,
- Organization,
- MeasureEnhanced
-} from '../../../app/types';
import { translate } from '../../../helpers/l10n';
import { hasPrivateAccess } from '../../../helpers/organizations';
import {
@@ -49,19 +40,19 @@ import {
import PrivacyBadgeContainer from '../../../components/common/PrivacyBadgeContainer';
interface StateToProps {
- currentUser: CurrentUser;
- organization?: Organization;
- userOrganizations: Organization[];
+ currentUser: T.CurrentUser;
+ organization?: T.Organization;
+ userOrganizations: T.Organization[];
}
interface OwnProps {
- branchLike?: BranchLike;
- component: Component;
+ branchLike?: T.BranchLike;
+ component: T.Component;
history?: {
[metric: string]: Array<{ date: Date; value?: string }>;
};
- measures?: MeasureEnhanced[];
- metrics?: { [key: string]: Metric };
+ measures?: T.MeasureEnhanced[];
+ metrics?: { [key: string]: T.Metric };
onComponentChange: (changes: {}) => void;
}
@@ -113,7 +104,7 @@ export class Meta extends React.PureComponent<Props> {
const isProject = qualifier === 'TRK';
const isApp = qualifier === 'APP';
- const isPrivate = visibility === Visibility.Private;
+ const isPrivate = visibility === 'private';
return (
<div className="overview-meta">
<div className="overview-meta-card">
diff --git a/server/sonar-web/src/main/js/apps/overview/meta/MetaLink.tsx b/server/sonar-web/src/main/js/apps/overview/meta/MetaLink.tsx
index 85eeaf8ca81..a1e1e6bad13 100644
--- a/server/sonar-web/src/main/js/apps/overview/meta/MetaLink.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/meta/MetaLink.tsx
@@ -19,11 +19,10 @@
*/
import * as React from 'react';
import { getLinkName } from '../../projectLinks/utils';
-import { ProjectLink } from '../../../app/types';
import ProjectLinkIcon from '../../../components/icons-components/ProjectLinkIcon';
interface Props {
- link: ProjectLink;
+ link: T.ProjectLink;
}
export default function MetaLink({ link }: Props) {
diff --git a/server/sonar-web/src/main/js/apps/overview/meta/MetaLinks.tsx b/server/sonar-web/src/main/js/apps/overview/meta/MetaLinks.tsx
index 78d87b6f88b..0a8251dfb27 100644
--- a/server/sonar-web/src/main/js/apps/overview/meta/MetaLinks.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/meta/MetaLinks.tsx
@@ -21,15 +21,14 @@ import * as React from 'react';
import MetaLink from './MetaLink';
import { orderLinks } from '../../projectLinks/utils';
import { getProjectLinks } from '../../../api/projectLinks';
-import { LightComponent, ProjectLink } from '../../../app/types';
import { translate } from '../../../helpers/l10n';
interface Props {
- component: LightComponent;
+ component: T.LightComponent;
}
interface State {
- links?: ProjectLink[];
+ links?: T.ProjectLink[];
}
export default class MetaLinks extends React.PureComponent<Props, State> {
diff --git a/server/sonar-web/src/main/js/apps/overview/meta/MetaQualityProfiles.tsx b/server/sonar-web/src/main/js/apps/overview/meta/MetaQualityProfiles.tsx
index 06452143c33..406ffcee656 100644
--- a/server/sonar-web/src/main/js/apps/overview/meta/MetaQualityProfiles.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/meta/MetaQualityProfiles.tsx
@@ -26,16 +26,15 @@ import { translate, translateWithParameters } from '../../../helpers/l10n';
import { getQualityProfileUrl } from '../../../helpers/urls';
import { searchRules } from '../../../api/rules';
import { getLanguages, Store } from '../../../store/rootReducer';
-import { ComponentQualityProfile, Languages } from '../../../app/types';
interface StateProps {
- languages: Languages;
+ languages: T.Languages;
}
interface OwnProps {
headerClassName?: string;
organization?: string;
- profiles: ComponentQualityProfile[];
+ profiles: T.ComponentQualityProfile[];
}
interface State {
@@ -90,7 +89,7 @@ class MetaQualityProfiles extends React.PureComponent<StateProps & OwnProps, Sta
return count || 0;
}
- renderProfile(profile: ComponentQualityProfile) {
+ renderProfile(profile: T.ComponentQualityProfile) {
const languageFromStore = this.props.languages[profile.language];
const languageName = languageFromStore ? languageFromStore.name : profile.language;
diff --git a/server/sonar-web/src/main/js/apps/overview/meta/MetaSize.tsx b/server/sonar-web/src/main/js/apps/overview/meta/MetaSize.tsx
index ab902845eb1..2c97f7246ca 100644
--- a/server/sonar-web/src/main/js/apps/overview/meta/MetaSize.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/meta/MetaSize.tsx
@@ -25,16 +25,15 @@ import SizeRating from '../../../components/ui/SizeRating';
import { formatMeasure } from '../../../helpers/measures';
import { getMetricName } from '../utils';
import { translate } from '../../../helpers/l10n';
-import { LightComponent, BranchLike, MeasureEnhanced } from '../../../app/types';
interface Props {
- branchLike?: BranchLike;
- component: LightComponent;
- measures: MeasureEnhanced[];
+ branchLike?: T.BranchLike;
+ component: T.LightComponent;
+ measures: T.MeasureEnhanced[];
}
export default class MetaSize extends React.PureComponent<Props> {
- renderLoC = (ncloc?: MeasureEnhanced) => (
+ renderLoC = (ncloc?: T.MeasureEnhanced) => (
<div
className={classNames('overview-meta-size-ncloc', {
'is-half-width': this.props.component.qualifier === 'APP'
diff --git a/server/sonar-web/src/main/js/apps/overview/meta/MetaTags.tsx b/server/sonar-web/src/main/js/apps/overview/meta/MetaTags.tsx
index 855b3201c0c..475e82fb3cd 100644
--- a/server/sonar-web/src/main/js/apps/overview/meta/MetaTags.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/meta/MetaTags.tsx
@@ -22,13 +22,12 @@ import MetaTagsSelector from './MetaTagsSelector';
import { setProjectTags } from '../../../api/components';
import { translate } from '../../../helpers/l10n';
import TagsList from '../../../components/tags/TagsList';
-import { Component } from '../../../app/types';
import { Button } from '../../../components/ui/buttons';
import Dropdown from '../../../components/controls/Dropdown';
import { PopupPlacement } from '../../../components/ui/popups';
interface Props {
- component: Component;
+ component: T.Component;
onComponentChange: (changes: {}) => void;
}
diff --git a/server/sonar-web/src/main/js/apps/overview/qualityGate/ApplicationQualityGate.tsx b/server/sonar-web/src/main/js/apps/overview/qualityGate/ApplicationQualityGate.tsx
index 91cba327f51..7cf6741b1b9 100644
--- a/server/sonar-web/src/main/js/apps/overview/qualityGate/ApplicationQualityGate.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/qualityGate/ApplicationQualityGate.tsx
@@ -23,17 +23,16 @@ import ApplicationQualityGateProject from './ApplicationQualityGateProject';
import Level from '../../../components/ui/Level';
import { getApplicationQualityGate, ApplicationProject } from '../../../api/quality-gates';
import { translate } from '../../../helpers/l10n';
-import { LightComponent, Metric, LongLivingBranch } from '../../../app/types';
import DocTooltip from '../../../components/docs/DocTooltip';
interface Props {
- branch?: LongLivingBranch;
- component: LightComponent;
+ branch?: T.LongLivingBranch;
+ component: T.LightComponent;
}
type State = {
loading: boolean;
- metrics?: { [key: string]: Metric };
+ metrics?: { [key: string]: T.Metric };
projects?: ApplicationProject[];
status?: string;
};
diff --git a/server/sonar-web/src/main/js/apps/overview/qualityGate/ApplicationQualityGateProject.tsx b/server/sonar-web/src/main/js/apps/overview/qualityGate/ApplicationQualityGateProject.tsx
index 620a839fed0..fe5df8f34e6 100644
--- a/server/sonar-web/src/main/js/apps/overview/qualityGate/ApplicationQualityGateProject.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/qualityGate/ApplicationQualityGateProject.tsx
@@ -24,11 +24,10 @@ import { getLocalizedMetricName, translate } from '../../../helpers/l10n';
import { formatMeasure, isDiffMetric } from '../../../helpers/measures';
import { getProjectUrl } from '../../../helpers/urls';
import './ApplicationQualityGateProject.css';
-import { Metric } from '../../../app/types';
import { ApplicationProject, ConditionAnalysis } from '../../../api/quality-gates';
interface Props {
- metrics: { [key: string]: Metric };
+ metrics: { [key: string]: T.Metric };
project: ApplicationProject;
}
diff --git a/server/sonar-web/src/main/js/apps/overview/qualityGate/QualityGate.tsx b/server/sonar-web/src/main/js/apps/overview/qualityGate/QualityGate.tsx
index b49ea0000a2..47370714c3e 100644
--- a/server/sonar-web/src/main/js/apps/overview/qualityGate/QualityGate.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/qualityGate/QualityGate.tsx
@@ -24,13 +24,12 @@ import { translate } from '../../../helpers/l10n';
import Level from '../../../components/ui/Level';
import HelpTooltip from '../../../components/controls/HelpTooltip';
import DocTooltip from '../../../components/docs/DocTooltip';
-import { Component, BranchLike, MeasureEnhanced } from '../../../app/types';
import { Alert } from '../../../components/ui/Alert';
interface Props {
- branchLike?: BranchLike;
- component: Pick<Component, 'key' | 'qualifier'>;
- measures: MeasureEnhanced[];
+ branchLike?: T.BranchLike;
+ component: Pick<T.Component, 'key' | 'qualifier'>;
+ measures: T.MeasureEnhanced[];
}
export default function QualityGate({ branchLike, component, measures }: Props) {
@@ -89,6 +88,6 @@ function parseQualityGateDetails(rawDetails: string) {
return JSON.parse(rawDetails);
}
-function isProject(component: Pick<Component, 'qualifier'>) {
+function isProject(component: Pick<T.Component, 'qualifier'>) {
return component.qualifier === 'TRK';
}
diff --git a/server/sonar-web/src/main/js/apps/overview/qualityGate/QualityGateCondition.tsx b/server/sonar-web/src/main/js/apps/overview/qualityGate/QualityGateCondition.tsx
index af96ccf0a1d..627bf89d57d 100644
--- a/server/sonar-web/src/main/js/apps/overview/qualityGate/QualityGateCondition.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/qualityGate/QualityGateCondition.tsx
@@ -28,11 +28,10 @@ import { getPeriodValue, isDiffMetric, formatMeasure } from '../../../helpers/me
import { translate } from '../../../helpers/l10n';
import { getComponentIssuesUrl } from '../../../helpers/urls';
import { getBranchLikeQuery } from '../../../helpers/branches';
-import { IssueType, BranchLike, Component } from '../../../app/types';
interface Props {
- branchLike?: BranchLike;
- component: Pick<Component, 'key'>;
+ branchLike?: T.BranchLike;
+ component: Pick<T.Component, 'key'>;
condition: QualityGateStatusConditionEnhanced;
}
@@ -60,7 +59,7 @@ export default class QualityGateCondition extends React.PureComponent<Props> {
};
getUrlForCodeSmells(sinceLeakPeriod: boolean) {
- return this.getIssuesUrl(sinceLeakPeriod, { types: IssueType.CodeSmell });
+ return this.getIssuesUrl(sinceLeakPeriod, { types: 'CODE_SMELL' });
}
getUrlForBugsOrVulnerabilities(type: string, sinceLeakPeriod: boolean) {
@@ -81,7 +80,7 @@ export default class QualityGateCondition extends React.PureComponent<Props> {
}
getUrlForType(type: string, sinceLeakPeriod: boolean) {
- return type === IssueType.CodeSmell
+ return type === 'CODE_SMELL'
? this.getUrlForCodeSmells(sinceLeakPeriod)
: this.getUrlForBugsOrVulnerabilities(type, sinceLeakPeriod);
}
@@ -98,12 +97,12 @@ export default class QualityGateCondition extends React.PureComponent<Props> {
const metricKey = condition.measure.metric.key;
const RATING_METRICS_MAPPING: { [metric: string]: [string, boolean] } = {
- reliability_rating: [IssueType.Bug, false],
- new_reliability_rating: [IssueType.Bug, true],
- security_rating: [IssueType.Vulnerability, false],
- new_security_rating: [IssueType.Vulnerability, true],
- sqale_rating: [IssueType.CodeSmell, false],
- new_maintainability_rating: [IssueType.CodeSmell, true]
+ reliability_rating: ['BUG', false],
+ new_reliability_rating: ['BUG', true],
+ security_rating: ['VULNERABILITY', false],
+ new_security_rating: ['VULNERABILITY', true],
+ sqale_rating: ['CODE_SMELL', false],
+ new_maintainability_rating: ['CODE_SMELL', true]
};
return RATING_METRICS_MAPPING[metricKey] ? (
diff --git a/server/sonar-web/src/main/js/apps/overview/qualityGate/QualityGateConditions.tsx b/server/sonar-web/src/main/js/apps/overview/qualityGate/QualityGateConditions.tsx
index 32762196d54..5f4118e85bd 100644
--- a/server/sonar-web/src/main/js/apps/overview/qualityGate/QualityGateConditions.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/qualityGate/QualityGateConditions.tsx
@@ -24,13 +24,12 @@ import { QualityGateStatusCondition, QualityGateStatusConditionEnhanced } from '
import { getMeasuresAndMeta } from '../../../api/measures';
import { enhanceMeasuresWithMetrics } from '../../../helpers/measures';
import { isSameBranchLike, getBranchLikeQuery } from '../../../helpers/branches';
-import { BranchLike, Component, MeasureEnhanced } from '../../../app/types';
const LEVEL_ORDER = ['ERROR', 'WARN'];
interface Props {
- branchLike?: BranchLike;
- component: Pick<Component, 'key'>;
+ branchLike?: T.BranchLike;
+ component: Pick<T.Component, 'key'>;
conditions: QualityGateStatusCondition[];
}
@@ -126,7 +125,7 @@ export default class QualityGateConditions extends React.PureComponent<Props, St
function enhanceConditions(
conditions: QualityGateStatusCondition[],
- measures: MeasureEnhanced[]
+ measures: T.MeasureEnhanced[]
): QualityGateStatusConditionEnhanced[] {
return conditions.map(condition => {
const measure = measures.find(measure => measure.metric.key === condition.metric)!;
diff --git a/server/sonar-web/src/main/js/apps/overview/utils.ts b/server/sonar-web/src/main/js/apps/overview/utils.ts
index cb0923876ef..7e1b8f2eb74 100644
--- a/server/sonar-web/src/main/js/apps/overview/utils.ts
+++ b/server/sonar-web/src/main/js/apps/overview/utils.ts
@@ -17,7 +17,6 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { MeasureEnhanced } from '../../app/types';
import { translate } from '../../helpers/l10n';
export interface QualityGateStatusCondition {
@@ -32,7 +31,7 @@ export interface QualityGateStatusCondition {
// long name to not mix with Condition from /app/types.ts
export interface QualityGateStatusConditionEnhanced extends QualityGateStatusCondition {
- measure: MeasureEnhanced;
+ measure: T.MeasureEnhanced;
}
export const METRICS = [
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/ActionsCell.tsx b/server/sonar-web/src/main/js/apps/permission-templates/components/ActionsCell.tsx
index 771e50e4292..ce073542841 100644
--- a/server/sonar-web/src/main/js/apps/permission-templates/components/ActionsCell.tsx
+++ b/server/sonar-web/src/main/js/apps/permission-templates/components/ActionsCell.tsx
@@ -27,7 +27,6 @@ import {
deletePermissionTemplate,
updatePermissionTemplate
} from '../../../api/permissions';
-import { PermissionTemplate } from '../../../app/types';
import ActionsDropdown, { ActionsDropdownItem } from '../../../components/controls/ActionsDropdown';
import QualifierIcon from '../../../components/icons-components/QualifierIcon';
import { translate } from '../../../helpers/l10n';
@@ -35,7 +34,7 @@ import { translate } from '../../../helpers/l10n';
export interface Props {
fromDetails?: boolean;
organization?: { isDefault?: boolean; key: string };
- permissionTemplate: PermissionTemplate;
+ permissionTemplate: T.PermissionTemplate;
refresh: () => void;
topQualifiers: string[];
}
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/DeleteForm.tsx b/server/sonar-web/src/main/js/apps/permission-templates/components/DeleteForm.tsx
index b89b76e1c31..85dd456fa94 100644
--- a/server/sonar-web/src/main/js/apps/permission-templates/components/DeleteForm.tsx
+++ b/server/sonar-web/src/main/js/apps/permission-templates/components/DeleteForm.tsx
@@ -18,7 +18,6 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { PermissionTemplate } from '../../../app/types';
import SimpleModal from '../../../components/controls/SimpleModal';
import DeferredSpinner from '../../../components/common/DeferredSpinner';
import { SubmitButton, ResetButtonLink } from '../../../components/ui/buttons';
@@ -27,7 +26,7 @@ import { translate, translateWithParameters } from '../../../helpers/l10n';
interface Props {
onClose: () => void;
onSubmit: () => Promise<void>;
- permissionTemplate: PermissionTemplate;
+ permissionTemplate: T.PermissionTemplate;
}
export default function DeleteForm({ onClose, onSubmit, permissionTemplate: t }: Props) {
diff --git a/server/sonar-web/src/main/js/apps/permissions/global/components/AllHoldersList.tsx b/server/sonar-web/src/main/js/apps/permissions/global/components/AllHoldersList.tsx
index 0282227203b..4315b32a2b0 100644
--- a/server/sonar-web/src/main/js/apps/permissions/global/components/AllHoldersList.tsx
+++ b/server/sonar-web/src/main/js/apps/permissions/global/components/AllHoldersList.tsx
@@ -23,13 +23,6 @@ import SearchForm from '../../shared/components/SearchForm';
import HoldersList from '../../shared/components/HoldersList';
import ListFooter from '../../../../components/controls/ListFooter';
import {
- AppState,
- Organization,
- Paging,
- PermissionGroup,
- PermissionUser
-} from '../../../../app/types';
-import {
PERMISSIONS_ORDER_GLOBAL,
convertToPermissionDefinitions,
PERMISSIONS_ORDER_GLOBAL_GOV
@@ -37,32 +30,32 @@ import {
import { Store, getAppState } from '../../../../store/rootReducer';
interface StateProps {
- appState: Pick<AppState, 'qualifiers'>;
+ appState: Pick<T.AppState, 'qualifiers'>;
}
interface OwnProps {
filter: string;
grantPermissionToGroup: (groupName: string, permission: string) => Promise<void>;
grantPermissionToUser: (login: string, permission: string) => Promise<void>;
- groups: PermissionGroup[];
- groupsPaging?: Paging;
+ groups: T.PermissionGroup[];
+ groupsPaging?: T.Paging;
loadHolders: () => void;
loading?: boolean;
onLoadMore: () => void;
onFilter: (filter: string) => void;
onSearch: (query: string) => void;
- organization?: Organization;
+ organization?: T.Organization;
query: string;
revokePermissionFromGroup: (groupName: string, permission: string) => Promise<void>;
revokePermissionFromUser: (login: string, permission: string) => Promise<void>;
- users: PermissionUser[];
- usersPaging?: Paging;
+ users: T.PermissionUser[];
+ usersPaging?: T.Paging;
}
type Props = StateProps & OwnProps;
export class AllHoldersList extends React.PureComponent<Props> {
- handleToggleUser = (user: PermissionUser, permission: string) => {
+ handleToggleUser = (user: T.PermissionUser, permission: string) => {
const hasPermission = user.permissions.includes(permission);
if (hasPermission) {
return this.props.revokePermissionFromUser(user.login, permission);
@@ -71,7 +64,7 @@ export class AllHoldersList extends React.PureComponent<Props> {
}
};
- handleToggleGroup = (group: PermissionGroup, permission: string) => {
+ handleToggleGroup = (group: T.PermissionGroup, permission: string) => {
const hasPermission = group.permissions.includes(permission);
if (hasPermission) {
diff --git a/server/sonar-web/src/main/js/apps/permissions/global/components/App.tsx b/server/sonar-web/src/main/js/apps/permissions/global/components/App.tsx
index f34942f8cc2..fe32df6b04e 100644
--- a/server/sonar-web/src/main/js/apps/permissions/global/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/permissions/global/components/App.tsx
@@ -25,22 +25,21 @@ import AllHoldersList from './AllHoldersList';
import * as api from '../../../../api/permissions';
import Suggestions from '../../../../app/components/embed-docs-modal/Suggestions';
import { translate } from '../../../../helpers/l10n';
-import { Organization, Paging, PermissionGroup, PermissionUser } from '../../../../app/types';
import forSingleOrganization from '../../../organizations/forSingleOrganization';
import '../../styles.css';
interface Props {
- organization?: Organization;
+ organization?: T.Organization;
}
interface State {
filter: 'all' | 'groups' | 'users';
- groups: PermissionGroup[];
- groupsPaging?: Paging;
+ groups: T.PermissionGroup[];
+ groupsPaging?: T.Paging;
loading: boolean;
query: string;
- users: PermissionUser[];
- usersPaging?: Paging;
+ users: T.PermissionUser[];
+ usersPaging?: T.Paging;
}
export class App extends React.PureComponent<Props, State> {
@@ -70,7 +69,7 @@ export class App extends React.PureComponent<Props, State> {
const { organization } = this.props;
const { filter, query } = this.state;
- const getUsers: Promise<{ paging?: Paging; users: PermissionUser[] }> =
+ const getUsers: Promise<{ paging?: T.Paging; users: T.PermissionUser[] }> =
filter !== 'groups'
? api.getGlobalPermissionsUsers({
q: query || undefined,
@@ -79,7 +78,7 @@ export class App extends React.PureComponent<Props, State> {
})
: Promise.resolve({ paging: undefined, users: [] });
- const getGroups: Promise<{ paging?: Paging; groups: PermissionGroup[] }> =
+ const getGroups: Promise<{ paging?: T.Paging; groups: T.PermissionGroup[] }> =
filter !== 'users'
? api.getGlobalPermissionsGroups({
q: query || undefined,
@@ -133,7 +132,7 @@ export class App extends React.PureComponent<Props, State> {
this.setState({ query }, this.loadHolders);
};
- addPermissionToGroup = (groups: PermissionGroup[], group: string, permission: string) => {
+ addPermissionToGroup = (groups: T.PermissionGroup[], group: string, permission: string) => {
return groups.map(
candidate =>
candidate.name === group
@@ -142,7 +141,7 @@ export class App extends React.PureComponent<Props, State> {
);
};
- addPermissionToUser = (users: PermissionUser[], user: string, permission: string) => {
+ addPermissionToUser = (users: T.PermissionUser[], user: string, permission: string) => {
return users.map(
candidate =>
candidate.login === user
@@ -151,7 +150,7 @@ export class App extends React.PureComponent<Props, State> {
);
};
- removePermissionFromGroup = (groups: PermissionGroup[], group: string, permission: string) => {
+ removePermissionFromGroup = (groups: T.PermissionGroup[], group: string, permission: string) => {
return groups.map(
candidate =>
candidate.name === group
@@ -160,7 +159,7 @@ export class App extends React.PureComponent<Props, State> {
);
};
- removePermissionFromUser = (users: PermissionUser[], user: string, permission: string) => {
+ removePermissionFromUser = (users: T.PermissionUser[], user: string, permission: string) => {
return users.map(
candidate =>
candidate.login === user
diff --git a/server/sonar-web/src/main/js/apps/permissions/project/components/AllHoldersList.tsx b/server/sonar-web/src/main/js/apps/permissions/project/components/AllHoldersList.tsx
index 27cd441636e..52db4021166 100644
--- a/server/sonar-web/src/main/js/apps/permissions/project/components/AllHoldersList.tsx
+++ b/server/sonar-web/src/main/js/apps/permissions/project/components/AllHoldersList.tsx
@@ -23,21 +23,14 @@ import SearchForm from '../../shared/components/SearchForm';
import HoldersList from '../../shared/components/HoldersList';
import ListFooter from '../../../../components/controls/ListFooter';
import { PERMISSIONS_ORDER_BY_QUALIFIER, convertToPermissionDefinitions } from '../../utils';
-import {
- Component,
- Paging,
- PermissionGroup,
- PermissionUser,
- Visibility
-} from '../../../../app/types';
interface Props {
- component: Component;
+ component: T.Component;
filter: string;
grantPermissionToGroup: (group: string, permission: string) => Promise<void>;
grantPermissionToUser: (user: string, permission: string) => Promise<void>;
- groups: PermissionGroup[];
- groupsPaging?: Paging;
+ groups: T.PermissionGroup[];
+ groupsPaging?: T.Paging;
onLoadMore: () => void;
onFilterChange: (filter: string) => void;
onPermissionSelect: (permissions?: string) => void;
@@ -46,13 +39,13 @@ interface Props {
revokePermissionFromGroup: (group: string, permission: string) => Promise<void>;
revokePermissionFromUser: (user: string, permission: string) => Promise<void>;
selectedPermission?: string;
- users: PermissionUser[];
- usersPaging?: Paging;
- visibility?: Visibility;
+ users: T.PermissionUser[];
+ usersPaging?: T.Paging;
+ visibility?: T.Visibility;
}
export default class AllHoldersList extends React.PureComponent<Props> {
- handleToggleUser = (user: PermissionUser, permission: string) => {
+ handleToggleUser = (user: T.PermissionUser, permission: string) => {
const hasPermission = user.permissions.includes(permission);
if (hasPermission) {
@@ -62,7 +55,7 @@ export default class AllHoldersList extends React.PureComponent<Props> {
}
};
- handleToggleGroup = (group: PermissionGroup, permission: string) => {
+ handleToggleGroup = (group: T.PermissionGroup, permission: string) => {
const hasPermission = group.permissions.includes(permission);
if (hasPermission) {
@@ -79,7 +72,7 @@ export default class AllHoldersList extends React.PureComponent<Props> {
render() {
const { filter, groups, groupsPaging, users, usersPaging } = this.props;
let order = PERMISSIONS_ORDER_BY_QUALIFIER[this.props.component.qualifier];
- if (this.props.visibility === Visibility.Public) {
+ if (this.props.visibility === 'public') {
order = without(order, 'user', 'codeviewer');
}
const permissions = convertToPermissionDefinitions(order, 'projects_role');
diff --git a/server/sonar-web/src/main/js/apps/permissions/project/components/App.tsx b/server/sonar-web/src/main/js/apps/permissions/project/components/App.tsx
index 9e9f7678116..0f82247d151 100644
--- a/server/sonar-web/src/main/js/apps/permissions/project/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/permissions/project/components/App.tsx
@@ -27,30 +27,23 @@ import UpgradeOrganizationBox from '../../../../components/common/UpgradeOrganiz
import VisibilitySelector from '../../../../components/common/VisibilitySelector';
import * as api from '../../../../api/permissions';
import { translate } from '../../../../helpers/l10n';
-import {
- Component,
- Paging,
- PermissionGroup,
- PermissionUser,
- Visibility
-} from '../../../../app/types';
import '../../styles.css';
interface Props {
- component: Component;
- onComponentChange: (changes: Partial<Component>) => void;
+ component: T.Component;
+ onComponentChange: (changes: Partial<T.Component>) => void;
}
interface State {
disclaimer: boolean;
filter: string;
- groups: PermissionGroup[];
- groupsPaging?: Paging;
+ groups: T.PermissionGroup[];
+ groupsPaging?: T.Paging;
loading: boolean;
query: string;
selectedPermission?: string;
- users: PermissionUser[];
- usersPaging?: Paging;
+ users: T.PermissionUser[];
+ usersPaging?: T.Paging;
}
export default class App extends React.PureComponent<Props, State> {
@@ -87,7 +80,7 @@ export default class App extends React.PureComponent<Props, State> {
const { component } = this.props;
const { filter, query, selectedPermission } = this.state;
- const getUsers: Promise<{ paging?: Paging; users: PermissionUser[] }> =
+ const getUsers: Promise<{ paging?: T.Paging; users: T.PermissionUser[] }> =
filter !== 'groups'
? api.getPermissionsUsersForComponent({
projectKey: component.key,
@@ -98,7 +91,7 @@ export default class App extends React.PureComponent<Props, State> {
})
: Promise.resolve({ paging: undefined, users: [] });
- const getGroups: Promise<{ paging?: Paging; groups: PermissionGroup[] }> =
+ const getGroups: Promise<{ paging?: T.Paging; groups: T.PermissionGroup[] }> =
filter !== 'users'
? api.getPermissionsGroupsForComponent({
projectKey: component.key,
@@ -307,7 +300,7 @@ export default class App extends React.PureComponent<Props, State> {
};
handleVisibilityChange = (visibility: string) => {
- if (visibility === Visibility.Public) {
+ if (visibility === 'public') {
this.openDisclaimer();
} else {
this.turnProjectToPrivate();
@@ -315,28 +308,28 @@ export default class App extends React.PureComponent<Props, State> {
};
turnProjectToPublic = () => {
- this.props.onComponentChange({ visibility: Visibility.Public });
- api.changeProjectVisibility(this.props.component.key, Visibility.Public).then(
+ this.props.onComponentChange({ visibility: 'public' });
+ api.changeProjectVisibility(this.props.component.key, 'public').then(
() => {
this.loadHolders();
},
() => {
this.props.onComponentChange({
- visibility: Visibility.Private
+ visibility: 'private'
});
}
);
};
turnProjectToPrivate = () => {
- this.props.onComponentChange({ visibility: Visibility.Private });
- api.changeProjectVisibility(this.props.component.key, Visibility.Private).then(
+ this.props.onComponentChange({ visibility: 'private' });
+ api.changeProjectVisibility(this.props.component.key, 'private').then(
() => {
this.loadHolders();
},
() => {
this.props.onComponentChange({
- visibility: Visibility.Public
+ visibility: 'public'
});
}
);
diff --git a/server/sonar-web/src/main/js/apps/permissions/project/components/ApplyTemplate.tsx b/server/sonar-web/src/main/js/apps/permissions/project/components/ApplyTemplate.tsx
index 37cbecb1251..c90c4509123 100644
--- a/server/sonar-web/src/main/js/apps/permissions/project/components/ApplyTemplate.tsx
+++ b/server/sonar-web/src/main/js/apps/permissions/project/components/ApplyTemplate.tsx
@@ -19,7 +19,6 @@
*/
import * as React from 'react';
import { getPermissionTemplates, applyTemplateToProject } from '../../../../api/permissions';
-import { PermissionTemplate } from '../../../../app/types';
import DeferredSpinner from '../../../../components/common/DeferredSpinner';
import SimpleModal from '../../../../components/controls/SimpleModal';
import Select from '../../../../components/controls/Select';
@@ -38,7 +37,7 @@ interface State {
done: boolean;
loading: boolean;
permissionTemplate?: string;
- permissionTemplates?: PermissionTemplate[];
+ permissionTemplates?: T.PermissionTemplate[];
}
export default class ApplyTemplate extends React.PureComponent<Props, State> {
diff --git a/server/sonar-web/src/main/js/apps/permissions/project/components/PageHeader.tsx b/server/sonar-web/src/main/js/apps/permissions/project/components/PageHeader.tsx
index e7c6947c1a9..53fa13680f6 100644
--- a/server/sonar-web/src/main/js/apps/permissions/project/components/PageHeader.tsx
+++ b/server/sonar-web/src/main/js/apps/permissions/project/components/PageHeader.tsx
@@ -19,12 +19,11 @@
*/
import * as React from 'react';
import ApplyTemplate from './ApplyTemplate';
-import { Component } from '../../../../app/types';
import { Button } from '../../../../components/ui/buttons';
import { translate } from '../../../../helpers/l10n';
interface Props {
- component: Component;
+ component: T.Component;
loadHolders: () => void;
loading: boolean;
}
diff --git a/server/sonar-web/src/main/js/apps/permissions/shared/components/GroupHolder.tsx b/server/sonar-web/src/main/js/apps/permissions/shared/components/GroupHolder.tsx
index 54b3c93a865..540d238bbbc 100644
--- a/server/sonar-web/src/main/js/apps/permissions/shared/components/GroupHolder.tsx
+++ b/server/sonar-web/src/main/js/apps/permissions/shared/components/GroupHolder.tsx
@@ -21,13 +21,12 @@ import * as React from 'react';
import { without } from 'lodash';
import PermissionCell from './PermissionCell';
import GroupIcon from '../../../../components/icons-components/GroupIcon';
-import { PermissionDefinitions, PermissionGroup } from '../../../../app/types';
import { isPermissionDefinitionGroup } from '../../utils';
interface Props {
- group: PermissionGroup;
- onToggle: (group: PermissionGroup, permission: string) => Promise<void>;
- permissions: PermissionDefinitions;
+ group: T.PermissionGroup;
+ onToggle: (group: T.PermissionGroup, permission: string) => Promise<void>;
+ permissions: T.PermissionDefinitions;
selectedPermission?: string;
}
diff --git a/server/sonar-web/src/main/js/apps/permissions/shared/components/HoldersList.tsx b/server/sonar-web/src/main/js/apps/permissions/shared/components/HoldersList.tsx
index c90341d2510..fe9b4c898e3 100644
--- a/server/sonar-web/src/main/js/apps/permissions/shared/components/HoldersList.tsx
+++ b/server/sonar-web/src/main/js/apps/permissions/shared/components/HoldersList.tsx
@@ -23,21 +23,20 @@ import UserHolder from './UserHolder';
import GroupHolder from './GroupHolder';
import PermissionHeader from './PermissionHeader';
import { translate } from '../../../../helpers/l10n';
-import { PermissionGroup, PermissionUser, PermissionDefinitions } from '../../../../app/types';
import { isPermissionDefinitionGroup } from '../../utils';
interface Props {
filter?: string;
- groups: PermissionGroup[];
+ groups: T.PermissionGroup[];
loading?: boolean;
onSelectPermission?: (permission: string) => void;
- onToggleGroup: (group: PermissionGroup, permission: string) => Promise<void>;
- onToggleUser: (user: PermissionUser, permission: string) => Promise<void>;
- permissions: PermissionDefinitions;
+ onToggleGroup: (group: T.PermissionGroup, permission: string) => Promise<void>;
+ onToggleUser: (user: T.PermissionUser, permission: string) => Promise<void>;
+ permissions: T.PermissionDefinitions;
query?: string;
selectedPermission?: string;
showPublicProjectsWarning?: boolean;
- users: PermissionUser[];
+ users: T.PermissionUser[];
}
interface State {
@@ -51,11 +50,11 @@ export default class HoldersList extends React.PureComponent<Props, State> {
}
}
- isPermissionUser(item: PermissionGroup | PermissionUser): item is PermissionUser {
- return (item as PermissionUser).login !== undefined;
+ isPermissionUser(item: T.PermissionGroup | T.PermissionUser): item is T.PermissionUser {
+ return (item as T.PermissionUser).login !== undefined;
}
- handleGroupToggle = (group: PermissionGroup, permission: string) => {
+ handleGroupToggle = (group: T.PermissionGroup, permission: string) => {
const key = group.id || group.name;
if (this.state.initialPermissionsCount[key] === undefined) {
this.setState(state => ({
@@ -68,7 +67,7 @@ export default class HoldersList extends React.PureComponent<Props, State> {
return this.props.onToggleGroup(group, permission);
};
- handleUserToggle = (user: PermissionUser, permission: string) => {
+ handleUserToggle = (user: T.PermissionUser, permission: string) => {
if (this.state.initialPermissionsCount[user.login] === undefined) {
this.setState(state => ({
initialPermissionsCount: {
@@ -80,7 +79,7 @@ export default class HoldersList extends React.PureComponent<Props, State> {
return this.props.onToggleUser(user, permission);
};
- getItemInitialPermissionsCount = (item: PermissionGroup | PermissionUser) => {
+ getItemInitialPermissionsCount = (item: T.PermissionGroup | T.PermissionUser) => {
const key = this.isPermissionUser(item) ? item.login : item.id || item.name;
return this.state.initialPermissionsCount[key] !== undefined
? this.state.initialPermissionsCount[key]
@@ -96,7 +95,7 @@ export default class HoldersList extends React.PureComponent<Props, State> {
);
}
- renderItem(item: PermissionUser | PermissionGroup, permissions: PermissionDefinitions) {
+ renderItem(item: T.PermissionUser | T.PermissionGroup, permissions: T.PermissionDefinitions) {
return this.isPermissionUser(item) ? (
<UserHolder
key={`user-${item.login}`}
diff --git a/server/sonar-web/src/main/js/apps/permissions/shared/components/PermissionCell.tsx b/server/sonar-web/src/main/js/apps/permissions/shared/components/PermissionCell.tsx
index 30bebc26c25..b4aac025bf4 100644
--- a/server/sonar-web/src/main/js/apps/permissions/shared/components/PermissionCell.tsx
+++ b/server/sonar-web/src/main/js/apps/permissions/shared/components/PermissionCell.tsx
@@ -19,20 +19,14 @@
*/
import * as React from 'react';
import * as classNames from 'classnames';
-import {
- PermissionDefinition,
- PermissionDefinitionGroup,
- PermissionGroup,
- PermissionUser
-} from '../../../../app/types';
import { isPermissionDefinitionGroup } from '../../utils';
import Checkbox from '../../../../components/controls/Checkbox';
interface Props {
loading: string[];
onCheck: (checked: boolean, permission?: string) => void;
- permission: PermissionDefinition | PermissionDefinitionGroup;
- permissionItem: PermissionGroup | PermissionUser;
+ permission: T.PermissionDefinition | T.PermissionDefinitionGroup;
+ permissionItem: T.PermissionGroup | T.PermissionUser;
selectedPermission?: string;
}
diff --git a/server/sonar-web/src/main/js/apps/permissions/shared/components/PermissionHeader.tsx b/server/sonar-web/src/main/js/apps/permissions/shared/components/PermissionHeader.tsx
index 69e2a082b75..b5d9d890005 100644
--- a/server/sonar-web/src/main/js/apps/permissions/shared/components/PermissionHeader.tsx
+++ b/server/sonar-web/src/main/js/apps/permissions/shared/components/PermissionHeader.tsx
@@ -22,14 +22,13 @@ import * as classNames from 'classnames';
import HelpTooltip from '../../../../components/controls/HelpTooltip';
import InstanceMessage from '../../../../components/common/InstanceMessage';
import { translate, translateWithParameters } from '../../../../helpers/l10n';
-import { PermissionDefinition, PermissionDefinitionGroup } from '../../../../app/types';
import { isPermissionDefinitionGroup } from '../../utils';
import Tooltip from '../../../../components/controls/Tooltip';
import { Alert } from '../../../../components/ui/Alert';
interface Props {
onSelectPermission?: (permission: string) => void;
- permission: PermissionDefinition | PermissionDefinitionGroup;
+ permission: T.PermissionDefinition | T.PermissionDefinitionGroup;
selectedPermission?: string;
showPublicProjectsWarning?: boolean;
}
diff --git a/server/sonar-web/src/main/js/apps/permissions/shared/components/UserHolder.tsx b/server/sonar-web/src/main/js/apps/permissions/shared/components/UserHolder.tsx
index 728fe12cd98..0a7ed8dde02 100644
--- a/server/sonar-web/src/main/js/apps/permissions/shared/components/UserHolder.tsx
+++ b/server/sonar-web/src/main/js/apps/permissions/shared/components/UserHolder.tsx
@@ -22,14 +22,13 @@ import { without } from 'lodash';
import PermissionCell from './PermissionCell';
import Avatar from '../../../../components/ui/Avatar';
import { translate } from '../../../../helpers/l10n';
-import { PermissionDefinitions, PermissionUser } from '../../../../app/types';
import { isPermissionDefinitionGroup } from '../../utils';
interface Props {
- onToggle: (user: PermissionUser, permission: string) => Promise<void>;
- permissions: PermissionDefinitions;
+ onToggle: (user: T.PermissionUser, permission: string) => Promise<void>;
+ permissions: T.PermissionDefinitions;
selectedPermission?: string;
- user: PermissionUser;
+ user: T.PermissionUser;
}
interface State {
diff --git a/server/sonar-web/src/main/js/apps/permissions/utils.ts b/server/sonar-web/src/main/js/apps/permissions/utils.ts
index 98de45fa190..f0b78108820 100644
--- a/server/sonar-web/src/main/js/apps/permissions/utils.ts
+++ b/server/sonar-web/src/main/js/apps/permissions/utils.ts
@@ -18,7 +18,6 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { translate } from '../../helpers/l10n';
-import { PermissionDefinition, PermissionDefinitionGroup } from '../../app/types';
export const PERMISSIONS_ORDER_FOR_PROJECT_TEMPLATE = [
'user',
@@ -66,7 +65,7 @@ function convertToPermissionDefinition(permission: string, l10nPrefix: string) {
export function convertToPermissionDefinitions(
permissions: Array<string | { category: string; permissions: string[] }>,
l10nPrefix: string
-): Array<PermissionDefinition | PermissionDefinitionGroup> {
+): Array<T.PermissionDefinition | T.PermissionDefinitionGroup> {
return permissions.map(permission => {
if (typeof permission === 'object') {
return {
@@ -81,7 +80,7 @@ export function convertToPermissionDefinitions(
}
export function isPermissionDefinitionGroup(
- permission?: PermissionDefinition | PermissionDefinitionGroup
-): permission is PermissionDefinitionGroup {
- return Boolean(permission && (permission as PermissionDefinitionGroup).category);
+ permission?: T.PermissionDefinition | T.PermissionDefinitionGroup
+): permission is T.PermissionDefinitionGroup {
+ return Boolean(permission && (permission as T.PermissionDefinitionGroup).category);
}
diff --git a/server/sonar-web/src/main/js/apps/portfolio/components/Activity.tsx b/server/sonar-web/src/main/js/apps/portfolio/components/Activity.tsx
index 5907d243265..7e73a05b4b2 100644
--- a/server/sonar-web/src/main/js/apps/portfolio/components/Activity.tsx
+++ b/server/sonar-web/src/main/js/apps/portfolio/components/Activity.tsx
@@ -26,14 +26,13 @@ import {
} from '../../projectActivity/utils';
import PreviewGraph from '../../../components/preview-graph/PreviewGraph';
import { getAllTimeMachineData } from '../../../api/time-machine';
-import { Metric } from '../../../app/types';
import { parseDate } from '../../../helpers/dates';
import { translate } from '../../../helpers/l10n';
import { get } from '../../../helpers/storage';
interface Props {
component: string;
- metrics: { [key: string]: Metric };
+ metrics: { [key: string]: T.Metric };
}
interface State {
diff --git a/server/sonar-web/src/main/js/apps/portfolio/components/App.tsx b/server/sonar-web/src/main/js/apps/portfolio/components/App.tsx
index b5bef871e77..dd6bc722b41 100644
--- a/server/sonar-web/src/main/js/apps/portfolio/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/portfolio/components/App.tsx
@@ -34,16 +34,15 @@ import { getChildren } from '../../../api/components';
import { translate } from '../../../helpers/l10n';
import { fetchMetrics } from '../../../store/rootActions';
import { getMetrics, Store } from '../../../store/rootReducer';
-import { Metric, Component } from '../../../app/types';
import '../styles.css';
import PrivacyBadgeContainer from '../../../components/common/PrivacyBadgeContainer';
interface OwnProps {
- component: Component;
+ component: T.Component;
}
interface StateToProps {
- metrics: { [key: string]: Metric };
+ metrics: { [key: string]: T.Metric };
}
interface DispatchToProps {
diff --git a/server/sonar-web/src/main/js/apps/portfolio/components/Subscription.tsx b/server/sonar-web/src/main/js/apps/portfolio/components/Subscription.tsx
index 4d55cc25215..8fe4700c153 100644
--- a/server/sonar-web/src/main/js/apps/portfolio/components/Subscription.tsx
+++ b/server/sonar-web/src/main/js/apps/portfolio/components/Subscription.tsx
@@ -22,12 +22,11 @@ import AlertSuccessIcon from '../../../components/icons-components/AlertSuccessI
import { ReportStatus, subscribe, unsubscribe } from '../../../api/report';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { Button } from '../../../components/ui/buttons';
-import { CurrentUser } from '../../../app/types';
import { isLoggedIn } from '../../../helpers/users';
interface Props {
component: string;
- currentUser: CurrentUser;
+ currentUser: T.CurrentUser;
status: ReportStatus;
}
diff --git a/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/App-test.tsx
index 58ec3447ae8..1a66a953799 100644
--- a/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/App-test.tsx
+++ b/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/App-test.tsx
@@ -44,12 +44,11 @@ jest.mock('../Report', () => ({
import * as React from 'react';
import { shallow, mount } from 'enzyme';
import { App } from '../App';
-import { Component } from '../../../../app/types';
const getMeasures = require('../../../../api/measures').getMeasures as jest.Mock<any>;
const getChildren = require('../../../../api/components').getChildren as jest.Mock<any>;
-const component = { key: 'foo', name: 'Foo', qualifier: 'TRK' } as Component;
+const component = { key: 'foo', name: 'Foo', qualifier: 'TRK' } as T.Component;
it('renders', () => {
const wrapper = shallow(<App component={component} fetchMetrics={jest.fn()} metrics={{}} />);
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/actions.ts b/server/sonar-web/src/main/js/apps/projectActivity/actions.ts
index 0843edf9bb8..926f7095513 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/actions.ts
+++ b/server/sonar-web/src/main/js/apps/projectActivity/actions.ts
@@ -18,9 +18,8 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { State } from './components/ProjectActivityAppContainer';
-import { AnalysisEvent } from '../../app/types';
-export function addCustomEvent(analysis: string, event: AnalysisEvent) {
+export function addCustomEvent(analysis: string, event: T.AnalysisEvent) {
return (state: State) => ({
analyses: state.analyses.map(item => {
if (item.key !== analysis) {
@@ -42,7 +41,7 @@ export function deleteEvent(analysis: string, event: string) {
});
}
-export function changeEvent(analysis: string, event: AnalysisEvent) {
+export function changeEvent(analysis: string, event: T.AnalysisEvent) {
return (state: State) => ({
analyses: state.analyses.map(item => {
if (item.key !== analysis) {
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/DefinitionChangeEventInner.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/DefinitionChangeEventInner.tsx
index df2328de21f..b5ec2e12520 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/DefinitionChangeEventInner.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/DefinitionChangeEventInner.tsx
@@ -21,7 +21,6 @@ import * as React from 'react';
import { Link } from 'react-router';
import { FormattedMessage } from 'react-intl';
import * as classNames from 'classnames';
-import { AnalysisEvent, BranchLike } from '../../../app/types';
import DropdownIcon from '../../../components/icons-components/DropdownIcon';
import ProjectEventIcon from '../../../components/icons-components/ProjectEventIcon';
import { ResetButtonLink } from '../../../components/ui/buttons';
@@ -31,15 +30,15 @@ import LongLivingBranchIcon from '../../../components/icons-components/LongLivin
import { isMainBranch } from '../../../helpers/branches';
import { limitComponentName } from '../../../helpers/path';
-export type DefinitionChangeEvent = AnalysisEvent &
- Required<Pick<AnalysisEvent, 'definitionChange'>>;
+export type DefinitionChangeEvent = T.AnalysisEvent &
+ Required<Pick<T.AnalysisEvent, 'definitionChange'>>;
-export function isDefinitionChangeEvent(event: AnalysisEvent): event is DefinitionChangeEvent {
+export function isDefinitionChangeEvent(event: T.AnalysisEvent): event is DefinitionChangeEvent {
return event.category === 'DEFINITION_CHANGE' && event.definitionChange !== undefined;
}
interface Props {
- branchLike: BranchLike | undefined;
+ branchLike: T.BranchLike | undefined;
event: DefinitionChangeEvent;
}
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/Event.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/Event.tsx
index b2923e8d25e..7f9e0519749 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/Event.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/Event.tsx
@@ -24,14 +24,13 @@ import RemoveEventForm from './forms/RemoveEventForm';
import Tooltip from '../../../components/controls/Tooltip';
import { DeleteButton, EditButton } from '../../../components/ui/buttons';
import { translate } from '../../../helpers/l10n';
-import { AnalysisEvent } from '../../../app/types';
interface Props {
analysis: string;
canAdmin?: boolean;
changeEvent: (event: string, name: string) => Promise<void>;
deleteEvent: (analysis: string, event: string) => Promise<void>;
- event: AnalysisEvent;
+ event: T.AnalysisEvent;
isFirst?: boolean;
}
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/EventInner.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/EventInner.tsx
index 69369b52d4a..c32ef56e442 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/EventInner.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/EventInner.tsx
@@ -21,13 +21,12 @@ import * as React from 'react';
import * as classNames from 'classnames';
import { isRichQualityGateEvent, RichQualityGateEventInner } from './RichQualityGateEventInner';
import { isDefinitionChangeEvent, DefinitionChangeEventInner } from './DefinitionChangeEventInner';
-import { AnalysisEvent } from '../../../app/types';
import { ComponentContext } from '../../../app/components/ComponentContext';
import ProjectEventIcon from '../../../components/icons-components/ProjectEventIcon';
import { translate } from '../../../helpers/l10n';
interface Props {
- event: AnalysisEvent;
+ event: T.AnalysisEvent;
}
export default function EventInner({ event }: Props) {
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/Events.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/Events.tsx
index b891e1f686d..e5dd48f5f83 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/Events.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/Events.tsx
@@ -20,14 +20,13 @@
import * as React from 'react';
import { sortBy } from 'lodash';
import Event from './Event';
-import { AnalysisEvent } from '../../../app/types';
interface Props {
analysis: string;
canAdmin?: boolean;
changeEvent: (event: string, name: string) => Promise<void>;
deleteEvent: (analysis: string, event: string) => Promise<void>;
- events: AnalysisEvent[];
+ events: T.AnalysisEvent[];
isFirst?: boolean;
}
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphHistory.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphHistory.tsx
index 7576d41f7df..f188656f3c2 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphHistory.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphHistory.tsx
@@ -25,10 +25,9 @@ import GraphsLegendStatic from './GraphsLegendStatic';
import AdvancedTimeline from '../../../components/charts/AdvancedTimeline';
import { formatMeasure, getShortType } from '../../../helpers/measures';
import { MeasureHistory, Serie } from '../utils';
-import { AnalysisEvent } from '../../../app/types';
interface Props {
- events: AnalysisEvent[];
+ events: T.AnalysisEvent[];
graph: string;
graphEndDate?: Date;
graphStartDate?: Date;
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltips.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltips.tsx
index 027a0ce1636..b8542ee8be4 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltips.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltips.tsx
@@ -26,10 +26,9 @@ import GraphsTooltipsContentIssues from './GraphsTooltipsContentIssues';
import { DEFAULT_GRAPH, MeasureHistory, Serie } from '../utils';
import DateTimeFormatter from '../../../components/intl/DateTimeFormatter';
import { Popup, PopupPlacement } from '../../../components/ui/popups';
-import { AnalysisEvent } from '../../../app/types';
interface Props {
- events: AnalysisEvent[];
+ events: T.AnalysisEvent[];
formatValue: (tick: number | string) => string;
graph: string;
graphWidth: number;
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentEvents.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentEvents.tsx
index c9c67110b71..239b09c5f51 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentEvents.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentEvents.tsx
@@ -20,11 +20,10 @@
import * as React from 'react';
import ProjectEventIcon from '../../../components/icons-components/ProjectEventIcon';
import { translate } from '../../../helpers/l10n';
-import { AnalysisEvent } from '../../../app/types';
interface Props {
addSeparator: boolean;
- events: AnalysisEvent[];
+ events: T.AnalysisEvent[];
}
export default function GraphsTooltipsContentEvents({ addSeparator, events }: Props) {
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityApp.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityApp.tsx
index e3c0725684d..8f64b78ec38 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityApp.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityApp.tsx
@@ -26,7 +26,6 @@ import { MeasureHistory, Query, ParsedAnalysis } from '../utils';
import { parseDate } from '../../../helpers/dates';
import { translate } from '../../../helpers/l10n';
import Suggestions from '../../../app/components/embed-docs-modal/Suggestions';
-import { Metric, Component } from '../../../app/types';
import './projectActivity.css';
interface Props {
@@ -39,8 +38,8 @@ interface Props {
deleteEvent: (analysis: string, event: string) => Promise<void>;
graphLoading: boolean;
initializing: boolean;
- project: Pick<Component, 'configuration' | 'leakPeriodDate' | 'qualifier'>;
- metrics: Metric[];
+ project: Pick<T.Component, 'configuration' | 'leakPeriodDate' | 'qualifier'>;
+ metrics: T.Metric[];
measuresHistory: MeasureHistory[];
query: Query;
updateQuery: (changes: Partial<Query>) => void;
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAppContainer.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAppContainer.tsx
index 2b003b1ec9c..2ddfd9672fe 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAppContainer.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAppContainer.tsx
@@ -42,12 +42,11 @@ import {
Query,
ParsedAnalysis
} from '../utils';
-import { Metric, Paging, BranchLike, Component } from '../../../app/types';
import { RawQuery } from '../../../helpers/query';
interface Props {
- branchLike?: BranchLike;
- component: Component;
+ branchLike?: T.BranchLike;
+ component: T.Component;
location: Location;
router: Pick<InjectedRouter, 'push' | 'replace'>;
}
@@ -57,9 +56,9 @@ export interface State {
analysesLoading: boolean;
graphLoading: boolean;
initialized: boolean;
- metrics: Metric[];
+ metrics: T.Metric[];
measuresHistory: MeasureHistory[];
- paging?: Paging;
+ paging?: T.Paging;
query: Query;
}
@@ -188,8 +187,8 @@ export default class ProjectActivityAppContainer extends React.PureComponent<Pro
loadAllActivities = (
project: string,
- prevResult?: { analyses: ParsedAnalysis[]; paging: Paging }
- ): Promise<{ analyses: ParsedAnalysis[]; paging: Paging }> => {
+ prevResult?: { analyses: ParsedAnalysis[]; paging: T.Paging }
+ ): Promise<{ analyses: ParsedAnalysis[]; paging: T.Paging }> => {
if (
prevResult &&
prevResult.paging.pageIndex * prevResult.paging.pageSize >= prevResult.paging.total
@@ -208,7 +207,7 @@ export default class ProjectActivityAppContainer extends React.PureComponent<Pro
});
};
- getTopLevelComponent = (component: Component) => {
+ getTopLevelComponent = (component: T.Component) => {
let current = component.breadcrumbs.length - 1;
while (
current > 0 &&
@@ -219,7 +218,7 @@ export default class ProjectActivityAppContainer extends React.PureComponent<Pro
return component.breadcrumbs[current].key;
};
- firstLoadData(query: Query, component: Component) {
+ firstLoadData(query: Query, component: T.Component) {
const graphMetrics = getHistoryMetrics(query.graph, query.customMetrics);
const topLevelComponent = this.getTopLevelComponent(component);
Promise.all([
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityGraphs.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityGraphs.tsx
index 064f437778a..a446e395dc5 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityGraphs.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityGraphs.tsx
@@ -39,14 +39,13 @@ import {
Point,
ParsedAnalysis
} from '../utils';
-import { Metric } from '../../../app/types';
interface Props {
analyses: ParsedAnalysis[];
leakPeriodDate?: Date;
loading: boolean;
measuresHistory: MeasureHistory[];
- metrics: Metric[];
+ metrics: T.Metric[];
query: Query;
updateQuery: (changes: Partial<Query>) => void;
}
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityGraphsHeader.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityGraphsHeader.tsx
index 8f7e5bd70df..ad1955d4368 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityGraphsHeader.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityGraphsHeader.tsx
@@ -22,13 +22,12 @@ import AddGraphMetric from './forms/AddGraphMetric';
import { isCustomGraph, GRAPH_TYPES } from '../utils';
import Select from '../../../components/controls/Select';
import { translate } from '../../../helpers/l10n';
-import { Metric } from '../../../app/types';
interface Props {
addCustomMetric: (metric: string) => void;
removeCustomMetric: (metric: string) => void;
graph: string;
- metrics: Metric[];
+ metrics: T.Metric[];
metricsTypeFilter?: string[];
selectedMetrics: string[];
updateGraph: (graphType: string) => void;
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityPageFooter.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityPageFooter.tsx
index e32165f83d3..9c58fc2ab00 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityPageFooter.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityPageFooter.tsx
@@ -19,12 +19,11 @@
*/
import * as React from 'react';
import ListFooter from '../../../components/controls/ListFooter';
-import { Paging } from '../../../app/types';
interface Props {
analyses: unknown[];
fetchMoreActivity: () => void;
- paging?: Paging;
+ paging?: T.Paging;
}
export default function ProjectActivityPageFooter({ analyses, fetchMoreActivity, paging }: Props) {
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityPageHeader.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityPageHeader.tsx
index 8136cfcc71a..d5427b1e91d 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityPageHeader.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityPageHeader.tsx
@@ -25,12 +25,11 @@ import ProjectActivityDateInput from './ProjectActivityDateInput';
import { EVENT_TYPES, APPLICATION_EVENT_TYPES, Query } from '../utils';
import Select from '../../../components/controls/Select';
import { translate } from '../../../helpers/l10n';
-import { Component } from '../../../app/types';
interface Props {
category?: string;
from?: Date;
- project: Pick<Component, 'qualifier'>;
+ project: Pick<T.Component, 'qualifier'>;
to?: Date;
updateQuery: (changes: Partial<Query>) => void;
}
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/RichQualityGateEventInner.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/RichQualityGateEventInner.tsx
index 65ea0562655..598fd155bf5 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/RichQualityGateEventInner.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/RichQualityGateEventInner.tsx
@@ -21,7 +21,6 @@ import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import { Link } from 'react-router';
import * as classNames from 'classnames';
-import { AnalysisEvent } from '../../../app/types';
import DropdownIcon from '../../../components/icons-components/DropdownIcon';
import Level from '../../../components/ui/Level';
import ProjectEventIcon from '../../../components/icons-components/ProjectEventIcon';
@@ -29,9 +28,9 @@ import { ResetButtonLink } from '../../../components/ui/buttons';
import { translate } from '../../../helpers/l10n';
import { getProjectUrl } from '../../../helpers/urls';
-export type RichQualityGateEvent = AnalysisEvent & Required<Pick<AnalysisEvent, 'qualityGate'>>;
+export type RichQualityGateEvent = T.AnalysisEvent & Required<Pick<T.AnalysisEvent, 'qualityGate'>>;
-export function isRichQualityGateEvent(event: AnalysisEvent): event is RichQualityGateEvent {
+export function isRichQualityGateEvent(event: T.AnalysisEvent): event is RichQualityGateEvent {
return event.category === 'QUALITY_GATE' && event.qualityGate !== undefined;
}
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/DefinitionChangeEventInner-test.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/DefinitionChangeEventInner-test.tsx
index adff6e7da08..5dc67e3ef41 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/DefinitionChangeEventInner-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/DefinitionChangeEventInner-test.tsx
@@ -21,7 +21,6 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import { DefinitionChangeEventInner, DefinitionChangeEvent } from '../DefinitionChangeEventInner';
import { click } from '../../../../helpers/testUtils';
-import { LongLivingBranch, BranchType } from '../../../../app/types';
it('should render', () => {
const event: DefinitionChangeEvent = {
@@ -44,7 +43,7 @@ it('should render', () => {
});
it('should render for a branch', () => {
- const branch: LongLivingBranch = { name: 'feature-x', isMain: false, type: BranchType.LONG };
+ const branch: T.LongLivingBranch = { name: 'feature-x', isMain: false, type: 'LONG' };
const event: DefinitionChangeEvent = {
category: 'DEFINITION_CHANGE',
key: 'foo1234',
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/forms/AddGraphMetric.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/forms/AddGraphMetric.tsx
index 01b587c81db..5d4d36ed8cb 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/forms/AddGraphMetric.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/forms/AddGraphMetric.tsx
@@ -25,12 +25,11 @@ import Dropdown from '../../../../components/controls/Dropdown';
import { Button } from '../../../../components/ui/buttons';
import { isDiffMetric } from '../../../../helpers/measures';
import { getLocalizedMetricName, translate } from '../../../../helpers/l10n';
-import { Metric } from '../../../../app/types';
interface Props {
addMetric: (metric: string) => void;
className?: string;
- metrics: Metric[];
+ metrics: T.Metric[];
metricsTypeFilter?: string[];
removeMetric: (metric: string) => void;
selectedMetrics: string[];
@@ -82,7 +81,7 @@ export default class AddGraphMetric extends React.PureComponent<Props, State> {
.map(metric => metric.key);
};
- getSelectedMetricsElements = (metrics: Metric[], selectedMetrics?: string[]) => {
+ getSelectedMetricsElements = (metrics: T.Metric[], selectedMetrics?: string[]) => {
const selected = selectedMetrics || this.props.selectedMetrics;
return metrics.filter(metric => selected.includes(metric.key)).map(metric => metric.key);
};
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/forms/ChangeEventForm.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/forms/ChangeEventForm.tsx
index 6e2d95c85bb..b7cf9827a53 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/forms/ChangeEventForm.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/forms/ChangeEventForm.tsx
@@ -20,12 +20,11 @@
import * as React from 'react';
import { translate } from '../../../../helpers/l10n';
import ConfirmModal from '../../../../components/controls/ConfirmModal';
-import { AnalysisEvent } from '../../../../app/types';
interface Props {
changeEvent: (event: string, name: string) => Promise<void>;
header: string;
- event: AnalysisEvent;
+ event: T.AnalysisEvent;
onClose: () => void;
}
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/forms/RemoveEventForm.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/forms/RemoveEventForm.tsx
index abecbb8a41d..dee2732c12e 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/forms/RemoveEventForm.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/forms/RemoveEventForm.tsx
@@ -20,12 +20,11 @@
import * as React from 'react';
import { translate } from '../../../../helpers/l10n';
import ConfirmModal from '../../../../components/controls/ConfirmModal';
-import { AnalysisEvent } from '../../../../app/types';
interface Props {
analysis: string;
deleteEvent: (analysis: string, event: string) => Promise<void>;
- event: AnalysisEvent;
+ event: T.AnalysisEvent;
header: string;
removeEventQuestion: string;
onClose: () => void;
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/utils.ts b/server/sonar-web/src/main/js/apps/projectActivity/utils.ts
index ce069f69369..a596a9ac6b4 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/utils.ts
+++ b/server/sonar-web/src/main/js/apps/projectActivity/utils.ts
@@ -30,9 +30,8 @@ import {
} from '../../helpers/query';
import { parseDate, startOfDay } from '../../helpers/dates';
import { getLocalizedMetricName, translate } from '../../helpers/l10n';
-import { Metric, Analysis, Omit } from '../../app/types';
-export type ParsedAnalysis = Omit<Analysis, 'date'> & { date: Date };
+export type ParsedAnalysis = T.Omit<T.Analysis, 'date'> & { date: Date };
export interface Query {
category: string;
@@ -142,7 +141,7 @@ export function generateCoveredLinesMetric(
};
}
-function findMetric(key: string, metrics: Metric[] | { [key: string]: Metric }) {
+function findMetric(key: string, metrics: T.Metric[] | { [key: string]: T.Metric }) {
if (Array.isArray(metrics)) {
return metrics.find(metric => metric.key === key);
}
@@ -152,7 +151,7 @@ function findMetric(key: string, metrics: Metric[] | { [key: string]: Metric })
export function generateSeries(
measuresHistory: MeasureHistory[],
graph: string,
- metrics: Metric[] | { [key: string]: Metric },
+ metrics: T.Metric[] | { [key: string]: T.Metric },
displayedMetrics: string[]
): Serie[] {
if (displayedMetrics.length <= 0 || typeof measuresHistory === 'undefined') {
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/App.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/App.tsx
index f73a5e17ecd..dab6b18c8c8 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/App.tsx
@@ -22,7 +22,6 @@ import { FormattedMessage } from 'react-intl';
import { Link } from 'react-router';
import BranchRow from './BranchRow';
import LongBranchesPattern from './LongBranchesPattern';
-import { BranchLike } from '../../../app/types';
import {
sortBranchesAsTree,
getBranchLikeKey,
@@ -35,7 +34,7 @@ import { formatMeasure } from '../../../helpers/measures';
import HelpTooltip from '../../../components/controls/HelpTooltip';
interface Props {
- branchLikes: BranchLike[];
+ branchLikes: T.BranchLike[];
canAdmin?: boolean;
component: { key: string };
onBranchesChange: () => void;
@@ -78,7 +77,7 @@ export default class App extends React.PureComponent<Props, State> {
);
}
- isOrphan = (branchLike: BranchLike) => {
+ isOrphan = (branchLike: T.BranchLike) => {
return (isShortLivingBranch(branchLike) || isPullRequest(branchLike)) && branchLike.isOrphan;
};
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/BranchRow.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/BranchRow.tsx
index fbcbb4d1751..26b5bb56027 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/BranchRow.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/BranchRow.tsx
@@ -22,7 +22,6 @@ import * as classNames from 'classnames';
import DeleteBranchModal from './DeleteBranchModal';
import LeakPeriodForm from './LeakPeriodForm';
import RenameBranchModal from './RenameBranchModal';
-import { BranchLike } from '../../../app/types';
import BranchStatus from '../../../components/common/BranchStatus';
import BranchIcon from '../../../components/icons-components/BranchIcon';
import {
@@ -40,7 +39,7 @@ import ActionsDropdown, {
} from '../../../components/controls/ActionsDropdown';
interface Props {
- branchLike: BranchLike;
+ branchLike: T.BranchLike;
component: string;
isOrphan?: boolean;
onChange: () => void;
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/DeleteBranchModal.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/DeleteBranchModal.tsx
index c98bb190f65..637b54a2774 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/DeleteBranchModal.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/DeleteBranchModal.tsx
@@ -19,14 +19,13 @@
*/
import * as React from 'react';
import { deleteBranch, deletePullRequest } from '../../../api/branches';
-import { BranchLike } from '../../../app/types';
import Modal from '../../../components/controls/Modal';
import { SubmitButton, ResetButtonLink } from '../../../components/ui/buttons';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { isPullRequest, getBranchLikeDisplayName } from '../../../helpers/branches';
interface Props {
- branchLike: BranchLike;
+ branchLike: T.BranchLike;
component: string;
onClose: () => void;
onDelete: () => void;
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/LeakPeriodForm.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/LeakPeriodForm.tsx
index ebfc5e35072..3104fb7af2e 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/LeakPeriodForm.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/LeakPeriodForm.tsx
@@ -22,7 +22,6 @@ import SettingForm from './SettingForm';
import { translate } from '../../../helpers/l10n';
import { getValues } from '../../../api/settings';
import Modal from '../../../components/controls/Modal';
-import { SettingValue } from '../../../app/types';
interface Props {
branch: string;
@@ -32,7 +31,7 @@ interface Props {
interface State {
loading: boolean;
- setting?: SettingValue;
+ setting?: T.SettingValue;
submitting: boolean;
value?: string;
}
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/LongBranchesPattern.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/LongBranchesPattern.tsx
index e0b17e46f8e..a884cb48195 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/LongBranchesPattern.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/LongBranchesPattern.tsx
@@ -22,7 +22,6 @@ import LongBranchesPatternForm from './LongBranchesPatternForm';
import { getValues } from '../../../api/settings';
import { EditButton } from '../../../components/ui/buttons';
import { translate } from '../../../helpers/l10n';
-import { SettingValue } from '../../../app/types';
interface Props {
project: string;
@@ -30,7 +29,7 @@ interface Props {
interface State {
formOpen: boolean;
- setting?: SettingValue;
+ setting?: T.SettingValue;
}
export const LONG_BRANCH_PATTERN = 'sonar.branch.longLivedBranches.regex';
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/LongBranchesPatternForm.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/LongBranchesPatternForm.tsx
index d323cf22a81..d966c92ad76 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/LongBranchesPatternForm.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/LongBranchesPatternForm.tsx
@@ -21,13 +21,12 @@ import * as React from 'react';
import SettingForm from './SettingForm';
import { translate } from '../../../helpers/l10n';
import Modal from '../../../components/controls/Modal';
-import { SettingValue } from '../../../app/types';
interface Props {
onChange: () => void;
onClose: () => void;
project: string;
- setting: SettingValue;
+ setting: T.SettingValue;
}
export default function LongBranchesPatternForm(props: Props) {
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/RenameBranchModal.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/RenameBranchModal.tsx
index 2e8ee656d44..ab41ea24d43 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/RenameBranchModal.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/RenameBranchModal.tsx
@@ -19,13 +19,12 @@
*/
import * as React from 'react';
import { renameBranch } from '../../../api/branches';
-import { MainBranch } from '../../../app/types';
import Modal from '../../../components/controls/Modal';
import { SubmitButton, ResetButtonLink } from '../../../components/ui/buttons';
import { translate } from '../../../helpers/l10n';
interface Props {
- branch: MainBranch;
+ branch: T.MainBranch;
component: string;
onClose: () => void;
onRename: () => void;
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/SettingForm.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/SettingForm.tsx
index 08f1bb0e802..f400962c823 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/SettingForm.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/SettingForm.tsx
@@ -21,14 +21,13 @@ import * as React from 'react';
import { setSimpleSettingValue, resetSettingValue } from '../../../api/settings';
import { Button, SubmitButton, ResetButtonLink } from '../../../components/ui/buttons';
import { translate, translateWithParameters } from '../../../helpers/l10n';
-import { SettingValue } from '../../../app/types';
interface Props {
branch?: string;
onClose: () => void;
onChange: () => void;
project: string;
- setting: SettingValue;
+ setting: T.SettingValue;
}
interface State {
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/App-test.tsx
index 36faa6a97e2..638bd45b1dc 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/App-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/App-test.tsx
@@ -25,13 +25,6 @@ jest.mock('../../../../api/settings', () => ({
import * as React from 'react';
import { mount, shallow } from 'enzyme';
import App from '../App';
-import {
- BranchType,
- LongLivingBranch,
- ShortLivingBranch,
- MainBranch,
- PullRequest
-} from '../../../../app/types';
const getValues = require('../../../../api/settings').getValues as jest.Mock<any>;
@@ -41,22 +34,22 @@ beforeEach(() => {
it('renders sorted list of branches', () => {
const branchLikes: [
- MainBranch,
- LongLivingBranch,
- ShortLivingBranch,
- PullRequest,
- ShortLivingBranch
+ T.MainBranch,
+ T.LongLivingBranch,
+ T.ShortLivingBranch,
+ T.PullRequest,
+ T.ShortLivingBranch
] = [
{ isMain: true, name: 'master' },
- { isMain: false, name: 'branch-1.0', type: BranchType.LONG },
- { isMain: false, mergeBranch: 'master', name: 'feature', type: BranchType.SHORT },
+ { isMain: false, name: 'branch-1.0', type: 'LONG' },
+ { isMain: false, mergeBranch: 'master', name: 'feature', type: 'SHORT' },
{ base: 'master', branch: 'feature', key: '1234', title: 'Feature PR' },
{
isMain: false,
mergeBranch: 'foobar',
isOrphan: true,
name: 'feature',
- type: BranchType.SHORT
+ type: 'SHORT'
}
];
const wrapper = shallow(
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchRow-test.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchRow-test.tsx
index eac799c7f6f..cb33663fbca 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchRow-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchRow-test.tsx
@@ -20,26 +20,19 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import BranchRow from '../BranchRow';
-import {
- MainBranch,
- ShortLivingBranch,
- BranchType,
- PullRequest,
- BranchLike
-} from '../../../../app/types';
import { click } from '../../../../helpers/testUtils';
-const mainBranch: MainBranch = { isMain: true, name: 'master' };
+const mainBranch: T.MainBranch = { isMain: true, name: 'master' };
-const shortBranch: ShortLivingBranch = {
+const shortBranch: T.ShortLivingBranch = {
analysisDate: '2017-09-27T00:05:19+0000',
isMain: false,
name: 'feature',
mergeBranch: 'foo',
- type: BranchType.SHORT
+ type: 'SHORT'
};
-const pullRequest: PullRequest = {
+const pullRequest: T.PullRequest = {
base: 'master',
branch: 'feature',
key: '1234',
@@ -85,7 +78,7 @@ it('deletes pull request', () => {
expect(onChange).toBeCalled();
});
-function shallowRender(branchLike: BranchLike, onChange: () => void = jest.fn()) {
+function shallowRender(branchLike: T.BranchLike, onChange: () => void = jest.fn()) {
const wrapper = shallow(
<BranchRow branchLike={branchLike} component="foo" isOrphan={false} onChange={onChange} />
);
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/DeleteBranchModal-test.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/DeleteBranchModal-test.tsx
index 721df857ac0..e8a4150d6db 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/DeleteBranchModal-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/DeleteBranchModal-test.tsx
@@ -26,15 +26,14 @@ jest.mock('../../../../api/branches', () => ({
import * as React from 'react';
import { shallow, ShallowWrapper } from 'enzyme';
import DeleteBranchModal from '../DeleteBranchModal';
-import { ShortLivingBranch, BranchType, BranchLike, PullRequest } from '../../../../app/types';
import { submit, doAsync, click, waitAndUpdate } from '../../../../helpers/testUtils';
import { deleteBranch, deletePullRequest } from '../../../../api/branches';
-const branch: ShortLivingBranch = {
+const branch: T.ShortLivingBranch = {
isMain: false,
name: 'feature',
mergeBranch: 'master',
- type: BranchType.SHORT
+ type: 'SHORT'
};
beforeEach(() => {
@@ -64,7 +63,7 @@ it('deletes branch', async () => {
it('deletes pull request', async () => {
(deletePullRequest as jest.Mock).mockImplementationOnce(() => Promise.resolve());
- const pullRequest: PullRequest = {
+ const pullRequest: T.PullRequest = {
base: 'master',
branch: 'feature',
key: '1234',
@@ -106,7 +105,7 @@ it('stops loading on WS error', async () => {
});
function shallowRender(
- branchLike: BranchLike,
+ branchLike: T.BranchLike,
onDelete: () => void = jest.fn(),
onClose: () => void = jest.fn()
) {
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/RenameBranchModal-test.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/RenameBranchModal-test.tsx
index 7e69538b1e7..de40ac89403 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/RenameBranchModal-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/RenameBranchModal-test.tsx
@@ -23,7 +23,6 @@ jest.mock('../../../../api/branches', () => ({ renameBranch: jest.fn() }));
import * as React from 'react';
import { shallow, ShallowWrapper } from 'enzyme';
import RenameBranchModal from '../RenameBranchModal';
-import { MainBranch } from '../../../../app/types';
import { submit, doAsync, click, change, waitAndUpdate } from '../../../../helpers/testUtils';
import { renameBranch } from '../../../../api/branches';
@@ -77,7 +76,7 @@ it('stops loading on WS error', async () => {
});
function shallowRender(onRename: () => void = jest.fn(), onClose: () => void = jest.fn()) {
- const branch: MainBranch = { isMain: true, name: 'master' };
+ const branch: T.MainBranch = { isMain: true, name: 'master' };
const wrapper = shallow<RenameBranchModal>(
<RenameBranchModal branch={branch} component="foo" onClose={onClose} onRename={onRename} />
);
diff --git a/server/sonar-web/src/main/js/apps/projectDeletion/App.tsx b/server/sonar-web/src/main/js/apps/projectDeletion/App.tsx
index 87413a22988..ff35ca6fb2d 100644
--- a/server/sonar-web/src/main/js/apps/projectDeletion/App.tsx
+++ b/server/sonar-web/src/main/js/apps/projectDeletion/App.tsx
@@ -21,11 +21,10 @@ import * as React from 'react';
import Helmet from 'react-helmet';
import Header from './Header';
import Form from './Form';
-import { Component } from '../../app/types';
import { translate } from '../../helpers/l10n';
interface Props {
- component: Pick<Component, 'key' | 'name' | 'qualifier'>;
+ component: Pick<T.Component, 'key' | 'name' | 'qualifier'>;
}
export default function App(props: Props) {
diff --git a/server/sonar-web/src/main/js/apps/projectDeletion/Form.tsx b/server/sonar-web/src/main/js/apps/projectDeletion/Form.tsx
index 1114935a92f..0b546452f37 100644
--- a/server/sonar-web/src/main/js/apps/projectDeletion/Form.tsx
+++ b/server/sonar-web/src/main/js/apps/projectDeletion/Form.tsx
@@ -22,11 +22,10 @@ import { withRouter, WithRouterProps } from 'react-router';
import { deleteProject, deletePortfolio } from '../../api/components';
import { Button } from '../../components/ui/buttons';
import { translate, translateWithParameters } from '../../helpers/l10n';
-import { Component } from '../../app/types';
import ConfirmButton from '../../components/controls/ConfirmButton';
interface Props {
- component: Pick<Component, 'key' | 'name' | 'qualifier'>;
+ component: Pick<T.Component, 'key' | 'name' | 'qualifier'>;
}
export default withRouter(
diff --git a/server/sonar-web/src/main/js/apps/projectDeletion/Header.tsx b/server/sonar-web/src/main/js/apps/projectDeletion/Header.tsx
index 4cd39cec859..0cfc5903b43 100644
--- a/server/sonar-web/src/main/js/apps/projectDeletion/Header.tsx
+++ b/server/sonar-web/src/main/js/apps/projectDeletion/Header.tsx
@@ -19,10 +19,9 @@
*/
import * as React from 'react';
import { translate } from '../../helpers/l10n';
-import { Component } from '../../app/types';
interface Props {
- component: Pick<Component, 'qualifier'>;
+ component: Pick<T.Component, 'qualifier'>;
}
export default function Header(props: Props) {
diff --git a/server/sonar-web/src/main/js/apps/projectLinks/App.tsx b/server/sonar-web/src/main/js/apps/projectLinks/App.tsx
index 5e9d9a2b94e..0d246149716 100644
--- a/server/sonar-web/src/main/js/apps/projectLinks/App.tsx
+++ b/server/sonar-web/src/main/js/apps/projectLinks/App.tsx
@@ -22,16 +22,15 @@ import Helmet from 'react-helmet';
import Header from './Header';
import Table from './Table';
import { getProjectLinks, createLink, deleteLink } from '../../api/projectLinks';
-import { ProjectLink, Component } from '../../app/types';
import { translate } from '../../helpers/l10n';
import DeferredSpinner from '../../components/common/DeferredSpinner';
interface Props {
- component: Pick<Component, 'key'>;
+ component: Pick<T.Component, 'key'>;
}
interface State {
- links?: ProjectLink[];
+ links?: T.ProjectLink[];
loading: boolean;
}
diff --git a/server/sonar-web/src/main/js/apps/projectLinks/LinkRow.tsx b/server/sonar-web/src/main/js/apps/projectLinks/LinkRow.tsx
index 7d2630cba14..9ca2a8f6906 100644
--- a/server/sonar-web/src/main/js/apps/projectLinks/LinkRow.tsx
+++ b/server/sonar-web/src/main/js/apps/projectLinks/LinkRow.tsx
@@ -19,19 +19,18 @@
*/
import * as React from 'react';
import { isProvided, getLinkName } from './utils';
-import { ProjectLink } from '../../app/types';
import ConfirmButton from '../../components/controls/ConfirmButton';
import ProjectLinkIcon from '../../components/icons-components/ProjectLinkIcon';
import { Button } from '../../components/ui/buttons';
import { translate, translateWithParameters } from '../../helpers/l10n';
interface Props {
- link: ProjectLink;
+ link: T.ProjectLink;
onDelete: (linkId: string) => Promise<void>;
}
export default class LinkRow extends React.PureComponent<Props> {
- renderNameForProvided = (link: ProjectLink) => {
+ renderNameForProvided = (link: T.ProjectLink) => {
return (
<div className="display-inline-block text-top">
<div>
@@ -44,7 +43,7 @@ export default class LinkRow extends React.PureComponent<Props> {
);
};
- renderName = (link: ProjectLink) => {
+ renderName = (link: T.ProjectLink) => {
return (
<div>
<ProjectLinkIcon className="little-spacer-right" type={link.type} />
@@ -59,7 +58,7 @@ export default class LinkRow extends React.PureComponent<Props> {
);
};
- renderDeleteButton = (link: ProjectLink) => {
+ renderDeleteButton = (link: T.ProjectLink) => {
if (isProvided(link)) {
return null;
}
diff --git a/server/sonar-web/src/main/js/apps/projectLinks/Table.tsx b/server/sonar-web/src/main/js/apps/projectLinks/Table.tsx
index 41a21af6d92..dc789bdb14d 100644
--- a/server/sonar-web/src/main/js/apps/projectLinks/Table.tsx
+++ b/server/sonar-web/src/main/js/apps/projectLinks/Table.tsx
@@ -20,11 +20,10 @@
import * as React from 'react';
import LinkRow from './LinkRow';
import { orderLinks } from './utils';
-import { ProjectLink } from '../../app/types';
import { translate } from '../../helpers/l10n';
interface Props {
- links: ProjectLink[];
+ links: T.ProjectLink[];
onDelete: (linkId: string) => Promise<void>;
}
diff --git a/server/sonar-web/src/main/js/apps/projectLinks/utils.ts b/server/sonar-web/src/main/js/apps/projectLinks/utils.ts
index 2bb1bd70c25..c5a39442084 100644
--- a/server/sonar-web/src/main/js/apps/projectLinks/utils.ts
+++ b/server/sonar-web/src/main/js/apps/projectLinks/utils.ts
@@ -18,13 +18,12 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { partition, sortBy } from 'lodash';
-import { ProjectLink } from '../../app/types';
import { translate } from '../../helpers/l10n';
const PROVIDED_TYPES = ['homepage', 'ci', 'issue', 'scm', 'scm_dev'];
-type NameAndType = Pick<ProjectLink, 'name' | 'type'>;
+type NameAndType = Pick<T.ProjectLink, 'name' | 'type'>;
-export function isProvided(link: Pick<ProjectLink, 'type'>) {
+export function isProvided(link: Pick<T.ProjectLink, 'type'>) {
return PROVIDED_TYPES.includes(link.type);
}
diff --git a/server/sonar-web/src/main/js/apps/projectQualityGate/App.tsx b/server/sonar-web/src/main/js/apps/projectQualityGate/App.tsx
index 2ecc5f07a4f..d41fa24b94a 100644
--- a/server/sonar-web/src/main/js/apps/projectQualityGate/App.tsx
+++ b/server/sonar-web/src/main/js/apps/projectQualityGate/App.tsx
@@ -30,17 +30,16 @@ import {
import Suggestions from '../../app/components/embed-docs-modal/Suggestions';
import addGlobalSuccessMessage from '../../app/utils/addGlobalSuccessMessage';
import handleRequiredAuthorization from '../../app/utils/handleRequiredAuthorization';
-import { Component, QualityGate } from '../../app/types';
import { translate } from '../../helpers/l10n';
interface Props {
- component: Component;
+ component: T.Component;
onComponentChange: (changes: {}) => void;
}
interface State {
- allGates?: QualityGate[];
- gate?: QualityGate;
+ allGates?: T.QualityGate[];
+ gate?: T.QualityGate;
loading: boolean;
}
diff --git a/server/sonar-web/src/main/js/apps/projectQualityGate/Form.tsx b/server/sonar-web/src/main/js/apps/projectQualityGate/Form.tsx
index 1ac3be588b2..d85420c8697 100644
--- a/server/sonar-web/src/main/js/apps/projectQualityGate/Form.tsx
+++ b/server/sonar-web/src/main/js/apps/projectQualityGate/Form.tsx
@@ -20,11 +20,10 @@
import * as React from 'react';
import Select from '../../components/controls/Select';
import { translate } from '../../helpers/l10n';
-import { QualityGate } from '../../app/types';
interface Props {
- allGates: QualityGate[];
- gate?: QualityGate;
+ allGates: T.QualityGate[];
+ gate?: T.QualityGate;
onChange: (oldGate?: number, newGate?: number) => Promise<void>;
}
diff --git a/server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/App-test.tsx
index 158e002447c..10b43cd82ed 100644
--- a/server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/App-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/App-test.tsx
@@ -36,7 +36,6 @@ jest.mock('../../../app/utils/handleRequiredAuthorization', () => ({
import * as React from 'react';
import { shallow } from 'enzyme';
import App from '../App';
-import { Component } from '../../../app/types';
const associateGateWithProject = require('../../../api/quality-gates')
.associateGateWithProject as jest.Mock<any>;
@@ -63,7 +62,7 @@ const component = {
organization: 'org',
qualifier: 'TRK',
version: '0.0.1'
-} as Component;
+} as T.Component;
beforeEach(() => {
associateGateWithProject.mockClear();
@@ -75,7 +74,7 @@ it('checks permissions', () => {
handleRequiredAuthorization.mockClear();
shallow(
<App
- component={{ ...component, configuration: undefined } as Component}
+ component={{ ...component, configuration: undefined } as T.Component}
onComponentChange={jest.fn()}
/>
);
diff --git a/server/sonar-web/src/main/js/apps/projectQualityProfiles/App.tsx b/server/sonar-web/src/main/js/apps/projectQualityProfiles/App.tsx
index 9cd66cea2cf..6f93a366e3e 100644
--- a/server/sonar-web/src/main/js/apps/projectQualityProfiles/App.tsx
+++ b/server/sonar-web/src/main/js/apps/projectQualityProfiles/App.tsx
@@ -27,14 +27,13 @@ import {
searchQualityProfiles,
Profile
} from '../../api/quality-profiles';
-import { Component } from '../../app/types';
import Suggestions from '../../app/components/embed-docs-modal/Suggestions';
import addGlobalSuccessMessage from '../../app/utils/addGlobalSuccessMessage';
import handleRequiredAuthorization from '../../app/utils/handleRequiredAuthorization';
import { translate, translateWithParameters } from '../../helpers/l10n';
interface Props {
- component: Component;
+ component: T.Component;
}
interface State {
diff --git a/server/sonar-web/src/main/js/apps/projects/components/AllProjects.tsx b/server/sonar-web/src/main/js/apps/projects/components/AllProjects.tsx
index 0e1c185aaac..9094431da5d 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/AllProjects.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/AllProjects.tsx
@@ -26,7 +26,6 @@ import ProjectsList from './ProjectsList';
import PageSidebar from './PageSidebar';
import Suggestions from '../../../app/components/embed-docs-modal/Suggestions';
import Visualizations from '../visualizations/Visualizations';
-import { CurrentUser, Organization } from '../../../app/types';
import handleRequiredAuthentication from '../../../app/utils/handleRequiredAuthentication';
import DeferredSpinner from '../../../components/common/DeferredSpinner';
import ListFooter from '../../../components/controls/ListFooter';
@@ -43,10 +42,10 @@ import '../../../components/search-navigator.css';
import '../styles.css';
export interface Props {
- currentUser: CurrentUser;
+ currentUser: T.CurrentUser;
isFavorite: boolean;
location: { pathname: string; query: RawQuery };
- organization: Organization | undefined;
+ organization: T.Organization | undefined;
organizationsEnabled?: boolean;
storageOptionsSuffix?: string;
}
diff --git a/server/sonar-web/src/main/js/apps/projects/components/DefaultPageSelector.tsx b/server/sonar-web/src/main/js/apps/projects/components/DefaultPageSelector.tsx
index c2d8c70efdd..dd86e540523 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/DefaultPageSelector.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/DefaultPageSelector.tsx
@@ -23,12 +23,11 @@ import AllProjectsContainer from './AllProjectsContainer';
import { PROJECTS_DEFAULT_FILTER, PROJECTS_FAVORITE, PROJECTS_ALL } from '../utils';
import { get } from '../../../helpers/storage';
import { searchProjects } from '../../../api/components';
-import { CurrentUser } from '../../../app/types';
import { isSonarCloud } from '../../../helpers/system';
import { isLoggedIn } from '../../../helpers/users';
interface Props {
- currentUser: CurrentUser;
+ currentUser: T.CurrentUser;
location: { pathname: string; query: { [x: string]: string } };
}
diff --git a/server/sonar-web/src/main/js/apps/projects/components/EmptyInstance.tsx b/server/sonar-web/src/main/js/apps/projects/components/EmptyInstance.tsx
index a4e91c44302..790e0970db3 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/EmptyInstance.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/EmptyInstance.tsx
@@ -21,13 +21,12 @@ import * as React from 'react';
import * as PropTypes from 'prop-types';
import { translate } from '../../../helpers/l10n';
import { Button } from '../../../components/ui/buttons';
-import { Organization, CurrentUser } from '../../../app/types';
import { isSonarCloud } from '../../../helpers/system';
import { hasGlobalPermission, isLoggedIn } from '../../../helpers/users';
interface Props {
- organization?: Organization;
- currentUser: CurrentUser;
+ organization?: T.Organization;
+ currentUser: T.CurrentUser;
}
export default class EmptyInstance extends React.PureComponent<Props> {
diff --git a/server/sonar-web/src/main/js/apps/projects/components/FavoriteFilter.tsx b/server/sonar-web/src/main/js/apps/projects/components/FavoriteFilter.tsx
index ebec0b9f090..958d8b69721 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/FavoriteFilter.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/FavoriteFilter.tsx
@@ -20,14 +20,13 @@
import * as React from 'react';
import { IndexLink, Link } from 'react-router';
import { translate } from '../../../helpers/l10n';
-import { CurrentUser } from '../../../app/types';
import { save } from '../../../helpers/storage';
import { RawQuery } from '../../../helpers/query';
import { PROJECTS_DEFAULT_FILTER, PROJECTS_FAVORITE, PROJECTS_ALL } from '../utils';
import { isLoggedIn } from '../../../helpers/users';
interface Props {
- currentUser: CurrentUser;
+ currentUser: T.CurrentUser;
organization?: { key: string };
query?: RawQuery;
}
diff --git a/server/sonar-web/src/main/js/apps/projects/components/NoFavoriteProjects.tsx b/server/sonar-web/src/main/js/apps/projects/components/NoFavoriteProjects.tsx
index 469007d6b14..c28dc6312b7 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/NoFavoriteProjects.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/NoFavoriteProjects.tsx
@@ -28,11 +28,10 @@ import OrganizationListItem from '../../../components/ui/OrganizationListItem';
import { Button } from '../../../components/ui/buttons';
import { getMyOrganizations, Store } from '../../../store/rootReducer';
import { isSonarCloud } from '../../../helpers/system';
-import { Organization } from '../../../app/types';
import { translate } from '../../../helpers/l10n';
interface StateProps {
- organizations: Organization[];
+ organizations: T.Organization[];
}
export class NoFavoriteProjects extends React.PureComponent<StateProps> {
diff --git a/server/sonar-web/src/main/js/apps/projects/components/PageHeader.tsx b/server/sonar-web/src/main/js/apps/projects/components/PageHeader.tsx
index 54cae091589..088be7ee8c8 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/PageHeader.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/PageHeader.tsx
@@ -23,7 +23,6 @@ import PerspectiveSelect from './PerspectiveSelect';
import ProjectsSortingSelect from './ProjectsSortingSelect';
import SearchFilterContainer from '../filters/SearchFilterContainer';
import Tooltip from '../../../components/controls/Tooltip';
-import { CurrentUser, HomePageType } from '../../../app/types';
import HomePageSelect from '../../../components/controls/HomePageSelect';
import { translate } from '../../../helpers/l10n';
import { RawQuery } from '../../../helpers/query';
@@ -32,7 +31,7 @@ import { isSonarCloud } from '../../../helpers/system';
import { isLoggedIn } from '../../../helpers/users';
interface Props {
- currentUser: CurrentUser;
+ currentUser: T.CurrentUser;
isFavorite: boolean;
loading: boolean;
onPerspectiveChange: (x: { view: string; visualization?: string }) => void;
@@ -104,9 +103,7 @@ export default function PageHeader(props: Props) {
{showHomePageSelect && (
<HomePageSelect
className="huge-spacer-left"
- currentPage={
- isSonarCloud() ? { type: HomePageType.MyProjects } : { type: HomePageType.Projects }
- }
+ currentPage={isSonarCloud() ? { type: 'MY_PROJECTS' } : { type: 'PROJECTS' }}
/>
)}
</header>
diff --git a/server/sonar-web/src/main/js/apps/projects/components/ProjectCard.tsx b/server/sonar-web/src/main/js/apps/projects/components/ProjectCard.tsx
index e562aac058e..b1bd9138c4b 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/ProjectCard.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/ProjectCard.tsx
@@ -21,11 +21,10 @@ import * as React from 'react';
import ProjectCardLeak from './ProjectCardLeak';
import ProjectCardOverall from './ProjectCardOverall';
import { Project } from '../types';
-import { Organization } from '../../../app/types';
interface Props {
height: number;
- organization: Organization | undefined;
+ organization: T.Organization | undefined;
project: Project;
type?: string;
}
diff --git a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLanguages.tsx b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLanguages.tsx
index 790fd8ec979..2c703a27114 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLanguages.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLanguages.tsx
@@ -21,12 +21,11 @@ import * as React from 'react';
import { sortBy } from 'lodash';
import Tooltip from '../../../components/controls/Tooltip';
import { translate } from '../../../helpers/l10n';
-import { Languages } from '../../../app/types';
interface Props {
className?: string;
distribution?: string;
- languages: Languages;
+ languages: T.Languages;
}
export default function ProjectCardLanguages({ className, distribution, languages }: Props) {
@@ -65,7 +64,7 @@ export default function ProjectCardLanguages({ className, distribution, language
);
}
-function getLanguageName(languages: Languages, key: string): string {
+function getLanguageName(languages: T.Languages, key: string): string {
if (key === '<null>') {
return translate('unknown');
}
diff --git a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLeak.tsx b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLeak.tsx
index fe1452872f4..bda94e978e3 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLeak.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLeak.tsx
@@ -30,12 +30,11 @@ import PrivacyBadgeContainer from '../../../components/common/PrivacyBadgeContai
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { Project } from '../types';
import { formatDuration } from '../utils';
-import { Organization } from '../../../app/types';
import { getProjectUrl } from '../../../helpers/urls';
interface Props {
height: number;
- organization: Organization | undefined;
+ organization: T.Organization | undefined;
project: Project;
}
diff --git a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardOverall.tsx b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardOverall.tsx
index 264ef83813c..882c297ff8f 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardOverall.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardOverall.tsx
@@ -28,12 +28,11 @@ import TagsList from '../../../components/tags/TagsList';
import PrivacyBadgeContainer from '../../../components/common/PrivacyBadgeContainer';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { Project } from '../types';
-import { Organization } from '../../../app/types';
import { getProjectUrl } from '../../../helpers/urls';
interface Props {
height: number;
- organization: Organization | undefined;
+ organization: T.Organization | undefined;
project: Project;
}
diff --git a/server/sonar-web/src/main/js/apps/projects/components/ProjectsList.tsx b/server/sonar-web/src/main/js/apps/projects/components/ProjectsList.tsx
index 3cb5f2fc575..8bb2f535070 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/ProjectsList.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/ProjectsList.tsx
@@ -28,14 +28,13 @@ import EmptyFavoriteSearch from './EmptyFavoriteSearch';
import EmptySearch from '../../../components/common/EmptySearch';
import { Project } from '../types';
import { Query } from '../query';
-import { Organization, CurrentUser } from '../../../app/types';
interface Props {
cardType?: string;
- currentUser: CurrentUser;
+ currentUser: T.CurrentUser;
isFavorite: boolean;
isFiltered: boolean;
- organization: Organization | undefined;
+ organization: T.Organization | undefined;
projects: Project[];
query: Query;
}
diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/DefaultPageSelector-test.tsx b/server/sonar-web/src/main/js/apps/projects/components/__tests__/DefaultPageSelector-test.tsx
index f5beee0d39c..e3d269914db 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/DefaultPageSelector-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/DefaultPageSelector-test.tsx
@@ -36,7 +36,6 @@ jest.mock('../../../../api/components', () => ({
import * as React from 'react';
import { mount } from 'enzyme';
import DefaultPageSelector from '../DefaultPageSelector';
-import { CurrentUser } from '../../../../app/types';
import { doAsync } from '../../../../helpers/testUtils';
const get = require('../../../../helpers/storage').get as jest.Mock<any>;
@@ -83,7 +82,7 @@ it('fetches favorites', () => {
});
function mountRender(
- currentUser: CurrentUser = { isLoggedIn: true },
+ currentUser: T.CurrentUser = { isLoggedIn: true },
query: any = {},
replace: any = jest.fn()
) {
diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/NoFavoriteProjects-test.tsx b/server/sonar-web/src/main/js/apps/projects/components/__tests__/NoFavoriteProjects-test.tsx
index 01b07755388..0e0f2af3a93 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/NoFavoriteProjects-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/NoFavoriteProjects-test.tsx
@@ -20,7 +20,6 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import { NoFavoriteProjects } from '../NoFavoriteProjects';
-import { Visibility } from '../../../../app/types';
import { isSonarCloud } from '../../../../helpers/system';
jest.mock('../../../../helpers/system', () => ({ isSonarCloud: jest.fn() }));
@@ -32,9 +31,9 @@ it('renders', () => {
it('renders for SonarCloud', () => {
(isSonarCloud as jest.Mock).mockImplementation(() => true);
- const organizations = [
- { actions: { admin: true }, key: 'org1', name: 'org1', projectVisibility: Visibility.Public },
- { actions: { admin: false }, key: 'org2', name: 'org2', projectVisibility: Visibility.Public }
+ const organizations: T.Organization[] = [
+ { actions: { admin: true }, key: 'org1', name: 'org1', projectVisibility: 'public' },
+ { actions: { admin: false }, key: 'org2', name: 'org2', projectVisibility: 'public' }
];
expect(shallow(<NoFavoriteProjects organizations={organizations} />)).toMatchSnapshot();
});
diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCardLeak-test.tsx b/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCardLeak-test.tsx
index 2eb69814db0..9376052bf6c 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCardLeak-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCardLeak-test.tsx
@@ -20,7 +20,7 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import ProjectCardLeak from '../ProjectCardLeak';
-import { Visibility } from '../../../../app/types';
+import { Project } from '../../types';
jest.mock(
'date-fns/difference_in_milliseconds',
@@ -34,7 +34,7 @@ const MEASURES = {
new_bugs: '12'
};
-const PROJECT = {
+const PROJECT: Project = {
analysisDate: '2017-01-01',
leakPeriodDate: '2016-12-01',
key: 'foo',
@@ -42,7 +42,7 @@ const PROJECT = {
name: 'Foo',
organization: { key: 'org', name: 'org' },
tags: [],
- visibility: Visibility.Public
+ visibility: 'public'
};
it('should display analysis date and leak start date', () => {
@@ -68,7 +68,7 @@ it('should display tags', () => {
});
it('should display private badge', () => {
- const project = { ...PROJECT, visibility: Visibility.Private };
+ const project: Project = { ...PROJECT, visibility: 'private' };
expect(
shallow(<ProjectCardLeak height={100} organization={undefined} project={project} />)
.find('Connect(PrivacyBadge)')
diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCardOverall-test.tsx b/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCardOverall-test.tsx
index f0c2736bde7..fe1685807d3 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCardOverall-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCardOverall-test.tsx
@@ -20,7 +20,7 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import ProjectCardOverall from '../ProjectCardOverall';
-import { Visibility } from '../../../../app/types';
+import { Project } from '../../types';
const MEASURES = {
alert_status: 'OK',
@@ -29,14 +29,14 @@ const MEASURES = {
new_bugs: '12'
};
-const PROJECT = {
+const PROJECT: Project = {
analysisDate: '2017-01-01',
key: 'foo',
measures: MEASURES,
name: 'Foo',
organization: { key: 'org', name: 'org' },
tags: [],
- visibility: Visibility.Public
+ visibility: 'public'
};
it('should display analysis date (and not leak period) when defined', () => {
@@ -77,7 +77,7 @@ it('should display tags', () => {
});
it('should display private badge', () => {
- const project = { ...PROJECT, visibility: Visibility.Private };
+ const project: Project = { ...PROJECT, visibility: 'private' };
expect(
shallow(<ProjectCardOverall height={100} organization={undefined} project={project} />)
.find('Connect(PrivacyBadge)')
diff --git a/server/sonar-web/src/main/js/apps/projects/filters/LanguagesFilter.tsx b/server/sonar-web/src/main/js/apps/projects/filters/LanguagesFilter.tsx
index 7d875b5ae85..23a92e1cf35 100644
--- a/server/sonar-web/src/main/js/apps/projects/filters/LanguagesFilter.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/filters/LanguagesFilter.tsx
@@ -27,11 +27,10 @@ import { getLanguageByKey } from '../../../store/languages';
import { translate } from '../../../helpers/l10n';
import { Facet } from '../types';
import { RawQuery } from '../../../helpers/query';
-import { Languages } from '../../../app/types';
interface Props {
facet?: Facet;
- languages: Languages;
+ languages: T.Languages;
maxFacetValue?: number;
onQueryChange: (change: RawQuery) => void;
organization?: { key: string };
diff --git a/server/sonar-web/src/main/js/apps/projects/types.ts b/server/sonar-web/src/main/js/apps/projects/types.ts
index e997ca3eae6..b77a627aedf 100644
--- a/server/sonar-web/src/main/js/apps/projects/types.ts
+++ b/server/sonar-web/src/main/js/apps/projects/types.ts
@@ -17,7 +17,6 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { Visibility } from '../../app/types';
export interface Project {
analysisDate?: string;
@@ -28,7 +27,7 @@ export interface Project {
name: string;
organization?: { key: string; name: string };
tags: string[];
- visibility: Visibility;
+ visibility: T.Visibility;
}
export interface Facet {
diff --git a/server/sonar-web/src/main/js/apps/projects/utils.ts b/server/sonar-web/src/main/js/apps/projects/utils.ts
index abc41aeb328..b1be8b79d6d 100644
--- a/server/sonar-web/src/main/js/apps/projects/utils.ts
+++ b/server/sonar-web/src/main/js/apps/projects/utils.ts
@@ -25,7 +25,6 @@ import { getOrganizations } from '../../api/organizations';
import { searchProjects, Facet } from '../../api/components';
import { getMeasuresForProjects } from '../../api/measures';
import { isDiffMetric, getPeriodValue } from '../../helpers/measures';
-import { Organization } from '../../app/types';
interface SortingOption {
class?: string;
@@ -164,7 +163,7 @@ export function parseSorting(sort: string): { sortValue: string; sortDesc: boole
export function fetchProjects(
query: Query,
isFavorite: boolean,
- organization: Organization | undefined,
+ organization: T.Organization | undefined,
pageIndex = 1
) {
const ps = query.view === 'visualizations' ? PAGE_SIZE_VISUALIZATIONS : PAGE_SIZE;
@@ -259,7 +258,7 @@ export function fetchProjectMeasures(projects: Array<{ key: string }>, query: Qu
export function fetchProjectOrganizations(
projects: Array<{ organization: string }>,
- organization: Organization | undefined
+ organization: T.Organization | undefined
) {
if (organization) {
return Promise.resolve([organization]);
diff --git a/server/sonar-web/src/main/js/apps/projects/visualizations/SimpleBubbleChart.tsx b/server/sonar-web/src/main/js/apps/projects/visualizations/SimpleBubbleChart.tsx
index be1e6ee0f8c..c0c68a4c13d 100644
--- a/server/sonar-web/src/main/js/apps/projects/visualizations/SimpleBubbleChart.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/visualizations/SimpleBubbleChart.tsx
@@ -27,7 +27,7 @@ import { getProjectUrl } from '../../../helpers/urls';
import { Project } from '../types';
import HelpTooltip from '../../../components/controls/HelpTooltip';
-export interface Metric {
+interface Metric {
key: string;
type: string;
}
diff --git a/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/Risk-test.tsx b/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/Risk-test.tsx
index 23d9bb2830c..35081887946 100644
--- a/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/Risk-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/Risk-test.tsx
@@ -20,15 +20,15 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import Risk from '../Risk';
-import { Visibility } from '../../../../app/types';
+import { Project } from '../../types';
it('renders', () => {
- const project1 = {
+ const project1: Project = {
key: 'foo',
measures: { complexity: '17.2', coverage: '53.5', ncloc: '1734' },
name: 'Foo',
tags: [],
- visibility: Visibility.Public
+ visibility: 'public'
};
expect(
shallow(<Risk displayOrganizations={false} helpText="foobar" projects={[project1]} />)
diff --git a/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/SimpleBubbleChart-test.tsx b/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/SimpleBubbleChart-test.tsx
index e5b3f083975..0adf159c4a5 100644
--- a/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/SimpleBubbleChart-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/SimpleBubbleChart-test.tsx
@@ -20,15 +20,15 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import SimpleBubbleChart from '../SimpleBubbleChart';
-import { Visibility } from '../../../../app/types';
+import { Project } from '../../types';
it('renders', () => {
- const project1 = {
+ const project1: Project = {
key: 'foo',
measures: { complexity: '17.2', coverage: '53.5', ncloc: '1734', security_rating: '2' },
name: 'Foo',
tags: [],
- visibility: Visibility.Public
+ visibility: 'public'
};
expect(
shallow(
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/App.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/App.tsx
index 4df65fc78df..293e9f98836 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/App.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/App.tsx
@@ -27,15 +27,14 @@ import CreateProjectForm from './CreateProjectForm';
import ListFooter from '../../components/controls/ListFooter';
import Suggestions from '../../app/components/embed-docs-modal/Suggestions';
import { getComponents, Project } from '../../api/components';
-import { Organization, Visibility } from '../../app/types';
import { toNotSoISOString } from '../../helpers/dates';
import { translate } from '../../helpers/l10n';
export interface Props {
currentUser: { login: string };
hasProvisionPermission?: boolean;
- onVisibilityChange: (visibility: Visibility) => void;
- organization: Organization;
+ onVisibilityChange: (visibility: T.Visibility) => void;
+ organization: T.Organization;
topLevelQualifiers: string[];
}
@@ -50,7 +49,7 @@ interface State {
ready: boolean;
selection: string[];
total: number;
- visibility?: Visibility;
+ visibility?: T.Visibility;
}
const PAGE_SIZE = 50;
@@ -138,7 +137,7 @@ export default class App extends React.PureComponent<Props, State> {
);
};
- onVisibilityChanged = (newVisibility: Visibility | 'all') => {
+ onVisibilityChanged = (newVisibility: T.Visibility | 'all') => {
this.setState(
{
ready: false,
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/AppContainer.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/AppContainer.tsx
index a932cbe7b5b..99437f0da4f 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/AppContainer.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/AppContainer.tsx
@@ -21,7 +21,6 @@ import * as React from 'react';
import { connect } from 'react-redux';
import App from './App';
import forSingleOrganization from '../organizations/forSingleOrganization';
-import { Organization, LoggedInUser, Visibility } from '../../app/types';
import { getAppState, getOrganizationByKey, getCurrentUser, Store } from '../../store/rootReducer';
import { receiveOrganizations } from '../../store/organizations';
import { changeProjectDefaultVisibility } from '../../api/permissions';
@@ -29,18 +28,18 @@ import { fetchOrganization } from '../organizations/actions';
interface StateProps {
appState: { defaultOrganization: string; qualifiers: string[] };
- currentUser: LoggedInUser;
- organization?: Organization;
+ currentUser: T.LoggedInUser;
+ organization?: T.Organization;
}
interface DispatchProps {
fetchOrganization: (organization: string) => void;
- onVisibilityChange: (organization: Organization, visibility: Visibility) => void;
+ onVisibilityChange: (organization: T.Organization, visibility: T.Visibility) => void;
}
interface OwnProps {
onRequestFail: (error: any) => void;
- organization: Organization;
+ organization: T.Organization;
}
class AppContainer extends React.PureComponent<OwnProps & StateProps & DispatchProps> {
@@ -52,7 +51,7 @@ class AppContainer extends React.PureComponent<OwnProps & StateProps & DispatchP
}
}
- handleVisibilityChange = (visibility: Visibility) => {
+ handleVisibilityChange = (visibility: T.Visibility) => {
if (this.props.organization) {
this.props.onVisibilityChange(this.props.organization, visibility);
}
@@ -82,12 +81,12 @@ class AppContainer extends React.PureComponent<OwnProps & StateProps & DispatchP
const mapStateToProps = (state: Store, ownProps: OwnProps) => ({
appState: getAppState(state),
- currentUser: getCurrentUser(state) as LoggedInUser,
+ currentUser: getCurrentUser(state) as T.LoggedInUser,
organization:
ownProps.organization || getOrganizationByKey(state, getAppState(state).defaultOrganization)
});
-const onVisibilityChange = (organization: Organization, visibility: Visibility) => (
+const onVisibilityChange = (organization: T.Organization, visibility: T.Visibility) => (
dispatch: Function
) => {
const currentVisibility = organization.projectVisibility;
@@ -99,7 +98,7 @@ const onVisibilityChange = (organization: Organization, visibility: Visibility)
const mapDispatchToProps = (dispatch: Function) => ({
fetchOrganization: (key: string) => dispatch(fetchOrganization(key)),
- onVisibilityChange: (organization: Organization, visibility: Visibility) =>
+ onVisibilityChange: (organization: T.Organization, visibility: T.Visibility) =>
dispatch(onVisibilityChange(organization, visibility))
});
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/BulkApplyTemplateModal.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/BulkApplyTemplateModal.tsx
index 0e8fe28995c..77f52ddec6e 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/BulkApplyTemplateModal.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/BulkApplyTemplateModal.tsx
@@ -19,7 +19,6 @@
*/
import * as React from 'react';
import { getPermissionTemplates, bulkApplyTemplate } from '../../api/permissions';
-import { PermissionTemplate } from '../../app/types';
import { translate, translateWithParameters } from '../../helpers/l10n';
import Modal from '../../components/controls/Modal';
import Select from '../../components/controls/Select';
@@ -42,7 +41,7 @@ interface State {
done: boolean;
loading: boolean;
permissionTemplate?: string;
- permissionTemplates?: PermissionTemplate[];
+ permissionTemplates?: T.PermissionTemplate[];
submitting: boolean;
}
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/ChangeVisibilityForm.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/ChangeVisibilityForm.tsx
index 55ce40be1b9..04e41ea9b39 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/ChangeVisibilityForm.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/ChangeVisibilityForm.tsx
@@ -21,25 +21,24 @@ import * as React from 'react';
import * as classNames from 'classnames';
import UpgradeOrganizationBox from '../../components/common/UpgradeOrganizationBox';
import Modal from '../../components/controls/Modal';
-import { Organization, Visibility } from '../../app/types';
import { Button, ResetButtonLink } from '../../components/ui/buttons';
import { translate } from '../../helpers/l10n';
import { Alert } from '../../components/ui/Alert';
export interface Props {
onClose: () => void;
- onConfirm: (visiblity: Visibility) => void;
- organization: Organization;
+ onConfirm: (visiblity: T.Visibility) => void;
+ organization: T.Organization;
}
interface State {
- visibility: Visibility;
+ visibility: T.Visibility;
}
export default class ChangeVisibilityForm extends React.PureComponent<Props, State> {
constructor(props: Props) {
super(props);
- this.state = { visibility: props.organization.projectVisibility as Visibility };
+ this.state = { visibility: props.organization.projectVisibility as T.Visibility };
}
handleConfirmClick = () => {
@@ -50,7 +49,7 @@ export default class ChangeVisibilityForm extends React.PureComponent<Props, Sta
handleVisibilityClick = (event: React.SyntheticEvent<HTMLAnchorElement>) => {
event.preventDefault();
event.currentTarget.blur();
- const visibility = event.currentTarget.dataset.visibility as Visibility;
+ const visibility = event.currentTarget.dataset.visibility as T.Visibility;
this.setState({ visibility });
};
@@ -63,11 +62,10 @@ export default class ChangeVisibilityForm extends React.PureComponent<Props, Sta
</header>
<div className="modal-body">
- {[Visibility.Public, Visibility.Private].map(visibility => (
+ {['public', 'private'].map(visibility => (
<div className="big-spacer-bottom" key={visibility}>
<p>
- {visibility === Visibility.Private &&
- !organization.canUpdateProjectsVisibilityToPrivate ? (
+ {visibility === 'private' && !organization.canUpdateProjectsVisibilityToPrivate ? (
<span className="text-muted cursor-not-allowed">
<i
className={classNames('icon-radio', 'spacer-right', {
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/CreateProjectForm.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/CreateProjectForm.tsx
index d48e5cf0300..e434616ecc1 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/CreateProjectForm.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/CreateProjectForm.tsx
@@ -21,7 +21,6 @@ import * as React from 'react';
import { Link } from 'react-router';
import { FormattedMessage } from 'react-intl';
import { createProject } from '../../api/components';
-import { Organization, Visibility } from '../../app/types';
import UpgradeOrganizationBox from '../../components/common/UpgradeOrganizationBox';
import VisibilitySelector from '../../components/common/VisibilitySelector';
import Modal from '../../components/controls/Modal';
@@ -33,7 +32,7 @@ import { Alert } from '../../components/ui/Alert';
interface Props {
onClose: () => void;
onProjectCreated: () => void;
- organization: Organization;
+ organization: T.Organization;
}
interface State {
@@ -41,7 +40,7 @@ interface State {
key: string;
loading: boolean;
name: string;
- visibility?: Visibility;
+ visibility?: T.Visibility;
// add index declaration to be able to do `this.setState({ [name]: value });`
[x: string]: any;
}
@@ -82,7 +81,7 @@ export default class CreateProjectForm extends React.PureComponent<Props, State>
this.setState({ [name]: value });
};
- handleVisibilityChange = (visibility: Visibility) => {
+ handleVisibilityChange = (visibility: T.Visibility) => {
this.setState({ visibility });
};
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/Header.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/Header.tsx
index 4d75c04cc18..70d207a00c4 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/Header.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/Header.tsx
@@ -19,7 +19,6 @@
*/
import * as React from 'react';
import ChangeVisibilityForm from './ChangeVisibilityForm';
-import { Organization, Visibility } from '../../app/types';
import { EditButton, Button } from '../../components/ui/buttons';
import { translate } from '../../helpers/l10n';
import { isSonarCloud } from '../../helpers/system';
@@ -27,8 +26,8 @@ import { isSonarCloud } from '../../helpers/system';
export interface Props {
hasProvisionPermission?: boolean;
onProjectCreate: () => void;
- onVisibilityChange: (visibility: Visibility) => void;
- organization: Organization;
+ onVisibilityChange: (visibility: T.Visibility) => void;
+ organization: T.Organization;
}
interface State {
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/Projects.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/Projects.tsx
index 09add750d94..5ad0ae99ba2 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/Projects.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/Projects.tsx
@@ -20,7 +20,6 @@
import * as React from 'react';
import * as classNames from 'classnames';
import ProjectRow from './ProjectRow';
-import { Organization } from '../../app/types';
import { translate } from '../../helpers/l10n';
import { Project } from '../../api/components';
@@ -28,7 +27,7 @@ interface Props {
currentUser: { login: string };
onProjectDeselected: (project: string) => void;
onProjectSelected: (project: string) => void;
- organization: Organization;
+ organization: T.Organization;
projects: Project[];
ready?: boolean;
selection: string[];
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/Search.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/Search.tsx
index f336153d976..eeb7e985832 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/Search.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/Search.tsx
@@ -29,7 +29,6 @@ import Select from '../../components/controls/Select';
import SearchBox from '../../components/controls/SearchBox';
import { Button } from '../../components/ui/buttons';
import { Project } from '../../api/components';
-import { Organization, Visibility } from '../../app/types';
import { translate } from '../../helpers/l10n';
export interface Props {
@@ -42,7 +41,7 @@ export interface Props {
onQualifierChanged: (qualifier: string) => void;
onVisibilityChanged: (qualifier: string) => void;
onSearch: (query: string) => void;
- organization: Organization;
+ organization: T.Organization;
projects: Project[];
provisioned: boolean;
qualifiers: string;
@@ -51,7 +50,7 @@ export interface Props {
selection: any[];
topLevelQualifiers: string[];
total: number;
- visibility?: Visibility;
+ visibility?: T.Visibility;
}
interface State {
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/App-test.tsx
index 3299c3e33b4..f27f9b4eaf3 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/App-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/App-test.tsx
@@ -21,7 +21,6 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import App, { Props } from '../App';
-import { Visibility } from '../../../app/types';
jest.mock('lodash', () => {
const lodash = require.requireActual('lodash');
@@ -33,7 +32,7 @@ jest.mock('../../../api/components', () => ({ getComponents: jest.fn() }));
const getComponents = require('../../../api/components').getComponents as jest.Mock<any>;
-const organization = { key: 'org', name: 'org', projectVisibility: Visibility.Public };
+const organization: T.Organization = { key: 'org', name: 'org', projectVisibility: 'public' };
const defaultSearchParameters = {
organization: 'org',
@@ -129,8 +128,8 @@ it('creates project', () => {
it('changes default project visibility', () => {
const onVisibilityChange = jest.fn();
const wrapper = shallowRender({ onVisibilityChange });
- wrapper.find('Header').prop<Function>('onVisibilityChange')(Visibility.Private);
- expect(onVisibilityChange).toBeCalledWith(Visibility.Private);
+ wrapper.find('Header').prop<Function>('onVisibilityChange')('private');
+ expect(onVisibilityChange).toBeCalledWith('private');
});
function shallowRender(props?: { [P in keyof Props]?: Props[P] }) {
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ChangeVisibilityForm-test.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ChangeVisibilityForm-test.tsx
index 18fdae14861..d6f02e43602 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ChangeVisibilityForm-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ChangeVisibilityForm-test.tsx
@@ -21,13 +21,12 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import ChangeVisibilityForm from '../ChangeVisibilityForm';
import { click } from '../../../helpers/testUtils';
-import { Visibility } from '../../../app/types';
-const organization = {
+const organization: T.Organization = {
canUpdateProjectsVisibilityToPrivate: true,
key: 'org',
name: 'org',
- projectVisibility: Visibility.Public
+ projectVisibility: 'public'
};
it('renders disabled', () => {
@@ -53,13 +52,13 @@ it('changes visibility', () => {
click(wrapper.find('a[data-visibility="private"]'), {
currentTarget: {
blur() {},
- dataset: { visibility: Visibility.Private }
+ dataset: { visibility: 'private' }
}
});
expect(wrapper).toMatchSnapshot();
click(wrapper.find('.js-confirm'));
- expect(onConfirm).toBeCalledWith(Visibility.Private);
+ expect(onConfirm).toBeCalledWith('private');
});
function shallowRender(props: Partial<ChangeVisibilityForm['props']> = {}) {
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/CreateProjectForm-test.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/CreateProjectForm-test.tsx
index bc9e0ff3a6d..4fb4271cbff 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/CreateProjectForm-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/CreateProjectForm-test.tsx
@@ -28,11 +28,10 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import CreateProjectForm from '../CreateProjectForm';
import { change, submit, waitAndUpdate } from '../../../helpers/testUtils';
-import { Visibility } from '../../../app/types';
const createProject = require('../../../api/components').createProject as jest.Mock<any>;
-const organization = { key: 'org', name: 'org', projectVisibility: Visibility.Public };
+const organization: T.Organization = { key: 'org', name: 'org', projectVisibility: 'public' };
it('creates project', async () => {
const wrapper = shallow(
@@ -51,7 +50,7 @@ it('creates project', async () => {
change(wrapper.find('input[name="key"]'), 'key', {
currentTarget: { name: 'key', value: 'key' }
});
- wrapper.find('VisibilitySelector').prop<Function>('onChange')(Visibility.Private);
+ wrapper.find('VisibilitySelector').prop<Function>('onChange')('private');
wrapper.update();
expect(wrapper).toMatchSnapshot();
@@ -60,7 +59,7 @@ it('creates project', async () => {
name: 'name',
organization: 'org',
project: 'key',
- visibility: Visibility.Private
+ visibility: 'private'
});
expect(wrapper).toMatchSnapshot();
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Header-test.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Header-test.tsx
index 310e6246165..6eddf971a9f 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Header-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Header-test.tsx
@@ -20,10 +20,9 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import Header, { Props } from '../Header';
-import { Visibility } from '../../../app/types';
import { click } from '../../../helpers/testUtils';
-const organization = { key: 'org', name: 'org', projectVisibility: Visibility.Public };
+const organization: T.Organization = { key: 'org', name: 'org', projectVisibility: 'public' };
it('renders', () => {
expect(shallowRender()).toMatchSnapshot();
@@ -44,8 +43,8 @@ it('changes default visibility', () => {
const modalWrapper = wrapper.find('ChangeVisibilityForm');
expect(modalWrapper).toMatchSnapshot();
- modalWrapper.prop<Function>('onConfirm')(Visibility.Private);
- expect(onVisibilityChange).toBeCalledWith(Visibility.Private);
+ modalWrapper.prop<Function>('onConfirm')('private');
+ expect(onVisibilityChange).toBeCalledWith('private');
modalWrapper.prop<Function>('onClose')();
wrapper.update();
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ProjectRow-test.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ProjectRow-test.tsx
index 140fae55d91..6cb6b4835b0 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ProjectRow-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ProjectRow-test.tsx
@@ -20,13 +20,12 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import ProjectRow from '../ProjectRow';
-import { Visibility } from '../../../app/types';
const project = {
key: 'project',
name: 'Project',
qualifier: 'TRK',
- visibility: Visibility.Private
+ visibility: 'private'
};
it('renders', () => {
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ProjectRowActions-test.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ProjectRowActions-test.tsx
index df159be98da..4b2046321c0 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ProjectRowActions-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ProjectRowActions-test.tsx
@@ -20,8 +20,8 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import ProjectRowActions, { Props } from '../ProjectRowActions';
-import { Visibility } from '../../../app/types';
import { click, waitAndUpdate } from '../../../helpers/testUtils';
+import { Project } from '../../../api/components';
jest.mock('../../../api/components', () => ({
getComponentShow: jest.fn(() => Promise.reject(undefined))
@@ -31,13 +31,13 @@ jest.mock('../../../api/nav', () => ({
getComponentNavigation: jest.fn(() => Promise.resolve())
}));
-const project = {
+const project: Project = {
id: '',
key: 'project',
name: 'Project',
organization: 'org',
qualifier: 'TRK',
- visibility: Visibility.Private
+ visibility: 'private'
};
it('restores access', async () => {
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Projects-test.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Projects-test.tsx
index 63a914ea80a..d1669a1f25f 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Projects-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Projects-test.tsx
@@ -20,12 +20,11 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import Projects from '../Projects';
-import { Visibility } from '../../../app/types';
-const organization = { key: 'org', name: 'org', projectVisibility: Visibility.Public };
+const organization = { key: 'org', name: 'org', projectVisibility: 'public' };
const projects = [
- { key: 'a', name: 'A', qualifier: 'TRK', visibility: Visibility.Public },
- { key: 'b', name: 'B', qualifier: 'TRK', visibility: Visibility.Public }
+ { key: 'a', name: 'A', qualifier: 'TRK', visibility: 'public' },
+ { key: 'b', name: 'B', qualifier: 'TRK', visibility: 'public' }
];
const selection = ['a'];
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Search-test.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Search-test.tsx
index f8081a89174..018dc396858 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Search-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Search-test.tsx
@@ -21,9 +21,8 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import Search, { Props } from '../Search';
import { click } from '../../../helpers/testUtils';
-import { Visibility } from '../../../app/types';
-const organization = { key: 'org', name: 'org', projectVisibility: Visibility.Public };
+const organization: T.Organization = { key: 'org', name: 'org', projectVisibility: 'public' };
it('renders', () => {
expect(shallowRender()).toMatchSnapshot();
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/AddConditionSelect.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/AddConditionSelect.tsx
index 9b9f416c3d3..22226b306ed 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/AddConditionSelect.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/AddConditionSelect.tsx
@@ -21,11 +21,10 @@ import * as React from 'react';
import { sortBy } from 'lodash';
import Select from '../../../components/controls/Select';
import { translate, getLocalizedMetricName, getLocalizedMetricDomain } from '../../../helpers/l10n';
-import { Metric } from '../../../app/types';
interface Props {
- metrics: Metric[];
- onAddCondition: (metric: Metric) => void;
+ metrics: T.Metric[];
+ onAddCondition: (metric: T.Metric) => void;
}
interface State {
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/Condition.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/Condition.tsx
index 284a0e876d5..af9f13c9a51 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/Condition.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/Condition.tsx
@@ -21,7 +21,6 @@ import * as React from 'react';
import ConditionOperator from './ConditionOperator';
import Period from './Period';
import ConditionModal from './ConditionModal';
-import { Condition as ICondition, Metric, QualityGate } from '../../../app/types';
import ActionsDropdown, { ActionsDropdownItem } from '../../../components/controls/ActionsDropdown';
import { translate, getLocalizedMetricName, translateWithParameters } from '../../../helpers/l10n';
import { formatMeasure } from '../../../helpers/measures';
@@ -29,13 +28,13 @@ import ConfirmModal from '../../../components/controls/ConfirmModal';
import { deleteCondition } from '../../../api/quality-gates';
interface Props {
- condition: ICondition;
+ condition: T.Condition;
canEdit: boolean;
- metric: Metric;
+ metric: T.Metric;
organization?: string;
- onRemoveCondition: (Condition: ICondition) => void;
- onSaveCondition: (newCondition: ICondition, oldCondition: ICondition) => void;
- qualityGate: QualityGate;
+ onRemoveCondition: (Condition: T.Condition) => void;
+ onSaveCondition: (newCondition: T.Condition, oldCondition: T.Condition) => void;
+ qualityGate: T.QualityGate;
}
interface State {
@@ -60,7 +59,7 @@ export default class Condition extends React.PureComponent<Props, State> {
};
}
- handleUpdateCondition = (newCondition: ICondition) => {
+ handleUpdateCondition = (newCondition: T.Condition) => {
this.props.onSaveCondition(newCondition, this.props.condition);
};
@@ -80,7 +79,7 @@ export default class Condition extends React.PureComponent<Props, State> {
this.setState({ deleteFormOpen: false });
};
- removeCondition = (condition: ICondition) => {
+ removeCondition = (condition: T.Condition) => {
deleteCondition({ id: condition.id, organization: this.props.organization }).then(
() => this.props.onRemoveCondition(condition),
() => {}
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionModal.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionModal.tsx
index 5c11c927d00..86a1706430e 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionModal.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionModal.tsx
@@ -23,7 +23,6 @@ import ConditionOperator from './ConditionOperator';
import ThresholdInput from './ThresholdInput';
import Period from './Period';
import { translate, getLocalizedMetricName } from '../../../helpers/l10n';
-import { Metric, QualityGate, Condition, Omit } from '../../../app/types';
import { createCondition, updateCondition } from '../../../api/quality-gates';
import { isDiffMetric } from '../../../helpers/measures';
import { parseError } from '../../../helpers/request';
@@ -31,20 +30,20 @@ import ConfirmModal from '../../../components/controls/ConfirmModal';
import { Alert } from '../../../components/ui/Alert';
interface Props {
- condition?: Condition;
- metric?: Metric;
- metrics?: Metric[];
+ condition?: T.Condition;
+ metric?: T.Metric;
+ metrics?: T.Metric[];
header: string;
- onAddCondition: (condition: Condition) => void;
+ onAddCondition: (condition: T.Condition) => void;
onClose: () => void;
organization?: string;
- qualityGate: QualityGate;
+ qualityGate: T.QualityGate;
}
interface State {
error: string;
errorMessage?: string;
- metric?: Metric;
+ metric?: T.Metric;
op?: string;
period: boolean;
warning: string;
@@ -72,8 +71,8 @@ export default class ConditionModal extends React.PureComponent<Props, State> {
this.mounted = false;
}
- getUpdatedCondition = (metric: Metric) => {
- const data: Omit<Condition, 'id'> = {
+ getUpdatedCondition = (metric: T.Metric) => {
+ const data: T.Omit<T.Condition, 'id'> = {
metric: metric.key,
op: metric.type === 'RATING' ? 'GT' : this.state.op,
warning: this.state.warning,
@@ -95,7 +94,7 @@ export default class ConditionModal extends React.PureComponent<Props, State> {
if (this.state.metric) {
const { condition, qualityGate, organization } = this.props;
const newCondition = this.getUpdatedCondition(this.state.metric);
- let submitPromise: Promise<Condition>;
+ let submitPromise: Promise<T.Condition>;
if (condition) {
submitPromise = updateCondition({ organization, id: condition.id, ...newCondition });
} else {
@@ -113,7 +112,7 @@ export default class ConditionModal extends React.PureComponent<Props, State> {
return Promise.reject('No metric selected');
};
- handleChooseType = (metric: Metric) => {
+ handleChooseType = (metric: T.Metric) => {
this.setState({ metric });
};
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionOperator.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionOperator.tsx
index 526813bde06..125b5110d9f 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionOperator.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionOperator.tsx
@@ -19,13 +19,12 @@
*/
import * as React from 'react';
import Select from '../../../components/controls/Select';
-import { Metric } from '../../../app/types';
import { translate } from '../../../helpers/l10n';
interface Props {
op?: string;
canEdit: boolean;
- metric: Metric;
+ metric: T.Metric;
onOperatorChange?: (op: string) => void;
}
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.tsx
index fd422093e2f..6fa018479e0 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.tsx
@@ -23,24 +23,23 @@ import Condition from './Condition';
import ConditionModal from './ConditionModal';
import DocTooltip from '../../../components/docs/DocTooltip';
import { translate, getLocalizedMetricName } from '../../../helpers/l10n';
-import { Condition as ICondition, Metric, QualityGate } from '../../../app/types';
import ModalButton from '../../../components/controls/ModalButton';
import { Button } from '../../../components/ui/buttons';
import { Alert } from '../../../components/ui/Alert';
interface Props {
canEdit: boolean;
- conditions: ICondition[];
- metrics: { [key: string]: Metric };
- onAddCondition: (condition: ICondition) => void;
- onSaveCondition: (newCondition: ICondition, oldCondition: ICondition) => void;
- onRemoveCondition: (Condition: ICondition) => void;
+ conditions: T.Condition[];
+ metrics: { [key: string]: T.Metric };
+ onAddCondition: (condition: T.Condition) => void;
+ onSaveCondition: (newCondition: T.Condition, oldCondition: T.Condition) => void;
+ onRemoveCondition: (Condition: T.Condition) => void;
organization?: string;
- qualityGate: QualityGate;
+ qualityGate: T.QualityGate;
}
export default class Conditions extends React.PureComponent<Props> {
- getConditionKey = (condition: ICondition, index: number) => {
+ getConditionKey = (condition: T.Condition, index: number) => {
return condition.id ? condition.id : `new-${index}`;
};
@@ -54,7 +53,7 @@ export default class Conditions extends React.PureComponent<Props> {
condition => metrics[condition.metric] && metrics[condition.metric].name
);
- const duplicates: ICondition[] = [];
+ const duplicates: T.Condition[] = [];
const savedConditions = existingConditions.filter(condition => condition.id != null);
savedConditions.forEach(condition => {
const sameCount = savedConditions.filter(
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/CopyQualityGateForm.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/CopyQualityGateForm.tsx
index 0d95becd65d..b7e2c9831d2 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/CopyQualityGateForm.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/CopyQualityGateForm.tsx
@@ -23,13 +23,12 @@ import { copyQualityGate } from '../../../api/quality-gates';
import ConfirmModal from '../../../components/controls/ConfirmModal';
import { translate } from '../../../helpers/l10n';
import { getQualityGateUrl } from '../../../helpers/urls';
-import { QualityGate } from '../../../app/types';
interface Props {
onClose: () => void;
onCopy: () => Promise<void>;
organization?: string;
- qualityGate: QualityGate;
+ qualityGate: T.QualityGate;
}
interface State {
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/DeleteQualityGateForm.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/DeleteQualityGateForm.tsx
index 818b2d6d052..f523a4f12f1 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/DeleteQualityGateForm.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/DeleteQualityGateForm.tsx
@@ -24,12 +24,11 @@ import ConfirmButton from '../../../components/controls/ConfirmButton';
import { Button } from '../../../components/ui/buttons';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { getQualityGatesUrl } from '../../../helpers/urls';
-import { QualityGate } from '../../../app/types';
interface Props {
onDelete: () => Promise<void>;
organization?: string;
- qualityGate: QualityGate;
+ qualityGate: T.QualityGate;
}
export default class DeleteQualityGateForm extends React.PureComponent<Props> {
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsApp.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsApp.tsx
index d09415b9c64..95bb2bcfb76 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsApp.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsApp.tsx
@@ -26,19 +26,18 @@ import DetailsContent from './DetailsContent';
import { getMetrics, Store } from '../../../store/rootReducer';
import { fetchMetrics } from '../../../store/rootActions';
import { fetchQualityGate } from '../../../api/quality-gates';
-import { Metric, QualityGate, Condition } from '../../../app/types';
import { checkIfDefault, addCondition, replaceCondition, deleteCondition } from '../utils';
interface OwnProps {
- onSetDefault: (qualityGate: QualityGate) => void;
+ onSetDefault: (qualityGate: T.QualityGate) => void;
organization?: string;
params: { id: number };
- qualityGates: QualityGate[];
+ qualityGates: T.QualityGate[];
refreshQualityGates: () => Promise<void>;
}
interface StateToProps {
- metrics: { [key: string]: Metric };
+ metrics: { [key: string]: T.Metric };
}
interface DispatchToProps {
@@ -49,7 +48,7 @@ type Props = StateToProps & DispatchToProps & OwnProps;
interface State {
loading: boolean;
- qualityGate?: QualityGate;
+ qualityGate?: T.QualityGate;
}
export class DetailsApp extends React.PureComponent<Props, State> {
@@ -93,7 +92,7 @@ export class DetailsApp extends React.PureComponent<Props, State> {
);
};
- handleAddCondition = (condition: Condition) => {
+ handleAddCondition = (condition: T.Condition) => {
this.setState(({ qualityGate }) => {
if (!qualityGate) {
return null;
@@ -102,7 +101,7 @@ export class DetailsApp extends React.PureComponent<Props, State> {
});
};
- handleSaveCondition = (newCondition: Condition, oldCondition: Condition) => {
+ handleSaveCondition = (newCondition: T.Condition, oldCondition: T.Condition) => {
this.setState(({ qualityGate }) => {
if (!qualityGate) {
return null;
@@ -111,7 +110,7 @@ export class DetailsApp extends React.PureComponent<Props, State> {
});
};
- handleRemoveCondition = (condition: Condition) => {
+ handleRemoveCondition = (condition: T.Condition) => {
this.setState(({ qualityGate }) => {
if (!qualityGate) {
return null;
@@ -126,7 +125,7 @@ export class DetailsApp extends React.PureComponent<Props, State> {
return null;
}
this.props.onSetDefault(qualityGate);
- const newQualityGate: QualityGate = {
+ const newQualityGate: T.QualityGate = {
...qualityGate,
actions: { ...qualityGate.actions, delete: false, setAsDefault: false }
};
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsContent.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsContent.tsx
index ea00c28f0ae..5d2b70f78e3 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsContent.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsContent.tsx
@@ -22,16 +22,15 @@ import Conditions from './Conditions';
import Projects from './Projects';
import DocTooltip from '../../../components/docs/DocTooltip';
import { translate } from '../../../helpers/l10n';
-import { Condition as ICondition, Metric, QualityGate } from '../../../app/types';
interface Props {
isDefault?: boolean;
- metrics: { [key: string]: Metric };
+ metrics: { [key: string]: T.Metric };
organization?: string;
- onAddCondition: (condition: ICondition) => void;
- onRemoveCondition: (Condition: ICondition) => void;
- onSaveCondition: (newCondition: ICondition, oldCondition: ICondition) => void;
- qualityGate: QualityGate;
+ onAddCondition: (condition: T.Condition) => void;
+ onRemoveCondition: (Condition: T.Condition) => void;
+ onSaveCondition: (newCondition: T.Condition, oldCondition: T.Condition) => void;
+ qualityGate: T.QualityGate;
}
export default class DetailsContent extends React.PureComponent<Props> {
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsHeader.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsHeader.tsx
index 6f7343e0485..642619fe84a 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsHeader.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsHeader.tsx
@@ -26,12 +26,11 @@ import ModalButton from '../../../components/controls/ModalButton';
import { setQualityGateAsDefault } from '../../../api/quality-gates';
import { Button } from '../../../components/ui/buttons';
import { translate } from '../../../helpers/l10n';
-import { QualityGate } from '../../../app/types';
interface Props {
onSetDefault: () => void;
organization?: string;
- qualityGate: QualityGate;
+ qualityGate: T.QualityGate;
refreshItem: () => Promise<void>;
refreshList: () => Promise<void>;
}
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/Intro.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/Intro.tsx
index bbf59a9610d..fa5ec72b485 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/Intro.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/Intro.tsx
@@ -20,12 +20,11 @@
import * as React from 'react';
import { InjectedRouter } from 'react-router';
import { translate } from '../../../helpers/l10n';
-import { QualityGate } from '../../../app/types';
import { getQualityGateUrl } from '../../../helpers/urls';
interface Props {
organization?: string;
- qualityGates: QualityGate[];
+ qualityGates: T.QualityGate[];
router: InjectedRouter;
}
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/List.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/List.tsx
index 5586c52f22f..2adbb1518b0 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/List.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/List.tsx
@@ -22,11 +22,10 @@ import { Link } from 'react-router';
import BuiltInQualityGateBadge from './BuiltInQualityGateBadge';
import { translate } from '../../../helpers/l10n';
import { getQualityGateUrl } from '../../../helpers/urls';
-import { QualityGate } from '../../../app/types';
interface Props {
organization?: string;
- qualityGates: QualityGate[];
+ qualityGates: T.QualityGate[];
}
export default function List({ organization, qualityGates }: Props) {
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/Period.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/Period.tsx
index fbb996c24da..1668dce7822 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/Period.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/Period.tsx
@@ -19,13 +19,12 @@
*/
import * as React from 'react';
import Checkbox from '../../../components/controls/Checkbox';
-import { Metric } from '../../../app/types';
import { isDiffMetric } from '../../../helpers/measures';
import { translate } from '../../../helpers/l10n';
interface Props {
canEdit: boolean;
- metric: Metric;
+ metric: T.Metric;
onPeriodChange?: (checked: boolean) => void;
period: boolean;
}
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/Projects.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/Projects.tsx
index 8153ec3e3ca..77eafc27e7e 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/Projects.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/Projects.tsx
@@ -26,12 +26,11 @@ import {
associateGateWithProject,
dissociateGateWithProject
} from '../../../api/quality-gates';
-import { QualityGate } from '../../../app/types';
interface Props {
canEdit?: boolean;
organization?: string;
- qualityGate: QualityGate;
+ qualityGate: T.QualityGate;
}
interface State {
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatesApp.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatesApp.tsx
index 07104d8db0e..56e3986f26c 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatesApp.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatesApp.tsx
@@ -27,7 +27,6 @@ import Suggestions from '../../../app/components/embed-docs-modal/Suggestions';
import { fetchQualityGates } from '../../../api/quality-gates';
import { translate } from '../../../helpers/l10n';
import { getQualityGateUrl } from '../../../helpers/urls';
-import { Organization, QualityGate } from '../../../app/types';
import '../../../components/search-navigator.css';
import '../styles.css';
@@ -36,13 +35,13 @@ interface Props {
organization?: string;
refreshQualityGates: () => Promise<void>;
}>;
- organization: Pick<Organization, 'key'>;
+ organization: Pick<T.Organization, 'key'>;
}
interface State {
canCreate: boolean;
loading: boolean;
- qualityGates: QualityGate[];
+ qualityGates: T.QualityGate[];
}
export default class QualityGatesApp extends React.PureComponent<Props, State> {
@@ -102,7 +101,7 @@ export default class QualityGatesApp extends React.PureComponent<Props, State> {
);
};
- handleSetDefault = (qualityGate: QualityGate) => {
+ handleSetDefault = (qualityGate: T.QualityGate) => {
this.setState(({ qualityGates }) => {
return {
qualityGates: qualityGates.map(candidate => {
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/RenameQualityGateForm.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/RenameQualityGateForm.tsx
index 852ed3fb40f..5c5f7292b78 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/RenameQualityGateForm.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/RenameQualityGateForm.tsx
@@ -21,13 +21,12 @@ import * as React from 'react';
import ConfirmModal from '../../../components/controls/ConfirmModal';
import { renameQualityGate } from '../../../api/quality-gates';
import { translate } from '../../../helpers/l10n';
-import { QualityGate } from '../../../app/types';
interface Props {
onClose: () => void;
onRename: () => Promise<void>;
organization?: string;
- qualityGate: QualityGate;
+ qualityGate: T.QualityGate;
}
interface State {
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/ThresholdInput.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/ThresholdInput.tsx
index f5c328f348a..ef7f7417793 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/ThresholdInput.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/ThresholdInput.tsx
@@ -19,12 +19,11 @@
*/
import * as React from 'react';
import Select from '../../../components/controls/Select';
-import { Metric } from '../../../app/types';
interface Props {
name: string;
value: string;
- metric: Metric;
+ metric: T.Metric;
onChange: (value: string) => void;
}
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/utils.ts b/server/sonar-web/src/main/js/apps/quality-gates/utils.ts
index 6279a475f12..b617fab89e2 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/utils.ts
+++ b/server/sonar-web/src/main/js/apps/quality-gates/utils.ts
@@ -18,30 +18,28 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { QualityGate, Condition } from '../../app/types';
-
-export function checkIfDefault(qualityGate: QualityGate, list: QualityGate[]): boolean {
+export function checkIfDefault(qualityGate: T.QualityGate, list: T.QualityGate[]): boolean {
const finding = list.find(candidate => candidate.id === qualityGate.id);
return (finding && finding.isDefault) || false;
}
-export function addCondition(qualityGate: QualityGate, condition: Condition): QualityGate {
+export function addCondition(qualityGate: T.QualityGate, condition: T.Condition): T.QualityGate {
const oldConditions = qualityGate.conditions || [];
const conditions = [...oldConditions, condition];
return { ...qualityGate, conditions };
}
-export function deleteCondition(qualityGate: QualityGate, condition: Condition): QualityGate {
+export function deleteCondition(qualityGate: T.QualityGate, condition: T.Condition): T.QualityGate {
const conditions =
qualityGate.conditions && qualityGate.conditions.filter(candidate => candidate !== condition);
return { ...qualityGate, conditions };
}
export function replaceCondition(
- qualityGate: QualityGate,
- newCondition: Condition,
- oldCondition: Condition
-): QualityGate {
+ qualityGate: T.QualityGate,
+ newCondition: T.Condition,
+ oldCondition: T.Condition
+): T.QualityGate {
const conditions =
qualityGate.conditions &&
qualityGate.conditions.map(candidate => {
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/components/App.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/components/App.tsx
index dc123ff9963..28c7cd7d123 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/components/App.tsx
@@ -24,12 +24,11 @@ import { sortProfiles } from '../utils';
import { Exporter, Profile } from '../types';
import OrganizationHelmet from '../../../components/common/OrganizationHelmet';
import { translate } from '../../../helpers/l10n';
-import { Languages } from '../../../app/types';
import '../styles.css';
interface Props {
children: React.ReactElement<any>;
- languages: Languages;
+ languages: T.Languages;
organization: { name: string; key: string } | undefined;
}
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissions.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissions.tsx
index ad88c22f0a1..b19ce402ff9 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissions.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissions.tsx
@@ -128,7 +128,7 @@ export default class ProfilePermissions extends React.PureComponent<Props, State
}
};
- handleGroupAdd = (addedGroup: Group) => {
+ handleGroupAdd = (addedGroup: T.Group) => {
if (this.mounted) {
this.setState((state: State) => ({
addUserForm: false,
@@ -137,7 +137,7 @@ export default class ProfilePermissions extends React.PureComponent<Props, State
}
};
- handleGroupDelete = (removedGroup: Group) => {
+ handleGroupDelete = (removedGroup: T.Group) => {
if (this.mounted) {
this.setState((state: State) => ({
groups: state.groups && state.groups.filter(group => group !== removedGroup)
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.tsx
index 038499c0fb2..ec7f000e6dd 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.tsx
@@ -29,11 +29,10 @@ import { getQualityProfile } from '../../../api/quality-profiles';
import { getRulesUrl } from '../../../helpers/urls';
import { translate } from '../../../helpers/l10n';
import { Profile } from '../types';
-import { RuleType } from '../../../app/types';
import { Button } from '../../../components/ui/buttons';
import DocTooltip from '../../../components/docs/DocTooltip';
-const TYPES = [RuleType.Bug, RuleType.Vulnerability, RuleType.CodeSmell, RuleType.Hotspot];
+const TYPES = ['BUG', 'VULNERABILITY', 'CODE_SMELL', 'SECURITY_HOTSPOT'];
interface Props {
organization: string | null;
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileRules-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileRules-test.tsx
index ef964aa5b01..3d7c0ff4bf1 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileRules-test.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileRules-test.tsx
@@ -23,7 +23,6 @@ import ProfileRules from '../ProfileRules';
import * as apiRules from '../../../../api/rules';
import * as apiQP from '../../../../api/quality-profiles';
import { waitAndUpdate } from '../../../../helpers/testUtils';
-import { RuleType } from '../../../../app/types';
const PROFILE = {
activeRuleCount: 68,
@@ -49,10 +48,10 @@ const apiResponseAll = {
{
property: 'types',
values: [
- { val: RuleType.CodeSmell, count: 168 },
- { val: RuleType.Bug, count: 68 },
- { val: RuleType.Vulnerability, count: 7 },
- { val: RuleType.Hotspot, count: 10 }
+ { val: 'CODE_SMELL', count: 168 },
+ { val: 'BUG', count: 68 },
+ { val: 'VULNERABILITY', count: 7 },
+ { val: 'SECURITY_HOTSPOT', count: 10 }
]
}
]
@@ -64,10 +63,10 @@ const apiResponseActive = {
{
property: 'types',
values: [
- { val: RuleType.Bug, count: 68 },
- { val: RuleType.CodeSmell, count: 0 },
- { val: RuleType.Vulnerability, count: 0 },
- { val: RuleType.Hotspot, count: 0 }
+ { val: 'BUG', count: 68 },
+ { val: 'CODE_SMELL', count: 0 },
+ { val: 'VULNERABILITY', count: 0 },
+ { val: 'SECURITY_HOTSPOT', count: 0 }
]
}
]
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionRules.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionRules.tsx
index f0e4363e8dc..c3bf8c77f7a 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionRules.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionRules.tsx
@@ -25,11 +25,13 @@ import { translateWithParameters, translate } from '../../../helpers/l10n';
import { getRulesUrl } from '../../../helpers/urls';
import { toShortNotSoISOString } from '../../../helpers/dates';
import { formatMeasure } from '../../../helpers/measures';
-import { Rule, RuleActivation } from '../../../app/types';
const RULES_LIMIT = 10;
-function parseRules(rules: Rule[], actives?: { [rule: string]: RuleActivation[] }): ExtendedRule[] {
+function parseRules(
+ rules: T.Rule[],
+ actives?: { [rule: string]: T.RuleActivation[] }
+): ExtendedRule[] {
return rules.map(rule => {
const activations = actives && actives[rule.key];
return { ...rule, activations: activations ? activations.length : 0 };
@@ -40,7 +42,7 @@ interface Props {
organization: string | null;
}
-interface ExtendedRule extends Rule {
+interface ExtendedRule extends T.Rule {
activations: number;
}
diff --git a/server/sonar-web/src/main/js/apps/securityReports/components/App.tsx b/server/sonar-web/src/main/js/apps/securityReports/components/App.tsx
index ed50bf28c72..8ab102b5744 100755
--- a/server/sonar-web/src/main/js/apps/securityReports/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/securityReports/components/App.tsx
@@ -24,7 +24,6 @@ import { Link } from 'react-router';
import VulnerabilityList from './VulnerabilityList';
import Suggestions from '../../../app/components/embed-docs-modal/Suggestions';
import { translate } from '../../../helpers/l10n';
-import { Component, BranchLike, SecurityHotspot } from '../../../app/types';
import DeferredSpinner from '../../../components/common/DeferredSpinner';
import Checkbox from '../../../components/controls/Checkbox';
import { RawQuery } from '../../../helpers/query';
@@ -37,15 +36,15 @@ import { Alert } from '../../../components/ui/Alert';
import '../style.css';
interface Props {
- branchLike?: BranchLike;
- component: Component;
+ branchLike?: T.BranchLike;
+ component: T.Component;
location: { pathname: string; query: RawQuery };
params: { type: string };
}
interface State {
loading: boolean;
- findings: Array<SecurityHotspot>;
+ findings: T.SecurityHotspot[];
hasVulnerabilities: boolean;
type: StandardType;
showCWE: boolean;
diff --git a/server/sonar-web/src/main/js/apps/securityReports/components/VulnerabilityList.tsx b/server/sonar-web/src/main/js/apps/securityReports/components/VulnerabilityList.tsx
index 28cbd625f14..8629b9d2639 100755
--- a/server/sonar-web/src/main/js/apps/securityReports/components/VulnerabilityList.tsx
+++ b/server/sonar-web/src/main/js/apps/securityReports/components/VulnerabilityList.tsx
@@ -21,7 +21,6 @@ import * as React from 'react';
import * as classNames from 'classnames';
import { Link } from 'react-router';
import { translate } from '../../../helpers/l10n';
-import { SecurityHotspot, Component, BranchLike, IssueType } from '../../../app/types';
import Rating from '../../../components/ui/Rating';
import { getComponentIssuesUrl, getRulesUrl } from '../../../helpers/urls';
import { getBranchLikeQuery } from '../../../helpers/branches';
@@ -43,9 +42,9 @@ import { isSonarCloud } from '../../../helpers/system';
import * as theme from '../../../app/theme';
interface Props {
- branchLike?: BranchLike;
- component: Component;
- findings: SecurityHotspot[];
+ branchLike?: T.BranchLike;
+ component: T.Component;
+ findings: T.SecurityHotspot[];
showCWE: boolean;
type: StandardType;
}
@@ -86,7 +85,7 @@ export default class VulnerabilityList extends React.PureComponent<Props, State>
);
};
- getName(finding: SecurityHotspot, type: StandardType) {
+ getName(finding: T.SecurityHotspot, type: StandardType) {
const category = finding.category || finding.cwe || 'unknown';
const renderers = {
owaspTop10: renderOwaspTop10Category,
@@ -138,7 +137,7 @@ export default class VulnerabilityList extends React.PureComponent<Props, State>
<Link
className="spacer-left link-no-underline"
to={getRulesUrl(
- { languages, tags, types: [IssueType.Hotspot, IssueType.Vulnerability].join() },
+ { languages, tags, types: ['SECURITY_HOTSPOT', 'VULNERABILITY'].join() },
isSonarCloud() ? this.props.component.organization : undefined
)}>
{translate('security_reports.activate_rules.link')}
@@ -190,14 +189,14 @@ export default class VulnerabilityList extends React.PureComponent<Props, State>
};
renderFinding(
- finding: SecurityHotspot,
+ finding: T.SecurityHotspot,
isCWE?: boolean,
- parent?: SecurityHotspot
+ parent?: T.SecurityHotspot
): React.ReactFragment {
const { branchLike, component, type } = this.props;
const params: { [name: string]: string | undefined } = {
...getBranchLikeQuery(branchLike),
- types: IssueType.Hotspot
+ types: 'SECURITY_HOTSPOT'
};
if (isCWE && parent) {
params['cwe'] = finding.cwe;
@@ -224,7 +223,7 @@ export default class VulnerabilityList extends React.PureComponent<Props, State>
finding.activeRules,
{
...params,
- types: IssueType.Vulnerability,
+ types: 'VULNERABILITY',
resolved: 'false'
},
finding.vulnerabilities,
@@ -233,7 +232,7 @@ export default class VulnerabilityList extends React.PureComponent<Props, State>
className="link-no-underline spacer-left"
to={getComponentIssuesUrl(component.key, {
...params,
- types: IssueType.Vulnerability,
+ types: 'VULNERABILITY',
resolved: 'false'
})}>
<Rating value={finding.vulnerabilityRating || 1} />
@@ -247,7 +246,7 @@ export default class VulnerabilityList extends React.PureComponent<Props, State>
finding.activeRules,
{
...params,
- types: IssueType.Hotspot,
+ types: 'SECURITY_HOTSPOT',
resolved: 'false',
statuses: 'OPEN,REOPENED'
},
@@ -259,7 +258,7 @@ export default class VulnerabilityList extends React.PureComponent<Props, State>
finding.activeRules,
{
...params,
- types: IssueType.Hotspot,
+ types: 'SECURITY_HOTSPOT',
resolutions: 'FIXED',
statuses: 'RESOLVED'
},
@@ -271,7 +270,7 @@ export default class VulnerabilityList extends React.PureComponent<Props, State>
finding.activeRules,
{
...params,
- types: IssueType.Hotspot,
+ types: 'SECURITY_HOTSPOT',
resolutions: 'WONTFIX',
statuses: 'RESOLVED'
},
diff --git a/server/sonar-web/src/main/js/apps/securityReports/components/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/securityReports/components/__tests__/App-test.tsx
index 61c8f980517..b934385a71b 100644
--- a/server/sonar-web/src/main/js/apps/securityReports/components/__tests__/App-test.tsx
+++ b/server/sonar-web/src/main/js/apps/securityReports/components/__tests__/App-test.tsx
@@ -78,14 +78,13 @@ jest.mock('../../../../api/security-reports', () => ({
import * as React from 'react';
import { shallow } from 'enzyme';
-import { Component } from '../../../../app/types';
import App from '../App';
import { waitAndUpdate } from '../../../../helpers/testUtils';
const getSecurityHotspots = require('../../../../api/security-reports')
.getSecurityHotspots as jest.Mock<any>;
-const component = { key: 'foo', name: 'Foo', qualifier: 'TRK' } as Component;
+const component = { key: 'foo', name: 'Foo', qualifier: 'TRK' } as T.Component;
const context = { router: { push: jest.fn() } };
const location = { pathname: 'foo', query: {} };
const locationWithCWE = { pathname: 'foo', query: { showCWE: 'true' } };
diff --git a/server/sonar-web/src/main/js/apps/securityReports/components/__tests__/VulnerabilityList-test.tsx b/server/sonar-web/src/main/js/apps/securityReports/components/__tests__/VulnerabilityList-test.tsx
index 06f6ed58ae1..c9a8902b61a 100644
--- a/server/sonar-web/src/main/js/apps/securityReports/components/__tests__/VulnerabilityList-test.tsx
+++ b/server/sonar-web/src/main/js/apps/securityReports/components/__tests__/VulnerabilityList-test.tsx
@@ -20,7 +20,6 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import VulnerabilityList from '../VulnerabilityList';
-import { Component } from '../../../../app/types';
jest.mock('../../../../helpers/standards.json', () => ({
default: {
@@ -30,7 +29,7 @@ jest.mock('../../../../helpers/standards.json', () => ({
}
}));
-const component = { key: 'foo', name: 'Foo', qualifier: 'TRK' } as Component;
+const component = { key: 'foo', name: 'Foo', qualifier: 'TRK' } as T.Component;
const findings = [
{
activeRules: 1,
diff --git a/server/sonar-web/src/main/js/apps/sessions/components/EmailAlreadyExists.tsx b/server/sonar-web/src/main/js/apps/sessions/components/EmailAlreadyExists.tsx
index e8bc0c13bae..411b0254014 100644
--- a/server/sonar-web/src/main/js/apps/sessions/components/EmailAlreadyExists.tsx
+++ b/server/sonar-web/src/main/js/apps/sessions/components/EmailAlreadyExists.tsx
@@ -21,7 +21,6 @@ import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import { getIdentityProviders } from '../../../api/users';
import * as theme from '../../../app/theme';
-import { IdentityProvider } from '../../../app/types';
import { getTextColor } from '../../../helpers/colors';
import { translate } from '../../../helpers/l10n';
import { getBaseUrl } from '../../../helpers/urls';
@@ -40,7 +39,7 @@ interface Props {
}
interface State {
- identityProviders: IdentityProvider[];
+ identityProviders: T.IdentityProvider[];
loading: boolean;
}
diff --git a/server/sonar-web/src/main/js/apps/sessions/components/Login.tsx b/server/sonar-web/src/main/js/apps/sessions/components/Login.tsx
index 7af866cade5..2e7708d5f56 100644
--- a/server/sonar-web/src/main/js/apps/sessions/components/Login.tsx
+++ b/server/sonar-web/src/main/js/apps/sessions/components/Login.tsx
@@ -20,12 +20,11 @@
import * as React from 'react';
import LoginForm from './LoginForm';
import OAuthProviders from './OAuthProviders';
-import { IdentityProvider } from '../../../app/types';
import { translate } from '../../../helpers/l10n';
import './Login.css';
interface Props {
- identityProviders: IdentityProvider[];
+ identityProviders: T.IdentityProvider[];
onSubmit: (login: string, password: string) => Promise<void>;
returnTo: string;
}
diff --git a/server/sonar-web/src/main/js/apps/sessions/components/LoginContainer.tsx b/server/sonar-web/src/main/js/apps/sessions/components/LoginContainer.tsx
index e676c44a2e9..68341e09285 100644
--- a/server/sonar-web/src/main/js/apps/sessions/components/LoginContainer.tsx
+++ b/server/sonar-web/src/main/js/apps/sessions/components/LoginContainer.tsx
@@ -23,7 +23,6 @@ import Login from './Login';
import LoginSonarCloud from './LoginSonarCloud';
import { doLogin } from '../../../store/rootActions';
import { getIdentityProviders } from '../../../api/users';
-import { IdentityProvider } from '../../../app/types';
import { getReturnUrl } from '../../../helpers/urls';
import { isSonarCloud } from '../../../helpers/system';
@@ -42,7 +41,7 @@ interface DispatchToProps {
type Props = OwnProps & DispatchToProps;
interface State {
- identityProviders?: IdentityProvider[];
+ identityProviders?: T.IdentityProvider[];
}
class LoginContainer extends React.PureComponent<Props, State> {
diff --git a/server/sonar-web/src/main/js/apps/sessions/components/LoginSonarCloud.tsx b/server/sonar-web/src/main/js/apps/sessions/components/LoginSonarCloud.tsx
index 8aa620c9ace..ce758229acc 100644
--- a/server/sonar-web/src/main/js/apps/sessions/components/LoginSonarCloud.tsx
+++ b/server/sonar-web/src/main/js/apps/sessions/components/LoginSonarCloud.tsx
@@ -21,13 +21,12 @@ import * as React from 'react';
import * as classNames from 'classnames';
import LoginForm from './LoginForm';
import OAuthProviders from './OAuthProviders';
-import { IdentityProvider } from '../../../app/types';
import { getBaseUrl } from '../../../helpers/urls';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import './LoginSonarCloud.css';
interface Props {
- identityProviders: IdentityProvider[];
+ identityProviders: T.IdentityProvider[];
onSubmit: (login: string, password: string) => Promise<void>;
returnTo: string;
showForm?: boolean;
diff --git a/server/sonar-web/src/main/js/apps/sessions/components/OAuthProviders.tsx b/server/sonar-web/src/main/js/apps/sessions/components/OAuthProviders.tsx
index 80ad700666e..cf52cab84cb 100644
--- a/server/sonar-web/src/main/js/apps/sessions/components/OAuthProviders.tsx
+++ b/server/sonar-web/src/main/js/apps/sessions/components/OAuthProviders.tsx
@@ -23,13 +23,12 @@ import HelpTooltip from '../../../components/controls/HelpTooltip';
import IdentityProviderLink from '../../../components/ui/IdentityProviderLink';
import { translateWithParameters } from '../../../helpers/l10n';
import { getBaseUrl } from '../../../helpers/urls';
-import { IdentityProvider } from '../../../app/types';
import './OAuthProviders.css';
interface Props {
className?: string;
formatLabel?: (name: string) => React.ReactNode;
- identityProviders: IdentityProvider[];
+ identityProviders: T.IdentityProvider[];
returnTo: string;
}
@@ -53,7 +52,7 @@ export default function OAuthProviders(props: Props) {
interface ItemProps {
format: (name: string) => React.ReactNode;
- identityProvider: IdentityProvider;
+ identityProvider: T.IdentityProvider;
returnTo: string;
}
diff --git a/server/sonar-web/src/main/js/apps/sessions/components/UpdateLogin.tsx b/server/sonar-web/src/main/js/apps/sessions/components/UpdateLogin.tsx
index 6aac2f2e318..ea03b8deb7a 100644
--- a/server/sonar-web/src/main/js/apps/sessions/components/UpdateLogin.tsx
+++ b/server/sonar-web/src/main/js/apps/sessions/components/UpdateLogin.tsx
@@ -21,7 +21,6 @@ import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import { getIdentityProviders } from '../../../api/users';
import * as theme from '../../../app/theme';
-import { IdentityProvider } from '../../../app/types';
import { getTextColor } from '../../../helpers/colors';
import { translate } from '../../../helpers/l10n';
import { getBaseUrl } from '../../../helpers/urls';
@@ -40,7 +39,7 @@ interface Props {
}
interface State {
- identityProviders: IdentityProvider[];
+ identityProviders: T.IdentityProvider[];
loading: boolean;
}
diff --git a/server/sonar-web/src/main/js/apps/settings/__tests__/utils-test.ts b/server/sonar-web/src/main/js/apps/settings/__tests__/utils-test.ts
index 53605d927a4..7bb1eb132cb 100644
--- a/server/sonar-web/src/main/js/apps/settings/__tests__/utils-test.ts
+++ b/server/sonar-web/src/main/js/apps/settings/__tests__/utils-test.ts
@@ -18,14 +18,13 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { getEmptyValue, getDefaultValue } from '../utils';
-import { SettingFieldDefinition, SettingCategoryDefinition, SettingType } from '../../../app/types';
const fields = [
- { key: 'foo', type: SettingType.String } as SettingFieldDefinition,
- { key: 'bar', type: SettingType.SingleSelectList } as SettingFieldDefinition
+ { key: 'foo', type: 'STRING' } as T.SettingFieldDefinition,
+ { key: 'bar', type: 'SINGLE_SELECT_LIST' } as T.SettingFieldDefinition
];
-const settingDefinition: SettingCategoryDefinition = {
+const settingDefinition: T.SettingCategoryDefinition = {
category: 'test',
fields: [],
key: 'test',
@@ -35,25 +34,37 @@ const settingDefinition: SettingCategoryDefinition = {
describe('#getEmptyValue()', () => {
it('should work for property sets', () => {
- const setting = { ...settingDefinition, type: SettingType.PropertySet, fields };
+ const setting: T.SettingCategoryDefinition = {
+ ...settingDefinition,
+ type: 'PROPERTY_SET',
+ fields
+ };
expect(getEmptyValue(setting)).toEqual([{ foo: '', bar: null }]);
});
it('should work for multi values string', () => {
- const setting = { ...settingDefinition, type: SettingType.String, multiValues: true };
+ const setting: T.SettingCategoryDefinition = {
+ ...settingDefinition,
+ type: 'STRING',
+ multiValues: true
+ };
expect(getEmptyValue(setting)).toEqual(['']);
});
it('should work for multi values boolean', () => {
- const setting = { ...settingDefinition, type: SettingType.Boolean, multiValues: true };
+ const setting: T.SettingCategoryDefinition = {
+ ...settingDefinition,
+ type: 'BOOLEAN',
+ multiValues: true
+ };
expect(getEmptyValue(setting)).toEqual([null]);
});
});
describe('#getDefaultValue()', () => {
const check = (parentValue?: string, expected?: string) => {
- const setting = {
- definition: { key: 'test', options: [], type: SettingType.Boolean },
+ const setting: T.Setting = {
+ definition: { key: 'test', options: [], type: 'BOOLEAN' },
parentValue,
key: 'test'
};
diff --git a/server/sonar-web/src/main/js/apps/settings/components/AllCategoriesList.tsx b/server/sonar-web/src/main/js/apps/settings/components/AllCategoriesList.tsx
index f01a2ed2b25..8118c2f0362 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/AllCategoriesList.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/AllCategoriesList.tsx
@@ -23,7 +23,6 @@ import { connect } from 'react-redux';
import { sortBy } from 'lodash';
import { IndexLink } from 'react-router';
import { getCategoryName } from '../utils';
-import { Component } from '../../../app/types';
import { getSettingsAppAllCategories, Store } from '../../../store/rootReducer';
interface Category {
@@ -33,7 +32,7 @@ interface Category {
interface Props {
categories: string[];
- component?: Component;
+ component?: T.Component;
defaultCategory: string;
selectedCategory: string;
}
diff --git a/server/sonar-web/src/main/js/apps/settings/components/AppContainer.tsx b/server/sonar-web/src/main/js/apps/settings/components/AppContainer.tsx
index 7a65fab906e..3950c150e0b 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/AppContainer.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/AppContainer.tsx
@@ -29,12 +29,11 @@ import Suggestions from '../../../app/components/embed-docs-modal/Suggestions';
import { fetchSettings } from '../store/actions';
import { getSettingsAppDefaultCategory, Store } from '../../../store/rootReducer';
import { translate } from '../../../helpers/l10n';
-import { Component } from '../../../app/types';
import '../styles.css';
import '../side-tabs.css';
interface Props {
- component?: Component;
+ component?: T.Component;
defaultCategory: string;
fetchSettings(component?: string): Promise<void>;
}
diff --git a/server/sonar-web/src/main/js/apps/settings/components/CategoryDefinitionsList.tsx b/server/sonar-web/src/main/js/apps/settings/components/CategoryDefinitionsList.tsx
index 87f503f9ee8..f1ee1b717af 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/CategoryDefinitionsList.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/CategoryDefinitionsList.tsx
@@ -21,11 +21,10 @@ import { connect } from 'react-redux';
import SubCategoryDefinitionsList from './SubCategoryDefinitionsList';
import { fetchValues } from '../store/actions';
import { getSettingsAppSettingsForCategory, Store } from '../../../store/rootReducer';
-import { Component } from '../../../app/types';
interface Props {
category: string;
- component?: Component;
+ component?: T.Component;
}
const mapStateToProps = (state: Store, ownProps: Props) => ({
diff --git a/server/sonar-web/src/main/js/apps/settings/components/Definition.tsx b/server/sonar-web/src/main/js/apps/settings/components/Definition.tsx
index d9b9b34d837..10b87c4abb1 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/Definition.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/Definition.tsx
@@ -39,19 +39,18 @@ import {
isSettingsAppLoading,
Store
} from '../../../store/rootReducer';
-import { Component, Setting } from '../../../app/types';
interface Props {
cancelChange: (key: string) => void;
changedValue: any;
changeValue: (key: string, value: any) => void;
checkValue: (key: string) => boolean;
- component?: Component;
+ component?: T.Component;
loading: boolean;
passValidation: (key: string) => void;
resetValue: (key: string, component?: string) => Promise<void>;
saveValue: (key: string, component?: string) => Promise<void>;
- setting: Setting;
+ setting: T.Setting;
validationMessage?: string;
}
diff --git a/server/sonar-web/src/main/js/apps/settings/components/DefinitionActions.tsx b/server/sonar-web/src/main/js/apps/settings/components/DefinitionActions.tsx
index b7fab85c9ad..bc263cdeb7b 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/DefinitionActions.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/DefinitionActions.tsx
@@ -22,7 +22,6 @@ import Modal from '../../../components/controls/Modal';
import { Button, ResetButtonLink, SubmitButton } from '../../../components/ui/buttons';
import { isEmptyValue, getDefaultValue, getSettingValue } from '../utils';
import { translate } from '../../../helpers/l10n';
-import { Setting } from '../../../app/types';
type Props = {
changedValue: string;
@@ -32,7 +31,7 @@ type Props = {
onCancel: () => void;
onReset: () => void;
onSave: () => void;
- setting: Setting;
+ setting: T.Setting;
};
type State = { reseting: boolean };
diff --git a/server/sonar-web/src/main/js/apps/settings/components/DefinitionsList.tsx b/server/sonar-web/src/main/js/apps/settings/components/DefinitionsList.tsx
index 2f597afc239..b5fd89edd9d 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/DefinitionsList.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/DefinitionsList.tsx
@@ -19,11 +19,10 @@
*/
import * as React from 'react';
import Definition from './Definition';
-import { Component, Setting } from '../../../app/types';
interface Props {
- component?: Component;
- settings: Setting[];
+ component?: T.Component;
+ settings: T.Setting[];
}
export default function DefinitionsList({ component, settings }: Props) {
diff --git a/server/sonar-web/src/main/js/apps/settings/components/EmailForm.tsx b/server/sonar-web/src/main/js/apps/settings/components/EmailForm.tsx
index f1516115bba..77e202c7cf6 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/EmailForm.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/EmailForm.tsx
@@ -23,11 +23,10 @@ import { sendTestEmail } from '../../../api/settings';
import { parseError } from '../../../helpers/request';
import { SubmitButton } from '../../../components/ui/buttons';
import { Alert } from '../../../components/ui/Alert';
-import { LoggedInUser } from '../../../app/types';
import { withCurrentUser } from '../../../components/hoc/withCurrentUser';
interface Props {
- currentUser: LoggedInUser;
+ currentUser: T.LoggedInUser;
}
interface State {
diff --git a/server/sonar-web/src/main/js/apps/settings/components/PageHeader.tsx b/server/sonar-web/src/main/js/apps/settings/components/PageHeader.tsx
index 18b2f644585..3aecf2f05f8 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/PageHeader.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/PageHeader.tsx
@@ -20,10 +20,9 @@
import * as React from 'react';
import InstanceMessage from '../../../components/common/InstanceMessage';
import { translate } from '../../../helpers/l10n';
-import { Component } from '../../../app/types';
interface Props {
- component?: Component;
+ component?: T.Component;
}
export default function PageHeader({ component }: Props) {
diff --git a/server/sonar-web/src/main/js/apps/settings/components/SubCategoryDefinitionsList.tsx b/server/sonar-web/src/main/js/apps/settings/components/SubCategoryDefinitionsList.tsx
index 34fa14caaa0..108997c3882 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/SubCategoryDefinitionsList.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/SubCategoryDefinitionsList.tsx
@@ -22,13 +22,12 @@ import { groupBy, isEqual, sortBy } from 'lodash';
import DefinitionsList from './DefinitionsList';
import EmailForm from './EmailForm';
import { getSubCategoryName, getSubCategoryDescription } from '../utils';
-import { Component, SettingCategoryDefinition, Setting } from '../../../app/types';
interface Props {
category: string;
- component?: Component;
+ component?: T.Component;
fetchValues: Function;
- settings: Array<Setting & { definition: SettingCategoryDefinition }>;
+ settings: Array<T.Setting & { definition: T.SettingCategoryDefinition }>;
}
export default class SubCategoryDefinitionsList extends React.PureComponent<Props> {
diff --git a/server/sonar-web/src/main/js/apps/settings/components/__tests__/DefinitionActions-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/__tests__/DefinitionActions-test.tsx
index 432be0e9f3b..2bbe437983d 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/__tests__/DefinitionActions-test.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/__tests__/DefinitionActions-test.tsx
@@ -21,9 +21,8 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import DefinitionActions from '../DefinitionActions';
-import { SettingType } from '../../../../app/types';
-const definition = {
+const definition: T.SettingCategoryDefinition = {
category: 'baz',
description: 'lorem',
fields: [],
@@ -31,7 +30,7 @@ const definition = {
name: 'foobar',
options: [],
subCategory: 'bar',
- type: SettingType.String
+ type: 'STRING'
};
const settings = {
diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/Input.tsx b/server/sonar-web/src/main/js/apps/settings/components/inputs/Input.tsx
index cbe09c0278d..1859d777515 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/inputs/Input.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/Input.tsx
@@ -22,7 +22,6 @@ import PropertySetInput from './PropertySetInput';
import MultiValueInput from './MultiValueInput';
import PrimitiveInput from './PrimitiveInput';
import { DefaultInputProps, isCategoryDefinition } from '../../utils';
-import { SettingType } from '../../../../app/types';
export default function Input(props: DefaultInputProps) {
const { definition } = props.setting;
@@ -31,7 +30,7 @@ export default function Input(props: DefaultInputProps) {
return <MultiValueInput {...props} />;
}
- if (definition.type === SettingType.PropertySet) {
+ if (definition.type === 'PROPERTY_SET') {
return <PropertySetInput {...props} />;
}
diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForSingleSelectList.tsx b/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForSingleSelectList.tsx
index 71466a83d18..f57fa5e98de 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForSingleSelectList.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForSingleSelectList.tsx
@@ -20,9 +20,8 @@
import * as React from 'react';
import Select from '../../../../components/controls/Select';
import { DefaultSpecializedInputProps } from '../../utils';
-import { SettingCategoryDefinition } from '../../../../app/types';
-type Props = DefaultSpecializedInputProps & Pick<SettingCategoryDefinition, 'options'>;
+type Props = DefaultSpecializedInputProps & Pick<T.SettingCategoryDefinition, 'options'>;
export default class InputForSingleSelectList extends React.PureComponent<Props> {
handleInputChange = ({ value }: { value: string }) => {
diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/PrimitiveInput.tsx b/server/sonar-web/src/main/js/apps/settings/components/inputs/PrimitiveInput.tsx
index 7f611e1e1a0..274cb51551b 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/inputs/PrimitiveInput.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/PrimitiveInput.tsx
@@ -30,20 +30,19 @@ import {
DefaultInputProps,
DefaultSpecializedInputProps
} from '../../utils';
-import { SettingType } from '../../../../app/types';
const typeMapping: {
- [type in SettingType]?:
+ [type in T.SettingType]?:
| React.ComponentClass<DefaultSpecializedInputProps>
| React.StatelessComponent<DefaultSpecializedInputProps>
} = {
- [SettingType.String]: InputForString,
- [SettingType.Text]: InputForText,
- [SettingType.Password]: InputForPassword,
- [SettingType.Boolean]: InputForBoolean,
- [SettingType.Integer]: InputForNumber,
- [SettingType.Long]: InputForNumber,
- [SettingType.Float]: InputForNumber
+ STRING: InputForString,
+ TEXT: InputForText,
+ PASSWORD: InputForPassword,
+ BOOLEAN: InputForBoolean,
+ INTEGER: InputForNumber,
+ LONG: InputForNumber,
+ FLOAT: InputForNumber
};
interface Props extends DefaultInputProps {
@@ -57,7 +56,7 @@ export default class PrimitiveInput extends React.PureComponent<Props> {
const name = this.props.name || getUniqueName(definition);
- if (definition.type === SettingType.SingleSelectList) {
+ if (definition.type === 'SINGLE_SELECT_LIST') {
return (
<InputForSingleSelectList
isDefault={isDefaultOrInherited(setting)}
diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/Input-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/Input-test.tsx
index 15399a446d9..3906a73ff28 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/Input-test.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/Input-test.tsx
@@ -20,20 +20,19 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import Input from '../Input';
-import { SettingType } from '../../../../../app/types';
import { DefaultInputProps } from '../../../utils';
const settingValue = {
key: 'example'
};
-const settingDefinition = {
+const settingDefinition: T.SettingCategoryDefinition = {
category: 'general',
fields: [],
key: 'example',
options: [],
subCategory: 'Branches',
- type: SettingType.String
+ type: 'STRING'
};
it('should render PrimitiveInput', () => {
@@ -58,9 +57,9 @@ it('should render MultiValueInput', () => {
});
it('should render PropertySetInput', () => {
- const setting = {
+ const setting: T.Setting = {
...settingValue,
- definition: { ...settingDefinition, type: SettingType.PropertySet, fields: [] }
+ definition: { ...settingDefinition, type: 'PROPERTY_SET', fields: [] }
};
const onChange = jest.fn();
diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/MultiValueInput-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/MultiValueInput-test.tsx
index 2fab1a35ed0..6e4b2ed8b65 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/MultiValueInput-test.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/MultiValueInput-test.tsx
@@ -23,20 +23,19 @@ import MultiValueInput from '../MultiValueInput';
import PrimitiveInput from '../PrimitiveInput';
import { click } from '../../../../../helpers/testUtils';
import { DefaultInputProps } from '../../../utils';
-import { SettingType } from '../../../../../app/types';
const settingValue = {
key: 'example'
};
-const settingDefinition = {
+const settingDefinition: T.SettingCategoryDefinition = {
category: 'general',
fields: [],
key: 'example',
multiValues: true,
options: [],
subCategory: 'Branches',
- type: SettingType.String
+ type: 'STRING'
};
const assertValues = (inputs: ShallowWrapper<any>, values: string[]) => {
diff --git a/server/sonar-web/src/main/js/apps/settings/store/actions.ts b/server/sonar-web/src/main/js/apps/settings/store/actions.ts
index d3b3526c06f..4636a8b5e26 100644
--- a/server/sonar-web/src/main/js/apps/settings/store/actions.ts
+++ b/server/sonar-web/src/main/js/apps/settings/store/actions.ts
@@ -42,13 +42,12 @@ import {
getSettingsAppChangedValue,
Store
} from '../../../store/rootReducer';
-import { SettingType } from '../../../app/types';
export function fetchSettings(component?: string) {
return (dispatch: Dispatch) => {
return getDefinitions(component).then(definitions => {
const filtered = definitions
- .filter(definition => definition.type !== SettingType.License)
+ .filter(definition => definition.type !== 'LICENSE')
// do not display this setting on project level
.filter(
definition => !component || definition.key !== 'sonar.branch.longLivedBranches.regex'
diff --git a/server/sonar-web/src/main/js/apps/settings/store/definitions.ts b/server/sonar-web/src/main/js/apps/settings/store/definitions.ts
index fef242043bf..9871af85a50 100644
--- a/server/sonar-web/src/main/js/apps/settings/store/definitions.ts
+++ b/server/sonar-web/src/main/js/apps/settings/store/definitions.ts
@@ -19,7 +19,6 @@
*/
import { keyBy, sortBy, uniqBy } from 'lodash';
import { ActionType } from '../../../store/utils/actions';
-import { SettingCategoryDefinition } from '../../../app/types';
import { DEFAULT_CATEGORY, getCategoryName } from '../utils';
const enum Actions {
@@ -29,10 +28,10 @@ const enum Actions {
type Action = ActionType<typeof receiveDefinitions, Actions.ReceiveDefinitions>;
export interface State {
- [key: string]: SettingCategoryDefinition;
+ [key: string]: T.SettingCategoryDefinition;
}
-export function receiveDefinitions(definitions: SettingCategoryDefinition[]) {
+export function receiveDefinitions(definitions: T.SettingCategoryDefinition[]) {
return { type: Actions.ReceiveDefinitions, definitions };
}
diff --git a/server/sonar-web/src/main/js/apps/settings/store/values.ts b/server/sonar-web/src/main/js/apps/settings/store/values.ts
index e00727a86a5..023148c7a5b 100644
--- a/server/sonar-web/src/main/js/apps/settings/store/values.ts
+++ b/server/sonar-web/src/main/js/apps/settings/store/values.ts
@@ -21,7 +21,6 @@ import { combineReducers } from 'redux';
import { keyBy } from 'lodash';
import { ActionType } from '../../../store/utils/actions';
import { Action as AppStateAction, Actions as AppStateActions } from '../../../store/appState';
-import { SettingValue } from '../../../app/types';
enum Actions {
receiveValues = 'RECEIVE_VALUES'
@@ -30,7 +29,7 @@ enum Actions {
type Action = ActionType<typeof receiveValues, Actions.receiveValues>;
interface SettingsState {
- [key: string]: SettingValue;
+ [key: string]: T.SettingValue;
}
export interface State {
@@ -77,7 +76,11 @@ function global(state: State['components'] = {}, action: Action | AppStateAction
export default combineReducers({ components, global });
-export function getValue(state: State, key: string, component?: string): SettingValue | undefined {
+export function getValue(
+ state: State,
+ key: string,
+ component?: string
+): T.SettingValue | undefined {
if (component) {
return state.components[component] && state.components[component][key];
}
diff --git a/server/sonar-web/src/main/js/apps/settings/utils.ts b/server/sonar-web/src/main/js/apps/settings/utils.ts
index 40abef3e3c8..baacdb76839 100644
--- a/server/sonar-web/src/main/js/apps/settings/utils.ts
+++ b/server/sonar-web/src/main/js/apps/settings/utils.ts
@@ -18,17 +18,10 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { translate, hasMessage } from '../../helpers/l10n';
-import {
- Omit,
- Setting,
- SettingCategoryDefinition,
- SettingType,
- SettingDefinition
-} from '../../app/types';
export const DEFAULT_CATEGORY = 'general';
-export type DefaultSpecializedInputProps = Omit<DefaultInputProps, 'setting'> & {
+export type DefaultSpecializedInputProps = T.Omit<DefaultInputProps, 'setting'> & {
isDefault: boolean;
name: string;
};
@@ -38,16 +31,16 @@ export interface DefaultInputProps {
onCancel?: () => void;
onChange: (value: any) => void;
onSave?: () => void;
- setting: Setting;
+ setting: T.Setting;
value: any;
}
-export function getPropertyName(definition: SettingDefinition) {
+export function getPropertyName(definition: T.SettingDefinition) {
const key = `property.${definition.key}.name`;
return hasMessage(key) ? translate(key) : definition.name;
}
-export function getPropertyDescription(definition: SettingDefinition) {
+export function getPropertyDescription(definition: T.SettingDefinition) {
const key = `property.${definition.key}.description`;
return hasMessage(key) ? translate(key) : definition.description;
}
@@ -67,66 +60,68 @@ export function getSubCategoryDescription(category: string, subCategory: string)
return hasMessage(key) ? translate(key) : null;
}
-export function getUniqueName(definition: SettingDefinition, index?: string) {
+export function getUniqueName(definition: T.SettingDefinition, index?: string) {
const indexSuffix = index ? `[${index}]` : '';
return `settings[${definition.key}]${indexSuffix}`;
}
-export function getSettingValue({ definition, fieldValues, value, values }: Setting) {
+export function getSettingValue({ definition, fieldValues, value, values }: T.Setting) {
if (isCategoryDefinition(definition) && definition.multiValues) {
return values;
- } else if (definition.type === SettingType.PropertySet) {
+ } else if (definition.type === 'PROPERTY_SET') {
return fieldValues;
} else {
return value;
}
}
-export function isEmptyValue(definition: SettingDefinition, value: any) {
+export function isEmptyValue(definition: T.SettingDefinition, value: any) {
if (value == null) {
return true;
- } else if (definition.type === SettingType.Boolean) {
+ } else if (definition.type === 'BOOLEAN') {
return false;
} else {
return value.length === 0;
}
}
-export function isCategoryDefinition(item: SettingDefinition): item is SettingCategoryDefinition {
+export function isCategoryDefinition(
+ item: T.SettingDefinition
+): item is T.SettingCategoryDefinition {
return Boolean((item as any).fields);
}
-export function getEmptyValue(item: SettingDefinition | SettingCategoryDefinition): any {
+export function getEmptyValue(item: T.SettingDefinition | T.SettingCategoryDefinition): any {
if (isCategoryDefinition(item)) {
if (item.multiValues) {
return [getEmptyValue({ ...item, multiValues: false })];
}
- if (item.type === SettingType.PropertySet) {
+ if (item.type === 'PROPERTY_SET') {
const value: { [key: string]: string } = {};
item.fields.forEach(field => (value[field.key] = getEmptyValue(field)));
return [value];
}
}
- if (item.type === SettingType.Boolean || item.type === SettingType.SingleSelectList) {
+ if (item.type === 'BOOLEAN' || item.type === 'SINGLE_SELECT_LIST') {
return null;
}
return '';
}
-export function isDefaultOrInherited(setting: Setting) {
+export function isDefaultOrInherited(setting: T.Setting) {
return Boolean(setting.inherited);
}
-export function getDefaultValue(setting: Setting) {
+export function getDefaultValue(setting: T.Setting) {
const { definition, parentFieldValues, parentValue, parentValues } = setting;
- if (definition.type === SettingType.Password) {
+ if (definition.type === 'PASSWORD') {
return translate('settings.default.password');
}
- if (definition.type === SettingType.Boolean && parentValue) {
+ if (definition.type === 'BOOLEAN' && parentValue) {
const isTrue = parentValue === 'true';
return isTrue ? translate('settings.boolean.true') : translate('settings.boolean.false');
}
@@ -140,11 +135,7 @@ export function getDefaultValue(setting: Setting) {
return parentValues.join(', ');
}
- if (
- definition.type === SettingType.PropertySet &&
- parentFieldValues &&
- parentFieldValues.length > 0
- ) {
+ if (definition.type === 'PROPERTY_SET' && parentFieldValues && parentFieldValues.length > 0) {
return translate('settings.default.complex_value');
}
diff --git a/server/sonar-web/src/main/js/apps/tutorials/analyzeProject/AnalyzeTutorial.tsx b/server/sonar-web/src/main/js/apps/tutorials/analyzeProject/AnalyzeTutorial.tsx
index 031af9848cd..6d2ce3130ef 100644
--- a/server/sonar-web/src/main/js/apps/tutorials/analyzeProject/AnalyzeTutorial.tsx
+++ b/server/sonar-web/src/main/js/apps/tutorials/analyzeProject/AnalyzeTutorial.tsx
@@ -21,7 +21,6 @@ import * as React from 'react';
import AnalyzeTutorialSuggestion from './AnalyzeTutorialSuggestion';
import ProjectAnalysisStep from '../components/ProjectAnalysisStep';
import TokenStep from '../components/TokenStep';
-import { Component, LoggedInUser } from '../../../app/types';
import { isVSTS } from '../../../helpers/almIntegrations';
import { translate } from '../../../helpers/l10n';
import '../styles.css';
@@ -32,8 +31,8 @@ enum Steps {
}
interface Props {
- component: Component;
- currentUser: LoggedInUser;
+ component: T.Component;
+ currentUser: T.LoggedInUser;
}
interface State {
diff --git a/server/sonar-web/src/main/js/apps/tutorials/analyzeProject/__tests__/AnalyzeTutorial-test.tsx b/server/sonar-web/src/main/js/apps/tutorials/analyzeProject/__tests__/AnalyzeTutorial-test.tsx
index 17617b4b9db..3b8f8ca1433 100644
--- a/server/sonar-web/src/main/js/apps/tutorials/analyzeProject/__tests__/AnalyzeTutorial-test.tsx
+++ b/server/sonar-web/src/main/js/apps/tutorials/analyzeProject/__tests__/AnalyzeTutorial-test.tsx
@@ -20,7 +20,6 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import AnalyzeTutorial from '../AnalyzeTutorial';
-import { LoggedInUser } from '../../../../app/types';
Date.now = jest.fn().mockReturnValue(1540457859031);
@@ -34,7 +33,7 @@ const component = {
version: '0.0.1'
};
-const loggedInUser: LoggedInUser = {
+const loggedInUser: T.LoggedInUser = {
groups: [],
isLoggedIn: true,
login: 'luke',
diff --git a/server/sonar-web/src/main/js/apps/tutorials/components/LanguageForm.tsx b/server/sonar-web/src/main/js/apps/tutorials/components/LanguageForm.tsx
index 8762501b301..26e273e936a 100644
--- a/server/sonar-web/src/main/js/apps/tutorials/components/LanguageForm.tsx
+++ b/server/sonar-web/src/main/js/apps/tutorials/components/LanguageForm.tsx
@@ -23,11 +23,10 @@ import NewProjectForm from './NewProjectForm';
import RadioToggle from '../../../components/controls/RadioToggle';
import { translate } from '../../../helpers/l10n';
import { isSonarCloud } from '../../../helpers/system';
-import { Component } from '../../../app/types';
import { isLanguageConfigured, LanguageConfig } from '../utils';
interface Props {
- component?: Component;
+ component?: T.Component;
config?: LanguageConfig;
onDone: (config: LanguageConfig) => void;
onReset: () => void;
diff --git a/server/sonar-web/src/main/js/apps/tutorials/components/OrganizationStep.tsx b/server/sonar-web/src/main/js/apps/tutorials/components/OrganizationStep.tsx
index 57c9ffb63d0..203b46cbeed 100644
--- a/server/sonar-web/src/main/js/apps/tutorials/components/OrganizationStep.tsx
+++ b/server/sonar-web/src/main/js/apps/tutorials/components/OrganizationStep.tsx
@@ -32,7 +32,7 @@ import { Button } from '../../../components/ui/buttons';
type Selection = 'personal' | 'existing' | 'new';
interface Props {
- currentUser: { login: string; isLoggedIn: boolean };
+ currentUser: T.CurrentUser;
finished: boolean;
onOpen: () => void;
onContinue: (organization: string) => void;
diff --git a/server/sonar-web/src/main/js/apps/tutorials/components/ProjectAnalysisStep.tsx b/server/sonar-web/src/main/js/apps/tutorials/components/ProjectAnalysisStep.tsx
index 3a924f2415e..e4887471654 100644
--- a/server/sonar-web/src/main/js/apps/tutorials/components/ProjectAnalysisStep.tsx
+++ b/server/sonar-web/src/main/js/apps/tutorials/components/ProjectAnalysisStep.tsx
@@ -22,11 +22,10 @@ import Step from './Step';
import LanguageForm from './LanguageForm';
import AnalysisCommand from './commands/AnalysisCommand';
import { translate } from '../../../helpers/l10n';
-import { Component } from '../../../app/types';
import { LanguageConfig } from '../utils';
interface Props {
- component?: Component;
+ component?: T.Component;
displayRowLayout?: boolean;
onFinish?: (projectKey?: string) => void;
onReset?: () => void;
diff --git a/server/sonar-web/src/main/js/apps/tutorials/components/commands/AnalysisCommand.tsx b/server/sonar-web/src/main/js/apps/tutorials/components/commands/AnalysisCommand.tsx
index 9f40deec8cd..829463faae3 100644
--- a/server/sonar-web/src/main/js/apps/tutorials/components/commands/AnalysisCommand.tsx
+++ b/server/sonar-web/src/main/js/apps/tutorials/components/commands/AnalysisCommand.tsx
@@ -25,11 +25,10 @@ import Msvc from './Msvc';
import ClangGCC from './ClangGCC';
import Other from './Other';
import { getHostUrl } from '../../../../helpers/urls';
-import { Component } from '../../../../app/types';
import { LanguageConfig } from '../../utils';
interface Props {
- component?: Component;
+ component?: T.Component;
organization?: string;
languageConfig: LanguageConfig;
small?: boolean;
diff --git a/server/sonar-web/src/main/js/apps/tutorials/onboarding/OnboardingModal.tsx b/server/sonar-web/src/main/js/apps/tutorials/onboarding/OnboardingModal.tsx
index d7a8aa94acd..719ba4d4ba1 100644
--- a/server/sonar-web/src/main/js/apps/tutorials/onboarding/OnboardingModal.tsx
+++ b/server/sonar-web/src/main/js/apps/tutorials/onboarding/OnboardingModal.tsx
@@ -26,7 +26,6 @@ import OnboardingProjectIcon from '../../../components/icons-components/Onboardi
import OnboardingTeamIcon from '../../../components/icons-components/OnboardingTeamIcon';
import { Button, ResetButtonLink } from '../../../components/ui/buttons';
import { translate } from '../../../helpers/l10n';
-import { CurrentUser } from '../../../app/types';
import { getCurrentUser, Store } from '../../../store/rootReducer';
import { isLoggedIn } from '../../../helpers/users';
import '../styles.css';
@@ -39,7 +38,7 @@ interface OwnProps {
}
interface StateProps {
- currentUser: CurrentUser;
+ currentUser: T.CurrentUser;
}
type Props = OwnProps & StateProps;
diff --git a/server/sonar-web/src/main/js/apps/tutorials/onboarding/OnboardingPage.tsx b/server/sonar-web/src/main/js/apps/tutorials/onboarding/OnboardingPage.tsx
index ae23029734e..7aa040268ff 100644
--- a/server/sonar-web/src/main/js/apps/tutorials/onboarding/OnboardingPage.tsx
+++ b/server/sonar-web/src/main/js/apps/tutorials/onboarding/OnboardingPage.tsx
@@ -24,7 +24,6 @@ import { InjectedRouter } from 'react-router';
import OnboardingModal from './OnboardingModal';
import { skipOnboarding } from '../../../store/users';
import TeamOnboardingModal from '../teamOnboarding/TeamOnboardingModal';
-import { Organization } from '../../../app/types';
interface DispatchProps {
skipOnboarding: () => void;
@@ -55,7 +54,7 @@ export class OnboardingPage extends React.PureComponent<OwnProps & DispatchProps
this.props.router.replace('/');
};
- closeOrganizationOnboarding = ({ key }: Pick<Organization, 'key'>) => {
+ closeOrganizationOnboarding = ({ key }: Pick<T.Organization, 'key'>) => {
this.closeOnboarding();
this.props.router.push(`/organizations/${key}`);
};
diff --git a/server/sonar-web/src/main/js/apps/tutorials/projectOnboarding/ProjectOnboarding.tsx b/server/sonar-web/src/main/js/apps/tutorials/projectOnboarding/ProjectOnboarding.tsx
index 164f58ed467..e21b74aa1bb 100644
--- a/server/sonar-web/src/main/js/apps/tutorials/projectOnboarding/ProjectOnboarding.tsx
+++ b/server/sonar-web/src/main/js/apps/tutorials/projectOnboarding/ProjectOnboarding.tsx
@@ -27,7 +27,6 @@ import OrganizationStep from '../components/OrganizationStep';
import TokenStep from '../components/TokenStep';
import handleRequiredAuthentication from '../../../app/utils/handleRequiredAuthentication';
import { getCurrentUser, areThereCustomOrganizations, Store } from '../../../store/rootReducer';
-import { CurrentUser } from '../../../app/types';
import { ResetButtonLink } from '../../../components/ui/buttons';
import { getProjectUrl } from '../../../helpers/urls';
import { translate, translateWithParameters } from '../../../helpers/l10n';
@@ -41,7 +40,7 @@ interface OwnProps {
}
interface StateProps {
- currentUser: CurrentUser;
+ currentUser: T.CurrentUser;
organizationsEnabled?: boolean;
}
@@ -199,7 +198,7 @@ export class ProjectOnboarding extends React.PureComponent<Props, State> {
const mapStateToProps = (state: Store): StateProps => {
return {
- currentUser: getCurrentUser(state),
+ currentUser: getCurrentUser(state) as T.LoggedInUser,
organizationsEnabled: areThereCustomOrganizations(state)
};
};
diff --git a/server/sonar-web/src/main/js/apps/users/UsersApp.tsx b/server/sonar-web/src/main/js/apps/users/UsersApp.tsx
index 9c898e36ad6..e833d41cd55 100644
--- a/server/sonar-web/src/main/js/apps/users/UsersApp.tsx
+++ b/server/sonar-web/src/main/js/apps/users/UsersApp.tsx
@@ -28,7 +28,6 @@ import { parseQuery, Query, serializeQuery } from './utils';
import ListFooter from '../../components/controls/ListFooter';
import Suggestions from '../../app/components/embed-docs-modal/Suggestions';
import { getIdentityProviders, searchUsers } from '../../api/users';
-import { Paging, IdentityProvider, User } from '../../app/types';
import { translate } from '../../helpers/l10n';
interface Props {
@@ -38,10 +37,10 @@ interface Props {
}
interface State {
- identityProviders: IdentityProvider[];
+ identityProviders: T.IdentityProvider[];
loading: boolean;
- paging?: Paging;
- users: User[];
+ paging?: T.Paging;
+ users: T.User[];
}
export default class UsersApp extends React.PureComponent<Props, State> {
diff --git a/server/sonar-web/src/main/js/apps/users/UsersList.tsx b/server/sonar-web/src/main/js/apps/users/UsersList.tsx
index cb91c04a60a..19eb40284b9 100644
--- a/server/sonar-web/src/main/js/apps/users/UsersList.tsx
+++ b/server/sonar-web/src/main/js/apps/users/UsersList.tsx
@@ -19,16 +19,15 @@
*/
import * as React from 'react';
import UserListItem from './components/UserListItem';
-import { IdentityProvider, User } from '../../app/types';
import { translate } from '../../helpers/l10n';
interface Props {
currentUser: { isLoggedIn: boolean; login?: string };
- identityProviders: IdentityProvider[];
+ identityProviders: T.IdentityProvider[];
onUpdateUsers: () => void;
organizationsEnabled?: boolean;
updateTokensCount: (login: string, tokensCount: number) => void;
- users: User[];
+ users: T.User[];
}
export default function UsersList({
diff --git a/server/sonar-web/src/main/js/apps/users/components/DeactivateForm.tsx b/server/sonar-web/src/main/js/apps/users/components/DeactivateForm.tsx
index 062a463d444..8bb6d61728d 100644
--- a/server/sonar-web/src/main/js/apps/users/components/DeactivateForm.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/DeactivateForm.tsx
@@ -19,7 +19,6 @@
*/
import * as React from 'react';
import { deactivateUser } from '../../../api/users';
-import { User } from '../../../app/types';
import Modal from '../../../components/controls/Modal';
import { SubmitButton, ResetButtonLink } from '../../../components/ui/buttons';
import { translate, translateWithParameters } from '../../../helpers/l10n';
@@ -27,7 +26,7 @@ import { translate, translateWithParameters } from '../../../helpers/l10n';
export interface Props {
onClose: () => void;
onUpdateUsers: () => void;
- user: User;
+ user: T.User;
}
interface State {
diff --git a/server/sonar-web/src/main/js/apps/users/components/GroupsForm.tsx b/server/sonar-web/src/main/js/apps/users/components/GroupsForm.tsx
index c09f4297e9c..144ce96cf54 100644
--- a/server/sonar-web/src/main/js/apps/users/components/GroupsForm.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/GroupsForm.tsx
@@ -19,7 +19,6 @@
*/
import * as React from 'react';
import { find, without } from 'lodash';
-import { User } from '../../../app/types';
import Modal from '../../../components/controls/Modal';
import SelectList, { Filter } from '../../../components/SelectList/SelectList';
import { translate } from '../../../helpers/l10n';
@@ -29,7 +28,7 @@ import { addUserToGroup, removeUserFromGroup } from '../../../api/user_groups';
interface Props {
onClose: () => void;
onUpdateUsers: () => void;
- user: User;
+ user: T.User;
}
interface State {
diff --git a/server/sonar-web/src/main/js/apps/users/components/PasswordForm.tsx b/server/sonar-web/src/main/js/apps/users/components/PasswordForm.tsx
index 5ee73668115..a937d9610fd 100644
--- a/server/sonar-web/src/main/js/apps/users/components/PasswordForm.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/PasswordForm.tsx
@@ -19,7 +19,6 @@
*/
import * as React from 'react';
import { changePassword } from '../../../api/users';
-import { User } from '../../../app/types';
import addGlobalSuccessMessage from '../../../app/utils/addGlobalSuccessMessage';
import throwGlobalError from '../../../app/utils/throwGlobalError';
import Modal from '../../../components/controls/Modal';
@@ -30,7 +29,7 @@ import { Alert } from '../../../components/ui/Alert';
interface Props {
isCurrentUser: boolean;
- user: User;
+ user: T.User;
onClose: () => void;
}
diff --git a/server/sonar-web/src/main/js/apps/users/components/TokensFormModal.tsx b/server/sonar-web/src/main/js/apps/users/components/TokensFormModal.tsx
index 6a96b785357..99a3eb5c1c9 100644
--- a/server/sonar-web/src/main/js/apps/users/components/TokensFormModal.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/TokensFormModal.tsx
@@ -19,12 +19,11 @@
*/
import * as React from 'react';
import TokensForm from './TokensForm';
-import { User } from '../../../app/types';
import Modal from '../../../components/controls/Modal';
import { translate } from '../../../helpers/l10n';
interface Props {
- user: User;
+ user: T.User;
onClose: () => void;
updateTokensCount: (login: string, tokensCount: number) => void;
}
diff --git a/server/sonar-web/src/main/js/apps/users/components/UserActions.tsx b/server/sonar-web/src/main/js/apps/users/components/UserActions.tsx
index 5c132436de1..84d6f05326e 100644
--- a/server/sonar-web/src/main/js/apps/users/components/UserActions.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/UserActions.tsx
@@ -21,7 +21,6 @@ import * as React from 'react';
import DeactivateForm from './DeactivateForm';
import PasswordForm from './PasswordForm';
import UserForm from './UserForm';
-import { User } from '../../../app/types';
import ActionsDropdown, {
ActionsDropdownItem,
ActionsDropdownDivider
@@ -31,7 +30,7 @@ import { translate } from '../../../helpers/l10n';
interface Props {
isCurrentUser: boolean;
onUpdateUsers: () => void;
- user: User;
+ user: T.User;
}
interface State {
diff --git a/server/sonar-web/src/main/js/apps/users/components/UserForm.tsx b/server/sonar-web/src/main/js/apps/users/components/UserForm.tsx
index 381d58ff3df..05c2384a004 100644
--- a/server/sonar-web/src/main/js/apps/users/components/UserForm.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/UserForm.tsx
@@ -21,7 +21,6 @@ import * as React from 'react';
import { uniq } from 'lodash';
import UserScmAccountInput from './UserScmAccountInput';
import { createUser, updateUser } from '../../../api/users';
-import { User } from '../../../app/types';
import throwGlobalError from '../../../app/utils/throwGlobalError';
import Modal from '../../../components/controls/Modal';
import { Button, ResetButtonLink, SubmitButton } from '../../../components/ui/buttons';
@@ -30,7 +29,7 @@ import { parseError } from '../../../helpers/request';
import { Alert } from '../../../components/ui/Alert';
export interface Props {
- user?: User;
+ user?: T.User;
onClose: () => void;
onUpdateUsers: () => void;
}
diff --git a/server/sonar-web/src/main/js/apps/users/components/UserGroups.tsx b/server/sonar-web/src/main/js/apps/users/components/UserGroups.tsx
index 53ab715e8da..2fc3ae5bc67 100644
--- a/server/sonar-web/src/main/js/apps/users/components/UserGroups.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/UserGroups.tsx
@@ -20,14 +20,13 @@
import * as React from 'react';
import GroupsForm from './GroupsForm';
import BulletListIcon from '../../../components/icons-components/BulletListIcon';
-import { User } from '../../../app/types';
import { ButtonIcon } from '../../../components/ui/buttons';
import { translate, translateWithParameters } from '../../../helpers/l10n';
interface Props {
groups: string[];
onUpdateUsers: () => void;
- user: User;
+ user: T.User;
}
interface State {
diff --git a/server/sonar-web/src/main/js/apps/users/components/UserListItem.tsx b/server/sonar-web/src/main/js/apps/users/components/UserListItem.tsx
index 10d34f4a158..8e0c82dd167 100644
--- a/server/sonar-web/src/main/js/apps/users/components/UserListItem.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/UserListItem.tsx
@@ -23,19 +23,18 @@ import UserActions from './UserActions';
import UserGroups from './UserGroups';
import UserListItemIdentity from './UserListItemIdentity';
import UserScmAccounts from './UserScmAccounts';
-import { IdentityProvider, User } from '../../../app/types';
import BulletListIcon from '../../../components/icons-components/BulletListIcon';
import Avatar from '../../../components/ui/Avatar';
import { ButtonIcon } from '../../../components/ui/buttons';
import { translate } from '../../../helpers/l10n';
interface Props {
- identityProvider?: IdentityProvider;
+ identityProvider?: T.IdentityProvider;
isCurrentUser: boolean;
onUpdateUsers: () => void;
organizationsEnabled?: boolean;
updateTokensCount: (login: string, tokensCount: number) => void;
- user: User;
+ user: T.User;
}
interface State {
diff --git a/server/sonar-web/src/main/js/apps/users/components/UserListItemIdentity.tsx b/server/sonar-web/src/main/js/apps/users/components/UserListItemIdentity.tsx
index 1d3ff144df0..4751d64b0ba 100644
--- a/server/sonar-web/src/main/js/apps/users/components/UserListItemIdentity.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/UserListItemIdentity.tsx
@@ -19,13 +19,12 @@
*/
import * as React from 'react';
import * as theme from '../../../app/theme';
-import { IdentityProvider, User } from '../../../app/types';
import { getTextColor } from '../../../helpers/colors';
import { getBaseUrl } from '../../../helpers/urls';
interface Props {
- identityProvider?: IdentityProvider;
- user: User;
+ identityProvider?: T.IdentityProvider;
+ user: T.User;
}
export default function UserListItemIdentity({ identityProvider, user }: Props) {
diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/App.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/App.tsx
index e29280e7d14..37c21e0a5b6 100644
--- a/server/sonar-web/src/main/js/apps/webhooks/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/webhooks/components/App.tsx
@@ -24,17 +24,16 @@ import PageHeader from './PageHeader';
import WebhooksList from './WebhooksList';
import { createWebhook, deleteWebhook, searchWebhooks, updateWebhook } from '../../../api/webhooks';
import Suggestions from '../../../app/components/embed-docs-modal/Suggestions';
-import { LightComponent, Organization, Webhook } from '../../../app/types';
import { translate } from '../../../helpers/l10n';
interface Props {
- component?: LightComponent;
- organization: Organization | undefined;
+ component?: T.LightComponent;
+ organization: T.Organization | undefined;
}
interface State {
loading: boolean;
- webhooks: Webhook[];
+ webhooks: T.Webhook[];
}
export default class App extends React.PureComponent<Props, State> {
diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/CreateWebhookForm.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/CreateWebhookForm.tsx
index 462df320caa..297d0a504e6 100644
--- a/server/sonar-web/src/main/js/apps/webhooks/components/CreateWebhookForm.tsx
+++ b/server/sonar-web/src/main/js/apps/webhooks/components/CreateWebhookForm.tsx
@@ -22,13 +22,12 @@ import { FormikProps } from 'formik';
import { isWebUri } from 'valid-url';
import ValidationModal from '../../../components/controls/ValidationModal';
import InputValidationField from '../../../components/controls/InputValidationField';
-import { Webhook } from '../../../app/types';
import { translate } from '../../../helpers/l10n';
interface Props {
onClose: () => void;
onDone: (data: { name: string; url: string }) => Promise<void>;
- webhook?: Webhook;
+ webhook?: T.Webhook;
}
interface Values {
diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/DeleteWebhookForm.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/DeleteWebhookForm.tsx
index 4e177160af0..b8b63d4131b 100644
--- a/server/sonar-web/src/main/js/apps/webhooks/components/DeleteWebhookForm.tsx
+++ b/server/sonar-web/src/main/js/apps/webhooks/components/DeleteWebhookForm.tsx
@@ -18,7 +18,6 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { Webhook } from '../../../app/types';
import SimpleModal from '../../../components/controls/SimpleModal';
import DeferredSpinner from '../../../components/common/DeferredSpinner';
import { SubmitButton, ResetButtonLink } from '../../../components/ui/buttons';
@@ -27,7 +26,7 @@ import { translate, translateWithParameters } from '../../../helpers/l10n';
interface Props {
onClose: () => void;
onSubmit: () => Promise<void>;
- webhook: Webhook;
+ webhook: T.Webhook;
}
export default function DeleteWebhookForm({ onClose, onSubmit, webhook }: Props) {
diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/DeliveriesForm.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/DeliveriesForm.tsx
index c1622381057..d4ccf4b5427 100644
--- a/server/sonar-web/src/main/js/apps/webhooks/components/DeliveriesForm.tsx
+++ b/server/sonar-web/src/main/js/apps/webhooks/components/DeliveriesForm.tsx
@@ -23,19 +23,18 @@ import { Button } from '../../../components/ui/buttons';
import DeferredSpinner from '../../../components/common/DeferredSpinner';
import ListFooter from '../../../components/controls/ListFooter';
import Modal from '../../../components/controls/Modal';
-import { Webhook, WebhookDelivery, Paging } from '../../../app/types';
import { translateWithParameters, translate } from '../../../helpers/l10n';
import { searchDeliveries } from '../../../api/webhooks';
interface Props {
onClose: () => void;
- webhook: Webhook;
+ webhook: T.Webhook;
}
interface State {
- deliveries: WebhookDelivery[];
+ deliveries: T.WebhookDelivery[];
loading: boolean;
- paging?: Paging;
+ paging?: T.Paging;
}
const PAGE_SIZE = 10;
diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/DeliveryAccordion.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/DeliveryAccordion.tsx
index c5994e7a1c1..45de010ffc3 100644
--- a/server/sonar-web/src/main/js/apps/webhooks/components/DeliveryAccordion.tsx
+++ b/server/sonar-web/src/main/js/apps/webhooks/components/DeliveryAccordion.tsx
@@ -24,10 +24,9 @@ import AlertSuccessIcon from '../../../components/icons-components/AlertSuccessI
import DateTimeFormatter from '../../../components/intl/DateTimeFormatter';
import BoxedGroupAccordion from '../../../components/controls/BoxedGroupAccordion';
import { getDelivery } from '../../../api/webhooks';
-import { WebhookDelivery } from '../../../app/types';
interface Props {
- delivery: WebhookDelivery;
+ delivery: T.WebhookDelivery;
}
interface State {
diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/DeliveryItem.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/DeliveryItem.tsx
index 06f661468dd..4809cea9fee 100644
--- a/server/sonar-web/src/main/js/apps/webhooks/components/DeliveryItem.tsx
+++ b/server/sonar-web/src/main/js/apps/webhooks/components/DeliveryItem.tsx
@@ -22,11 +22,10 @@ import CodeSnippet from '../../../components/common/CodeSnippet';
import DeferredSpinner from '../../../components/common/DeferredSpinner';
import { formatMeasure } from '../../../helpers/measures';
import { translateWithParameters, translate } from '../../../helpers/l10n';
-import { WebhookDelivery } from '../../../app/types';
interface Props {
className?: string;
- delivery: WebhookDelivery;
+ delivery: T.WebhookDelivery;
loading: boolean;
payload: string | undefined;
}
diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/LatestDeliveryForm.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/LatestDeliveryForm.tsx
index 154dcd8e188..0cae97b03f5 100644
--- a/server/sonar-web/src/main/js/apps/webhooks/components/LatestDeliveryForm.tsx
+++ b/server/sonar-web/src/main/js/apps/webhooks/components/LatestDeliveryForm.tsx
@@ -21,14 +21,13 @@ import * as React from 'react';
import DeliveryItem from './DeliveryItem';
import { Button } from '../../../components/ui/buttons';
import Modal from '../../../components/controls/Modal';
-import { Webhook, WebhookDelivery } from '../../../app/types';
import { translateWithParameters, translate } from '../../../helpers/l10n';
import { getDelivery } from '../../../api/webhooks';
interface Props {
- delivery: WebhookDelivery;
+ delivery: T.WebhookDelivery;
onClose: () => void;
- webhook: Webhook;
+ webhook: T.Webhook;
}
interface State {
diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/WebhookActions.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/WebhookActions.tsx
index cfbeff267e3..8e318dc5b75 100644
--- a/server/sonar-web/src/main/js/apps/webhooks/components/WebhookActions.tsx
+++ b/server/sonar-web/src/main/js/apps/webhooks/components/WebhookActions.tsx
@@ -26,12 +26,11 @@ import ActionsDropdown, {
ActionsDropdownDivider
} from '../../../components/controls/ActionsDropdown';
import { translate } from '../../../helpers/l10n';
-import { Webhook } from '../../../app/types';
interface Props {
onDelete: (webhook: string) => Promise<void>;
onUpdate: (data: { webhook: string; name: string; url: string }) => Promise<void>;
- webhook: Webhook;
+ webhook: T.Webhook;
}
interface State {
diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/WebhookItem.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/WebhookItem.tsx
index 3bd7e4aa4b2..d1632165b52 100644
--- a/server/sonar-web/src/main/js/apps/webhooks/components/WebhookItem.tsx
+++ b/server/sonar-web/src/main/js/apps/webhooks/components/WebhookItem.tsx
@@ -20,12 +20,11 @@
import * as React from 'react';
import WebhookItemLatestDelivery from './WebhookItemLatestDelivery';
import WebhookActions from './WebhookActions';
-import { Webhook } from '../../../app/types';
interface Props {
onDelete: (webhook: string) => Promise<void>;
onUpdate: (data: { webhook: string; name: string; url: string }) => Promise<void>;
- webhook: Webhook;
+ webhook: T.Webhook;
}
export default function WebhookItem({ onDelete, onUpdate, webhook }: Props) {
diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/WebhookItemLatestDelivery.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/WebhookItemLatestDelivery.tsx
index 417790dddeb..0e5525f8851 100644
--- a/server/sonar-web/src/main/js/apps/webhooks/components/WebhookItemLatestDelivery.tsx
+++ b/server/sonar-web/src/main/js/apps/webhooks/components/WebhookItemLatestDelivery.tsx
@@ -24,11 +24,10 @@ import AlertErrorIcon from '../../../components/icons-components/AlertErrorIcon'
import AlertSuccessIcon from '../../../components/icons-components/AlertSuccessIcon';
import DateTimeFormatter from '../../../components/intl/DateTimeFormatter';
import { ButtonIcon } from '../../../components/ui/buttons';
-import { Webhook } from '../../../app/types';
import { translate } from '../../../helpers/l10n';
interface Props {
- webhook: Webhook;
+ webhook: T.Webhook;
}
interface State {
diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/WebhooksList.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/WebhooksList.tsx
index 92e8f191c29..98003f79c25 100644
--- a/server/sonar-web/src/main/js/apps/webhooks/components/WebhooksList.tsx
+++ b/server/sonar-web/src/main/js/apps/webhooks/components/WebhooksList.tsx
@@ -20,13 +20,12 @@
import * as React from 'react';
import { sortBy } from 'lodash';
import WebhookItem from './WebhookItem';
-import { Webhook } from '../../../app/types';
import { translate } from '../../../helpers/l10n';
interface Props {
onDelete: (webhook: string) => Promise<void>;
onUpdate: (data: { webhook: string; name: string; url: string }) => Promise<void>;
- webhooks: Webhook[];
+ webhooks: T.Webhook[];
}
export default class WebhooksList extends React.PureComponent<Props> {
diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/App-test.tsx
index 756f3830852..5a66a194451 100644
--- a/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/App-test.tsx
+++ b/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/App-test.tsx
@@ -26,7 +26,6 @@ import {
searchWebhooks,
updateWebhook
} from '../../../../api/webhooks';
-import { Visibility } from '../../../../app/types';
jest.mock('../../../../api/webhooks', () => ({
createWebhook: jest.fn(() =>
@@ -44,7 +43,7 @@ jest.mock('../../../../api/webhooks', () => ({
updateWebhook: jest.fn(() => Promise.resolve())
}));
-const organization = { key: 'foo', name: 'Foo', projectVisibility: Visibility.Private };
+const organization: T.Organization = { key: 'foo', name: 'Foo', projectVisibility: 'private' };
const component = { key: 'bar', organization: 'foo', qualifier: 'TRK' };
beforeEach(() => {
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerBase.tsx b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerBase.tsx
index 23dc626afc0..34ce61ab17e 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerBase.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerBase.tsx
@@ -37,16 +37,6 @@ import {
getDuplications,
getSources
} from '../../api/components';
-import {
- BranchLike,
- DuplicatedFile,
- Duplication,
- FlowLocation,
- Issue,
- LinearIssueLocation,
- SourceLine,
- SourceViewerFile
-} from '../../app/types';
import { isSameBranchLike, getBranchLikeQuery } from '../../helpers/branches';
import { translate } from '../../helpers/l10n';
import { Alert } from '../ui/Alert';
@@ -56,7 +46,7 @@ import './styles.css';
export interface Props {
aroundLine?: number;
- branchLike: BranchLike | undefined;
+ branchLike: T.BranchLike | undefined;
component: string;
displayAllIssues?: boolean;
displayIssueLocationsCount?: boolean;
@@ -65,27 +55,27 @@ export interface Props {
highlightedLine?: number;
// `undefined` elements mean they are located in a different file,
// but kept to maintaint the location indexes
- highlightedLocations?: (FlowLocation | undefined)[];
+ highlightedLocations?: (T.FlowLocation | undefined)[];
highlightedLocationMessage?: { index: number; text: string | undefined };
loadComponent: (
component: string,
- branchLike: BranchLike | undefined
- ) => Promise<SourceViewerFile>;
+ branchLike: T.BranchLike | undefined
+ ) => Promise<T.SourceViewerFile>;
loadIssues: (
component: string,
from: number,
to: number,
- branchLike: BranchLike | undefined
- ) => Promise<Issue[]>;
+ branchLike: T.BranchLike | undefined
+ ) => Promise<T.Issue[]>;
loadSources: (
component: string,
from: number,
to: number,
- branchLike: BranchLike | undefined
- ) => Promise<SourceLine[]>;
- onLoaded?: (component: SourceViewerFile, sources: SourceLine[], issues: Issue[]) => void;
+ branchLike: T.BranchLike | undefined
+ ) => Promise<T.SourceLine[]>;
+ onLoaded?: (component: T.SourceViewerFile, sources: T.SourceLine[], issues: T.Issue[]) => void;
onLocationSelect?: (index: number) => void;
- onIssueChange?: (issue: Issue) => void;
+ onIssueChange?: (issue: T.Issue) => void;
onIssueSelect?: (issueKey: string) => void;
onIssueUnselect?: () => void;
scroll?: (element: HTMLElement) => void;
@@ -93,17 +83,17 @@ export interface Props {
}
interface State {
- component?: SourceViewerFile;
+ component?: T.SourceViewerFile;
displayDuplications: boolean;
- duplicatedFiles?: { [ref: string]: DuplicatedFile };
- duplications?: Duplication[];
+ duplicatedFiles?: { [ref: string]: T.DuplicatedFile };
+ duplications?: T.Duplication[];
duplicationsByLine: { [line: number]: number[] };
hasSourcesAfter: boolean;
highlightedSymbols: string[];
- issueLocationsByLine: { [line: number]: LinearIssueLocation[] };
+ issueLocationsByLine: { [line: number]: T.LinearIssueLocation[] };
issuePopup?: { issue: string; name: string };
- issues?: Issue[];
- issuesByLine: { [line: number]: Issue[] };
+ issues?: T.Issue[];
+ issuesByLine: { [line: number]: T.Issue[] };
linePopup?: { index?: number; line: number; name: string };
loading: boolean;
loadingSourcesAfter: boolean;
@@ -113,7 +103,7 @@ interface State {
openIssuesByLine: { [line: number]: boolean };
selectedIssue?: string;
sourceRemoved: boolean;
- sources?: SourceLine[];
+ sources?: T.SourceLine[];
symbolsByLine: { [line: number]: string[] };
}
@@ -206,7 +196,7 @@ export default class SourceViewerBase extends React.PureComponent<Props, State>
this.mounted = false;
}
- computeCoverageStatus(lines: SourceLine[]) {
+ computeCoverageStatus(lines: T.SourceLine[]) {
return lines.map(line => ({ ...line, coverageStatus: getCoverageStatus(line) }));
}
@@ -225,7 +215,7 @@ export default class SourceViewerBase extends React.PureComponent<Props, State>
this.setState({ loading: true });
const to = (this.props.aroundLine || 0) + LINES;
- const loadIssues = (component: SourceViewerFile, sources: SourceLine[]) => {
+ const loadIssues = (component: T.SourceViewerFile, sources: T.SourceLine[]) => {
this.props.loadIssues(this.props.component, 1, to, this.props.branchLike).then(
issues => {
if (this.mounted) {
@@ -278,7 +268,7 @@ export default class SourceViewerBase extends React.PureComponent<Props, State>
}
};
- const onFailLoadSources = (response: Response, component: SourceViewerFile) => {
+ const onFailLoadSources = (response: Response, component: T.SourceViewerFile) => {
// TODO handle other statuses
if (this.mounted) {
if (response.status === 403) {
@@ -289,7 +279,7 @@ export default class SourceViewerBase extends React.PureComponent<Props, State>
}
};
- const onResolve = (component: SourceViewerFile) => {
+ const onResolve = (component: T.SourceViewerFile) => {
const sourcesRequest =
component.q === 'FIL' || component.q === 'UTS' ? this.loadSources() : Promise.resolve([]);
sourcesRequest.then(
@@ -356,7 +346,7 @@ export default class SourceViewerBase extends React.PureComponent<Props, State>
);
}
- loadSources = (): Promise<SourceLine[]> => {
+ loadSources = (): Promise<T.SourceLine[]> => {
return new Promise((resolve, reject) => {
const onFailLoadSources = ({ response }: { response: Response }) => {
// TODO handle other statuses
@@ -479,7 +469,7 @@ export default class SourceViewerBase extends React.PureComponent<Props, State>
);
};
- loadDuplications = (line: SourceLine) => {
+ loadDuplications = (line: T.SourceLine) => {
getDuplications({
key: this.props.component,
...getBranchLikeQuery(this.props.branchLike)
@@ -571,19 +561,19 @@ export default class SourceViewerBase extends React.PureComponent<Props, State>
}
};
- handleOpenIssues = (line: SourceLine) => {
+ handleOpenIssues = (line: T.SourceLine) => {
this.setState(state => ({
openIssuesByLine: { ...state.openIssuesByLine, [line.line]: true }
}));
};
- handleCloseIssues = (line: SourceLine) => {
+ handleCloseIssues = (line: T.SourceLine) => {
this.setState(state => ({
openIssuesByLine: { ...state.openIssuesByLine, [line.line]: false }
}));
};
- handleIssueChange = (issue: Issue) => {
+ handleIssueChange = (issue: T.Issue) => {
this.setState(({ issues = [] }) => {
const newIssues = issues.map(candidate => (candidate.key === issue.key ? issue : candidate));
return { issues: newIssues, issuesByLine: issuesByLine(newIssues) };
@@ -628,7 +618,7 @@ export default class SourceViewerBase extends React.PureComponent<Props, State>
);
};
- renderCode(sources: SourceLine[]) {
+ renderCode(sources: T.SourceLine[]) {
const hasSourcesBefore = sources.length > 0 && sources[0].line > 1;
return (
<SourceViewerCode
@@ -725,7 +715,7 @@ export default class SourceViewerBase extends React.PureComponent<Props, State>
}
}
-function defaultLoadComponent(component: string, branchLike: BranchLike | undefined) {
+function defaultLoadComponent(component: string, branchLike: T.BranchLike | undefined) {
return Promise.all([
getComponentForSourceViewer({ component, ...getBranchLikeQuery(branchLike) }),
getComponentData({ component, ...getBranchLikeQuery(branchLike) })
@@ -739,7 +729,7 @@ function defaultLoadSources(
key: string,
from: number | undefined,
to: number | undefined,
- branchLike: BranchLike | undefined
+ branchLike: T.BranchLike | undefined
) {
return getSources({ key, from, to, ...getBranchLikeQuery(branchLike) });
}
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerCode.tsx b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerCode.tsx
index c1a034d4dc5..6f8c04ecb54 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerCode.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerCode.tsx
@@ -21,14 +21,6 @@ import * as React from 'react';
import { intersection } from 'lodash';
import Line from './components/Line';
import { getLinearLocations } from './helpers/issueLocations';
-import {
- BranchLike,
- Duplication,
- FlowLocation,
- Issue,
- LinearIssueLocation,
- SourceLine
-} from '../../app/types';
import { translate } from '../../helpers/l10n';
import { Button } from '../ui/buttons';
@@ -42,13 +34,13 @@ const ZERO_LINE = {
};
interface Props {
- branchLike: BranchLike | undefined;
+ branchLike: T.BranchLike | undefined;
componentKey: string;
displayAllIssues?: boolean;
displayIssueLocationsCount?: boolean;
displayIssueLocationsLink?: boolean;
displayLocationMarkers?: boolean;
- duplications: Duplication[] | undefined;
+ duplications: T.Duplication[] | undefined;
duplicationsByLine: { [line: number]: number[] };
hasSourcesAfter: boolean;
hasSourcesBefore: boolean;
@@ -56,23 +48,23 @@ interface Props {
highlightedLocationMessage: { index: number; text: string | undefined } | undefined;
// `undefined` elements mean they are located in a different file,
// but kept to maintain the location indexes
- highlightedLocations: (FlowLocation | undefined)[] | undefined;
+ highlightedLocations: (T.FlowLocation | undefined)[] | undefined;
highlightedSymbols: string[];
- issueLocationsByLine: { [line: number]: LinearIssueLocation[] };
+ issueLocationsByLine: { [line: number]: T.LinearIssueLocation[] };
issuePopup: { issue: string; name: string } | undefined;
- issues: Issue[] | undefined;
- issuesByLine: { [line: number]: Issue[] };
+ issues: T.Issue[] | undefined;
+ issuesByLine: { [line: number]: T.Issue[] };
linePopup: { index?: number; line: number; name: string } | undefined;
- loadDuplications: (line: SourceLine) => void;
+ loadDuplications: (line: T.SourceLine) => void;
loadingSourcesAfter: boolean;
loadingSourcesBefore: boolean;
loadSourcesAfter: () => void;
loadSourcesBefore: () => void;
- onIssueChange: (issue: Issue) => void;
+ onIssueChange: (issue: T.Issue) => void;
onIssuePopupToggle: (issue: string, popupName: string, open?: boolean) => void;
- onIssuesClose: (line: SourceLine) => void;
+ onIssuesClose: (line: T.SourceLine) => void;
onIssueSelect: (issueKey: string) => void;
- onIssuesOpen: (line: SourceLine) => void;
+ onIssuesOpen: (line: T.SourceLine) => void;
onIssueUnselect: () => void;
onLinePopupToggle: (x: { index?: number; line: number; name: string; open?: boolean }) => void;
onLocationSelect: ((index: number) => void) | undefined;
@@ -81,30 +73,30 @@ interface Props {
renderDuplicationPopup: (index: number, line: number) => JSX.Element;
scroll?: (element: HTMLElement) => void;
selectedIssue: string | undefined;
- sources: SourceLine[];
+ sources: T.SourceLine[];
symbolsByLine: { [line: number]: string[] };
}
export default class SourceViewerCode extends React.PureComponent<Props> {
- getDuplicationsForLine = (line: SourceLine): number[] => {
+ getDuplicationsForLine = (line: T.SourceLine): number[] => {
return this.props.duplicationsByLine[line.line] || EMPTY_ARRAY;
};
- getIssuesForLine = (line: SourceLine): Issue[] => {
+ getIssuesForLine = (line: T.SourceLine): T.Issue[] => {
return this.props.issuesByLine[line.line] || EMPTY_ARRAY;
};
- getIssueLocationsForLine = (line: SourceLine): LinearIssueLocation[] => {
+ getIssueLocationsForLine = (line: T.SourceLine): T.LinearIssueLocation[] => {
return this.props.issueLocationsByLine[line.line] || EMPTY_ARRAY;
};
- getSecondaryIssueLocationsForLine = (line: SourceLine): LinearIssueLocation[] => {
+ getSecondaryIssueLocationsForLine = (line: T.SourceLine): T.LinearIssueLocation[] => {
const { highlightedLocations } = this.props;
if (!highlightedLocations) {
return EMPTY_ARRAY;
}
return highlightedLocations.reduce((locations, location, index) => {
- const linearLocations: LinearIssueLocation[] = location
+ const linearLocations: T.LinearIssueLocation[] = location
? getLinearLocations(location.textRange)
.filter(l => l.line === line.line)
.map(l => ({ ...l, startLine: location.textRange.startLine, index }))
@@ -120,7 +112,7 @@ export default class SourceViewerCode extends React.PureComponent<Props> {
displayDuplications,
displayIssues
}: {
- line: SourceLine;
+ line: T.SourceLine;
index: number;
displayCoverage: boolean;
displayDuplications: boolean;
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.tsx b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.tsx
index 36595d01856..5bf963a9fb1 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.tsx
@@ -22,7 +22,6 @@ import * as React from 'react';
import { Link } from 'react-router';
import * as PropTypes from 'prop-types';
import MeasuresOverlay from './components/MeasuresOverlay';
-import { SourceViewerFile, BranchLike } from '../../app/types';
import QualifierIcon from '../icons-components/QualifierIcon';
import Dropdown from '../controls/Dropdown';
import Favorite from '../controls/Favorite';
@@ -43,8 +42,8 @@ import { formatMeasure } from '../../helpers/measures';
import { omitNil } from '../../helpers/request';
interface Props {
- branchLike: BranchLike | undefined;
- sourceViewerFile: SourceViewerFile;
+ branchLike: T.BranchLike | undefined;
+ sourceViewerFile: T.SourceViewerFile;
}
interface State {
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/CoveragePopup.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/CoveragePopup.tsx
index cff05965304..f98d78c9376 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/CoveragePopup.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/CoveragePopup.tsx
@@ -21,7 +21,6 @@ import * as React from 'react';
import { groupBy } from 'lodash';
import * as PropTypes from 'prop-types';
import { getTests } from '../../../api/components';
-import { BranchLike, SourceLine, TestCase } from '../../../app/types';
import { DropdownOverlay } from '../../controls/Dropdown';
import TestStatusIcon from '../../icons-components/TestStatusIcon';
import { PopupPlacement } from '../../ui/popups';
@@ -36,15 +35,15 @@ import { translate } from '../../../helpers/l10n';
import { collapsePath } from '../../../helpers/path';
interface Props {
- branchLike: BranchLike | undefined;
+ branchLike: T.BranchLike | undefined;
componentKey: string;
- line: SourceLine;
+ line: T.SourceLine;
onClose: () => void;
}
interface State {
loading: boolean;
- testCases: TestCase[];
+ testCases: T.TestCase[];
}
export default class CoveragePopup extends React.PureComponent<Props, State> {
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/DuplicationPopup.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/DuplicationPopup.tsx
index c3c9bff0e83..1f348fde012 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/DuplicationPopup.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/DuplicationPopup.tsx
@@ -21,7 +21,6 @@ import * as React from 'react';
import { Link } from 'react-router';
import * as PropTypes from 'prop-types';
import { groupBy, sortBy } from 'lodash';
-import { BranchLike, DuplicatedFile, DuplicationBlock, SourceViewerFile } from '../../../app/types';
import { DropdownOverlay } from '../../controls/Dropdown';
import QualifierIcon from '../../icons-components/QualifierIcon';
import { PopupPlacement } from '../../ui/popups';
@@ -33,13 +32,13 @@ import { getProjectUrl } from '../../../helpers/urls';
import { Alert } from '../../ui/Alert';
interface Props {
- blocks: DuplicationBlock[];
- branchLike: BranchLike | undefined;
- duplicatedFiles?: { [ref: string]: DuplicatedFile };
+ blocks: T.DuplicationBlock[];
+ branchLike: T.BranchLike | undefined;
+ duplicatedFiles?: { [ref: string]: T.DuplicatedFile };
inRemovedComponent: boolean;
onClose: () => void;
popupPosition?: any;
- sourceViewerFile: SourceViewerFile;
+ sourceViewerFile: T.SourceViewerFile;
}
export default class DuplicationPopup extends React.PureComponent<Props> {
@@ -75,7 +74,7 @@ export default class DuplicationPopup extends React.PureComponent<Props> {
this.props.onClose();
};
- renderDuplication(file: DuplicatedFile, children: React.ReactNode, line?: number) {
+ renderDuplication(file: T.DuplicatedFile, children: React.ReactNode, line?: number) {
return this.shouldLink() ? (
<a
data-key={file.key}
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/Line.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/Line.tsx
index c2f2e4972e0..4af112bc041 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/Line.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/Line.tsx
@@ -27,10 +27,9 @@ import LineDuplications from './LineDuplications';
import LineDuplicationBlock from './LineDuplicationBlock';
import LineIssuesIndicator from './LineIssuesIndicator';
import LineCode from './LineCode';
-import { BranchLike, Issue, LinearIssueLocation, SourceLine } from '../../../app/types';
interface Props {
- branchLike: BranchLike | undefined;
+ branchLike: T.BranchLike | undefined;
componentKey: string;
displayAllIssues?: boolean;
displayCoverage: boolean;
@@ -44,24 +43,24 @@ interface Props {
highlighted: boolean;
highlightedLocationMessage: { index: number; text: string | undefined } | undefined;
highlightedSymbols: string[] | undefined;
- issueLocations: LinearIssueLocation[];
+ issueLocations: T.LinearIssueLocation[];
issuePopup: { issue: string; name: string } | undefined;
- issues: Issue[];
+ issues: T.Issue[];
last: boolean;
- line: SourceLine;
+ line: T.SourceLine;
linePopup: { index?: number; line: number; name: string } | undefined;
- loadDuplications: (line: SourceLine) => void;
+ loadDuplications: (line: T.SourceLine) => void;
onLinePopupToggle: (x: { index?: number; line: number; name: string; open?: boolean }) => void;
- onIssueChange: (issue: Issue) => void;
+ onIssueChange: (issue: T.Issue) => void;
onIssuePopupToggle: (issueKey: string, popupName: string, open?: boolean) => void;
- onIssuesClose: (line: SourceLine) => void;
+ onIssuesClose: (line: T.SourceLine) => void;
onIssueSelect: (issueKey: string) => void;
- onIssuesOpen: (line: SourceLine) => void;
+ onIssuesOpen: (line: T.SourceLine) => void;
onIssueUnselect: () => void;
onLocationSelect: ((x: number) => void) | undefined;
onSymbolClick: (symbols: string[]) => void;
openIssues: boolean;
- previousLine: SourceLine | undefined;
+ previousLine: T.SourceLine | undefined;
renderDuplicationPopup: (index: number, line: number) => JSX.Element;
scroll?: (element: HTMLElement) => void;
secondaryIssueLocations: Array<{
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/LineCode.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/LineCode.tsx
index b3ac1a77358..6ec33831474 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/LineCode.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/LineCode.tsx
@@ -20,7 +20,6 @@
import * as React from 'react';
import * as classNames from 'classnames';
import LineIssuesList from './LineIssuesList';
-import { BranchLike, Issue, LinearIssueLocation, SourceLine } from '../../../app/types';
import LocationIndex from '../../common/LocationIndex';
import LocationMessage from '../../common/LocationMessage';
import {
@@ -31,17 +30,17 @@ import {
} from '../helpers/highlight';
interface Props {
- branchLike: BranchLike | undefined;
+ branchLike: T.BranchLike | undefined;
displayIssueLocationsCount?: boolean;
displayIssueLocationsLink?: boolean;
displayLocationMarkers?: boolean;
highlightedLocationMessage: { index: number; text: string | undefined } | undefined;
highlightedSymbols: string[] | undefined;
- issueLocations: LinearIssueLocation[];
+ issueLocations: T.LinearIssueLocation[];
issuePopup: { issue: string; name: string } | undefined;
- issues: Issue[];
- line: SourceLine;
- onIssueChange: (issue: Issue) => void;
+ issues: T.Issue[];
+ line: T.SourceLine;
+ onIssueChange: (issue: T.Issue) => void;
onIssuePopupToggle: (issue: string, popupName: string, open?: boolean) => void;
onIssueSelect: (issueKey: string) => void;
onLocationSelect: ((index: number) => void) | undefined;
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/LineCoverage.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/LineCoverage.tsx
index 2be765bb904..4eb30dca4e7 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/LineCoverage.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/LineCoverage.tsx
@@ -19,15 +19,14 @@
*/
import * as React from 'react';
import CoveragePopup from './CoveragePopup';
-import { BranchLike, SourceLine } from '../../../app/types';
import Tooltip from '../../controls/Tooltip';
import Toggler from '../../controls/Toggler';
import { translate } from '../../../helpers/l10n';
interface Props {
- branchLike: BranchLike | undefined;
+ branchLike: T.BranchLike | undefined;
componentKey: string;
- line: SourceLine;
+ line: T.SourceLine;
onPopupToggle: (x: { index?: number; line: number; name: string; open?: boolean }) => void;
popupOpen: boolean;
}
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/LineDuplicationBlock.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/LineDuplicationBlock.tsx
index 0b9ae37f2fc..aaeebd3ff43 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/LineDuplicationBlock.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/LineDuplicationBlock.tsx
@@ -19,7 +19,6 @@
*/
import * as React from 'react';
import * as classNames from 'classnames';
-import { SourceLine } from '../../../app/types';
import Tooltip from '../../controls/Tooltip';
import Toggler from '../../controls/Toggler';
import { translate } from '../../../helpers/l10n';
@@ -27,7 +26,7 @@ import { translate } from '../../../helpers/l10n';
interface Props {
duplicated: boolean;
index: number;
- line: SourceLine;
+ line: T.SourceLine;
onPopupToggle: (x: { index?: number; line: number; name: string; open?: boolean }) => void;
popupOpen: boolean;
renderDuplicationPopup: (index: number, line: number) => JSX.Element;
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/LineDuplications.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/LineDuplications.tsx
index c51c49dcdca..a70dc04c969 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/LineDuplications.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/LineDuplications.tsx
@@ -19,13 +19,12 @@
*/
import * as React from 'react';
import * as classNames from 'classnames';
-import { SourceLine } from '../../../app/types';
import Tooltip from '../../controls/Tooltip';
import { translate } from '../../../helpers/l10n';
interface Props {
- line: SourceLine;
- onClick: (line: SourceLine) => void;
+ line: T.SourceLine;
+ onClick: (line: T.SourceLine) => void;
}
export default class LineDuplications extends React.PureComponent<Props> {
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesIndicator.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesIndicator.tsx
index e8d9b4162de..42bbfcd5cff 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesIndicator.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesIndicator.tsx
@@ -21,11 +21,10 @@ import * as React from 'react';
import * as classNames from 'classnames';
import SeverityIcon from '../../icons-components/SeverityIcon';
import { sortBySeverity } from '../../../helpers/issues';
-import { Issue, SourceLine } from '../../../app/types';
interface Props {
- issues: Issue[];
- line: SourceLine;
+ issues: T.Issue[];
+ line: T.SourceLine;
onClick: () => void;
}
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesList.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesList.tsx
index 6e8cfca7732..c036c1b431c 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesList.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesList.tsx
@@ -18,16 +18,15 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { BranchLike, Issue as IssueType } from '../../../app/types';
import Issue from '../../issue/Issue';
interface Props {
- branchLike: BranchLike | undefined;
+ branchLike: T.BranchLike | undefined;
displayIssueLocationsCount?: boolean;
displayIssueLocationsLink?: boolean;
issuePopup: { issue: string; name: string } | undefined;
- issues: IssueType[];
- onIssueChange: (issue: IssueType) => void;
+ issues: T.Issue[];
+ onIssueChange: (issue: T.Issue) => void;
onIssueClick: (issueKey: string) => void;
onIssuePopupToggle: (issue: string, popupName: string, open?: boolean) => void;
selectedIssue: string | undefined;
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/LineNumber.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/LineNumber.tsx
index 15af9ac258d..34ef00be9d3 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/LineNumber.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/LineNumber.tsx
@@ -19,13 +19,12 @@
*/
import * as React from 'react';
import LineOptionsPopup from './LineOptionsPopup';
-import { BranchLike, SourceLine } from '../../../app/types';
import Toggler from '../../controls/Toggler';
interface Props {
- branchLike: BranchLike | undefined;
+ branchLike: T.BranchLike | undefined;
componentKey: string;
- line: SourceLine;
+ line: T.SourceLine;
onPopupToggle: (x: { index?: number; line: number; name: string; open?: boolean }) => void;
popupOpen: boolean;
}
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/LineOptionsPopup.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/LineOptionsPopup.tsx
index 34a136d8391..ec9d9be9884 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/LineOptionsPopup.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/LineOptionsPopup.tsx
@@ -19,16 +19,15 @@
*/
import * as React from 'react';
import { Link } from 'react-router';
-import { BranchLike, SourceLine } from '../../../app/types';
import { DropdownOverlay } from '../../controls/Dropdown';
import { PopupPlacement } from '../../ui/popups';
import { translate } from '../../../helpers/l10n';
import { getBranchLikeQuery } from '../../../helpers/branches';
interface Props {
- branchLike: BranchLike | undefined;
+ branchLike: T.BranchLike | undefined;
componentKey: string;
- line: SourceLine;
+ line: T.SourceLine;
}
export default function LineOptionsPopup({ branchLike, componentKey, line }: Props) {
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/LineSCM.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/LineSCM.tsx
index 394c321b12d..43babe90379 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/LineSCM.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/LineSCM.tsx
@@ -19,14 +19,13 @@
*/
import * as React from 'react';
import SCMPopup from './SCMPopup';
-import { SourceLine } from '../../../app/types';
import Toggler from '../../controls/Toggler';
interface Props {
- line: SourceLine;
+ line: T.SourceLine;
onPopupToggle: (x: { index?: number; line: number; name: string; open?: boolean }) => void;
popupOpen: boolean;
- previousLine: SourceLine | undefined;
+ previousLine: T.SourceLine | undefined;
}
export default class LineSCM extends React.PureComponent<Props> {
@@ -74,7 +73,7 @@ export default class LineSCM extends React.PureComponent<Props> {
}
}
-function isSCMChanged(s: SourceLine, p: SourceLine | undefined) {
+function isSCMChanged(s: T.SourceLine, p: T.SourceLine | undefined) {
let changed = true;
if (p != null && s.scmRevision != null && p.scmRevision != null) {
changed = s.scmRevision !== p.scmRevision || s.scmDate !== p.scmDate;
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlay.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlay.tsx
index a21e366ae91..14fd268ddf3 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlay.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlay.tsx
@@ -26,13 +26,6 @@ import { Button } from '../../ui/buttons';
import { getFacets } from '../../../api/issues';
import { getMeasures } from '../../../api/measures';
import { getAllMetrics } from '../../../api/metrics';
-import {
- FacetValue,
- SourceViewerFile,
- BranchLike,
- MeasureEnhanced,
- IssueType
-} from '../../../app/types';
import Modal from '../../controls/Modal';
import Measure from '../../measure/Measure';
import QualifierIcon from '../../icons-components/QualifierIcon';
@@ -52,22 +45,22 @@ import { getBranchLikeQuery } from '../../../helpers/branches';
import TagsIcon from '../../icons-components/TagsIcon';
interface Props {
- branchLike: BranchLike | undefined;
+ branchLike: T.BranchLike | undefined;
onClose: () => void;
- sourceViewerFile: SourceViewerFile;
+ sourceViewerFile: T.SourceViewerFile;
}
interface Measures {
- [metricKey: string]: MeasureEnhanced;
+ [metricKey: string]: T.MeasureEnhanced;
}
interface State {
loading: boolean;
measures: Measures;
- severitiesFacet?: FacetValue[];
+ severitiesFacet?: T.FacetValue[];
showAllMeasures: boolean;
- tagsFacet?: FacetValue[];
- typesFacet?: FacetValue<IssueType>[];
+ tagsFacet?: T.FacetValue[];
+ typesFacet?: T.FacetValue<T.IssueType>[];
}
export default class MeasuresOverlay extends React.PureComponent<Props, State> {
@@ -131,7 +124,7 @@ export default class MeasuresOverlay extends React.PureComponent<Props, State> {
return {
severitiesFacet: severitiesFacet && severitiesFacet.values,
tagsFacet: tagsFacet && tagsFacet.values,
- typesFacet: typesFacet && (typesFacet.values as FacetValue<IssueType>[])
+ typesFacet: typesFacet && (typesFacet.values as T.FacetValue<T.IssueType>[])
};
});
};
@@ -142,7 +135,7 @@ export default class MeasuresOverlay extends React.PureComponent<Props, State> {
this.setState({ showAllMeasures: true });
};
- renderMeasure = (measure: MeasureEnhanced | undefined) => {
+ renderMeasure = (measure: T.MeasureEnhanced | undefined) => {
return measure ? <MeasuresOverlayMeasure key={measure.metric.key} measure={measure} /> : null;
};
@@ -173,7 +166,7 @@ export default class MeasuresOverlay extends React.PureComponent<Props, State> {
);
};
- renderBigMeasure = (measure: MeasureEnhanced | undefined) => {
+ renderBigMeasure = (measure: T.MeasureEnhanced | undefined) => {
return measure ? (
<div className="measure measure-big" data-metric={measure.metric.key}>
<span className="measure-value">
@@ -357,7 +350,7 @@ export default class MeasuresOverlay extends React.PureComponent<Props, State> {
);
};
- renderDomain = (domain: string, measures: MeasureEnhanced[]) => {
+ renderDomain = (domain: string, measures: T.MeasureEnhanced[]) => {
return (
<div className="source-viewer-measures-card" key={domain}>
<div className="measures">
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlayCoveredFiles.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlayCoveredFiles.tsx
index 1e46274b9e9..530acbcdab3 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlayCoveredFiles.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlayCoveredFiles.tsx
@@ -20,17 +20,16 @@
import * as React from 'react';
import { Link } from 'react-router';
import { getCoveredFiles } from '../../../api/tests';
-import { TestCase, CoveredFile } from '../../../app/types';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { getProjectUrl } from '../../../helpers/urls';
import DeferredSpinner from '../../common/DeferredSpinner';
interface Props {
- testCase: TestCase;
+ testCase: T.TestCase;
}
interface State {
- coveredFiles?: CoveredFile[];
+ coveredFiles?: T.CoveredFile[];
loading: boolean;
}
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlayMeasure.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlayMeasure.tsx
index 7a41a9ef001..11fb3a5ac57 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlayMeasure.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlayMeasure.tsx
@@ -18,13 +18,12 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { Metric } from '../../../app/types';
import Measure from '../../measure/Measure';
import IssueTypeIcon from '../../ui/IssueTypeIcon';
import { getLocalizedMetricName } from '../../../helpers/l10n';
export interface MeasureWithMetric {
- metric: Metric;
+ metric: T.Metric;
value?: string;
}
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlayTestCase.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlayTestCase.tsx
index 6f2981c17c8..2f149fd4471 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlayTestCase.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlayTestCase.tsx
@@ -18,12 +18,11 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { TestCase } from '../../../app/types';
import TestStatusIcon from '../../icons-components/TestStatusIcon';
interface Props {
onClick: (testId: string) => void;
- testCase: TestCase;
+ testCase: T.TestCase;
}
export default class MeasuresOverlayTestCase extends React.PureComponent<Props> {
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlayTestCases.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlayTestCases.tsx
index 8b2f880be51..244bd4b6a26 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlayTestCases.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlayTestCases.tsx
@@ -23,12 +23,11 @@ import { orderBy } from 'lodash';
import MeasuresOverlayCoveredFiles from './MeasuresOverlayCoveredFiles';
import MeasuresOverlayTestCase from './MeasuresOverlayTestCase';
import { getTests } from '../../../api/tests';
-import { TestCase, BranchLike } from '../../../app/types';
import { translate } from '../../../helpers/l10n';
import { getBranchLikeQuery } from '../../../helpers/branches';
interface Props {
- branchLike: BranchLike | undefined;
+ branchLike: T.BranchLike | undefined;
componentKey: string;
}
@@ -37,7 +36,7 @@ interface State {
selectedTestId?: string;
sort?: string;
sortAsc?: boolean;
- testCases?: TestCase[];
+ testCases?: T.TestCase[];
}
export default class MeasuresOverlayTestCases extends React.PureComponent<Props, State> {
@@ -174,7 +173,7 @@ export default class MeasuresOverlayTestCases extends React.PureComponent<Props,
}
}
-function sortTestCases(testCases: TestCase[], sort: string, sortAsc: boolean) {
+function sortTestCases(testCases: T.TestCase[], sort: string, sortAsc: boolean) {
const mainOrder = sortAsc ? 'asc' : 'desc';
if (sort === 'duration') {
return orderBy(testCases, ['durationInMs', 'name'], [mainOrder, 'asc']);
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/SCMPopup.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/SCMPopup.tsx
index 52f78a7382b..20f588ce4e5 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/SCMPopup.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/SCMPopup.tsx
@@ -19,13 +19,12 @@
*/
import * as React from 'react';
import * as classNames from 'classnames';
-import { SourceLine } from '../../../app/types';
import { DropdownOverlay } from '../../controls/Dropdown';
import DateFormatter from '../../intl/DateFormatter';
import { PopupPlacement } from '../../ui/popups';
interface Props {
- line: SourceLine;
+ line: T.SourceLine;
}
export default function SCMPopup({ line }: Props) {
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineCode-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineCode-test.tsx
index e50deb1f6ee..897f4c1b979 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineCode-test.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineCode-test.tsx
@@ -20,9 +20,8 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import LineCode from '../LineCode';
-import { BranchType, Issue, ShortLivingBranch, IssueType } from '../../../../app/types';
-const issueBase: Issue = {
+const issueBase: T.Issue = {
actions: [],
component: '',
componentLongName: '',
@@ -44,7 +43,7 @@ const issueBase: Issue = {
severity: '',
status: '',
transitions: [],
- type: IssueType.Bug
+ type: 'BUG'
};
it('render code', () => {
@@ -53,11 +52,11 @@ it('render code', () => {
code: '<span class="k">class</span> <span class="sym sym-1">Foo</span> {'
};
const issueLocations = [{ from: 0, to: 5, line: 3 }];
- const branch: ShortLivingBranch = {
+ const branch: T.ShortLivingBranch = {
isMain: false,
mergeBranch: 'master',
name: 'feature',
- type: BranchType.SHORT
+ type: 'SHORT'
};
const wrapper = shallow(
<LineCode
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineCoverage-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineCoverage-test.tsx
index efbe7ecfe67..1fe276c60d4 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineCoverage-test.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineCoverage-test.tsx
@@ -21,10 +21,9 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import LineCoverage from '../LineCoverage';
import { click } from '../../../../helpers/testUtils';
-import { SourceLine } from '../../../../app/types';
it('render covered line', () => {
- const line: SourceLine = { line: 3, coverageStatus: 'covered' };
+ const line: T.SourceLine = { line: 3, coverageStatus: 'covered' };
const wrapper = shallow(
<LineCoverage
branchLike={undefined}
@@ -39,7 +38,7 @@ it('render covered line', () => {
});
it('render uncovered line', () => {
- const line: SourceLine = { line: 3, coverageStatus: 'uncovered' };
+ const line: T.SourceLine = { line: 3, coverageStatus: 'uncovered' };
const wrapper = shallow(
<LineCoverage
branchLike={undefined}
@@ -53,7 +52,7 @@ it('render uncovered line', () => {
});
it('render line with unknown coverage', () => {
- const line: SourceLine = { line: 3 };
+ const line: T.SourceLine = { line: 3 };
const wrapper = shallow(
<LineCoverage
branchLike={undefined}
@@ -67,7 +66,7 @@ it('render line with unknown coverage', () => {
});
it('should open coverage popup', () => {
- const line: SourceLine = { line: 3, coverageStatus: 'covered' };
+ const line: T.SourceLine = { line: 3, coverageStatus: 'covered' };
const onPopupToggle = jest.fn();
const wrapper = shallow(
<LineCoverage
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineIssuesIndicator-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineIssuesIndicator-test.tsx
index b42dcbfb670..24a56f6a284 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineIssuesIndicator-test.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineIssuesIndicator-test.tsx
@@ -21,9 +21,8 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import { click } from '../../../../helpers/testUtils';
import LineIssuesIndicator from '../LineIssuesIndicator';
-import { Issue, IssueType } from '../../../../app/types';
-const issueBase: Issue = {
+const issueBase: T.Issue = {
actions: [],
component: '',
componentLongName: '',
@@ -45,7 +44,7 @@ const issueBase: Issue = {
severity: '',
status: '',
transitions: [],
- type: IssueType.Bug
+ type: 'BUG'
};
it('render highest severity', () => {
@@ -68,7 +67,7 @@ it('render highest severity', () => {
it('no issues', () => {
const line = { line: 3 };
- const issues: Issue[] = [];
+ const issues: T.Issue[] = [];
const onClick = jest.fn();
const wrapper = shallow(<LineIssuesIndicator issues={issues} line={line} onClick={onClick} />);
expect(wrapper).toMatchSnapshot();
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineIssuesList-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineIssuesList-test.tsx
index 5c40c7d813f..af54ee90c3e 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineIssuesList-test.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineIssuesList-test.tsx
@@ -20,9 +20,8 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import LineIssuesList from '../LineIssuesList';
-import { Issue, IssueType } from '../../../../app/types';
-const issueBase: Issue = {
+const issueBase: T.Issue = {
actions: [],
component: '',
componentLongName: '',
@@ -44,11 +43,11 @@ const issueBase: Issue = {
severity: '',
status: '',
transitions: [],
- type: IssueType.Bug
+ type: 'BUG'
};
it('render issues list', () => {
- const issues: Issue[] = [{ ...issueBase, key: 'foo' }, { ...issueBase, key: 'bar' }];
+ const issues: T.Issue[] = [{ ...issueBase, key: 'foo' }, { ...issueBase, key: 'bar' }];
const onIssueClick = jest.fn();
const wrapper = shallow(
<LineIssuesList
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineOptionsPopup-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineOptionsPopup-test.tsx
index 5ada553fbd6..1e2dd415bae 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineOptionsPopup-test.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineOptionsPopup-test.tsx
@@ -20,15 +20,14 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import LineOptionsPopup from '../LineOptionsPopup';
-import { BranchType, ShortLivingBranch } from '../../../../app/types';
it('should render', () => {
const line = { line: 3 };
- const branch: ShortLivingBranch = {
+ const branch: T.ShortLivingBranch = {
isMain: false,
mergeBranch: 'master',
name: 'feature',
- type: BranchType.SHORT
+ type: 'SHORT'
};
const wrapper = shallow(<LineOptionsPopup branchLike={branch} componentKey="foo" line={line} />);
expect(wrapper).toMatchSnapshot();
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlay-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlay-test.tsx
index 3c4a20dd0e2..2b29658928b 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlay-test.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlay-test.tsx
@@ -20,7 +20,6 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import MeasuresOverlay from '../MeasuresOverlay';
-import { SourceViewerFile, ShortLivingBranch, BranchType } from '../../../../app/types';
import { waitAndUpdate, click } from '../../../../helpers/testUtils';
jest.mock('../../../../api/issues', () => ({
@@ -136,7 +135,7 @@ jest.mock('../../../../api/metrics', () => ({
])
}));
-const sourceViewerFile: SourceViewerFile = {
+const sourceViewerFile: T.SourceViewerFile = {
key: 'component-key',
measures: {},
path: 'src/file.js',
@@ -148,11 +147,11 @@ const sourceViewerFile: SourceViewerFile = {
uuid: 'abcd123'
};
-const branchLike: ShortLivingBranch = {
+const branchLike: T.ShortLivingBranch = {
isMain: false,
mergeBranch: 'master',
name: 'feature',
- type: BranchType.SHORT
+ type: 'SHORT'
};
it('should render source file', async () => {
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlayTestCases-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlayTestCases-test.tsx
index 1eacb341dc0..47b3d3e8612 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlayTestCases-test.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlayTestCases-test.tsx
@@ -21,7 +21,6 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import MeasuresOverlayTestCases from '../MeasuresOverlayTestCases';
import { waitAndUpdate, click } from '../../../../helpers/testUtils';
-import { ShortLivingBranch, BranchType } from '../../../../app/types';
jest.mock('../../../../api/tests', () => ({
getTests: () =>
@@ -61,11 +60,11 @@ jest.mock('../../../../api/tests', () => ({
})
}));
-const branchLike: ShortLivingBranch = {
+const branchLike: T.ShortLivingBranch = {
isMain: false,
mergeBranch: 'master',
name: 'feature',
- type: BranchType.SHORT
+ type: 'SHORT'
};
it('should render', async () => {
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/helpers/getCoverageStatus.tsx b/server/sonar-web/src/main/js/components/SourceViewer/helpers/getCoverageStatus.tsx
index 88fd50b2f1d..cbcf01bb11f 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/helpers/getCoverageStatus.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/helpers/getCoverageStatus.tsx
@@ -17,9 +17,8 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { SourceLine } from '../../../app/types';
-export default function getCoverageStatus(s: SourceLine): string | undefined {
+export default function getCoverageStatus(s: T.SourceLine): string | undefined {
let status: string | undefined;
if (s.lineHits != null && s.lineHits > 0) {
status = 'partially-covered';
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/helpers/highlight.ts b/server/sonar-web/src/main/js/components/SourceViewer/helpers/highlight.ts
index 2f105f74884..45a6b7649bb 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/helpers/highlight.ts
+++ b/server/sonar-web/src/main/js/components/SourceViewer/helpers/highlight.ts
@@ -18,7 +18,6 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { uniq } from 'lodash';
-import { LinearIssueLocation } from '../../../app/types';
export interface Token {
className: string;
@@ -85,7 +84,7 @@ function part(str: string, from: number, to: number, acc: number): string {
*/
export function highlightIssueLocations(
tokens: Token[],
- issueLocations: LinearIssueLocation[],
+ issueLocations: T.LinearIssueLocation[],
rootClassName: string = ISSUE_LOCATION_CLASS
): Token[] {
issueLocations.forEach(location => {
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/helpers/indexing.ts b/server/sonar-web/src/main/js/components/SourceViewer/helpers/indexing.ts
index bf103f0cf34..5046bbead7f 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/helpers/indexing.ts
+++ b/server/sonar-web/src/main/js/components/SourceViewer/helpers/indexing.ts
@@ -20,10 +20,9 @@
import { flatten } from 'lodash';
import { splitByTokens } from './highlight';
import { getLinearLocations } from './issueLocations';
-import { Duplication, Issue, LinearIssueLocation, SourceLine } from '../../../app/types';
-export function issuesByLine(issues: Issue[]) {
- const index: { [line: number]: Issue[] } = {};
+export function issuesByLine(issues: T.Issue[]) {
+ const index: { [line: number]: T.Issue[] } = {};
issues.forEach(issue => {
const line = issue.textRange ? issue.textRange.endLine : 0;
if (!(line in index)) {
@@ -34,8 +33,8 @@ export function issuesByLine(issues: Issue[]) {
return index;
}
-export function locationsByLine(issues: Issue[]) {
- const index: { [line: number]: LinearIssueLocation[] } = {};
+export function locationsByLine(issues: T.Issue[]) {
+ const index: { [line: number]: T.LinearIssueLocation[] } = {};
issues.forEach(issue => {
getLinearLocations(issue.textRange).forEach(location => {
if (!(location.line in index)) {
@@ -47,7 +46,7 @@ export function locationsByLine(issues: Issue[]) {
return index;
}
-export function duplicationsByLine(duplications: Duplication[] | undefined) {
+export function duplicationsByLine(duplications: T.Duplication[] | undefined) {
if (duplications == null) {
return {};
}
@@ -71,7 +70,7 @@ export function duplicationsByLine(duplications: Duplication[] | undefined) {
return duplicationsByLine;
}
-export function symbolsByLine(sources: SourceLine[]) {
+export function symbolsByLine(sources: T.SourceLine[]) {
const index: { [line: number]: string[] } = {};
sources.forEach(line => {
const tokens = splitByTokens(line.code || '');
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/helpers/issueLocations.tsx b/server/sonar-web/src/main/js/components/SourceViewer/helpers/issueLocations.tsx
index 5c0f7ee9616..09ba8f805f3 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/helpers/issueLocations.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/helpers/issueLocations.tsx
@@ -17,9 +17,8 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { LinearIssueLocation, TextRange } from '../../../app/types';
-export function getLinearLocations(textRange: TextRange | undefined): LinearIssueLocation[] {
+export function getLinearLocations(textRange: T.TextRange | undefined): T.LinearIssueLocation[] {
if (!textRange) {
return [];
}
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/helpers/loadIssues.tsx b/server/sonar-web/src/main/js/components/SourceViewer/helpers/loadIssues.tsx
index e23ce75a528..fd9a03de6f2 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/helpers/loadIssues.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/helpers/loadIssues.tsx
@@ -18,7 +18,6 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { searchIssues } from '../../../api/issues';
-import { BranchLike, Issue } from '../../../app/types';
import { getBranchLikeQuery } from '../../../helpers/branches';
import { parseIssueFromResponse } from '../../../helpers/issues';
import { RawQuery } from '../../../helpers/query';
@@ -26,7 +25,7 @@ import { RawQuery } from '../../../helpers/query';
// maximum possible value
const PAGE_SIZE = 500;
-function buildQuery(component: string, branchLike: BranchLike | undefined) {
+function buildQuery(component: string, branchLike: T.BranchLike | undefined) {
return {
additionalFields: '_all',
resolved: 'false',
@@ -36,7 +35,7 @@ function buildQuery(component: string, branchLike: BranchLike | undefined) {
};
}
-export function loadPage(query: RawQuery, page: number, pageSize = PAGE_SIZE): Promise<Issue[]> {
+export function loadPage(query: RawQuery, page: number, pageSize = PAGE_SIZE): Promise<T.Issue[]> {
return searchIssues({
...query,
p: page,
@@ -51,7 +50,7 @@ export function loadPageAndNext(
toLine: number,
page: number,
pageSize = PAGE_SIZE
-): Promise<Issue[]> {
+): Promise<T.Issue[]> {
return loadPage(query, page).then(issues => {
if (issues.length === 0) {
return [];
@@ -76,8 +75,8 @@ export default function loadIssues(
component: string,
_fromLine: number,
toLine: number,
- branchLike: BranchLike | undefined
-): Promise<Issue[]> {
+ branchLike: T.BranchLike | undefined
+): Promise<T.Issue[]> {
const query = buildQuery(component, branchLike);
return new Promise(resolve => {
loadPageAndNext(query, toLine, 1).then(issues => {
diff --git a/server/sonar-web/src/main/js/components/charts/LanguageDistribution.tsx b/server/sonar-web/src/main/js/components/charts/LanguageDistribution.tsx
index 1ff1acac6c6..148d04a29df 100644
--- a/server/sonar-web/src/main/js/components/charts/LanguageDistribution.tsx
+++ b/server/sonar-web/src/main/js/components/charts/LanguageDistribution.tsx
@@ -22,12 +22,11 @@ import { sortBy } from 'lodash';
import Histogram from './Histogram';
import { formatMeasure } from '../../helpers/measures';
import { translate } from '../../helpers/l10n';
-import { Languages } from '../../app/types';
interface Props {
alignTicks?: boolean;
distribution: string;
- languages: Languages;
+ languages: T.Languages;
width: number;
}
diff --git a/server/sonar-web/src/main/js/components/common/BranchMeasures.tsx b/server/sonar-web/src/main/js/components/common/BranchMeasures.tsx
index 680ef8e51cf..055b55f6e68 100644
--- a/server/sonar-web/src/main/js/components/common/BranchMeasures.tsx
+++ b/server/sonar-web/src/main/js/components/common/BranchMeasures.tsx
@@ -21,7 +21,6 @@ import * as React from 'react';
import * as classNames from 'classnames';
import { FormattedMessage } from 'react-intl';
import { Link } from 'react-router';
-import { Measure, BranchLike } from '../../app/types';
import { getLeakValue } from '../measure/utils';
import CoverageRating from '../ui/CoverageRating';
import { formatMeasure } from '../../helpers/measures';
@@ -31,9 +30,9 @@ import DuplicationsRating from '../ui/DuplicationsRating';
import { getComponentDrilldownUrl } from '../../helpers/urls';
interface Props {
- branchLike: BranchLike;
+ branchLike: T.BranchLike;
componentKey: string;
- measures: Measure[];
+ measures: T.Measure[];
}
export default function BranchMeasures({ branchLike, componentKey, measures }: Props) {
@@ -59,10 +58,10 @@ export default function BranchMeasures({ branchLike, componentKey, measures }: P
}
interface MeasureProps {
- branchLike: BranchLike;
+ branchLike: T.BranchLike;
className?: string;
componentKey: string;
- measure: Measure | undefined;
+ measure: T.Measure | undefined;
}
export function BranchCoverage({ branchLike, className, componentKey, measure }: MeasureProps) {
diff --git a/server/sonar-web/src/main/js/components/common/BranchStatus.tsx b/server/sonar-web/src/main/js/components/common/BranchStatus.tsx
index 8fc097af87f..e1ede2a2a97 100644
--- a/server/sonar-web/src/main/js/components/common/BranchStatus.tsx
+++ b/server/sonar-web/src/main/js/components/common/BranchStatus.tsx
@@ -26,7 +26,6 @@ import CodeSmellIcon from '../icons-components/CodeSmellIcon';
import HelpTooltip from '../controls/HelpTooltip';
import Tooltip from '../controls/Tooltip';
import VulnerabilityIcon from '../icons-components/VulnerabilityIcon';
-import { BranchLike } from '../../app/types';
import {
getBranchQualityGateColor,
isShortLivingBranch,
@@ -39,7 +38,7 @@ import { formatMeasure } from '../../helpers/measures';
import './BranchStatus.css';
interface Props {
- branchLike: BranchLike;
+ branchLike: T.BranchLike;
concise?: boolean;
helpTooltipClassName?: string;
}
diff --git a/server/sonar-web/src/main/js/components/common/OrganizationAvatar.tsx b/server/sonar-web/src/main/js/components/common/OrganizationAvatar.tsx
index bda1c6774a0..c7e95c82de4 100644
--- a/server/sonar-web/src/main/js/components/common/OrganizationAvatar.tsx
+++ b/server/sonar-web/src/main/js/components/common/OrganizationAvatar.tsx
@@ -20,12 +20,11 @@
import * as React from 'react';
import * as classNames from 'classnames';
import GenericAvatar from '../ui/GenericAvatar';
-import { OrganizationBase } from '../../app/types';
import './OrganizationAvatar.css';
interface Props {
className?: string;
- organization: Pick<OrganizationBase, 'avatar' | 'name'>;
+ organization: Pick<T.OrganizationBase, 'avatar' | 'name'>;
small?: boolean;
}
diff --git a/server/sonar-web/src/main/js/components/common/PrivacyBadgeContainer.tsx b/server/sonar-web/src/main/js/components/common/PrivacyBadgeContainer.tsx
index dde6fb821a4..6bc7f28526f 100644
--- a/server/sonar-web/src/main/js/components/common/PrivacyBadgeContainer.tsx
+++ b/server/sonar-web/src/main/js/components/common/PrivacyBadgeContainer.tsx
@@ -23,7 +23,6 @@ import { connect } from 'react-redux';
import * as theme from '../../app/theme';
import Tooltip from '../controls/Tooltip';
import { translate } from '../../helpers/l10n';
-import { Visibility, Organization, CurrentUser } from '../../app/types';
import { isSonarCloud } from '../../helpers/system';
import { isCurrentUserMemberOf, isPaidOrganization } from '../../helpers/organizations';
import {
@@ -36,21 +35,21 @@ import VisibleIcon from '../icons-components/VisibleIcon';
import DocTooltip from '../docs/DocTooltip';
interface StateToProps {
- currentUser: CurrentUser;
- organization?: Organization;
- userOrganizations: Organization[];
+ currentUser: T.CurrentUser;
+ organization?: T.Organization;
+ userOrganizations: T.Organization[];
}
interface OwnProps {
className?: string;
- organization: Organization | string | undefined;
+ organization: T.Organization | string | undefined;
qualifier: string;
tooltipProps?: { projectKey: string };
- visibility: Visibility;
+ visibility: T.Visibility;
}
interface Props extends OwnProps, StateToProps {
- organization: Organization | undefined;
+ organization: T.Organization | undefined;
}
export function PrivacyBadge({
@@ -64,14 +63,14 @@ export function PrivacyBadge({
}: Props) {
const onSonarCloud = isSonarCloud();
if (
- visibility !== Visibility.Private &&
+ visibility !== 'private' &&
(!onSonarCloud || !isCurrentUserMemberOf(currentUser, organization, userOrganizations))
) {
return null;
}
let icon = null;
- if (isPaidOrganization(organization) && visibility === Visibility.Public) {
+ if (isPaidOrganization(organization) && visibility === 'public') {
icon = <VisibleIcon className="little-spacer-right" fill={theme.blue} />;
}
@@ -117,10 +116,10 @@ const mapStateToProps = (state: Store, { organization }: OwnProps) => {
export default connect(mapStateToProps)(PrivacyBadge);
-function getDoc(visibility: Visibility, icon: JSX.Element | null, organization: Organization) {
+function getDoc(visibility: T.Visibility, icon: JSX.Element | null, organization: T.Organization) {
let doc;
const { actions = {} } = organization;
- if (visibility === Visibility.Private) {
+ if (visibility === 'private') {
doc = import(/* webpackMode: "eager" */ 'Docs/tooltips/project/visibility-private.md');
} else if (icon) {
if (actions.admin) {
diff --git a/server/sonar-web/src/main/js/components/common/VisibilitySelector.tsx b/server/sonar-web/src/main/js/components/common/VisibilitySelector.tsx
index 7d6633d1189..3a5c2025479 100644
--- a/server/sonar-web/src/main/js/components/common/VisibilitySelector.tsx
+++ b/server/sonar-web/src/main/js/components/common/VisibilitySelector.tsx
@@ -20,26 +20,25 @@
import * as React from 'react';
import * as classNames from 'classnames';
import { translate } from '../../helpers/l10n';
-import { Visibility } from '../../app/types';
interface Props {
canTurnToPrivate?: boolean;
className?: string;
- onChange: (visibility: Visibility) => void;
- visibility?: Visibility;
+ onChange: (visibility: T.Visibility) => void;
+ visibility?: T.Visibility;
}
export default class VisibilitySelector extends React.PureComponent<Props> {
handlePublicClick = (event: React.SyntheticEvent<HTMLAnchorElement>) => {
event.preventDefault();
event.currentTarget.blur();
- this.props.onChange(Visibility.Public);
+ this.props.onChange('public');
};
handlePrivateClick = (event: React.SyntheticEvent<HTMLAnchorElement>) => {
event.preventDefault();
event.currentTarget.blur();
- this.props.onChange(Visibility.Private);
+ this.props.onChange('private');
};
render() {
@@ -52,7 +51,7 @@ export default class VisibilitySelector extends React.PureComponent<Props> {
onClick={this.handlePublicClick}>
<i
className={classNames('icon-radio', {
- 'is-checked': this.props.visibility === Visibility.Public
+ 'is-checked': this.props.visibility === 'public'
})}
/>
<span className="spacer-left">{translate('visibility.public')}</span>
@@ -66,7 +65,7 @@ export default class VisibilitySelector extends React.PureComponent<Props> {
onClick={this.handlePrivateClick}>
<i
className={classNames('icon-radio', {
- 'is-checked': this.props.visibility === Visibility.Private
+ 'is-checked': this.props.visibility === 'private'
})}
/>
<span className="spacer-left">{translate('visibility.private')}</span>
@@ -75,7 +74,7 @@ export default class VisibilitySelector extends React.PureComponent<Props> {
<span className="huge-spacer-left text-muted cursor-not-allowed" id="visibility-private">
<i
className={classNames('icon-radio', {
- 'is-checked': this.props.visibility === Visibility.Private
+ 'is-checked': this.props.visibility === 'private'
})}
/>
<span className="spacer-left">{translate('visibility.private')}</span>
diff --git a/server/sonar-web/src/main/js/components/common/__tests__/BranchMeasures-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/BranchMeasures-test.tsx
index c53ec9c6bd3..708db974c7d 100644
--- a/server/sonar-web/src/main/js/components/common/__tests__/BranchMeasures-test.tsx
+++ b/server/sonar-web/src/main/js/components/common/__tests__/BranchMeasures-test.tsx
@@ -20,14 +20,13 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import BranchMeasures, { BranchCoverage, BranchDuplications } from '../BranchMeasures';
-import { PullRequest } from '../../../app/types';
const MEASURES = [
{ metric: 'new_coverage', value: '0', periods: [{ index: 1, value: '95.9943' }] },
{ metric: 'new_duplicated_lines_density', periods: [{ index: 1, value: '3.5' }] }
];
-const pr: PullRequest = { base: 'master', branch: 'feature-x', key: '5', title: '' };
+const pr: T.PullRequest = { base: 'master', branch: 'feature-x', key: '5', title: '' };
describe('BranchMeasures', () => {
it('should render coverage and duplications', () => {
diff --git a/server/sonar-web/src/main/js/components/common/__tests__/BranchStatus-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/BranchStatus-test.tsx
index 5be99d59f49..6e35af6c5e7 100644
--- a/server/sonar-web/src/main/js/components/common/__tests__/BranchStatus-test.tsx
+++ b/server/sonar-web/src/main/js/components/common/__tests__/BranchStatus-test.tsx
@@ -20,7 +20,6 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import BranchStatus from '../BranchStatus';
-import { BranchType, LongLivingBranch, ShortLivingBranch, MainBranch } from '../../../app/types';
it('renders status of short-living branches', () => {
checkShort('OK', 0, 0, 0);
@@ -34,32 +33,32 @@ it('renders status of short-living branches', () => {
codeSmells: number,
vulnerabilities: number
) {
- const shortBranch: ShortLivingBranch = {
+ const shortBranch: T.ShortLivingBranch = {
isMain: false,
mergeBranch: 'master',
name: 'foo',
status: { bugs, codeSmells, qualityGateStatus, vulnerabilities },
- type: BranchType.SHORT
+ type: 'SHORT'
};
expect(shallow(<BranchStatus branchLike={shortBranch} />)).toMatchSnapshot();
}
});
it('renders status of long-living branches', () => {
- const branch: LongLivingBranch = { isMain: false, name: 'foo', type: BranchType.LONG };
+ const branch: T.LongLivingBranch = { isMain: false, name: 'foo', type: 'LONG' };
expect(getWrapper(branch).type()).toBeNull();
expect(getWrapper(branch, 'OK')).toMatchSnapshot();
expect(getWrapper(branch, 'ERROR')).toMatchSnapshot();
});
it('renders status of main branch', () => {
- const branch: MainBranch = { isMain: true, name: 'foo' };
+ const branch: T.MainBranch = { isMain: true, name: 'foo' };
expect(getWrapper(branch).type()).toBeNull();
expect(getWrapper(branch, 'OK')).toMatchSnapshot();
expect(getWrapper(branch, 'ERROR')).toMatchSnapshot();
});
-function getWrapper(branch: MainBranch | LongLivingBranch, qualityGateStatus?: string) {
+function getWrapper(branch: T.MainBranch | T.LongLivingBranch, qualityGateStatus?: string) {
if (qualityGateStatus) {
branch.status = { qualityGateStatus };
}
diff --git a/server/sonar-web/src/main/js/components/common/__tests__/PrivacyBadgeContainer-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/PrivacyBadgeContainer-test.tsx
index d087ccea800..28e77898aec 100644
--- a/server/sonar-web/src/main/js/components/common/__tests__/PrivacyBadgeContainer-test.tsx
+++ b/server/sonar-web/src/main/js/components/common/__tests__/PrivacyBadgeContainer-test.tsx
@@ -20,12 +20,11 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import { PrivacyBadge } from '../PrivacyBadgeContainer';
-import { Visibility, OrganizationSubscription } from '../../../app/types';
import { isSonarCloud } from '../../../helpers/system';
jest.mock('../../../helpers/system', () => ({ isSonarCloud: jest.fn().mockReturnValue(false) }));
-const organization = { key: 'foo', name: 'Foo' };
+const organization: T.Organization = { key: 'foo', name: 'Foo' };
const loggedInUser = { isLoggedIn: true, login: 'luke', name: 'Skywalker' };
it('renders', () => {
@@ -33,12 +32,12 @@ it('renders', () => {
});
it('do not render', () => {
- expect(getWrapper({ visibility: Visibility.Public })).toMatchSnapshot();
+ expect(getWrapper({ visibility: 'public' })).toMatchSnapshot();
});
it('renders public', () => {
(isSonarCloud as jest.Mock<any>).mockReturnValueOnce(true);
- expect(getWrapper({ visibility: Visibility.Public })).toMatchSnapshot();
+ expect(getWrapper({ visibility: 'public' })).toMatchSnapshot();
});
it('renders public with icon', () => {
@@ -48,9 +47,9 @@ it('renders public with icon', () => {
organization: {
...organization,
actions: { admin: true },
- subscription: OrganizationSubscription.Paid
+ subscription: 'PAID'
},
- visibility: Visibility.Public
+ visibility: 'public'
})
).toMatchSnapshot();
});
@@ -62,7 +61,7 @@ function getWrapper(props = {}) {
organization={organization}
qualifier="TRK"
userOrganizations={[organization]}
- visibility={Visibility.Private}
+ visibility={'private'}
{...props}
/>
);
diff --git a/server/sonar-web/src/main/js/components/common/__tests__/VisibilitySelector-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/VisibilitySelector-test.tsx
index 73c2b7771e6..655563b8932 100644
--- a/server/sonar-web/src/main/js/components/common/__tests__/VisibilitySelector-test.tsx
+++ b/server/sonar-web/src/main/js/components/common/__tests__/VisibilitySelector-test.tsx
@@ -21,37 +21,28 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import VisibilitySelector from '../VisibilitySelector';
import { click } from '../../../helpers/testUtils';
-import { Visibility } from '../../../app/types';
it('changes visibility', () => {
const onChange = jest.fn();
const wrapper = shallow(
- <VisibilitySelector
- canTurnToPrivate={true}
- onChange={onChange}
- visibility={Visibility.Public}
- />
+ <VisibilitySelector canTurnToPrivate={true} onChange={onChange} visibility="public" />
);
expect(wrapper).toMatchSnapshot();
click(wrapper.find('#visibility-private'));
- expect(onChange).toBeCalledWith(Visibility.Private);
+ expect(onChange).toBeCalledWith('private');
- wrapper.setProps({ visibility: Visibility.Private });
+ wrapper.setProps({ visibility: 'private' });
expect(wrapper).toMatchSnapshot();
click(wrapper.find('#visibility-public'));
- expect(onChange).toBeCalledWith(Visibility.Public);
+ expect(onChange).toBeCalledWith('public');
});
it('renders disabled', () => {
expect(
shallow(
- <VisibilitySelector
- canTurnToPrivate={false}
- onChange={jest.fn()}
- visibility={Visibility.Public}
- />
+ <VisibilitySelector canTurnToPrivate={false} onChange={jest.fn()} visibility="public" />
)
).toMatchSnapshot();
});
diff --git a/server/sonar-web/src/main/js/components/controls/HomePageSelect.tsx b/server/sonar-web/src/main/js/components/controls/HomePageSelect.tsx
index fef52ae8902..084637d8f73 100644
--- a/server/sonar-web/src/main/js/components/controls/HomePageSelect.tsx
+++ b/server/sonar-web/src/main/js/components/controls/HomePageSelect.tsx
@@ -22,23 +22,22 @@ import * as classNames from 'classnames';
import { connect } from 'react-redux';
import Tooltip from './Tooltip';
import HomeIcon from '../icons-components/HomeIcon';
-import { CurrentUser, HomePage, isSameHomePage } from '../../app/types';
import { translate } from '../../helpers/l10n';
import { getCurrentUser, Store } from '../../store/rootReducer';
import { setHomePage } from '../../store/users';
import { isLoggedIn } from '../../helpers/users';
interface StateProps {
- currentUser: CurrentUser;
+ currentUser: T.CurrentUser;
}
interface DispatchProps {
- setHomePage: (homepage: HomePage) => void;
+ setHomePage: (homepage: T.HomePage) => void;
}
interface Props extends StateProps, DispatchProps {
className?: string;
- currentPage: HomePage;
+ currentPage: T.HomePage;
}
class HomePageSelect extends React.PureComponent<Props> {
@@ -92,3 +91,12 @@ export default connect(
mapStateToProps,
mapDispatchToProps
)(HomePageSelect);
+
+function isSameHomePage(a: T.HomePage, b: T.HomePage) {
+ return (
+ a.type === b.type &&
+ (a as any).branch === (b as any).branch &&
+ (a as any).component === (b as any).component &&
+ (a as any).organization === (b as any).organization
+ );
+}
diff --git a/server/sonar-web/src/main/js/components/controls/ValidationForm.tsx b/server/sonar-web/src/main/js/components/controls/ValidationForm.tsx
index b4e061b3924..47b04cbf0c4 100644
--- a/server/sonar-web/src/main/js/components/controls/ValidationForm.tsx
+++ b/server/sonar-web/src/main/js/components/controls/ValidationForm.tsx
@@ -19,9 +19,8 @@
*/
import * as React from 'react';
import { FormikActions, FormikProps, Formik } from 'formik';
-import { Omit } from '../../app/types';
-export type ChildrenProps<V> = Omit<FormikProps<V>, 'handleSubmit'>;
+export type ChildrenProps<V> = T.Omit<FormikProps<V>, 'handleSubmit'>;
interface Props<V> {
children: (props: ChildrenProps<V>) => React.ReactNode;
diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/HomePageSelect-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/HomePageSelect-test.tsx
index 89803a78e97..686e0d663fb 100644
--- a/server/sonar-web/src/main/js/components/controls/__tests__/HomePageSelect-test.tsx
+++ b/server/sonar-web/src/main/js/components/controls/__tests__/HomePageSelect-test.tsx
@@ -21,7 +21,6 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import HomePageSelect from '../HomePageSelect';
import { setHomePage } from '../../../api/users';
-import { HomePageType, HomePage, LoggedInUser, CurrentUser } from '../../../app/types';
import { click } from '../../../helpers/testUtils';
import rootReducer, { getCurrentUser, Store } from '../../../store/rootReducer';
import configureStore from '../../../store/utils/configureStore';
@@ -30,7 +29,7 @@ jest.mock('../../../api/users', () => ({
setHomePage: jest.fn(() => Promise.resolve())
}));
-const homepage: HomePage = { type: HomePageType.Projects };
+const homepage: T.HomePage = { type: 'PROJECTS' };
it('should render unchecked', () => {
const store = configureStore(rootReducer, {
@@ -41,7 +40,7 @@ it('should render unchecked', () => {
it('should render checked', () => {
const store = configureStore(rootReducer, {
- users: { currentUser: { isLoggedIn: true, homepage } as CurrentUser }
+ users: { currentUser: { isLoggedIn: true, homepage } as T.CurrentUser }
} as Store);
expect(getWrapper(homepage, store)).toMatchSnapshot();
});
@@ -53,7 +52,7 @@ it('should set new home page', async () => {
const wrapper = getWrapper(homepage, store);
click(wrapper.find('a'));
await new Promise(setImmediate);
- const currentUser = getCurrentUser(store.getState() as Store) as LoggedInUser;
+ const currentUser = getCurrentUser(store.getState() as Store) as T.LoggedInUser;
expect(currentUser.homepage).toEqual(homepage);
expect(setHomePage).toBeCalledWith(homepage);
});
@@ -65,7 +64,7 @@ it('should not render for anonymous', () => {
expect(getWrapper(homepage, store).type()).toBeNull();
});
-function getWrapper(currentPage: HomePage, store: any) {
+function getWrapper(currentPage: T.HomePage, store: any) {
return shallow(<HomePageSelect currentPage={currentPage} />, {
context: { store }
}).dive();
diff --git a/server/sonar-web/src/main/js/components/facet/ListStyleFacet.tsx b/server/sonar-web/src/main/js/components/facet/ListStyleFacet.tsx
index 473a4cc19b4..d6f2556fee6 100644
--- a/server/sonar-web/src/main/js/components/facet/ListStyleFacet.tsx
+++ b/server/sonar-web/src/main/js/components/facet/ListStyleFacet.tsx
@@ -27,7 +27,6 @@ import ListStyleFacetFooter from './ListStyleFacetFooter';
import MultipleSelectionHint from './MultipleSelectionHint';
import { translate } from '../../helpers/l10n';
import DeferredSpinner from '../common/DeferredSpinner';
-import { Paging } from '../../app/types';
import SearchBox from '../controls/SearchBox';
import ListFooter from '../controls/ListFooter';
import { formatMeasure } from '../../helpers/measures';
@@ -37,7 +36,7 @@ import { Alert } from '../ui/Alert';
interface SearchResponse<S> {
maxResults?: boolean;
results: S[];
- paging?: Paging;
+ paging?: T.Paging;
}
export interface Props<S> {
@@ -72,7 +71,7 @@ interface State<S> {
query: string;
searching: boolean;
searchMaxResults?: boolean;
- searchPaging?: Paging;
+ searchPaging?: T.Paging;
searchResults?: S[];
searchResultsCounts: { [key: string]: number };
showFullList: boolean;
diff --git a/server/sonar-web/src/main/js/components/hoc/__tests__/withCurrentUser-test.tsx b/server/sonar-web/src/main/js/components/hoc/__tests__/withCurrentUser-test.tsx
index 84c292a37f9..d04cfceebfd 100644
--- a/server/sonar-web/src/main/js/components/hoc/__tests__/withCurrentUser-test.tsx
+++ b/server/sonar-web/src/main/js/components/hoc/__tests__/withCurrentUser-test.tsx
@@ -20,10 +20,9 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import { createStore } from 'redux';
-import { CurrentUser } from '../../../app/types';
import { withCurrentUser } from '../withCurrentUser';
-class X extends React.Component<{ currentUser: CurrentUser }> {
+class X extends React.Component<{ currentUser: T.CurrentUser }> {
render() {
return <div />;
}
diff --git a/server/sonar-web/src/main/js/components/hoc/__tests__/withUserOrganizations-test.tsx b/server/sonar-web/src/main/js/components/hoc/__tests__/withUserOrganizations-test.tsx
index dee2f7fec03..637d54e55ea 100644
--- a/server/sonar-web/src/main/js/components/hoc/__tests__/withUserOrganizations-test.tsx
+++ b/server/sonar-web/src/main/js/components/hoc/__tests__/withUserOrganizations-test.tsx
@@ -20,12 +20,11 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import { createStore } from 'redux';
-import { Organization } from '../../../app/types';
import { withUserOrganizations } from '../withUserOrganizations';
jest.mock('../../../api/organizations', () => ({ getOrganizations: jest.fn() }));
-class X extends React.Component<{ userOrganizations: Organization[] }> {
+class X extends React.Component<{ userOrganizations: T.Organization[] }> {
render() {
return <div />;
}
diff --git a/server/sonar-web/src/main/js/components/hoc/whenLoggedIn.tsx b/server/sonar-web/src/main/js/components/hoc/whenLoggedIn.tsx
index 2ce4c8894c0..30e32f600e0 100644
--- a/server/sonar-web/src/main/js/components/hoc/whenLoggedIn.tsx
+++ b/server/sonar-web/src/main/js/components/hoc/whenLoggedIn.tsx
@@ -19,14 +19,13 @@
*/
import * as React from 'react';
import { withCurrentUser } from './withCurrentUser';
-import { CurrentUser } from '../../app/types';
import { isLoggedIn } from '../../helpers/users';
import handleRequiredAuthentication from '../../app/utils/handleRequiredAuthentication';
export function whenLoggedIn<P>(WrappedComponent: React.ComponentClass<P>) {
const wrappedDisplayName = WrappedComponent.displayName || WrappedComponent.name || 'Component';
- class Wrapper extends React.Component<P & { currentUser: CurrentUser }> {
+ class Wrapper extends React.Component<P & { currentUser: T.CurrentUser }> {
static displayName = `whenLoggedIn(${wrappedDisplayName})`;
componentDidMount() {
diff --git a/server/sonar-web/src/main/js/components/hoc/withCurrentUser.tsx b/server/sonar-web/src/main/js/components/hoc/withCurrentUser.tsx
index b1933e1e23a..26a903ad595 100644
--- a/server/sonar-web/src/main/js/components/hoc/withCurrentUser.tsx
+++ b/server/sonar-web/src/main/js/components/hoc/withCurrentUser.tsx
@@ -19,15 +19,14 @@
*/
import * as React from 'react';
import { connect } from 'react-redux';
-import { CurrentUser } from '../../app/types';
import { Store, getCurrentUser } from '../../store/rootReducer';
export function withCurrentUser<P>(
- WrappedComponent: React.ComponentClass<P & { currentUser: CurrentUser }>
+ WrappedComponent: React.ComponentClass<P & { currentUser: T.CurrentUser }>
) {
const wrappedDisplayName = WrappedComponent.displayName || WrappedComponent.name || 'Component';
- class Wrapper extends React.Component<P & { currentUser: CurrentUser }> {
+ class Wrapper extends React.Component<P & { currentUser: T.CurrentUser }> {
static displayName = `withCurrentUser(${wrappedDisplayName})`;
render() {
diff --git a/server/sonar-web/src/main/js/components/hoc/withUserOrganizations.tsx b/server/sonar-web/src/main/js/components/hoc/withUserOrganizations.tsx
index bedc033bc09..485c9b6ac96 100644
--- a/server/sonar-web/src/main/js/components/hoc/withUserOrganizations.tsx
+++ b/server/sonar-web/src/main/js/components/hoc/withUserOrganizations.tsx
@@ -21,17 +21,19 @@ import * as React from 'react';
import { connect } from 'react-redux';
import { Store, getMyOrganizations } from '../../store/rootReducer';
import { fetchMyOrganizations } from '../../apps/account/organizations/actions';
-import { Organization } from '../../app/types';
export function withUserOrganizations<P>(
WrappedComponent: React.ComponentClass<
P & {
- personalOrganization?: Organization;
- userOrganizations: Organization[];
+ personalOrganization?: T.Organization;
+ userOrganizations: T.Organization[];
}
>
) {
- type Props = P & { fetchMyOrganizations: () => Promise<void>; userOrganizations: Organization[] };
+ type Props = P & {
+ fetchMyOrganizations: () => Promise<void>;
+ userOrganizations: T.Organization[];
+ };
const wrappedDisplayName = WrappedComponent.displayName || WrappedComponent.name || 'Component';
class Wrapper extends React.Component<Props> {
diff --git a/server/sonar-web/src/main/js/components/icons-components/BranchIcon.tsx b/server/sonar-web/src/main/js/components/icons-components/BranchIcon.tsx
index f4dae266050..e9e89e9ecd6 100644
--- a/server/sonar-web/src/main/js/components/icons-components/BranchIcon.tsx
+++ b/server/sonar-web/src/main/js/components/icons-components/BranchIcon.tsx
@@ -22,11 +22,10 @@ import ShortLivingBranchIcon from './ShortLivingBranchIcon';
import LongLivingBranchIcon from './LongLivingBranchIcon';
import PullRequestIcon from './PullRequestIcon';
import { IconProps } from './Icon';
-import { BranchLike } from '../../app/types';
import { isShortLivingBranch, isPullRequest } from '../../helpers/branches';
interface Props extends IconProps {
- branchLike: BranchLike;
+ branchLike: T.BranchLike;
}
export default function BranchIcon({ branchLike, ...props }: Props) {
diff --git a/server/sonar-web/src/main/js/components/issue/Issue.tsx b/server/sonar-web/src/main/js/components/issue/Issue.tsx
index e08b886fff2..663105633eb 100644
--- a/server/sonar-web/src/main/js/components/issue/Issue.tsx
+++ b/server/sonar-web/src/main/js/components/issue/Issue.tsx
@@ -22,19 +22,18 @@ import * as key from 'keymaster';
import IssueView from './IssueView';
import { updateIssue } from './actions';
import { setIssueAssignee } from '../../api/issues';
-import { BranchLike, Issue as IssueType } from '../../app/types';
import './Issue.css';
interface Props {
- branchLike?: BranchLike;
+ branchLike?: T.BranchLike;
checked?: boolean;
displayLocationsCount?: boolean;
displayLocationsLink?: boolean;
- issue: IssueType;
- onChange: (issue: IssueType) => void;
+ issue: T.Issue;
+ onChange: (issue: T.Issue) => void;
onCheck?: (issue: string, event: { shiftKey?: boolean }) => void;
onClick: (issueKey: string) => void;
- onFilter?: (property: string, issue: IssueType) => void;
+ onFilter?: (property: string, issue: T.Issue) => void;
onPopupToggle: (issue: string, popupName: string, open?: boolean) => void;
openPopup?: string;
selected: boolean;
diff --git a/server/sonar-web/src/main/js/components/issue/IssueView.tsx b/server/sonar-web/src/main/js/components/issue/IssueView.tsx
index 932d51a9176..486b2ac4b66 100644
--- a/server/sonar-web/src/main/js/components/issue/IssueView.tsx
+++ b/server/sonar-web/src/main/js/components/issue/IssueView.tsx
@@ -24,20 +24,19 @@ import IssueActionsBar from './components/IssueActionsBar';
import IssueCommentLine from './components/IssueCommentLine';
import { updateIssue } from './actions';
import { deleteIssueComment, editIssueComment } from '../../api/issues';
-import { Issue, BranchLike } from '../../app/types';
interface Props {
- branchLike?: BranchLike;
+ branchLike?: T.BranchLike;
checked?: boolean;
currentPopup?: string;
displayLocationsCount?: boolean;
displayLocationsLink?: boolean;
- issue: Issue;
+ issue: T.Issue;
onAssign: (login: string) => void;
- onChange: (issue: Issue) => void;
+ onChange: (issue: T.Issue) => void;
onCheck?: (issue: string, event: { shiftKey?: boolean }) => void;
onClick: (issueKey: string) => void;
- onFilter?: (property: string, issue: Issue) => void;
+ onFilter?: (property: string, issue: T.Issue) => void;
selected: boolean;
togglePopup: (popup: string, show: boolean | void) => void;
}
diff --git a/server/sonar-web/src/main/js/components/issue/actions.ts b/server/sonar-web/src/main/js/components/issue/actions.ts
index 763c3b2baca..f00f6599d77 100644
--- a/server/sonar-web/src/main/js/components/issue/actions.ts
+++ b/server/sonar-web/src/main/js/components/issue/actions.ts
@@ -18,14 +18,13 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { parseIssueFromResponse } from '../../helpers/issues';
-import { Issue } from '../../app/types';
import { IssueResponse } from '../../api/issues';
export const updateIssue = (
- onChange: (issue: Issue) => void,
+ onChange: (issue: T.Issue) => void,
resultPromise: Promise<IssueResponse>,
- oldIssue?: Issue,
- newIssue?: Issue
+ oldIssue?: T.Issue,
+ newIssue?: T.Issue
) => {
const optimisticUpdate = oldIssue !== undefined && newIssue !== undefined;
if (optimisticUpdate) {
diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueActionsBar.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueActionsBar.tsx
index ae74f0131f9..a800041b208 100644
--- a/server/sonar-web/src/main/js/components/issue/components/IssueActionsBar.tsx
+++ b/server/sonar-web/src/main/js/components/issue/components/IssueActionsBar.tsx
@@ -25,16 +25,15 @@ import IssueTags from './IssueTags';
import IssueTransition from './IssueTransition';
import IssueType from './IssueType';
import { updateIssue } from '../actions';
-import { IssueType as IssueTypes, Issue } from '../../../app/types';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { RawQuery } from '../../../helpers/query';
import { IssueResponse } from '../../../api/issues';
interface Props {
- issue: Issue;
+ issue: T.Issue;
currentPopup?: string;
onAssign: (login: string) => void;
- onChange: (issue: Issue) => void;
+ onChange: (issue: T.Issue) => void;
togglePopup: (popup: string, show?: boolean) => void;
}
@@ -48,7 +47,7 @@ export default class IssueActionsBar extends React.PureComponent<Props, State> {
};
setIssueProperty = (
- property: keyof Issue,
+ property: keyof T.Issue,
popup: string,
apiCall: (query: RawQuery) => Promise<IssueResponse>,
value: string
@@ -71,11 +70,11 @@ export default class IssueActionsBar extends React.PureComponent<Props, State> {
this.props.togglePopup('comment', open);
};
- handleTransition = (issue: Issue) => {
+ handleTransition = (issue: T.Issue) => {
this.props.onChange(issue);
if (
issue.resolution === 'FALSE-POSITIVE' ||
- (issue.resolution === 'WONTFIX' && issue.type !== IssueTypes.Hotspot)
+ (issue.resolution === 'WONTFIX' && issue.type !== 'SECURITY_HOTSPOT')
) {
this.toggleComment(true, translate('issue.comment.tell_why'));
}
@@ -89,7 +88,7 @@ export default class IssueActionsBar extends React.PureComponent<Props, State> {
const canSetType = issue.actions.includes('set_type');
const canSetTags = issue.actions.includes('set_tags');
const hasTransitions = issue.transitions && issue.transitions.length > 0;
- const isSecurityHotspot = issue.type === IssueTypes.Hotspot;
+ const isSecurityHotspot = issue.type === 'SECURITY_HOTSPOT';
return (
<div className="issue-actions">
diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueAssign.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueAssign.tsx
index 34072ed3d2c..b65e3c2e53d 100644
--- a/server/sonar-web/src/main/js/components/issue/components/IssueAssign.tsx
+++ b/server/sonar-web/src/main/js/components/issue/components/IssueAssign.tsx
@@ -24,11 +24,10 @@ import Toggler from '../../controls/Toggler';
import DropdownIcon from '../../icons-components/DropdownIcon';
import { Button } from '../../ui/buttons';
import { translate } from '../../../helpers/l10n';
-import { Issue } from '../../../app/types';
interface Props {
isOpen: boolean;
- issue: Pick<Issue, 'assignee' | 'assigneeAvatar' | 'assigneeName' | 'projectOrganization'>;
+ issue: Pick<T.Issue, 'assignee' | 'assigneeAvatar' | 'assigneeName' | 'projectOrganization'>;
canAssign: boolean;
onAssign: (login: string) => void;
togglePopup: (popup: string, show?: boolean) => void;
diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueChangelog.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueChangelog.tsx
index 19e8b1a3ca5..70d4c8ee1dc 100644
--- a/server/sonar-web/src/main/js/components/issue/components/IssueChangelog.tsx
+++ b/server/sonar-web/src/main/js/components/issue/components/IssueChangelog.tsx
@@ -25,11 +25,10 @@ import DateTimeFormatter from '../../intl/DateTimeFormatter';
import Toggler from '../../controls/Toggler';
import Tooltip from '../../controls/Tooltip';
import { Button } from '../../ui/buttons';
-import { Issue } from '../../../app/types';
interface Props {
isOpen: boolean;
- issue: Pick<Issue, 'author' | 'creationDate' | 'key'>;
+ issue: Pick<T.Issue, 'author' | 'creationDate' | 'key'>;
creationDate: string;
togglePopup: (popup: string, show?: boolean) => void;
}
diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueCommentAction.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueCommentAction.tsx
index 950c88e89ae..39ab83ff97a 100644
--- a/server/sonar-web/src/main/js/components/issue/components/IssueCommentAction.tsx
+++ b/server/sonar-web/src/main/js/components/issue/components/IssueCommentAction.tsx
@@ -24,13 +24,12 @@ import { Button } from '../../ui/buttons';
import CommentPopup from '../popups/CommentPopup';
import { addIssueComment } from '../../../api/issues';
import { translate } from '../../../helpers/l10n';
-import { Issue } from '../../../app/types';
interface Props {
commentPlaceholder: string;
currentPopup?: string;
issueKey: string;
- onChange: (issue: Issue) => void;
+ onChange: (issue: T.Issue) => void;
toggleComment: (open?: boolean, placeholder?: string) => void;
}
diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueCommentLine.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueCommentLine.tsx
index ce516d1775a..9e3c10690b0 100644
--- a/server/sonar-web/src/main/js/components/issue/components/IssueCommentLine.tsx
+++ b/server/sonar-web/src/main/js/components/issue/components/IssueCommentLine.tsx
@@ -24,10 +24,9 @@ import { EditButton, DeleteButton } from '../../ui/buttons';
import CommentDeletePopup from '../popups/CommentDeletePopup';
import CommentPopup from '../popups/CommentPopup';
import DateFromNow from '../../intl/DateFromNow';
-import { IssueComment } from '../../../app/types';
interface Props {
- comment: IssueComment;
+ comment: T.IssueComment;
onDelete: (comment: string) => void;
onEdit: (comment: string, text: string) => void;
}
diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueSeverity.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueSeverity.tsx
index 3913c36af51..8823284000e 100644
--- a/server/sonar-web/src/main/js/components/issue/components/IssueSeverity.tsx
+++ b/server/sonar-web/src/main/js/components/issue/components/IssueSeverity.tsx
@@ -24,15 +24,14 @@ import Toggler from '../../controls/Toggler';
import DropdownIcon from '../../icons-components/DropdownIcon';
import SeverityHelper from '../../shared/SeverityHelper';
import { Button } from '../../ui/buttons';
-import { Issue } from '../../../app/types';
import { RawQuery } from '../../../helpers/query';
interface Props {
canSetSeverity: boolean;
isOpen: boolean;
- issue: Pick<Issue, 'severity'>;
+ issue: Pick<T.Issue, 'severity'>;
setIssueProperty: (
- property: keyof Issue,
+ property: keyof T.Issue,
popup: string,
apiCall: (query: RawQuery) => Promise<IssueResponse>,
value: string
diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueTags.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueTags.tsx
index c0b8cb68f40..d0ae952a225 100644
--- a/server/sonar-web/src/main/js/components/issue/components/IssueTags.tsx
+++ b/server/sonar-web/src/main/js/components/issue/components/IssueTags.tsx
@@ -25,13 +25,12 @@ import Toggler from '../../controls/Toggler';
import TagsList from '../../tags/TagsList';
import { Button } from '../../ui/buttons';
import { translate } from '../../../helpers/l10n';
-import { Issue } from '../../../app/types';
interface Props {
canSetTags: boolean;
isOpen: boolean;
- issue: Pick<Issue, 'key' | 'projectOrganization' | 'tags'>;
- onChange: (issue: Issue) => void;
+ issue: Pick<T.Issue, 'key' | 'projectOrganization' | 'tags'>;
+ onChange: (issue: T.Issue) => void;
togglePopup: (popup: string, show?: boolean) => void;
}
@@ -46,8 +45,8 @@ export default class IssueTags extends React.PureComponent<Props> {
updateIssue(
this.props.onChange,
setIssueTags({ issue: issue.key, tags: tags.join(',') }),
- issue as Issue,
- newIssue as Issue
+ issue as T.Issue,
+ newIssue as T.Issue
);
};
diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.tsx
index 11a869003e9..25739813227 100644
--- a/server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.tsx
+++ b/server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.tsx
@@ -29,15 +29,14 @@ import { getBranchLikeQuery } from '../../../helpers/branches';
import { getComponentIssuesUrl } from '../../../helpers/urls';
import { formatMeasure } from '../../../helpers/measures';
import { translate, translateWithParameters } from '../../../helpers/l10n';
-import { IssueType, BranchLike, Issue } from '../../../app/types';
interface Props {
- branchLike?: BranchLike;
+ branchLike?: T.BranchLike;
currentPopup?: string;
displayLocationsCount?: boolean;
displayLocationsLink?: boolean;
- issue: Issue;
- onFilter?: (property: string, issue: Issue) => void;
+ issue: T.Issue;
+ onFilter?: (property: string, issue: T.Issue) => void;
togglePopup: (popup: string, show?: boolean) => void;
}
@@ -71,7 +70,7 @@ export default function IssueTitleBar(props: Props) {
<div className="issue-row">
<IssueMessage
engine={issue.externalRuleEngine}
- manualVulnerability={issue.fromHotspot && issue.type === IssueType.Vulnerability}
+ manualVulnerability={issue.fromHotspot && issue.type === 'VULNERABILITY'}
message={issue.message}
organization={issue.organization}
rule={issue.rule}
diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueTransition.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueTransition.tsx
index 1bb4bde8f59..ad5e2938522 100644
--- a/server/sonar-web/src/main/js/components/issue/components/IssueTransition.tsx
+++ b/server/sonar-web/src/main/js/components/issue/components/IssueTransition.tsx
@@ -25,13 +25,12 @@ import Toggler from '../../controls/Toggler';
import DropdownIcon from '../../icons-components/DropdownIcon';
import StatusHelper from '../../shared/StatusHelper';
import { Button } from '../../ui/buttons';
-import { Issue } from '../../../app/types';
interface Props {
hasTransitions: boolean;
isOpen: boolean;
- issue: Pick<Issue, 'key' | 'resolution' | 'status' | 'transitions'>;
- onChange: (issue: Issue) => void;
+ issue: Pick<T.Issue, 'key' | 'resolution' | 'status' | 'transitions'>;
+ onChange: (issue: T.Issue) => void;
togglePopup: (popup: string, show?: boolean) => void;
}
diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueType.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueType.tsx
index 6d38647517a..b99f152e9a4 100644
--- a/server/sonar-web/src/main/js/components/issue/components/IssueType.tsx
+++ b/server/sonar-web/src/main/js/components/issue/components/IssueType.tsx
@@ -25,15 +25,14 @@ import DropdownIcon from '../../icons-components/DropdownIcon';
import { Button } from '../../ui/buttons';
import IssueTypeIcon from '../../ui/IssueTypeIcon';
import { translate } from '../../../helpers/l10n';
-import { Issue } from '../../../app/types';
import { RawQuery } from '../../../helpers/query';
interface Props {
canSetType: boolean;
isOpen: boolean;
- issue: Pick<Issue, 'type'>;
+ issue: Pick<T.Issue, 'type'>;
setIssueProperty: (
- property: keyof Issue,
+ property: keyof T.Issue,
popup: string,
apiCall: (query: RawQuery) => Promise<IssueResponse>,
value: string
diff --git a/server/sonar-web/src/main/js/components/issue/components/SimilarIssuesFilter.tsx b/server/sonar-web/src/main/js/components/issue/components/SimilarIssuesFilter.tsx
index 2af9d3a8ff3..60fb22dfe6c 100644
--- a/server/sonar-web/src/main/js/components/issue/components/SimilarIssuesFilter.tsx
+++ b/server/sonar-web/src/main/js/components/issue/components/SimilarIssuesFilter.tsx
@@ -24,17 +24,16 @@ import DropdownIcon from '../../icons-components/DropdownIcon';
import FilterIcon from '../../icons-components/FilterIcon';
import { Button } from '../../ui/buttons';
import { translate } from '../../../helpers/l10n';
-import { Issue } from '../../../app/types';
interface Props {
isOpen: boolean;
- issue: Issue;
+ issue: T.Issue;
togglePopup: (popup: string, show?: boolean) => void;
- onFilter?: (property: string, issue: Issue) => void;
+ onFilter?: (property: string, issue: T.Issue) => void;
}
export default class SimilarIssuesFilter extends React.PureComponent<Props> {
- handleFilter = (property: string, issue: Issue) => {
+ handleFilter = (property: string, issue: T.Issue) => {
this.togglePopup(false);
if (this.props.onFilter) {
this.props.onFilter(property, issue);
diff --git a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueCommentLine-test.tsx b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueCommentLine-test.tsx
index ce358423f35..0ce8f9f43d7 100644
--- a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueCommentLine-test.tsx
+++ b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueCommentLine-test.tsx
@@ -21,9 +21,8 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import IssueCommentLine from '../IssueCommentLine';
import { click } from '../../../../helpers/testUtils';
-import { IssueComment } from '../../../../app/types';
-const comment: IssueComment = {
+const comment: T.IssueComment = {
authorAvatar: 'gravatarhash',
authorName: 'John Doe',
createdAt: '2017-03-01T09:36:01+0100',
diff --git a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTitleBar-test.tsx b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTitleBar-test.tsx
index 43b0c9a8f21..6dcfe67f543 100644
--- a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTitleBar-test.tsx
+++ b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTitleBar-test.tsx
@@ -20,15 +20,8 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import IssueTitleBar from '../IssueTitleBar';
-import {
- ShortLivingBranch,
- Issue,
- BranchType,
- IssueType,
- FlowLocation
-} from '../../../../app/types';
-const issue: Issue = {
+const issue: T.Issue = {
actions: [],
component: 'main.js',
componentLongName: 'main.js',
@@ -52,16 +45,16 @@ const issue: Issue = {
status: 'OPEN',
textRange: { startLine: 25, endLine: 26, startOffset: 0, endOffset: 15 },
transitions: [],
- type: IssueType.Bug
+ type: 'BUG'
};
-const issueWithLocations: Issue = {
+const issueWithLocations: T.Issue = {
...issue,
flows: [[loc(), loc(), loc()], [loc(), loc()]],
secondaryLocations: [loc(), loc()]
};
-function loc(): FlowLocation {
+function loc(): T.FlowLocation {
return {
component: 'main.js',
textRange: { startLine: 1, startOffset: 1, endLine: 2, endOffset: 2 }
@@ -69,11 +62,11 @@ function loc(): FlowLocation {
}
it('should render the titlebar correctly', () => {
- const branch: ShortLivingBranch = {
+ const branch: T.ShortLivingBranch = {
isMain: false,
mergeBranch: 'master',
name: 'feature-1.0',
- type: BranchType.SHORT
+ type: 'SHORT'
};
const element = shallow(
<IssueTitleBar branchLike={branch} issue={issue} togglePopup={jest.fn()} />
diff --git a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueType-test.tsx b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueType-test.tsx
index a7d62b447c1..e078ebb237e 100644
--- a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueType-test.tsx
+++ b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueType-test.tsx
@@ -21,10 +21,9 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import IssueType from '../IssueType';
import { click } from '../../../../helpers/testUtils';
-import { IssueType as Type } from '../../../../app/types';
-const issue = {
- type: Type.Bug
+const issue: Pick<T.Issue, 'type'> = {
+ type: 'BUG'
};
it('should render without the action when the correct rights are missing', () => {
diff --git a/server/sonar-web/src/main/js/components/issue/popups/ChangelogPopup.tsx b/server/sonar-web/src/main/js/components/issue/popups/ChangelogPopup.tsx
index 394fa2567d1..d8ee5dcd763 100644
--- a/server/sonar-web/src/main/js/components/issue/popups/ChangelogPopup.tsx
+++ b/server/sonar-web/src/main/js/components/issue/popups/ChangelogPopup.tsx
@@ -24,7 +24,6 @@ import Avatar from '../../ui/Avatar';
import DateTimeFormatter from '../../intl/DateTimeFormatter';
import IssueChangelogDiff, { ChangelogDiff } from '../components/IssueChangelogDiff';
import { DropdownOverlay } from '../../controls/Dropdown';
-import { Issue } from '../../../app/types';
interface Changelog {
avatar?: string;
@@ -35,7 +34,7 @@ interface Changelog {
}
interface Props {
- issue: Pick<Issue, 'author' | 'creationDate' | 'key'>;
+ issue: Pick<T.Issue, 'author' | 'creationDate' | 'key'>;
}
interface State {
diff --git a/server/sonar-web/src/main/js/components/issue/popups/CommentPopup.tsx b/server/sonar-web/src/main/js/components/issue/popups/CommentPopup.tsx
index fe399cd8d4c..68d3933ee06 100644
--- a/server/sonar-web/src/main/js/components/issue/popups/CommentPopup.tsx
+++ b/server/sonar-web/src/main/js/components/issue/popups/CommentPopup.tsx
@@ -22,10 +22,9 @@ import MarkdownTips from '../../common/MarkdownTips';
import { Button, ResetButtonLink } from '../../ui/buttons';
import { translate } from '../../../helpers/l10n';
import { DropdownOverlay } from '../../controls/Dropdown';
-import { IssueComment } from '../../../app/types';
interface Props {
- comment?: Pick<IssueComment, 'markdown'>;
+ comment?: Pick<T.IssueComment, 'markdown'>;
onComment: (text: string) => void;
toggleComment: (visible: boolean) => void;
placeholder: string;
diff --git a/server/sonar-web/src/main/js/components/issue/popups/SetAssigneePopup.tsx b/server/sonar-web/src/main/js/components/issue/popups/SetAssigneePopup.tsx
index 6d4e9744ebd..872760f182a 100644
--- a/server/sonar-web/src/main/js/components/issue/popups/SetAssigneePopup.tsx
+++ b/server/sonar-web/src/main/js/components/issue/popups/SetAssigneePopup.tsx
@@ -29,7 +29,6 @@ import { searchUsers } from '../../../api/users';
import { translate } from '../../../helpers/l10n';
import { getCurrentUser, Store } from '../../../store/rootReducer';
import { DropdownOverlay } from '../../controls/Dropdown';
-import { Issue, CurrentUser, OrganizationMember } from '../../../app/types';
import { isSonarCloud } from '../../../helpers/system';
import { isLoggedIn } from '../../../helpers/users';
@@ -41,8 +40,8 @@ interface User {
}
interface Props {
- currentUser: CurrentUser;
- issue: Pick<Issue, 'projectOrganization'>;
+ currentUser: T.CurrentUser;
+ issue: Pick<T.Issue, 'projectOrganization'>;
onSelect: (login: string) => void;
}
@@ -84,7 +83,7 @@ class SetAssigneePopup extends React.PureComponent<Props, State> {
searchUsers({ q: query, ps: LIST_SIZE }).then(this.handleSearchResult, () => {});
};
- handleSearchResult = (response: { users: OrganizationMember[] }) => {
+ handleSearchResult = (response: { users: T.OrganizationMember[] }) => {
this.setState({
users: response.users,
currentUser: response.users.length > 0 ? response.users[0].login : ''
diff --git a/server/sonar-web/src/main/js/components/issue/popups/SetSeverityPopup.tsx b/server/sonar-web/src/main/js/components/issue/popups/SetSeverityPopup.tsx
index dbefb623d92..49e4534f987 100644
--- a/server/sonar-web/src/main/js/components/issue/popups/SetSeverityPopup.tsx
+++ b/server/sonar-web/src/main/js/components/issue/popups/SetSeverityPopup.tsx
@@ -23,10 +23,9 @@ import SelectList from '../../common/SelectList';
import SelectListItem from '../../common/SelectListItem';
import SeverityIcon from '../../icons-components/SeverityIcon';
import { DropdownOverlay } from '../../controls/Dropdown';
-import { Issue } from '../../../app/types';
type Props = {
- issue: Pick<Issue, 'severity'>;
+ issue: Pick<T.Issue, 'severity'>;
onSelect: (severity: string) => void;
};
diff --git a/server/sonar-web/src/main/js/components/issue/popups/SetTypePopup.tsx b/server/sonar-web/src/main/js/components/issue/popups/SetTypePopup.tsx
index 9deb10ced76..35db527ed9d 100644
--- a/server/sonar-web/src/main/js/components/issue/popups/SetTypePopup.tsx
+++ b/server/sonar-web/src/main/js/components/issue/popups/SetTypePopup.tsx
@@ -23,14 +23,13 @@ import IssueTypeIcon from '../../ui/IssueTypeIcon';
import SelectList from '../../common/SelectList';
import SelectListItem from '../../common/SelectListItem';
import { DropdownOverlay } from '../../controls/Dropdown';
-import { Issue, IssueType } from '../../../app/types';
interface Props {
- issue: Pick<Issue, 'type'>;
- onSelect: (type: IssueType) => void;
+ issue: Pick<T.Issue, 'type'>;
+ onSelect: (type: T.IssueType) => void;
}
-const TYPES = [IssueType.Bug, IssueType.Vulnerability, IssueType.CodeSmell];
+const TYPES = ['BUG', 'VULNERABILITY', 'CODE_SMELL'];
export default function SetTypePopup({ issue, onSelect }: Props) {
return (
diff --git a/server/sonar-web/src/main/js/components/issue/popups/SimilarIssuesPopup.tsx b/server/sonar-web/src/main/js/components/issue/popups/SimilarIssuesPopup.tsx
index 85f8a606ab1..c75c01b1b65 100644
--- a/server/sonar-web/src/main/js/components/issue/popups/SimilarIssuesPopup.tsx
+++ b/server/sonar-web/src/main/js/components/issue/popups/SimilarIssuesPopup.tsx
@@ -29,11 +29,10 @@ import IssueTypeIcon from '../../ui/IssueTypeIcon';
import Avatar from '../../ui/Avatar';
import { translate } from '../../../helpers/l10n';
import { fileFromPath, limitComponentName } from '../../../helpers/path';
-import { Issue } from '../../../app/types';
interface Props {
- issue: Issue;
- onFilter: (property: string, issue: Issue) => void;
+ issue: T.Issue;
+ onFilter: (property: string, issue: T.Issue) => void;
}
export default class SimilarIssuesPopup extends React.PureComponent<Props> {
diff --git a/server/sonar-web/src/main/js/components/issue/popups/__tests__/SetTypePopup-test.tsx b/server/sonar-web/src/main/js/components/issue/popups/__tests__/SetTypePopup-test.tsx
index 20d17bb4fbf..3de436bf1c3 100644
--- a/server/sonar-web/src/main/js/components/issue/popups/__tests__/SetTypePopup-test.tsx
+++ b/server/sonar-web/src/main/js/components/issue/popups/__tests__/SetTypePopup-test.tsx
@@ -20,9 +20,8 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import SetTypePopup from '../SetTypePopup';
-import { IssueType } from '../../../../app/types';
it('should render tags popup correctly', () => {
- const element = shallow(<SetTypePopup issue={{ type: IssueType.Bug }} onSelect={jest.fn()} />);
+ const element = shallow(<SetTypePopup issue={{ type: 'BUG' }} onSelect={jest.fn()} />);
expect(element).toMatchSnapshot();
});
diff --git a/server/sonar-web/src/main/js/components/measure/utils.ts b/server/sonar-web/src/main/js/components/measure/utils.ts
index e5851a5f956..7442298c091 100644
--- a/server/sonar-web/src/main/js/components/measure/utils.ts
+++ b/server/sonar-web/src/main/js/components/measure/utils.ts
@@ -18,15 +18,14 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { getRatingTooltip as nextGetRatingTooltip, isDiffMetric } from '../../helpers/measures';
-import { Metric, Measure, MeasureEnhanced } from '../../app/types';
import { getLeakPeriod } from '../../helpers/periods';
const KNOWN_RATINGS = ['sqale_rating', 'reliability_rating', 'security_rating'];
export function enhanceMeasure(
- measure: Measure,
- metrics: { [key: string]: Metric }
-): MeasureEnhanced {
+ measure: T.Measure,
+ metrics: { [key: string]: T.Metric }
+): T.MeasureEnhanced {
return {
...measure,
metric: metrics[measure.metric],
@@ -34,7 +33,7 @@ export function enhanceMeasure(
};
}
-export function getLeakValue(measure: Measure | undefined): string | undefined {
+export function getLeakValue(measure: T.Measure | undefined): string | undefined {
if (!measure || !measure.periods) {
return undefined;
}
diff --git a/server/sonar-web/src/main/js/components/preview-graph/PreviewGraph.tsx b/server/sonar-web/src/main/js/components/preview-graph/PreviewGraph.tsx
index 10941bae6b7..177af3e2515 100644
--- a/server/sonar-web/src/main/js/components/preview-graph/PreviewGraph.tsx
+++ b/server/sonar-web/src/main/js/components/preview-graph/PreviewGraph.tsx
@@ -37,16 +37,15 @@ import {
import { get } from '../../helpers/storage';
import { formatMeasure, getShortType } from '../../helpers/measures';
import { getBranchLikeQuery } from '../../helpers/branches';
-import { BranchLike, Metric } from '../../app/types';
interface History {
[x: string]: Array<{ date: Date; value?: string }>;
}
interface Props {
- branchLike?: BranchLike;
+ branchLike?: T.BranchLike;
history?: History;
- metrics: { [key: string]: Metric };
+ metrics: { [key: string]: T.Metric };
project: string;
renderWhenEmpty?: () => React.ReactNode;
}
@@ -120,7 +119,7 @@ export default class PreviewGraph extends React.PureComponent<Props, State> {
history: History | undefined,
graph: string,
customMetrics: string[],
- metrics: { [x: string]: Metric }
+ metrics: { [x: string]: T.Metric }
) => {
const myHistory = history;
if (!myHistory) {
diff --git a/server/sonar-web/src/main/js/components/shared/DrilldownLink.tsx b/server/sonar-web/src/main/js/components/shared/DrilldownLink.tsx
index b711cdb4783..714830dafe1 100644
--- a/server/sonar-web/src/main/js/components/shared/DrilldownLink.tsx
+++ b/server/sonar-web/src/main/js/components/shared/DrilldownLink.tsx
@@ -20,7 +20,6 @@
import * as React from 'react';
import { Link } from 'react-router';
import { getComponentDrilldownUrl, getComponentIssuesUrl } from '../../helpers/urls';
-import { BranchLike, IssueType } from '../../app/types';
import { getBranchLikeQuery } from '../../helpers/branches';
const ISSUE_MEASURES = [
@@ -49,7 +48,7 @@ const ISSUE_MEASURES = [
];
interface Props {
- branchLike?: BranchLike;
+ branchLike?: T.BranchLike;
children?: React.ReactNode;
className?: string;
component: string;
@@ -104,15 +103,15 @@ export default class DrilldownLink extends React.PureComponent<Props> {
break;
case 'code_smells':
case 'new_code_smells':
- Object.assign(params, { resolved: 'false', types: IssueType.CodeSmell });
+ Object.assign(params, { resolved: 'false', types: 'CODE_SMELL' });
break;
case 'bugs':
case 'new_bugs':
- Object.assign(params, { resolved: 'false', types: IssueType.Bug });
+ Object.assign(params, { resolved: 'false', types: 'BUG' });
break;
case 'vulnerabilities':
case 'new_vulnerabilities':
- Object.assign(params, { resolved: 'false', types: IssueType.Vulnerability });
+ Object.assign(params, { resolved: 'false', types: 'VULNERABILITY' });
break;
default:
Object.assign(params, { resolved: 'false' });
diff --git a/server/sonar-web/src/main/js/components/shared/TypeHelper.tsx b/server/sonar-web/src/main/js/components/shared/TypeHelper.tsx
index f397063230e..110f0517460 100644
--- a/server/sonar-web/src/main/js/components/shared/TypeHelper.tsx
+++ b/server/sonar-web/src/main/js/components/shared/TypeHelper.tsx
@@ -20,11 +20,10 @@
import * as React from 'react';
import IssueTypeIcon from '../ui/IssueTypeIcon';
import { translate } from '../../helpers/l10n';
-import { RuleType, IssueType } from '../../app/types';
interface Props {
className?: string;
- type: IssueType | RuleType;
+ type: T.IssueType | T.RuleType;
}
export default function TypeHelper(props: Props) {
diff --git a/server/sonar-web/src/main/js/components/ui/IdentityProviderLink.tsx b/server/sonar-web/src/main/js/components/ui/IdentityProviderLink.tsx
index 75354424c63..7d945daa970 100644
--- a/server/sonar-web/src/main/js/components/ui/IdentityProviderLink.tsx
+++ b/server/sonar-web/src/main/js/components/ui/IdentityProviderLink.tsx
@@ -21,13 +21,12 @@ import * as React from 'react';
import * as classNames from 'classnames';
import { isDarkColor } from '../../helpers/colors';
import { getBaseUrl } from '../../helpers/urls';
-import { IdentityProvider } from '../../app/types';
import './IdentityProviderLink.css';
interface Props {
children: React.ReactNode;
className?: string;
- identityProvider: IdentityProvider;
+ identityProvider: T.IdentityProvider;
onClick?: () => void;
small?: boolean;
url: string | undefined;
diff --git a/server/sonar-web/src/main/js/components/ui/OrganizationListItem.tsx b/server/sonar-web/src/main/js/components/ui/OrganizationListItem.tsx
index 11ab3e1a6c4..46b1d9087f3 100644
--- a/server/sonar-web/src/main/js/components/ui/OrganizationListItem.tsx
+++ b/server/sonar-web/src/main/js/components/ui/OrganizationListItem.tsx
@@ -19,12 +19,11 @@
*/
import * as React from 'react';
import OrganizationLink from './OrganizationLink';
-import { Organization } from '../../app/types';
import OrganizationAvatar from '../common/OrganizationAvatar';
import { translate } from '../../helpers/l10n';
interface Props {
- organization: Organization;
+ organization: T.Organization;
}
export default function OrganizationListItem({ organization }: Props) {
diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/OrganizationListItem-test.tsx b/server/sonar-web/src/main/js/components/ui/__tests__/OrganizationListItem-test.tsx
index ed060178aa8..0c82a1789ad 100644
--- a/server/sonar-web/src/main/js/components/ui/__tests__/OrganizationListItem-test.tsx
+++ b/server/sonar-web/src/main/js/components/ui/__tests__/OrganizationListItem-test.tsx
@@ -20,7 +20,6 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import OrganizationListItem from '../OrganizationListItem';
-import { Visibility } from '../../../app/types';
it('renders', () => {
expect(
@@ -30,7 +29,7 @@ it('renders', () => {
actions: { admin: true },
key: 'org',
name: 'org',
- projectVisibility: Visibility.Public
+ projectVisibility: 'public'
}}
/>
)
diff --git a/server/sonar-web/src/main/js/components/ui/buttons.tsx b/server/sonar-web/src/main/js/components/ui/buttons.tsx
index 1e9d8bb866f..371fa16dfa9 100644
--- a/server/sonar-web/src/main/js/components/ui/buttons.tsx
+++ b/server/sonar-web/src/main/js/components/ui/buttons.tsx
@@ -20,7 +20,6 @@
import * as React from 'react';
import * as classNames from 'classnames';
import * as theme from '../../app/theme';
-import { Omit } from '../../app/types';
import ClearIcon from '../icons-components/ClearIcon';
import EditIcon from '../icons-components/EditIcon';
import Tooltip from '../controls/Tooltip';
@@ -77,12 +76,12 @@ export class Button extends React.PureComponent<ButtonProps> {
}
}
-export function SubmitButton(props: Omit<ButtonProps, 'type'>) {
+export function SubmitButton(props: T.Omit<ButtonProps, 'type'>) {
// do not prevent default to actually submit a form
return <Button {...props} preventDefault={false} type="submit" />;
}
-export function ResetButtonLink({ className, ...props }: Omit<ButtonProps, 'type'>) {
+export function ResetButtonLink({ className, ...props }: T.Omit<ButtonProps, 'type'>) {
return <Button {...props} className={classNames('button-link', className)} type="reset" />;
}
diff --git a/server/sonar-web/src/main/js/components/withAppState.tsx b/server/sonar-web/src/main/js/components/withAppState.tsx
index 958c37c441a..37ff073e1c7 100644
--- a/server/sonar-web/src/main/js/components/withAppState.tsx
+++ b/server/sonar-web/src/main/js/components/withAppState.tsx
@@ -19,15 +19,14 @@
*/
import * as React from 'react';
import { connect } from 'react-redux';
-import { AppState } from '../app/types';
import { Store, getAppState } from '../store/rootReducer';
export function withAppState<P>(
- WrappedComponent: React.ComponentClass<P & { appState: Partial<AppState> }>
+ WrappedComponent: React.ComponentClass<P & { appState: Partial<T.AppState> }>
) {
const wrappedDisplayName = WrappedComponent.displayName || WrappedComponent.name || 'Component';
- class Wrapper extends React.Component<P & { appState: AppState }> {
+ class Wrapper extends React.Component<P & { appState: T.AppState }> {
static displayName = `withAppState(${wrappedDisplayName})`;
render() {
diff --git a/server/sonar-web/src/main/js/components/workspace/WorkspaceComponentViewer.tsx b/server/sonar-web/src/main/js/components/workspace/WorkspaceComponentViewer.tsx
index ae971e13524..756a05138b7 100644
--- a/server/sonar-web/src/main/js/components/workspace/WorkspaceComponentViewer.tsx
+++ b/server/sonar-web/src/main/js/components/workspace/WorkspaceComponentViewer.tsx
@@ -22,10 +22,9 @@ import { ComponentDescriptor } from './context';
import WorkspaceHeader, { Props as WorkspaceHeaderProps } from './WorkspaceHeader';
import WorkspaceComponentTitle from './WorkspaceComponentTitle';
import SourceViewer from '../SourceViewer/SourceViewer';
-import { SourceViewerFile, Omit } from '../../app/types';
import { scrollToElement } from '../../helpers/scrolling';
-export interface Props extends Omit<WorkspaceHeaderProps, 'children' | 'onClose'> {
+export interface Props extends T.Omit<WorkspaceHeaderProps, 'children' | 'onClose'> {
component: ComponentDescriptor;
height: number;
onClose: (componentKey: string) => void;
@@ -51,7 +50,7 @@ export default class WorkspaceComponentViewer extends React.PureComponent<Props>
this.props.onClose(this.props.component.key);
};
- handleLoaded = (component: SourceViewerFile) => {
+ handleLoaded = (component: T.SourceViewerFile) => {
this.props.onLoad({
key: this.props.component.key,
name: component.path,
diff --git a/server/sonar-web/src/main/js/components/workspace/WorkspaceRuleDetails.tsx b/server/sonar-web/src/main/js/components/workspace/WorkspaceRuleDetails.tsx
index d19a47f480c..e46385e73fe 100644
--- a/server/sonar-web/src/main/js/components/workspace/WorkspaceRuleDetails.tsx
+++ b/server/sonar-web/src/main/js/components/workspace/WorkspaceRuleDetails.tsx
@@ -24,11 +24,10 @@ import DeferredSpinner from '../common/DeferredSpinner';
import RuleDetailsMeta from '../../apps/coding-rules/components/RuleDetailsMeta';
import RuleDetailsDescription from '../../apps/coding-rules/components/RuleDetailsDescription';
import { getRuleDetails, getRulesApp } from '../../api/rules';
-import { RuleDetails, AppState } from '../../app/types';
import '../../apps/coding-rules/styles.css';
interface Props {
- appState: Pick<AppState, 'organizationsEnabled'>;
+ appState: Pick<T.AppState, 'organizationsEnabled'>;
onLoad: (details: { name: string }) => void;
organizationKey: string | undefined;
ruleKey: string;
@@ -37,7 +36,7 @@ interface Props {
interface State {
loading: boolean;
referencedRepositories: { [repository: string]: { key: string; language: string; name: string } };
- ruleDetails?: RuleDetails;
+ ruleDetails?: T.RuleDetails;
}
export class WorkspaceRuleDetails extends React.PureComponent<Props, State> {
diff --git a/server/sonar-web/src/main/js/components/workspace/WorkspaceRuleViewer.tsx b/server/sonar-web/src/main/js/components/workspace/WorkspaceRuleViewer.tsx
index bb37eab9a0b..9c3760fb03e 100644
--- a/server/sonar-web/src/main/js/components/workspace/WorkspaceRuleViewer.tsx
+++ b/server/sonar-web/src/main/js/components/workspace/WorkspaceRuleViewer.tsx
@@ -22,9 +22,8 @@ import { RuleDescriptor } from './context';
import WorkspaceHeader, { Props as WorkspaceHeaderProps } from './WorkspaceHeader';
import WorkspaceRuleDetails from './WorkspaceRuleDetails';
import WorkspaceRuleTitle from './WorkspaceRuleTitle';
-import { Omit } from '../../app/types';
-export interface Props extends Omit<WorkspaceHeaderProps, 'children' | 'onClose'> {
+export interface Props extends T.Omit<WorkspaceHeaderProps, 'children' | 'onClose'> {
rule: RuleDescriptor;
height: number;
onClose: (componentKey: string) => void;
diff --git a/server/sonar-web/src/main/js/components/workspace/context.ts b/server/sonar-web/src/main/js/components/workspace/context.ts
index af0a75818cb..0193e811238 100644
--- a/server/sonar-web/src/main/js/components/workspace/context.ts
+++ b/server/sonar-web/src/main/js/components/workspace/context.ts
@@ -17,10 +17,9 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { BranchLike } from '../../app/types';
export interface ComponentDescriptor {
- branchLike: BranchLike | undefined;
+ branchLike: T.BranchLike | undefined;
key: string;
line?: number;
name?: string;
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/branches-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/branches-test.ts
index 934ef060ecc..7fb383a1c27 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/branches-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/branches-test.ts
@@ -18,13 +18,6 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { sortBranchesAsTree, isSameBranchLike } from '../branches';
-import {
- MainBranch,
- BranchType,
- ShortLivingBranch,
- LongLivingBranch,
- PullRequest
-} from '../../app/types';
describe('#sortBranchesAsTree', () => {
it('sorts main branch and short-living branches', () => {
@@ -102,28 +95,28 @@ describe('#isSameBranchLike', () => {
});
});
-function mainBranch(): MainBranch {
+function mainBranch(): T.MainBranch {
return { isMain: true, name: 'master' };
}
-function shortLivingBranch(overrides?: Partial<ShortLivingBranch>): ShortLivingBranch {
+function shortLivingBranch(overrides?: Partial<T.ShortLivingBranch>): T.ShortLivingBranch {
const status = { bugs: 0, codeSmells: 0, qualityGateStatus: 'OK', vulnerabilities: 0 };
return {
isMain: false,
mergeBranch: 'master',
name: 'foo',
status,
- type: BranchType.SHORT,
+ type: 'SHORT',
...overrides
};
}
-function longLivingBranch(overrides?: Partial<LongLivingBranch>): LongLivingBranch {
+function longLivingBranch(overrides?: Partial<T.LongLivingBranch>): T.LongLivingBranch {
const status = { qualityGateStatus: 'OK' };
- return { isMain: false, name: 'foo', status, type: BranchType.LONG, ...overrides };
+ return { isMain: false, name: 'foo', status, type: 'LONG', ...overrides };
}
-function pullRequest(overrides?: Partial<PullRequest>): PullRequest {
+function pullRequest(overrides?: Partial<T.PullRequest>): T.PullRequest {
const status = { bugs: 0, codeSmells: 0, qualityGateStatus: 'OK', vulnerabilities: 0 };
return {
base: 'master',
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/organizations-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/organizations-test.ts
index 959a9777b69..f36fdec8725 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/organizations-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/organizations-test.ts
@@ -18,9 +18,8 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { hasPrivateAccess, isCurrentUserMemberOf } from '../organizations';
-import { OrganizationSubscription } from '../../app/types';
-const org = { key: 'foo', name: 'Foo', subscription: OrganizationSubscription.Paid };
+const org: T.Organization = { key: 'foo', name: 'Foo', subscription: 'PAID' };
const adminOrg = { actions: { admin: true }, key: 'bar', name: 'Bar' };
const randomOrg = { key: 'bar', name: 'Bar' };
diff --git a/server/sonar-web/src/main/js/helpers/almIntegrations.ts b/server/sonar-web/src/main/js/helpers/almIntegrations.ts
index 29af8561f5a..04f3ecccacb 100644
--- a/server/sonar-web/src/main/js/helpers/almIntegrations.ts
+++ b/server/sonar-web/src/main/js/helpers/almIntegrations.ts
@@ -18,9 +18,8 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { isLoggedIn } from './users';
-import { CurrentUser, AlmOrganization } from '../app/types';
-export function hasAdvancedALMIntegration(user: CurrentUser) {
+export function hasAdvancedALMIntegration(user: T.CurrentUser) {
return (
isLoggedIn(user) && (isBitbucket(user.externalProvider) || isGithub(user.externalProvider))
);
@@ -38,7 +37,7 @@ export function isVSTS(almKey?: string) {
return almKey === 'microsoft';
}
-export function isPersonal(organization?: AlmOrganization) {
+export function isPersonal(organization?: T.AlmOrganization) {
return Boolean(organization && organization.personal);
}
diff --git a/server/sonar-web/src/main/js/helpers/branches.ts b/server/sonar-web/src/main/js/helpers/branches.ts
index 86dc7e10671..f0ec53fc427 100644
--- a/server/sonar-web/src/main/js/helpers/branches.ts
+++ b/server/sonar-web/src/main/js/helpers/branches.ts
@@ -18,54 +18,42 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { sortBy } from 'lodash';
-import {
- BranchLike,
- Branch,
- BranchType,
- ShortLivingBranch,
- LongLivingBranch,
- PullRequest,
- MainBranch,
- BranchParameters
-} from '../app/types';
-
-export function isBranch(branchLike?: BranchLike): branchLike is Branch {
- return branchLike !== undefined && (branchLike as Branch).isMain !== undefined;
+
+export function isBranch(branchLike?: T.BranchLike): branchLike is T.Branch {
+ return branchLike !== undefined && (branchLike as T.Branch).isMain !== undefined;
}
-export function isShortLivingBranch(branchLike?: BranchLike): branchLike is ShortLivingBranch {
+export function isShortLivingBranch(branchLike?: T.BranchLike): branchLike is T.ShortLivingBranch {
return (
isBranch(branchLike) &&
!branchLike.isMain &&
- (branchLike as ShortLivingBranch).type === BranchType.SHORT
+ (branchLike as T.ShortLivingBranch).type === 'SHORT'
);
}
-export function isLongLivingBranch(branchLike?: BranchLike): branchLike is LongLivingBranch {
+export function isLongLivingBranch(branchLike?: T.BranchLike): branchLike is T.LongLivingBranch {
return (
- isBranch(branchLike) &&
- !branchLike.isMain &&
- (branchLike as LongLivingBranch).type === BranchType.LONG
+ isBranch(branchLike) && !branchLike.isMain && (branchLike as T.LongLivingBranch).type === 'LONG'
);
}
-export function isMainBranch(branchLike?: BranchLike): branchLike is MainBranch {
+export function isMainBranch(branchLike?: T.BranchLike): branchLike is T.MainBranch {
return isBranch(branchLike) && branchLike.isMain;
}
-export function isPullRequest(branchLike?: BranchLike): branchLike is PullRequest {
- return branchLike !== undefined && (branchLike as PullRequest).key !== undefined;
+export function isPullRequest(branchLike?: T.BranchLike): branchLike is T.PullRequest {
+ return branchLike !== undefined && (branchLike as T.PullRequest).key !== undefined;
}
-export function getPullRequestDisplayName(pullRequest: PullRequest) {
+export function getPullRequestDisplayName(pullRequest: T.PullRequest) {
return `${pullRequest.key} – ${pullRequest.title}`;
}
-export function getBranchLikeDisplayName(branchLike: BranchLike) {
+export function getBranchLikeDisplayName(branchLike: T.BranchLike) {
return isPullRequest(branchLike) ? getPullRequestDisplayName(branchLike) : branchLike.name;
}
-export function getBranchLikeKey(branchLike: BranchLike) {
+export function getBranchLikeKey(branchLike: T.BranchLike) {
return isPullRequest(branchLike) ? `pull-request-${branchLike.key}` : `branch-${branchLike.name}`;
}
@@ -81,7 +69,7 @@ export function getBranchQualityGateColor(status: string) {
return indicatorColor;
}
-export function isSameBranchLike(a: BranchLike | undefined, b: BranchLike | undefined) {
+export function isSameBranchLike(a: T.BranchLike | undefined, b: T.BranchLike | undefined) {
// main branches are always equal
if (isMainBranch(a) && isMainBranch(b)) {
return true;
@@ -104,8 +92,8 @@ export function isSameBranchLike(a: BranchLike | undefined, b: BranchLike | unde
return a === b;
}
-export function sortBranchesAsTree(branchLikes: BranchLike[]) {
- const result: BranchLike[] = [];
+export function sortBranchesAsTree(branchLikes: T.BranchLike[]) {
+ const result: T.BranchLike[] = [];
const mainBranch = branchLikes.find(isMainBranch);
const longLivingBranches = branchLikes.filter(isLongLivingBranch);
@@ -140,7 +128,7 @@ export function sortBranchesAsTree(branchLikes: BranchLike[]) {
/** Get all short-living branches (possibly nested) which should be merged to a given branch */
function getNestedShortLivingBranches(mergeBranch: string) {
- const found: ShortLivingBranch[] = shortLivingBranches.filter(
+ const found: T.ShortLivingBranch[] = shortLivingBranches.filter(
branch => branch.mergeBranch === mergeBranch
);
@@ -159,7 +147,7 @@ export function sortBranchesAsTree(branchLikes: BranchLike[]) {
}
}
-export function getBranchLikeQuery(branchLike?: BranchLike): BranchParameters {
+export function getBranchLikeQuery(branchLike?: T.BranchLike): T.BranchParameters {
if (isShortLivingBranch(branchLike) || isLongLivingBranch(branchLike)) {
return { branch: branchLike.name };
} else if (isPullRequest(branchLike)) {
@@ -173,16 +161,16 @@ export function getBranchLikeQuery(branchLike?: BranchLike): BranchParameters {
export function fillBranchLike(
branch?: string,
pullRequest?: string
-): ShortLivingBranch | PullRequest | undefined {
+): T.ShortLivingBranch | T.PullRequest | undefined {
if (branch) {
return {
isMain: false,
mergeBranch: '',
name: branch,
- type: BranchType.SHORT
- } as ShortLivingBranch;
+ type: 'SHORT'
+ } as T.ShortLivingBranch;
} else if (pullRequest) {
- return { base: '', branch: '', key: pullRequest, title: '' } as PullRequest;
+ return { base: '', branch: '', key: pullRequest, title: '' } as T.PullRequest;
}
return undefined;
}
diff --git a/server/sonar-web/src/main/js/helpers/constants.ts b/server/sonar-web/src/main/js/helpers/constants.ts
index 44cf06ffd8f..a4a4b8dec71 100644
--- a/server/sonar-web/src/main/js/helpers/constants.ts
+++ b/server/sonar-web/src/main/js/helpers/constants.ts
@@ -18,21 +18,21 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as theme from '../app/theme';
-import { RuleType, IssueType } from '../app/types';
export const SEVERITIES = ['BLOCKER', 'CRITICAL', 'MAJOR', 'MINOR', 'INFO'];
export const STATUSES = ['OPEN', 'REOPENED', 'CONFIRMED', 'RESOLVED', 'CLOSED'];
-export const ISSUE_TYPES = [
- IssueType.Bug,
- IssueType.Vulnerability,
- IssueType.CodeSmell,
- IssueType.Hotspot
+export const ISSUE_TYPES: T.IssueType[] = [
+ 'BUG',
+ 'VULNERABILITY',
+ 'CODE_SMELL',
+ 'SECURITY_HOTSPOT'
];
-export const RULE_TYPES = [
- RuleType.Bug,
- RuleType.Vulnerability,
- RuleType.CodeSmell,
- RuleType.Hotspot
+export const RULE_TYPES: T.RuleType[] = [
+ 'BUG',
+ 'VULNERABILITY',
+ 'CODE_SMELL',
+ 'SECURITY_HOTSPOT',
+ 'UNKNOWN'
];
export const RULE_STATUSES = ['READY', 'BETA', 'DEPRECATED'];
diff --git a/server/sonar-web/src/main/js/helpers/issues.ts b/server/sonar-web/src/main/js/helpers/issues.ts
index 1842d50738a..d92db831e8a 100644
--- a/server/sonar-web/src/main/js/helpers/issues.ts
+++ b/server/sonar-web/src/main/js/helpers/issues.ts
@@ -19,7 +19,6 @@
*/
import { flatten, sortBy } from 'lodash';
import { SEVERITIES } from './constants';
-import { Issue, FlowLocation, TextRange, Omit } from '../app/types';
interface Comment {
login: string;
@@ -49,7 +48,7 @@ export interface RawIssue extends IssueBase {
component: string;
flows?: Array<{
// `componentName` is not available in RawIssue
- locations?: Array<Omit<FlowLocation, 'componentName'>>;
+ locations?: Array<T.Omit<T.FlowLocation, 'componentName'>>;
}>;
key: string;
line?: number;
@@ -57,10 +56,10 @@ export interface RawIssue extends IssueBase {
rule: string;
status: string;
subProject?: string;
- textRange?: TextRange;
+ textRange?: T.TextRange;
}
-export function sortBySeverity(issues: Issue[]): Issue[] {
+export function sortBySeverity(issues: T.Issue[]): T.Issue[] {
return sortBy(issues, issue => SEVERITIES.indexOf(issue.severity));
}
@@ -100,15 +99,15 @@ function injectCommentsRelational(issue: RawIssue, users?: User[]) {
function prepareClosed(
issue: RawIssue,
- secondaryLocations: FlowLocation[],
- flows: FlowLocation[][]
+ secondaryLocations: T.FlowLocation[],
+ flows: T.FlowLocation[][]
) {
return issue.status === 'CLOSED'
? { flows: [], line: undefined, textRange: undefined, secondaryLocations: [] }
: { flows, secondaryLocations };
}
-function ensureTextRange(issue: RawIssue): { textRange?: TextRange } {
+function ensureTextRange(issue: RawIssue): { textRange?: T.TextRange } {
return issue.line && !issue.textRange
? {
textRange: {
@@ -121,7 +120,7 @@ function ensureTextRange(issue: RawIssue): { textRange?: TextRange } {
: {};
}
-function reverseLocations(locations: FlowLocation[]): FlowLocation[] {
+function reverseLocations(locations: T.FlowLocation[]): T.FlowLocation[] {
const x = [...locations];
x.reverse();
return x;
@@ -130,8 +129,8 @@ function reverseLocations(locations: FlowLocation[]): FlowLocation[] {
function splitFlows(
issue: RawIssue,
components: Component[] = []
-): { secondaryLocations: FlowLocation[]; flows: FlowLocation[][] } {
- const parsedFlows: FlowLocation[][] = (issue.flows || [])
+): { secondaryLocations: T.FlowLocation[]; flows: T.FlowLocation[][] } {
+ const parsedFlows: T.FlowLocation[][] = (issue.flows || [])
.filter(flow => flow.locations !== undefined)
.map(flow => flow.locations!.filter(location => location.textRange != null))
.map(flow =>
@@ -148,7 +147,7 @@ function splitFlows(
: { secondaryLocations: [], flows: parsedFlows.map(reverseLocations) };
}
-function orderLocations(locations: FlowLocation[]) {
+function orderLocations(locations: T.FlowLocation[]) {
return sortBy(
locations,
location => location.textRange && location.textRange.startLine,
@@ -161,7 +160,7 @@ export function parseIssueFromResponse(
components?: Component[],
users?: User[],
rules?: Rule[]
-): Issue {
+): T.Issue {
const { secondaryLocations, flows } = splitFlows(issue, components);
return {
...issue,
@@ -173,5 +172,5 @@ export function parseIssueFromResponse(
...injectCommentsRelational(issue, users),
...prepareClosed(issue, secondaryLocations, flows),
...ensureTextRange(issue)
- } as Issue;
+ } as T.Issue;
}
diff --git a/server/sonar-web/src/main/js/helpers/measures.ts b/server/sonar-web/src/main/js/helpers/measures.ts
index 78256f28078..44f2bee718c 100644
--- a/server/sonar-web/src/main/js/helpers/measures.ts
+++ b/server/sonar-web/src/main/js/helpers/measures.ts
@@ -18,7 +18,6 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { translate, translateWithParameters, getCurrentLocale } from './l10n';
-import { Metric, Measure, MeasureEnhanced } from '../app/types';
const HOURS_IN_DAY = 8;
@@ -52,18 +51,18 @@ export function getShortType(type: string): string {
}
export function enhanceMeasuresWithMetrics(
- measures: Measure[],
- metrics: Metric[]
-): MeasureEnhanced[] {
+ measures: T.Measure[],
+ metrics: T.Metric[]
+): T.MeasureEnhanced[] {
return measures.map(measure => {
- const metric = metrics.find(metric => metric.key === measure.metric) as Metric;
+ const metric = metrics.find(metric => metric.key === measure.metric) as T.Metric;
return { ...measure, metric };
});
}
/** Get period value of a measure */
export function getPeriodValue(
- measure: Measure | MeasureEnhanced,
+ measure: T.Measure | T.MeasureEnhanced,
periodIndex: number
): string | undefined {
const { periods } = measure;
@@ -72,7 +71,7 @@ export function getPeriodValue(
}
export function isPeriodBestValue(
- measure: Measure | MeasureEnhanced,
+ measure: T.Measure | T.MeasureEnhanced,
periodIndex: number
): boolean {
const { periods } = measure;
@@ -356,6 +355,6 @@ export function getRatingTooltip(metricKey: string, value: number | string): str
: translate('metric', finalMetricKey, 'tooltip', ratingLetter);
}
-export function getDisplayMetrics(metrics: Metric[]) {
+export function getDisplayMetrics(metrics: T.Metric[]) {
return metrics.filter(metric => !metric.hidden && !['DATA', 'DISTRIB'].includes(metric.type));
}
diff --git a/server/sonar-web/src/main/js/helpers/organizations.ts b/server/sonar-web/src/main/js/helpers/organizations.ts
index 81852dd8776..6f124a53fbc 100644
--- a/server/sonar-web/src/main/js/helpers/organizations.ts
+++ b/server/sonar-web/src/main/js/helpers/organizations.ts
@@ -18,16 +18,15 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { isLoggedIn } from './users';
-import { Organization, OrganizationSubscription, CurrentUser } from '../app/types';
-export function isPaidOrganization(organization: Organization | undefined): boolean {
- return Boolean(organization && organization.subscription === OrganizationSubscription.Paid);
+export function isPaidOrganization(organization: T.Organization | undefined): boolean {
+ return Boolean(organization && organization.subscription === 'PAID');
}
export function hasPrivateAccess(
- currentUser: CurrentUser,
- organization: Organization | undefined,
- userOrganizations: Organization[]
+ currentUser: T.CurrentUser,
+ organization: T.Organization | undefined,
+ userOrganizations: T.Organization[]
): boolean {
return (
!isPaidOrganization(organization) ||
@@ -36,9 +35,9 @@ export function hasPrivateAccess(
}
export function isCurrentUserMemberOf(
- currentUser: CurrentUser,
- organization: Organization | undefined,
- userOrganizations: Organization[]
+ currentUser: T.CurrentUser,
+ organization: T.Organization | undefined,
+ userOrganizations: T.Organization[]
): boolean {
return Boolean(
organization &&
diff --git a/server/sonar-web/src/main/js/helpers/periods.ts b/server/sonar-web/src/main/js/helpers/periods.ts
index baa0651439d..bce39948602 100644
--- a/server/sonar-web/src/main/js/helpers/periods.ts
+++ b/server/sonar-web/src/main/js/helpers/periods.ts
@@ -19,21 +19,20 @@
*/
import { translate, translateWithParameters } from './l10n';
import { parseDate } from './dates';
-import { Period, PeriodMode, PeriodMeasure } from '../app/types';
-function getPeriod<T extends Period | PeriodMeasure>(periods: T[] | undefined, index: number) {
+function getPeriod<T extends T.Period | T.PeriodMeasure>(periods: T[] | undefined, index: number) {
if (!Array.isArray(periods)) {
return undefined;
}
return periods.find(period => period.index === index);
}
-export function getLeakPeriod<T extends Period | PeriodMeasure>(periods: T[] | undefined) {
+export function getLeakPeriod<T extends T.Period | T.PeriodMeasure>(periods: T[] | undefined) {
return getPeriod(periods, 1);
}
export function getPeriodLabel(
- period: Period | undefined,
+ period: T.Period | undefined,
dateFormatter: (date: string) => string
) {
if (!period) {
@@ -41,11 +40,11 @@ export function getPeriodLabel(
}
let parameter = period.modeParam || period.parameter;
- if (period.mode === PeriodMode.PreviousVersion && !parameter) {
+ if (period.mode === 'previous_version' && !parameter) {
return translate('overview.period.previous_version_only_date');
}
- if (period.mode === PeriodMode.Date && parameter) {
+ if (period.mode === 'date' && parameter) {
parameter = dateFormatter(parameter);
}
diff --git a/server/sonar-web/src/main/js/helpers/urls.ts b/server/sonar-web/src/main/js/helpers/urls.ts
index 8a1349419c3..c8c7db886a5 100644
--- a/server/sonar-web/src/main/js/helpers/urls.ts
+++ b/server/sonar-web/src/main/js/helpers/urls.ts
@@ -26,7 +26,6 @@ import {
getBranchLikeQuery
} from './branches';
import { getProfilePath } from '../apps/quality-profiles/utils';
-import { BranchLike, HomePage, HomePageType } from '../app/types';
interface Query {
[x: string]: string | undefined;
@@ -65,7 +64,7 @@ export function getComponentBackgroundTaskUrl(componentKey: string, status?: str
return { pathname: '/project/background_tasks', query: { id: componentKey, status } };
}
-export function getBranchLikeUrl(project: string, branchLike?: BranchLike): Location {
+export function getBranchLikeUrl(project: string, branchLike?: T.BranchLike): Location {
if (isPullRequest(branchLike)) {
return getPullRequestUrl(project, branchLike.key);
} else if (isShortLivingBranch(branchLike)) {
@@ -110,7 +109,7 @@ export function getComponentIssuesUrl(componentKey: string, query?: Query): Loca
export function getComponentDrilldownUrl(options: {
componentKey: string;
metric: string;
- branchLike?: BranchLike;
+ branchLike?: T.BranchLike;
selectionKey?: string;
treemapView?: boolean;
}): Location {
@@ -129,7 +128,7 @@ export function getComponentDrilldownUrlWithSelection(
componentKey: string,
selectionKey: string,
metric: string,
- branchLike?: BranchLike
+ branchLike?: T.BranchLike
): Location {
return getComponentDrilldownUrl({ componentKey, selectionKey, metric, branchLike });
}
@@ -138,7 +137,7 @@ export function getMeasureTreemapUrl(componentKey: string, metric: string) {
return getComponentDrilldownUrl({ componentKey, metric, treemapView: true });
}
-export function getActivityUrl(component: string, branchLike?: BranchLike) {
+export function getActivityUrl(component: string, branchLike?: T.BranchLike) {
return {
pathname: '/project/activity',
query: { id: component, ...getBranchLikeQuery(branchLike) }
@@ -148,7 +147,7 @@ export function getActivityUrl(component: string, branchLike?: BranchLike) {
/**
* Generate URL for a component's measure history
*/
-export function getMeasureHistoryUrl(component: string, metric: string, branchLike?: BranchLike) {
+export function getMeasureHistoryUrl(component: string, metric: string, branchLike?: T.BranchLike) {
return {
pathname: '/project/activity',
query: {
@@ -218,7 +217,7 @@ export function getMarkdownHelpUrl(): string {
return getBaseUrl() + '/markdown/help';
}
-export function getCodeUrl(project: string, branchLike?: BranchLike, selected?: string) {
+export function getCodeUrl(project: string, branchLike?: T.BranchLike, selected?: string) {
return { pathname: '/code', query: { id: project, ...getBranchLikeQuery(branchLike), selected } };
}
@@ -226,26 +225,26 @@ export function getOrganizationUrl(organization: string) {
return `/organizations/${organization}`;
}
-export function getHomePageUrl(homepage: HomePage) {
+export function getHomePageUrl(homepage: T.HomePage) {
switch (homepage.type) {
- case HomePageType.Application:
+ case 'APPLICATION':
return homepage.branch
? getProjectUrl(homepage.component, homepage.branch)
: getProjectUrl(homepage.component);
- case HomePageType.Project:
+ case 'PROJECT':
return homepage.branch
? getLongLivingBranchUrl(homepage.component, homepage.branch)
: getProjectUrl(homepage.component);
- case HomePageType.Organization:
+ case 'ORGANIZATION':
return getOrganizationUrl(homepage.organization);
- case HomePageType.Portfolio:
+ case 'PORTFOLIO':
return getPortfolioUrl(homepage.component);
- case HomePageType.Portfolios:
+ case 'PORTFOLIOS':
return '/portfolios';
- case HomePageType.MyProjects:
+ case 'MY_PROJECTS':
return '/projects';
- case HomePageType.Issues:
- case HomePageType.MyIssues:
+ case 'ISSUES':
+ case 'MY_ISSUES':
return { pathname: '/issues', query: { resolved: 'false' } };
}
diff --git a/server/sonar-web/src/main/js/helpers/users.ts b/server/sonar-web/src/main/js/helpers/users.ts
index 77968f08e3f..3fb6a77a198 100644
--- a/server/sonar-web/src/main/js/helpers/users.ts
+++ b/server/sonar-web/src/main/js/helpers/users.ts
@@ -17,15 +17,13 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { CurrentUser, LoggedInUser } from '../app/types';
-
-export function hasGlobalPermission(user: CurrentUser, permission: string): boolean {
+export function hasGlobalPermission(user: T.CurrentUser, permission: string): boolean {
if (!user.permissions) {
return false;
}
return user.permissions.global.includes(permission);
}
-export function isLoggedIn(user: CurrentUser): user is LoggedInUser {
+export function isLoggedIn(user: T.CurrentUser): user is T.LoggedInUser {
return user.isLoggedIn;
}
diff --git a/server/sonar-web/src/main/js/store/appState.ts b/server/sonar-web/src/main/js/store/appState.ts
index 89f31e98e12..6d322f7a639 100644
--- a/server/sonar-web/src/main/js/store/appState.ts
+++ b/server/sonar-web/src/main/js/store/appState.ts
@@ -18,7 +18,6 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { ActionType } from './utils/actions';
-import { Extension, AppState } from '../app/types';
import { EditionKey } from '../apps/marketplace/utils';
export const enum Actions {
@@ -32,11 +31,11 @@ export type Action =
| ActionType<typeof setAdminPages, Actions.SetAdminPages>
| ActionType<typeof requireAuthorization, Actions.RequireAuthorization>;
-export function setAppState(appState: AppState) {
+export function setAppState(appState: T.AppState) {
return { type: Actions.SetAppState, appState };
}
-export function setAdminPages(adminPages: Extension[]) {
+export function setAdminPages(adminPages: T.Extension[]) {
return { type: Actions.SetAdminPages, adminPages };
}
@@ -44,7 +43,7 @@ export function requireAuthorization() {
return { type: Actions.RequireAuthorization };
}
-const defaultValue: AppState = {
+const defaultValue: T.AppState = {
authenticationError: false,
authorizationError: false,
defaultOrganization: '',
@@ -56,7 +55,7 @@ const defaultValue: AppState = {
version: ''
};
-export default function(state: AppState = defaultValue, action: Action): AppState {
+export default function(state: T.AppState = defaultValue, action: Action): T.AppState {
if (action.type === Actions.SetAppState) {
return { ...state, ...action.appState };
}
diff --git a/server/sonar-web/src/main/js/store/languages.ts b/server/sonar-web/src/main/js/store/languages.ts
index e80c9d2cdbc..3056b39726f 100644
--- a/server/sonar-web/src/main/js/store/languages.ts
+++ b/server/sonar-web/src/main/js/store/languages.ts
@@ -19,7 +19,6 @@
*/
import { keyBy } from 'lodash';
import { ActionType } from './utils/actions';
-import { Languages } from '../app/types';
export function receiveLanguages(languages: Array<{ key: string; name: string }>) {
return { type: 'RECEIVE_LANGUAGES', languages };
@@ -27,7 +26,7 @@ export function receiveLanguages(languages: Array<{ key: string; name: string }>
type Action = ActionType<typeof receiveLanguages, 'RECEIVE_LANGUAGES'>;
-export default function(state: Languages = {}, action: Action): Languages {
+export default function(state: T.Languages = {}, action: Action): T.Languages {
if (action.type === 'RECEIVE_LANGUAGES') {
return keyBy(action.languages, 'key');
}
@@ -35,10 +34,10 @@ export default function(state: Languages = {}, action: Action): Languages {
return state;
}
-export function getLanguages(state: Languages) {
+export function getLanguages(state: T.Languages) {
return state;
}
-export function getLanguageByKey(state: Languages, key: string) {
+export function getLanguageByKey(state: T.Languages, key: string) {
return state[key];
}
diff --git a/server/sonar-web/src/main/js/store/metrics.ts b/server/sonar-web/src/main/js/store/metrics.ts
index 85098902b21..12db969ac6b 100644
--- a/server/sonar-web/src/main/js/store/metrics.ts
+++ b/server/sonar-web/src/main/js/store/metrics.ts
@@ -20,15 +20,14 @@
import { keyBy } from 'lodash';
import { combineReducers } from 'redux';
import { ActionType } from './utils/actions';
-import { Metric } from '../app/types';
-export function receiveMetrics(metrics: Metric[]) {
+export function receiveMetrics(metrics: T.Metric[]) {
return { type: 'RECEIVE_METRICS', metrics };
}
type Action = ActionType<typeof receiveMetrics, 'RECEIVE_METRICS'>;
-export type State = { byKey: { [key: string]: Metric }; keys: string[] };
+export type State = { byKey: { [key: string]: T.Metric }; keys: string[] };
const byKey = (state: State['byKey'] = {}, action: Action) => {
if (action.type === 'RECEIVE_METRICS') {
diff --git a/server/sonar-web/src/main/js/store/organizations.ts b/server/sonar-web/src/main/js/store/organizations.ts
index 2eb0b51df2c..cb116ff0539 100644
--- a/server/sonar-web/src/main/js/store/organizations.ts
+++ b/server/sonar-web/src/main/js/store/organizations.ts
@@ -20,7 +20,6 @@
import { combineReducers } from 'redux';
import { omit, uniq, without } from 'lodash';
import { ActionType } from './utils/actions';
-import { Organization, OrganizationBase } from '../app/types';
type ReceiveOrganizationsAction =
| ActionType<typeof receiveOrganizations, 'RECEIVE_ORGANIZATIONS'>
@@ -33,23 +32,23 @@ type Action =
| ActionType<typeof deleteOrganization, 'DELETE_ORGANIZATION'>;
export interface State {
- byKey: { [key: string]: Organization };
+ byKey: { [key: string]: T.Organization };
my: string[];
}
-export function receiveOrganizations(organizations: Organization[]) {
+export function receiveOrganizations(organizations: T.Organization[]) {
return { type: 'RECEIVE_ORGANIZATIONS', organizations };
}
-export function receiveMyOrganizations(organizations: Organization[]) {
+export function receiveMyOrganizations(organizations: T.Organization[]) {
return { type: 'RECEIVE_MY_ORGANIZATIONS', organizations };
}
-export function createOrganization(organization: Organization) {
+export function createOrganization(organization: T.Organization) {
return { type: 'CREATE_ORGANIZATION', organization };
}
-export function updateOrganization(key: string, changes: OrganizationBase) {
+export function updateOrganization(key: string, changes: T.OrganizationBase) {
return { type: 'UPDATE_ORGANIZATION', key, changes };
}
diff --git a/server/sonar-web/src/main/js/store/rootReducer.ts b/server/sonar-web/src/main/js/store/rootReducer.ts
index 336fe056b6b..b048b4b5d69 100644
--- a/server/sonar-web/src/main/js/store/rootReducer.ts
+++ b/server/sonar-web/src/main/js/store/rootReducer.ts
@@ -24,14 +24,13 @@ import languages, * as fromLanguages from './languages';
import metrics, * as fromMetrics from './metrics';
import organizations, * as fromOrganizations from './organizations';
import users, * as fromUsers from './users';
-import { AppState, Languages } from '../app/types';
import projectAdminApp, * as fromProjectAdminApp from '../apps/project-admin/store/rootReducer';
import settingsApp, * as fromSettingsApp from '../apps/settings/store/rootReducer';
export type Store = {
- appState: AppState;
+ appState: T.AppState;
globalMessages: fromGlobalMessages.State;
- languages: Languages;
+ languages: T.Languages;
metrics: fromMetrics.State;
organizations: fromOrganizations.State;
users: fromUsers.State;
diff --git a/server/sonar-web/src/main/js/store/users.ts b/server/sonar-web/src/main/js/store/users.ts
index 8440dab6e2e..8e1054686cb 100644
--- a/server/sonar-web/src/main/js/store/users.ts
+++ b/server/sonar-web/src/main/js/store/users.ts
@@ -21,10 +21,9 @@ import { uniq } from 'lodash';
import { Dispatch, combineReducers } from 'redux';
import { ActionType } from './utils/actions';
import * as api from '../api/users';
-import { CurrentUser, HomePage, LoggedInUser } from '../app/types';
import { isLoggedIn } from '../helpers/users';
-export function receiveCurrentUser(user: CurrentUser) {
+export function receiveCurrentUser(user: T.CurrentUser) {
return { type: 'RECEIVE_CURRENT_USER', user };
}
@@ -39,11 +38,11 @@ export function skipOnboarding() {
.then(() => dispatch(skipOnboardingAction()), () => dispatch(skipOnboardingAction()));
}
-function setHomePageAction(homepage: HomePage) {
+function setHomePageAction(homepage: T.HomePage) {
return { type: 'SET_HOMEPAGE', homepage };
}
-export function setHomePage(homepage: HomePage) {
+export function setHomePage(homepage: T.HomePage) {
return (dispatch: Dispatch) => {
api.setHomePage(homepage).then(
() => {
@@ -62,7 +61,7 @@ type Action =
export interface State {
usersByLogin: { [login: string]: any };
userLogins: string[];
- currentUser: CurrentUser;
+ currentUser: T.CurrentUser;
}
function usersByLogin(state: State['usersByLogin'] = {}, action: Action): State['usersByLogin'] {
@@ -89,10 +88,10 @@ function currentUser(
return action.user;
}
if (action.type === 'SKIP_ONBOARDING' && isLoggedIn(state)) {
- return { ...state, showOnboardingTutorial: false } as LoggedInUser;
+ return { ...state, showOnboardingTutorial: false } as T.LoggedInUser;
}
if (action.type === 'SET_HOMEPAGE' && isLoggedIn(state)) {
- return { ...state, homepage: action.homepage } as LoggedInUser;
+ return { ...state, homepage: action.homepage } as T.LoggedInUser;
}
return state;
}
diff --git a/server/sonar-web/src/main/js/store/utils/actions.ts b/server/sonar-web/src/main/js/store/utils/actions.ts
index 4926a67d2a3..365cd42b3d0 100644
--- a/server/sonar-web/src/main/js/store/utils/actions.ts
+++ b/server/sonar-web/src/main/js/store/utils/actions.ts
@@ -17,8 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { Omit } from '../../app/types';
type ActionCreator = (...args: any[]) => { type: string };
-export type ActionType<F extends ActionCreator, T> = Omit<ReturnType<F>, 'type'> & { type: T };
+export type ActionType<F extends ActionCreator, T> = T.Omit<ReturnType<F>, 'type'> & { type: T };