aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/quality-gates
diff options
context:
space:
mode:
authorStas Vilchik <stas.vilchik@sonarsource.com>2018-12-05 17:32:18 +0100
committerSonarTech <sonartech@sonarsource.com>2018-12-05 20:20:59 +0100
commit41c98779d38bda9fdfdca182a5f20c73fcff9a84 (patch)
treed895a9f8bfd0276aee5ffacf7bb33a0109436cbd /server/sonar-web/src/main/js/apps/quality-gates
parenta9c22c1185c5fd8c8dc4c9388f4a3b967e3f463d (diff)
downloadsonarqube-41c98779d38bda9fdfdca182a5f20c73fcff9a84.tar.gz
sonarqube-41c98779d38bda9fdfdca182a5f20c73fcff9a84.zip
create global type definitions (#1017)
Diffstat (limited to 'server/sonar-web/src/main/js/apps/quality-gates')
-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
18 files changed, 60 insertions, 79 deletions
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 => {