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);
}
return postJSON(url, data);
}
-export interface ISuggestionsResponse {
+export interface SuggestionsResponse {
organizations: Array<{ key: string; name: string }>;
projects: Array<{ key: string; name: string }>;
results: Array<{
query?: string,
recentlyBrowsed?: string[],
more?: string
-): Promise<ISuggestionsResponse> {
+): Promise<SuggestionsResponse> {
const data: RequestData = {};
if (query) {
data.s = query;
*/
import { getJSON, post, RequestData } from '../helpers/request';
-export interface IGetNotificationsResponse {
+export interface GetNotificationsResponse {
notifications: Array<{
channel: string;
type: string;
perProjectTypes: Array<string>;
}
-export function getNotifications(): Promise<IGetNotificationsResponse> {
+export function getNotifications(): Promise<GetNotificationsResponse> {
return getJSON('/api/notifications/list');
}
import { getJSON, postJSON, post, RequestData } from '../helpers/request';
import throwGlobalError from '../app/utils/throwGlobalError';
-interface IGetProjectActivityResponse {
+interface GetProjectActivityResponse {
analyses: any[];
paging: {
total: number;
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;
name: string,
category?: string,
description?: string
-): Promise<ICreateEventResponse> {
+): Promise<CreateEventResponse> {
const data: RequestData = { analysis, name };
if (category) {
data.category = category;
event: string,
name?: string,
description?: string
-): Promise<ICreateEventResponse> {
+): Promise<CreateEventResponse> {
const data: RequestData = { event };
if (name) {
data.name = name;
*/
import { getJSON } from '../helpers/request';
-interface ITimeMachineResponse {
+interface TimeMachineResponse {
measures: Array<{
metric: string;
history: Array<{ date: string; value: string }>;
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(),
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
? {
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) {
*/
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;
}
* 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;
* 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', () => {
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;
}
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: {
};
};
organization: string | null;
- profile: IProfile;
+ profile: Profile;
}
interface State {
- events?: IProfileChangelogEvent[];
+ events?: ProfileChangelogEvent[];
loading: boolean;
page?: number;
total?: number;
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',
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 };
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;
}
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>;
interface State {
loading: boolean;
- exporters?: IExporter[];
- profiles?: IProfile[];
+ exporters?: Exporter[];
+ profiles?: Profile[];
}
export default class App extends React.PureComponent<Props, State> {
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 {
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 {
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>;
}
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;
};
onRequestFail: (reasong: any) => void;
organization: string | null;
- profiles: IProfile[];
+ profiles: Profile[];
router: { replace: ({}) => void };
updateProfiles: () => Promise<void>;
}
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 {
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 {
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> {
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>;
}
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';
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>;
}
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>;
}
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>;
}
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 {
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) {
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) {
organization: string | null;
}
-interface IRule {
+interface Rule {
activations: number;
key: string;
langName: string;
}
interface State {
- latestRules?: Array<IRule>;
+ latestRules?: Array<Rule>;
latestRulesTotal?: number;
}
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
});
}
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) {
import PageHeader from './PageHeader';
import Evolution from './Evolution';
import ProfilesList from './ProfilesList';
-import { IProfile } from '../types';
+import { Profile } from '../types';
interface Props {
canAdmin: boolean;
location: { query: { [p: string]: string } };
onRequestFail: (reason: any) => void;
organization: string | null;
- profiles: Array<IProfile>;
+ profiles: Array<Profile>;
updateProfiles: () => Promise<void>;
}
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;
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)
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;
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}
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;
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>;
}
* 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;
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;
*/
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) {
};
}
-export function isStagnant(profile: IProfile) {
+export function isStagnant(profile: Profile) {
return moment().diff(moment(profile.userUpdatedAt), 'years') >= 1;
}
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);
}
Accept: 'application/json'
};
-export interface RequestData {
- [x: string]: any;
-}
-
/**
* Request
*/