Browse Source

remove I prefix from interfaces

tags/6.6-RC1
Stas Vilchik 6 years ago
parent
commit
e4a2b37268
39 changed files with 104 additions and 104 deletions
  1. 2
    2
      server/sonar-web/src/main/js/api/application.ts
  2. 2
    2
      server/sonar-web/src/main/js/api/components.ts
  3. 2
    2
      server/sonar-web/src/main/js/api/notifications.ts
  4. 5
    5
      server/sonar-web/src/main/js/api/projectActivity.ts
  5. 4
    4
      server/sonar-web/src/main/js/api/time-machine.ts
  6. 2
    2
      server/sonar-web/src/main/js/apps/account/projects/ProjectCard.tsx
  7. 2
    2
      server/sonar-web/src/main/js/apps/account/projects/Projects.tsx
  8. 1
    1
      server/sonar-web/src/main/js/apps/account/projects/types.ts
  9. 2
    2
      server/sonar-web/src/main/js/apps/quality-profiles/__tests__/utils-test.ts
  10. 2
    2
      server/sonar-web/src/main/js/apps/quality-profiles/changelog/Changelog.tsx
  11. 3
    3
      server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangelogContainer.tsx
  12. 2
    2
      server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/Changelog-test.tsx
  13. 3
    3
      server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonContainer.tsx
  14. 3
    3
      server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonForm.tsx
  15. 3
    3
      server/sonar-web/src/main/js/apps/quality-profiles/components/App.tsx
  16. 2
    2
      server/sonar-web/src/main/js/apps/quality-profiles/components/CopyProfileForm.tsx
  17. 2
    2
      server/sonar-web/src/main/js/apps/quality-profiles/components/DeleteProfileForm.tsx
  18. 2
    2
      server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileActions.tsx
  19. 2
    2
      server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileContainer.tsx
  20. 2
    2
      server/sonar-web/src/main/js/apps/quality-profiles/components/RenameProfileForm.tsx
  21. 3
    3
      server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeParentForm.tsx
  22. 2
    2
      server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeProjectsForm.tsx
  23. 4
    4
      server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileDetails.tsx
  24. 4
    4
      server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileExporters.tsx
  25. 2
    2
      server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileHeader.tsx
  26. 3
    3
      server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritance.tsx
  27. 2
    2
      server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileProjects.tsx
  28. 2
    2
      server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.tsx
  29. 2
    2
      server/sonar-web/src/main/js/apps/quality-profiles/home/Evolution.tsx
  30. 2
    2
      server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionDeprecated.tsx
  31. 3
    3
      server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionRules.tsx
  32. 2
    2
      server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionStagnant.tsx
  33. 2
    2
      server/sonar-web/src/main/js/apps/quality-profiles/home/HomeContainer.tsx
  34. 2
    2
      server/sonar-web/src/main/js/apps/quality-profiles/home/PageHeader.tsx
  35. 5
    5
      server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesList.tsx
  36. 2
    2
      server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListRow.tsx
  37. 3
    3
      server/sonar-web/src/main/js/apps/quality-profiles/types.ts
  38. 6
    6
      server/sonar-web/src/main/js/apps/quality-profiles/utils.ts
  39. 5
    5
      server/sonar-web/src/main/js/helpers/request.ts

+ 2
- 2
server/sonar-web/src/main/js/api/application.ts View File

@@ -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<Array<IApplicationLeak>> {
export function getApplicationLeak(application: string): Promise<Array<ApplicationLeak>> {
return getJSON('/api/views/show_leak', { application }).then(r => r.leaks, throwGlobalError);
}

+ 2
- 2
server/sonar-web/src/main/js/api/components.ts View File

@@ -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<ISuggestionsResponse> {
): Promise<SuggestionsResponse> {
const data: RequestData = {};
if (query) {
data.s = query;

+ 2
- 2
server/sonar-web/src/main/js/api/notifications.ts View File

@@ -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<string>;
}

export function getNotifications(): Promise<IGetNotificationsResponse> {
export function getNotifications(): Promise<GetNotificationsResponse> {
return getJSON('/api/notifications/list');
}


+ 5
- 5
server/sonar-web/src/main/js/api/projectActivity.ts View File

@@ -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<IGetProjectActivityResponse> {
}): Promise<GetProjectActivityResponse> {
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<ICreateEventResponse> {
): Promise<CreateEventResponse> {
const data: RequestData = { analysis, name };
if (category) {
data.category = category;
@@ -70,7 +70,7 @@ export function changeEvent(
event: string,
name?: string,
description?: string
): Promise<ICreateEventResponse> {
): Promise<CreateEventResponse> {
const data: RequestData = { event };
if (name) {
data.name = name;

+ 4
- 4
server/sonar-web/src/main/js/api/time-machine.ts View File

@@ -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<ITimeMachineResponse> {
): Promise<TimeMachineResponse> {
return getJSON('/api/measures/search_history', {
component,
metrics: metrics.join(),
@@ -44,8 +44,8 @@ export function getAllTimeMachineData(
component: string,
metrics: Array<string>,
other?: { p?: number; from?: string; to?: string },
prev?: ITimeMachineResponse
): Promise<ITimeMachineResponse> {
prev?: TimeMachineResponse
): Promise<TimeMachineResponse> {
return getTimeMachineData(component, metrics, { ...other, ps: 1000 }).then(r => {
const result = prev
? {

+ 2
- 2
server/sonar-web/src/main/js/apps/account/projects/ProjectCard.tsx View File

@@ -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) {

+ 2
- 2
server/sonar-web/src/main/js/apps/account/projects/Projects.tsx View File

@@ -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;
}

+ 1
- 1
server/sonar-web/src/main/js/apps/account/projects/types.ts View File

@@ -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;

+ 2
- 2
server/sonar-web/src/main/js/apps/quality-profiles/__tests__/utils-test.ts View File

@@ -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', () => {

+ 2
- 2
server/sonar-web/src/main/js/apps/quality-profiles/changelog/Changelog.tsx View File

@@ -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;
}


+ 3
- 3
server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangelogContainer.tsx View File

@@ -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;

+ 2
- 2
server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/Changelog-test.tsx View File

@@ -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',

+ 3
- 3
server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonContainer.tsx View File

@@ -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 };

+ 3
- 3
server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonForm.tsx View File

@@ -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;
}

+ 3
- 3
server/sonar-web/src/main/js/apps/quality-profiles/components/App.tsx View File

@@ -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<any>;
@@ -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<Props, State> {

+ 2
- 2
server/sonar-web/src/main/js/apps/quality-profiles/components/CopyProfileForm.tsx View File

@@ -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 {

+ 2
- 2
server/sonar-web/src/main/js/apps/quality-profiles/components/DeleteProfileForm.tsx View File

@@ -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 {

+ 2
- 2
server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileActions.tsx View File

@@ -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<void>;
}


+ 2
- 2
server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileContainer.tsx View File

@@ -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<void>;
}

+ 2
- 2
server/sonar-web/src/main/js/apps/quality-profiles/components/RenameProfileForm.tsx View File

@@ -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 {

+ 3
- 3
server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeParentForm.tsx View File

@@ -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 {

+ 2
- 2
server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeProjectsForm.tsx View File

@@ -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<Props> {

+ 4
- 4
server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileDetails.tsx View File

@@ -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<void>;
}


+ 4
- 4
server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileExporters.tsx View File

@@ -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<Props> {
getExportUrl(exporter: IExporter) {
getExportUrl(exporter: Exporter) {
const { organization, profile } = this.props;

const path = '/api/qualityprofiles/export';

+ 2
- 2
server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileHeader.tsx View File

@@ -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<void>;
}

+ 3
- 3
server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritance.tsx View File

@@ -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<void>;
}


+ 2
- 2
server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileProjects.tsx View File

@@ -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<void>;
}


+ 2
- 2
server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.tsx View File

@@ -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 {

+ 2
- 2
server/sonar-web/src/main/js/apps/quality-profiles/home/Evolution.tsx View File

@@ -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) {

+ 2
- 2
server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionDeprecated.tsx View File

@@ -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) {

+ 3
- 3
server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionRules.tsx View File

@@ -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<IRule>;
latestRules?: Array<Rule>;
latestRulesTotal?: number;
}

@@ -79,7 +79,7 @@ export default class EvolutionRules extends React.PureComponent<Props, State> {
searchRules(data).then((r: any) => {
if (this.mounted) {
this.setState({
latestRules: sortBy<IRule>(parseRules(r), 'langName'),
latestRules: sortBy<Rule>(parseRules(r), 'langName'),
latestRulesTotal: r.total
});
}

+ 2
- 2
server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionStagnant.tsx View File

@@ -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) {

+ 2
- 2
server/sonar-web/src/main/js/apps/quality-profiles/home/HomeContainer.tsx View File

@@ -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<IProfile>;
profiles: Array<Profile>;
updateProfiles: () => Promise<void>;
}


+ 2
- 2
server/sonar-web/src/main/js/apps/quality-profiles/home/PageHeader.tsx View File

@@ -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<Props, State> {
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)

+ 5
- 5
server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesList.tsx View File

@@ -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<void>;
}

export default class ProfilesList extends React.PureComponent<Props> {
renderProfiles(profiles: IProfile[]) {
renderProfiles(profiles: Profile[]) {
return profiles.map(profile =>
<ProfilesListRow
canAdmin={this.props.canAdmin}
@@ -85,12 +85,12 @@ export default class ProfilesList extends React.PureComponent<Props> {
const { profiles, languages } = this.props;
const { language } = this.props.location.query;

const profilesIndex: { [language: string]: IProfile[] } = groupBy<IProfile>(
const profilesIndex: { [language: string]: Profile[] } = groupBy<Profile>(
profiles,
profile => profile.language
);

const profilesToShow: { [language: string]: IProfile[] } = language
const profilesToShow: { [language: string]: Profile[] } = language
? pick(profilesIndex, language)
: profilesIndex;


+ 2
- 2
server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListRow.tsx View File

@@ -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<void>;
}


+ 3
- 3
server/sonar-web/src/main/js/apps/quality-profiles/types.ts View File

@@ -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;

+ 6
- 6
server/sonar-web/src/main/js/apps/quality-profiles/utils.ts View File

@@ -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;
}


+ 5
- 5
server/sonar-web/src/main/js/helpers/request.ts View File

@@ -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
*/

Loading…
Cancel
Save