aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps
diff options
context:
space:
mode:
Diffstat (limited to 'server/sonar-web/src/main/js/apps')
-rw-r--r--server/sonar-web/src/main/js/apps/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
421 files changed, 1267 insertions, 1802 deletions
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(() => {