From e4a2b37268212b232c7aea22445a5bbbf0acd050 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Mon, 21 Aug 2017 09:23:52 +0200 Subject: [PATCH] remove I prefix from interfaces --- server/sonar-web/src/main/js/api/application.ts | 4 ++-- server/sonar-web/src/main/js/api/components.ts | 4 ++-- server/sonar-web/src/main/js/api/notifications.ts | 4 ++-- server/sonar-web/src/main/js/api/projectActivity.ts | 10 +++++----- server/sonar-web/src/main/js/api/time-machine.ts | 8 ++++---- .../main/js/apps/account/projects/ProjectCard.tsx | 4 ++-- .../src/main/js/apps/account/projects/Projects.tsx | 4 ++-- .../src/main/js/apps/account/projects/types.ts | 2 +- .../js/apps/quality-profiles/__tests__/utils-test.ts | 4 ++-- .../js/apps/quality-profiles/changelog/Changelog.tsx | 4 ++-- .../changelog/ChangelogContainer.tsx | 6 +++--- .../changelog/__tests__/Changelog-test.tsx | 4 ++-- .../quality-profiles/compare/ComparisonContainer.tsx | 6 +++--- .../apps/quality-profiles/compare/ComparisonForm.tsx | 6 +++--- .../main/js/apps/quality-profiles/components/App.tsx | 6 +++--- .../quality-profiles/components/CopyProfileForm.tsx | 4 ++-- .../components/DeleteProfileForm.tsx | 4 ++-- .../quality-profiles/components/ProfileActions.tsx | 4 ++-- .../quality-profiles/components/ProfileContainer.tsx | 4 ++-- .../components/RenameProfileForm.tsx | 4 ++-- .../quality-profiles/details/ChangeParentForm.tsx | 6 +++--- .../quality-profiles/details/ChangeProjectsForm.tsx | 4 ++-- .../apps/quality-profiles/details/ProfileDetails.tsx | 8 ++++---- .../quality-profiles/details/ProfileExporters.tsx | 8 ++++---- .../apps/quality-profiles/details/ProfileHeader.tsx | 4 ++-- .../quality-profiles/details/ProfileInheritance.tsx | 6 +++--- .../quality-profiles/details/ProfileProjects.tsx | 4 ++-- .../apps/quality-profiles/details/ProfileRules.tsx | 4 ++-- .../main/js/apps/quality-profiles/home/Evolution.tsx | 4 ++-- .../quality-profiles/home/EvolutionDeprecated.tsx | 4 ++-- .../js/apps/quality-profiles/home/EvolutionRules.tsx | 6 +++--- .../apps/quality-profiles/home/EvolutionStagnant.tsx | 4 ++-- .../js/apps/quality-profiles/home/HomeContainer.tsx | 4 ++-- .../js/apps/quality-profiles/home/PageHeader.tsx | 4 ++-- .../js/apps/quality-profiles/home/ProfilesList.tsx | 10 +++++----- .../apps/quality-profiles/home/ProfilesListRow.tsx | 4 ++-- .../src/main/js/apps/quality-profiles/types.ts | 6 +++--- .../src/main/js/apps/quality-profiles/utils.ts | 12 ++++++------ server/sonar-web/src/main/js/helpers/request.ts | 10 +++++----- 39 files changed, 104 insertions(+), 104 deletions(-) diff --git a/server/sonar-web/src/main/js/api/application.ts b/server/sonar-web/src/main/js/api/application.ts index c6bce86fbd6..11cab631512 100644 --- a/server/sonar-web/src/main/js/api/application.ts +++ b/server/sonar-web/src/main/js/api/application.ts @@ -20,12 +20,12 @@ import { getJSON } from '../helpers/request'; import throwGlobalError from '../app/utils/throwGlobalError'; -export interface IApplicationLeak { +export interface ApplicationLeak { date: string; project: string; projectName: string; } -export function getApplicationLeak(application: string): Promise> { +export function getApplicationLeak(application: string): Promise> { return getJSON('/api/views/show_leak', { application }).then(r => r.leaks, throwGlobalError); } diff --git a/server/sonar-web/src/main/js/api/components.ts b/server/sonar-web/src/main/js/api/components.ts index 5cd527da6ad..168f41d4a32 100644 --- a/server/sonar-web/src/main/js/api/components.ts +++ b/server/sonar-web/src/main/js/api/components.ts @@ -157,7 +157,7 @@ export function bulkChangeKey( return postJSON(url, data); } -export interface ISuggestionsResponse { +export interface SuggestionsResponse { organizations: Array<{ key: string; name: string }>; projects: Array<{ key: string; name: string }>; results: Array<{ @@ -180,7 +180,7 @@ export function getSuggestions( query?: string, recentlyBrowsed?: string[], more?: string -): Promise { +): Promise { const data: RequestData = {}; if (query) { data.s = query; diff --git a/server/sonar-web/src/main/js/api/notifications.ts b/server/sonar-web/src/main/js/api/notifications.ts index a95def188f3..51d258c59b9 100644 --- a/server/sonar-web/src/main/js/api/notifications.ts +++ b/server/sonar-web/src/main/js/api/notifications.ts @@ -19,7 +19,7 @@ */ import { getJSON, post, RequestData } from '../helpers/request'; -export interface IGetNotificationsResponse { +export interface GetNotificationsResponse { notifications: Array<{ channel: string; type: string; @@ -32,7 +32,7 @@ export interface IGetNotificationsResponse { perProjectTypes: Array; } -export function getNotifications(): Promise { +export function getNotifications(): Promise { return getJSON('/api/notifications/list'); } diff --git a/server/sonar-web/src/main/js/api/projectActivity.ts b/server/sonar-web/src/main/js/api/projectActivity.ts index 6edd9732081..b2dddd8c890 100644 --- a/server/sonar-web/src/main/js/api/projectActivity.ts +++ b/server/sonar-web/src/main/js/api/projectActivity.ts @@ -20,7 +20,7 @@ import { getJSON, postJSON, post, RequestData } from '../helpers/request'; import throwGlobalError from '../app/utils/throwGlobalError'; -interface IGetProjectActivityResponse { +interface GetProjectActivityResponse { analyses: any[]; paging: { total: number; @@ -34,11 +34,11 @@ export function getProjectActivity(data: { category?: string; p?: number; ps?: number; -}): Promise { +}): Promise { return getJSON('/api/project_analyses/search', data).catch(throwGlobalError); } -interface ICreateEventResponse { +interface CreateEventResponse { analysis: string; key: string; name: string; @@ -51,7 +51,7 @@ export function createEvent( name: string, category?: string, description?: string -): Promise { +): Promise { const data: RequestData = { analysis, name }; if (category) { data.category = category; @@ -70,7 +70,7 @@ export function changeEvent( event: string, name?: string, description?: string -): Promise { +): Promise { const data: RequestData = { event }; if (name) { data.name = name; diff --git a/server/sonar-web/src/main/js/api/time-machine.ts b/server/sonar-web/src/main/js/api/time-machine.ts index 643b3fb9848..4423d563c8c 100644 --- a/server/sonar-web/src/main/js/api/time-machine.ts +++ b/server/sonar-web/src/main/js/api/time-machine.ts @@ -19,7 +19,7 @@ */ import { getJSON } from '../helpers/request'; -interface ITimeMachineResponse { +interface TimeMachineResponse { measures: Array<{ metric: string; history: Array<{ date: string; value: string }>; @@ -31,7 +31,7 @@ export function getTimeMachineData( component: string, metrics: string[], other?: { p?: number; ps?: number; from?: string; to?: string } -): Promise { +): Promise { return getJSON('/api/measures/search_history', { component, metrics: metrics.join(), @@ -44,8 +44,8 @@ export function getAllTimeMachineData( component: string, metrics: Array, other?: { p?: number; from?: string; to?: string }, - prev?: ITimeMachineResponse -): Promise { + prev?: TimeMachineResponse +): Promise { return getTimeMachineData(component, metrics, { ...other, ps: 1000 }).then(r => { const result = prev ? { 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 93a3a787715..b81b2cf256f 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 @@ -21,12 +21,12 @@ import * as React from 'react'; import * as moment from 'moment'; import { sortBy } from 'lodash'; import { Link } from 'react-router'; -import { IProject } from './types'; +import { Project } from './types'; import Level from '../../../components/ui/Level'; import { translateWithParameters, translate } from '../../../helpers/l10n'; interface Props { - project: IProject; + project: Project; } export default function ProjectCard(props: 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 e3681c3465d..1b574e3d09d 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 @@ -19,14 +19,14 @@ */ import * as React from 'react'; import ProjectCard from './ProjectCard'; -import { IProject } from './types'; +import { Project } from './types'; import ListFooter from '../../../components/controls/ListFooter'; import { translate } from '../../../helpers/l10n'; interface Props { loading: boolean; loadMore: () => void; - projects: IProject[]; + projects: Project[]; search: (query: string) => void; total?: number; } diff --git a/server/sonar-web/src/main/js/apps/account/projects/types.ts b/server/sonar-web/src/main/js/apps/account/projects/types.ts index 76feb045c64..7d78a718e2e 100644 --- a/server/sonar-web/src/main/js/apps/account/projects/types.ts +++ b/server/sonar-web/src/main/js/apps/account/projects/types.ts @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -export interface IProject { +export interface Project { id: string; key: string; name: string; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/__tests__/utils-test.ts b/server/sonar-web/src/main/js/apps/quality-profiles/__tests__/utils-test.ts index 433702eab06..9eb11a47481 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/__tests__/utils-test.ts +++ b/server/sonar-web/src/main/js/apps/quality-profiles/__tests__/utils-test.ts @@ -18,10 +18,10 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import { sortProfiles } from '../utils'; -import { IProfile } from '../types'; +import { Profile } from '../types'; function createProfile(key: string, parentKey?: string) { - return { name: key, key, parentKey } as IProfile; + return { name: key, key, parentKey } as Profile; } describe('#sortProfiles', () => { diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/Changelog.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/Changelog.tsx index 6c152925cca..1dbfdda95fd 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/Changelog.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/Changelog.tsx @@ -23,10 +23,10 @@ import * as moment from 'moment'; import ChangesList from './ChangesList'; import { translate } from '../../../helpers/l10n'; import { getRulesUrl } from '../../../helpers/urls'; -import { IProfileChangelogEvent } from '../types'; +import { ProfileChangelogEvent } from '../types'; interface Props { - events: IProfileChangelogEvent[]; + events: ProfileChangelogEvent[]; organization: string | null; } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangelogContainer.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangelogContainer.tsx index aa54dd0c89c..c045d1e2208 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangelogContainer.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangelogContainer.tsx @@ -25,7 +25,7 @@ import ChangelogEmpty from './ChangelogEmpty'; import { getProfileChangelog } from '../../../api/quality-profiles'; import { translate } from '../../../helpers/l10n'; import { getProfileChangelogPath } from '../utils'; -import { IProfile, IProfileChangelogEvent } from '../types'; +import { Profile, ProfileChangelogEvent } from '../types'; interface Props { location: { @@ -35,11 +35,11 @@ interface Props { }; }; organization: string | null; - profile: IProfile; + profile: Profile; } interface State { - events?: IProfileChangelogEvent[]; + events?: ProfileChangelogEvent[]; loading: boolean; page?: number; total?: number; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/Changelog-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/Changelog-test.tsx index ed8fb6b6106..b28f8e236e0 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/Changelog-test.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/Changelog-test.tsx @@ -21,9 +21,9 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import Changelog from '../Changelog'; import ChangesList from '../ChangesList'; -import { IProfileChangelogEvent } from '../../types'; +import { ProfileChangelogEvent } from '../../types'; -function createEvent(overrides?: { [p: string]: any }): IProfileChangelogEvent { +function createEvent(overrides?: { [p: string]: any }): ProfileChangelogEvent { return { date: '2016-01-01', authorName: 'John', diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonContainer.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonContainer.tsx index 003fd55a6d3..5ce25c758e8 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonContainer.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonContainer.tsx @@ -23,13 +23,13 @@ import ComparisonForm from './ComparisonForm'; import ComparisonResults from './ComparisonResults'; import { compareProfiles } from '../../../api/quality-profiles'; import { getProfileComparePath } from '../utils'; -import { IProfile } from '../types'; +import { Profile } from '../types'; interface Props { location: { query: { withKey?: string } }; organization: string | null; - profile: IProfile; - profiles: IProfile[]; + profile: Profile; + profiles: Profile[]; } type Params = { [p: string]: string }; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonForm.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonForm.tsx index 11c4fb25639..a65bd9f73e2 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonForm.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonForm.tsx @@ -20,11 +20,11 @@ import * as React from 'react'; import * as Select from 'react-select'; import { translate } from '../../../helpers/l10n'; -import { IProfile } from '../types'; +import { Profile } from '../types'; interface Props { - profile: IProfile; - profiles: IProfile[]; + profile: Profile; + profiles: Profile[]; onCompare: (rule: string) => void; withKey?: string; } 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 44013b73e70..a044618fd0e 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 @@ -23,7 +23,7 @@ import { sortProfiles } from '../utils'; import { translate } from '../../../helpers/l10n'; import OrganizationHelmet from '../../../components/common/OrganizationHelmet'; import '../styles.css'; -import { IExporter, IProfile } from '../types'; +import { Exporter, Profile } from '../types'; interface Props { children: React.ReactElement; @@ -35,8 +35,8 @@ interface Props { interface State { loading: boolean; - exporters?: IExporter[]; - profiles?: IProfile[]; + exporters?: Exporter[]; + profiles?: Profile[]; } export default class App extends React.PureComponent { diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/components/CopyProfileForm.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/components/CopyProfileForm.tsx index 4d24898081d..0488d31b863 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/components/CopyProfileForm.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/components/CopyProfileForm.tsx @@ -21,13 +21,13 @@ import * as React from 'react'; import Modal from 'react-modal'; import { copyProfile } from '../../../api/quality-profiles'; import { translate, translateWithParameters } from '../../../helpers/l10n'; -import { IProfile } from '../types'; +import { Profile } from '../types'; interface Props { onClose: () => void; onCopy: (name: string) => void; onRequestFail: (reasong: any) => void; - profile: IProfile; + profile: Profile; } interface State { diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/components/DeleteProfileForm.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/components/DeleteProfileForm.tsx index 5a7b22719db..2b7b1cbe26c 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/components/DeleteProfileForm.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/components/DeleteProfileForm.tsx @@ -21,13 +21,13 @@ import * as React from 'react'; import Modal from 'react-modal'; import { deleteProfile } from '../../../api/quality-profiles'; import { translate, translateWithParameters } from '../../../helpers/l10n'; -import { IProfile } from '../types'; +import { Profile } from '../types'; interface Props { onClose: () => void; onDelete: () => void; onRequestFail: (reason: any) => void; - profile: IProfile; + profile: Profile; } interface State { diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileActions.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileActions.tsx index 6d1ad5c0120..7d3f250244a 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileActions.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileActions.tsx @@ -27,14 +27,14 @@ import { translate } from '../../../helpers/l10n'; import { getRulesUrl } from '../../../helpers/urls'; import { setDefaultProfile } from '../../../api/quality-profiles'; import { getProfilePath, getProfileComparePath, getProfilesPath } from '../utils'; -import { IProfile } from '../types'; +import { Profile } from '../types'; interface Props { canAdmin: boolean; fromList?: boolean; onRequestFail: (reasong: any) => void; organization: string | null; - profile: IProfile; + profile: Profile; updateProfiles: () => Promise; } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileContainer.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileContainer.tsx index ee6d302acdd..c804775b721 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileContainer.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileContainer.tsx @@ -21,7 +21,7 @@ import * as React from 'react'; import Helmet from 'react-helmet'; import ProfileNotFound from './ProfileNotFound'; import ProfileHeader from '../details/ProfileHeader'; -import { IProfile } from '../types'; +import { Profile } from '../types'; interface Props { canAdmin: boolean; @@ -32,7 +32,7 @@ interface Props { }; onRequestFail: (reasong: any) => void; organization: string | null; - profiles: IProfile[]; + profiles: Profile[]; router: { replace: ({}) => void }; updateProfiles: () => Promise; } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/components/RenameProfileForm.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/components/RenameProfileForm.tsx index 1d1491975ec..afc7e5f9c62 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/components/RenameProfileForm.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/components/RenameProfileForm.tsx @@ -21,13 +21,13 @@ import * as React from 'react'; import Modal from 'react-modal'; import { renameProfile } from '../../../api/quality-profiles'; import { translate, translateWithParameters } from '../../../helpers/l10n'; -import { IProfile } from '../types'; +import { Profile } from '../types'; interface Props { onClose: () => void; onRename: (name: string) => void; onRequestFail: (reason: any) => void; - profile: IProfile; + profile: Profile; } interface State { diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeParentForm.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeParentForm.tsx index fd8292c7d97..082aad2b5bf 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeParentForm.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeParentForm.tsx @@ -23,14 +23,14 @@ import * as Select from 'react-select'; import { sortBy } from 'lodash'; import { changeProfileParent } from '../../../api/quality-profiles'; import { translate } from '../../../helpers/l10n'; -import { IProfile } from '../types'; +import { Profile } from '../types'; interface Props { onChange: () => void; onClose: () => void; onRequestFail: (reasong: any) => void; - profile: IProfile; - profiles: IProfile[]; + profile: Profile; + profiles: Profile[]; } interface State { diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeProjectsForm.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeProjectsForm.tsx index 19085883c03..5da1b7c6056 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeProjectsForm.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeProjectsForm.tsx @@ -22,12 +22,12 @@ import Modal from 'react-modal'; import * as escapeHtml from 'escape-html'; import SelectList from '../../../components/SelectList'; import { translate } from '../../../helpers/l10n'; -import { IProfile } from '../types'; +import { Profile } from '../types'; interface Props { onClose: () => void; organization: string | null; - profile: IProfile; + profile: Profile; } export default class ChangeProjectsForm extends React.PureComponent { diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileDetails.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileDetails.tsx index a01130a889b..f1408a5277c 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileDetails.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileDetails.tsx @@ -22,15 +22,15 @@ import ProfileRules from './ProfileRules'; import ProfileProjects from './ProfileProjects'; import ProfileInheritance from './ProfileInheritance'; import ProfileExporters from './ProfileExporters'; -import { IExporter, IProfile } from '../types'; +import { Exporter, Profile } from '../types'; interface Props { canAdmin: boolean; - exporters: IExporter[]; + exporters: Exporter[]; onRequestFail: (reasong: any) => void; organization: string | null; - profile: IProfile; - profiles: IProfile[]; + profile: Profile; + profiles: Profile[]; updateProfiles: () => Promise; } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileExporters.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileExporters.tsx index 71913fae114..8dc0ec280a7 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileExporters.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileExporters.tsx @@ -20,16 +20,16 @@ import { stringify } from 'querystring'; import * as React from 'react'; import { translate } from '../../../helpers/l10n'; -import { IProfile, IExporter } from '../types'; +import { Profile, Exporter } from '../types'; interface Props { - exporters: IExporter[]; + exporters: Exporter[]; organization: string | null; - profile: IProfile; + profile: Profile; } export default class ProfileExporters extends React.PureComponent { - getExportUrl(exporter: IExporter) { + getExportUrl(exporter: Exporter) { const { organization, profile } = this.props; const path = '/api/qualityprofiles/export'; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileHeader.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileHeader.tsx index ba0598251d6..c611571269f 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileHeader.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileHeader.tsx @@ -30,12 +30,12 @@ import { getProfilesForLanguagePath, getProfileChangelogPath } from '../utils'; -import { IProfile } from '../types'; +import { Profile } from '../types'; interface Props { canAdmin: boolean; onRequestFail: (reasong: any) => void; - profile: IProfile; + profile: Profile; organization: string | null; updateProfiles: () => Promise; } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritance.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritance.tsx index a7c6173deec..6ae17d29f37 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritance.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritance.tsx @@ -23,14 +23,14 @@ import ProfileInheritanceBox from './ProfileInheritanceBox'; import ChangeParentForm from './ChangeParentForm'; import { translate } from '../../../helpers/l10n'; import { getProfileInheritance } from '../../../api/quality-profiles'; -import { IProfile } from '../types'; +import { Profile } from '../types'; interface Props { canAdmin: boolean; onRequestFail: (reason: any) => void; organization: string | null; - profile: IProfile; - profiles: IProfile[]; + profile: Profile; + profiles: Profile[]; updateProfiles: () => Promise; } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileProjects.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileProjects.tsx index 92d30c277ba..f04e4cd5c4d 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileProjects.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileProjects.tsx @@ -23,12 +23,12 @@ import ChangeProjectsForm from './ChangeProjectsForm'; import QualifierIcon from '../../../components/shared/QualifierIcon'; import { getProfileProjects } from '../../../api/quality-profiles'; import { translate } from '../../../helpers/l10n'; -import { IProfile } from '../types'; +import { Profile } from '../types'; interface Props { canAdmin: boolean; organization: string | null; - profile: IProfile; + profile: Profile; updateProfiles: () => Promise; } 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 2fc1879190c..106636460f4 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 @@ -28,14 +28,14 @@ import { searchRules, takeFacet } from '../../../api/rules'; import { getQualityProfiles } from '../../../api/quality-profiles'; import { getRulesUrl } from '../../../helpers/urls'; import { translate } from '../../../helpers/l10n'; -import { IProfile } from '../types'; +import { Profile } from '../types'; const TYPES = ['BUG', 'VULNERABILITY', 'CODE_SMELL']; interface Props { canAdmin: boolean; organization: string | null; - profile: IProfile; + profile: Profile; } interface ByType { diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/Evolution.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/Evolution.tsx index f238580d1e2..7bb4c2b653f 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/Evolution.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/Evolution.tsx @@ -21,11 +21,11 @@ import * as React from 'react'; import EvolutionDeprecated from './EvolutionDeprecated'; import EvolutionStagnant from './EvolutionStagnant'; import EvolutionRules from './EvolutionRules'; -import { IProfile } from '../types'; +import { Profile } from '../types'; interface Props { organization: string | null; - profiles: IProfile[]; + profiles: Profile[]; } export default function Evolution({ organization, profiles }: Props) { diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionDeprecated.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionDeprecated.tsx index 0f8da8a3e9a..9357f905e21 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionDeprecated.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionDeprecated.tsx @@ -23,11 +23,11 @@ import { sortBy } from 'lodash'; import ProfileLink from '../components/ProfileLink'; import { getDeprecatedActiveRulesUrl } from '../../../helpers/urls'; import { translateWithParameters, translate } from '../../../helpers/l10n'; -import { IProfile } from '../types'; +import { Profile } from '../types'; interface Props { organization: string | null; - profiles: IProfile[]; + profiles: Profile[]; } export default function EvolutionDeprecated(props: Props) { 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 c9e3e1f46e1..84df54ceb49 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 @@ -42,7 +42,7 @@ interface Props { organization: string | null; } -interface IRule { +interface Rule { activations: number; key: string; langName: string; @@ -50,7 +50,7 @@ interface IRule { } interface State { - latestRules?: Array; + latestRules?: Array; latestRulesTotal?: number; } @@ -79,7 +79,7 @@ export default class EvolutionRules extends React.PureComponent { searchRules(data).then((r: any) => { if (this.mounted) { this.setState({ - latestRules: sortBy(parseRules(r), 'langName'), + latestRules: sortBy(parseRules(r), 'langName'), latestRulesTotal: r.total }); } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionStagnant.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionStagnant.tsx index 8b3fc2eae90..578020e7129 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionStagnant.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionStagnant.tsx @@ -22,11 +22,11 @@ import * as moment from 'moment'; import ProfileLink from '../components/ProfileLink'; import { translate } from '../../../helpers/l10n'; import { isStagnant } from '../utils'; -import { IProfile } from '../types'; +import { Profile } from '../types'; interface Props { organization: string | null; - profiles: IProfile[]; + profiles: Profile[]; } export default function EvolutionStagnan(props: Props) { diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/HomeContainer.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/HomeContainer.tsx index cd3b21502a5..bbea46ca28a 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/HomeContainer.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/HomeContainer.tsx @@ -21,7 +21,7 @@ import * as React from 'react'; import PageHeader from './PageHeader'; import Evolution from './Evolution'; import ProfilesList from './ProfilesList'; -import { IProfile } from '../types'; +import { Profile } from '../types'; interface Props { canAdmin: boolean; @@ -29,7 +29,7 @@ interface Props { location: { query: { [p: string]: string } }; onRequestFail: (reason: any) => void; organization: string | null; - profiles: Array; + profiles: Array; updateProfiles: () => Promise; } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/PageHeader.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/PageHeader.tsx index 0f3b2b9c19f..d1cec0e51de 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/PageHeader.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/PageHeader.tsx @@ -23,7 +23,7 @@ import CreateProfileForm from './CreateProfileForm'; import RestoreProfileForm from './RestoreProfileForm'; import { getProfilePath } from '../utils'; import { translate } from '../../../helpers/l10n'; -import { IProfile } from '../types'; +import { Profile } from '../types'; interface Props { canAdmin: boolean; @@ -54,7 +54,7 @@ export default class PageHeader extends React.PureComponent { this.setState({ createFormOpen: true }); }; - handleCreate = (profile: IProfile) => { + handleCreate = (profile: Profile) => { this.props.updateProfiles().then(() => { this.context.router.push( getProfilePath(profile.name, profile.language, this.props.organization) diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesList.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesList.tsx index 6f4c8f8c17b..49e5e23b668 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesList.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesList.tsx @@ -22,7 +22,7 @@ import { groupBy, pick, sortBy } from 'lodash'; import ProfilesListRow from './ProfilesListRow'; import ProfilesListHeader from './ProfilesListHeader'; import { translate, translateWithParameters } from '../../../helpers/l10n'; -import { IProfile } from '../types'; +import { Profile } from '../types'; interface Props { canAdmin: boolean; @@ -30,12 +30,12 @@ interface Props { location: { query: { [p: string]: string } }; onRequestFail: (reason: any) => void; organization: string | null; - profiles: IProfile[]; + profiles: Profile[]; updateProfiles: () => Promise; } export default class ProfilesList extends React.PureComponent { - renderProfiles(profiles: IProfile[]) { + renderProfiles(profiles: Profile[]) { return profiles.map(profile => { const { profiles, languages } = this.props; const { language } = this.props.location.query; - const profilesIndex: { [language: string]: IProfile[] } = groupBy( + const profilesIndex: { [language: string]: Profile[] } = groupBy( profiles, profile => profile.language ); - const profilesToShow: { [language: string]: IProfile[] } = language + const profilesToShow: { [language: string]: Profile[] } = language ? pick(profilesIndex, language) : profilesIndex; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListRow.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListRow.tsx index 2d982c34db4..5d61f000f48 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListRow.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListRow.tsx @@ -26,14 +26,14 @@ import BuiltInBadge from '../components/BuiltInBadge'; import { translate } from '../../../helpers/l10n'; import { getRulesUrl } from '../../../helpers/urls'; import { isStagnant } from '../utils'; -import { IProfile } from '../types'; +import { Profile } from '../types'; import Tooltip from '../../../components/controls/Tooltip'; interface Props { canAdmin: boolean; onRequestFail: (reason: any) => void; organization: string | null; - profile: IProfile; + profile: Profile; updateProfiles: () => Promise; } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/types.ts b/server/sonar-web/src/main/js/apps/quality-profiles/types.ts index 73e4384706d..415ab3c03bb 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/types.ts +++ b/server/sonar-web/src/main/js/apps/quality-profiles/types.ts @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -export interface IProfile { +export interface Profile { key: string; name: string; isBuiltIn: boolean; @@ -37,13 +37,13 @@ export interface IProfile { childrenCount: number; } -export interface IExporter { +export interface Exporter { key: string; name: string; languages: string[]; } -export interface IProfileChangelogEvent { +export interface ProfileChangelogEvent { action: string; authorName: string; date: string; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/utils.ts b/server/sonar-web/src/main/js/apps/quality-profiles/utils.ts index 890f3879e63..b23906f430f 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/utils.ts +++ b/server/sonar-web/src/main/js/apps/quality-profiles/utils.ts @@ -19,19 +19,19 @@ */ import { sortBy } from 'lodash'; import * as moment from 'moment'; -import { IProfile } from './types'; +import { Profile } from './types'; -export function sortProfiles(profiles: IProfile[]) { - const result: IProfile[] = []; +export function sortProfiles(profiles: Profile[]) { + const result: Profile[] = []; const sorted = sortBy(profiles, 'name'); - function retrieveChildren(parent: IProfile | null) { + function retrieveChildren(parent: Profile | null) { return sorted.filter( p => (parent == null && p.parentKey == null) || (parent != null && p.parentKey === parent.key) ); } - function putProfile(profile: IProfile | null = null, depth: number = 1) { + function putProfile(profile: Profile | null = null, depth: number = 1) { const children = retrieveChildren(profile); if (profile != null) { @@ -65,7 +65,7 @@ export function createFakeProfile(overrides?: any) { }; } -export function isStagnant(profile: IProfile) { +export function isStagnant(profile: Profile) { return moment().diff(moment(profile.userUpdatedAt), 'years') >= 1; } diff --git a/server/sonar-web/src/main/js/helpers/request.ts b/server/sonar-web/src/main/js/helpers/request.ts index b225df5d4fc..4bac03dadd6 100644 --- a/server/sonar-web/src/main/js/helpers/request.ts +++ b/server/sonar-web/src/main/js/helpers/request.ts @@ -44,7 +44,11 @@ export function getCSRFToken(): { [x: string]: string } { return value ? { [getCSRFTokenName()]: value } : {}; } -export function omitNil(obj: { [x: string]: any }): { [x: string]: any } { +export interface RequestData { + [x: string]: any; +} + +export function omitNil(obj: RequestData): RequestData { return omitBy(obj, isNil); } @@ -66,10 +70,6 @@ const DEFAULT_HEADERS = { Accept: 'application/json' }; -export interface RequestData { - [x: string]: any; -} - /** * Request */ -- 2.39.5