]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-12632 Rework QG related types
authorWouter Admiraal <wouter.admiraal@sonarsource.com>
Tue, 17 Dec 2019 15:50:29 +0000 (16:50 +0100)
committerSonarTech <sonartech@sonarsource.com>
Mon, 10 Feb 2020 19:46:14 +0000 (20:46 +0100)
20 files changed:
server/sonar-web/src/main/js/api/application.ts
server/sonar-web/src/main/js/api/quality-gates.ts
server/sonar-web/src/main/js/apps/overview/__tests__/utils-test.ts
server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/Details-test.tsx
server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/DetailsContent-test.tsx
server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/DetailsHeader-test.tsx
server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/List-test.tsx
server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/Projects-test.tsx
server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/RenameQualityGateForm-test.tsx
server/sonar-web/src/main/js/helpers/__tests__/qualityGates-test.ts
server/sonar-web/src/main/js/helpers/mocks/application.ts [new file with mode: 0644]
server/sonar-web/src/main/js/helpers/mocks/quality-gates.ts [new file with mode: 0644]
server/sonar-web/src/main/js/helpers/qualityGates.ts
server/sonar-web/src/main/js/helpers/testMocks.ts
server/sonar-web/src/main/js/store/__tests__/branches-test.ts
server/sonar-web/src/main/js/store/__tests__/rootActions-test.tsx
server/sonar-web/src/main/js/store/branches.ts
server/sonar-web/src/main/js/types/application.ts [new file with mode: 0644]
server/sonar-web/src/main/js/types/quality-gates.ts [new file with mode: 0644]
server/sonar-web/src/main/js/types/types.d.ts

index 73de323927b2da40b5b33085e8cdccc66aec28f9..470e0798cd4f6ce270945e5f22acd4e1d738e1e8 100644 (file)
  */
 import { getJSON } from 'sonar-ui-common/helpers/request';
 import throwGlobalError from '../app/utils/throwGlobalError';
-
-export interface ApplicationLeak {
-  date: string;
-  project: string;
-  projectName: string;
-}
+import { ApplicationPeriod } from '../types/application';
 
 export function getApplicationLeak(
   application: string,
   branch?: string
-): Promise<Array<ApplicationLeak>> {
+): Promise<ApplicationPeriod[]> {
   return getJSON('/api/applications/show_leak', { application, branch }).then(
     r => r.leaks,
     throwGlobalError
index a43ccdc02509b391c714b5cdcc29a2eb90019952..2af81857bfa4cf2d1aed22fb15392f4bcde24a4f 100644 (file)
@@ -20,6 +20,7 @@
 import { getJSON, post, postJSON } from 'sonar-ui-common/helpers/request';
 import throwGlobalError from '../app/utils/throwGlobalError';
 import { BranchParameters } from '../types/branch-like';
+import { QualityGateApplicationStatus, QualityGateProjectStatus } from '../types/quality-gates';
 
 export function fetchQualityGates(data: {
   organization?: string;
@@ -139,35 +140,11 @@ export function dissociateGateWithProject(data: {
   return post('/api/qualitygates/deselect', data).catch(throwGlobalError);
 }
 
-export interface ConditionAnalysis {
-  comparator: string;
-  errorThreshold?: string;
-  metric: string;
-  periodIndex?: number;
-  onLeak?: boolean;
-  status: string;
-  value: string;
-  warningThreshold?: string;
-}
-
-export interface ApplicationProject {
-  key: string;
-  name: string;
-  status: string;
-  conditions: ConditionAnalysis[];
-}
-
-export interface ApplicationQualityGate {
-  metrics: T.Metric[];
-  projects: ApplicationProject[];
-  status: string;
-}
-
 export function getApplicationQualityGate(data: {
   application: string;
   branch?: string;
   organization?: string;
-}): Promise<ApplicationQualityGate> {
+}): Promise<QualityGateApplicationStatus> {
   return getJSON('/api/qualitygates/application_status', data).catch(throwGlobalError);
 }
 
@@ -176,7 +153,7 @@ export function getQualityGateProjectStatus(
     projectKey?: string;
     projectId?: string;
   } & BranchParameters
-): Promise<T.QualityGateProjectStatus> {
+): Promise<QualityGateProjectStatus> {
   return getJSON('/api/qualitygates/project_status', data)
     .then(r => r.projectStatus)
     .catch(throwGlobalError);
index 5cf88d6dda641f08282a5522549b9c034ad379f3..fced030fc8634d9fab1fbbcf07c9bfcb73f3bc32 100644 (file)
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
-import {
-  mockMeasureEnhanced,
-  mockMetric,
-  mockQualityGateStatusCondition
-} from '../../../helpers/testMocks';
+import { mockQualityGateStatusCondition } from '../../../helpers/mocks/quality-gates';
+import { mockMeasureEnhanced, mockMetric } from '../../../helpers/testMocks';
+import { MetricKey } from '../../../types/metrics';
 import { getThreshold } from '../utils';
 
 // eslint-disable-next-line no-console
index d76b2b1475ad3b7e2c2df22aeeb1a78aa2af8681..27835834681f2cb1f1d569e7820d6c22315499ef 100644 (file)
@@ -21,12 +21,13 @@ import { shallow } from 'enzyme';
 import * as React from 'react';
 import { waitAndUpdate } from 'sonar-ui-common/helpers/testUtils';
 import { fetchQualityGate } from '../../../../api/quality-gates';
-import { mockCondition, mockQualityGate } from '../../../../helpers/testMocks';
+import { mockQualityGate } from '../../../../helpers/mocks/quality-gates';
+import { mockCondition } from '../../../../helpers/testMocks';
 import { addCondition, deleteCondition, replaceCondition } from '../../utils';
 import { Details } from '../Details';
 
 jest.mock('../../../../api/quality-gates', () => {
-  const { mockQualityGate } = jest.requireActual('../../../../helpers/testMocks');
+  const { mockQualityGate } = jest.requireActual('../../../../helpers/mocks/quality-gates');
   return {
     fetchQualityGate: jest.fn().mockResolvedValue(mockQualityGate())
   };
index 0235cffcd0a5a9566363060310324f055e8bcf05..6f21e9f6fb91bd06fecc643be7c4883a4b318df9 100644 (file)
@@ -19,7 +19,7 @@
  */
 import { shallow } from 'enzyme';
 import * as React from 'react';
-import { mockQualityGate } from '../../../../helpers/testMocks';
+import { mockQualityGate } from '../../../../helpers/mocks/quality-gates';
 import { DetailsContent, DetailsContentProps } from '../DetailsContent';
 
 it('should render correctly', () => {
index 5707ad41b51262a15be1a96dc67a8ad64c5129a7..c3d927b6efb693e9e5e201a2e006db7dc6f1f825 100644 (file)
@@ -21,7 +21,7 @@ import { shallow } from 'enzyme';
 import * as React from 'react';
 import { click, waitAndUpdate } from 'sonar-ui-common/helpers/testUtils';
 import { setQualityGateAsDefault } from '../../../../api/quality-gates';
-import { mockQualityGate } from '../../../../helpers/testMocks';
+import { mockQualityGate } from '../../../../helpers/mocks/quality-gates';
 import DetailsHeader from '../DetailsHeader';
 
 jest.mock('../../../../api/quality-gates', () => ({
index 685ddd9da1a270bc6fa2c54893724e949a323fbb..ae327226a47bceccef9d4619dda6f68c0870f432 100644 (file)
@@ -19,7 +19,7 @@
  */
 import { shallow } from 'enzyme';
 import * as React from 'react';
-import { mockQualityGate } from '../../../../helpers/testMocks';
+import { mockQualityGate } from '../../../../helpers/mocks/quality-gates';
 import List from '../List';
 
 it('should render correctly', () => {
index 99d12c3d3dc36697b8aac5363026a172d3555fc8..39135e168fe1565bc057535caebe011b3ff91c71 100644 (file)
@@ -26,7 +26,7 @@ import {
   dissociateGateWithProject,
   searchProjects
 } from '../../../../api/quality-gates';
-import { mockQualityGate } from '../../../../helpers/testMocks';
+import { mockQualityGate } from '../../../../helpers/mocks/quality-gates';
 import Projects from '../Projects';
 
 const qualityGate = mockQualityGate();
index a497f84a3e07939ef3feec4c4ac85f24163b3f86..40eb1a513bf7e613ea7c3f32cf82074a91c2e479 100644 (file)
@@ -19,7 +19,7 @@
  */
 import { shallow } from 'enzyme';
 import * as React from 'react';
-import { mockQualityGate } from '../../../../helpers/testMocks';
+import { mockQualityGate } from '../../../../helpers/mocks/quality-gates';
 import RenameQualityGateForm from '../RenameQualityGateForm';
 
 it('should render correctly', () => {
index a7269d658697de45e145732d60f4faef89d68ae0..0017092aa536bc4322c2a08aae77f853632a812c 100644 (file)
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
-import { extractStatusConditionsFromProjectStatus } from '../qualityGates';
-import { mockQualityGateProjectStatus } from '../testMocks';
+import {
+  mockQualityGateApplicationStatus,
+  mockQualityGateProjectStatus
+} from '../mocks/quality-gates';
+import {
+  extractStatusConditionsFromApplicationStatusChildProject,
+  extractStatusConditionsFromProjectStatus
+} from '../qualityGates';
 
 describe('extractStatusConditionsFromProjectStatus', () => {
   it('should correclty extract the conditions for the project status', () => {
@@ -34,3 +40,30 @@ describe('extractStatusConditionsFromProjectStatus', () => {
     ]);
   });
 });
+
+describe('extractStatusConditionsFromApplicationStatusChildProject', () => {
+  it('should correclty extract the conditions for the application child project status', () => {
+    expect(
+      extractStatusConditionsFromApplicationStatusChildProject(
+        mockQualityGateApplicationStatus().projects[0]
+      )
+    ).toEqual([
+      {
+        actual: '10',
+        error: '1.0',
+        level: 'ERROR',
+        metric: 'coverage',
+        op: 'GT',
+        period: undefined
+      },
+      {
+        actual: '5',
+        error: '1.0',
+        level: 'ERROR',
+        metric: 'new_bugs',
+        op: 'GT',
+        period: 1
+      }
+    ]);
+  });
+});
diff --git a/server/sonar-web/src/main/js/helpers/mocks/application.ts b/server/sonar-web/src/main/js/helpers/mocks/application.ts
new file mode 100644 (file)
index 0000000..8f81272
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2020 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+import { ApplicationPeriod } from '../../types/application';
+
+export function mockApplicationPeriod(
+  overrides: Partial<ApplicationPeriod> = {}
+): ApplicationPeriod {
+  return {
+    date: '2017-10-01',
+    project: 'foo',
+    projectName: 'Foo',
+    ...overrides
+  };
+}
diff --git a/server/sonar-web/src/main/js/helpers/mocks/quality-gates.ts b/server/sonar-web/src/main/js/helpers/mocks/quality-gates.ts
new file mode 100644 (file)
index 0000000..1da5332
--- /dev/null
@@ -0,0 +1,145 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2020 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+/* eslint-disable sonarjs/no-duplicate-string */
+import {
+  QualityGateApplicationStatus,
+  QualityGateProjectStatus,
+  QualityGateStatus,
+  QualityGateStatusCondition,
+  QualityGateStatusConditionEnhanced
+} from '../../types/quality-gates';
+import { mockMeasureEnhanced, mockMetric } from '../testMocks';
+
+export function mockQualityGate(overrides: Partial<T.QualityGate> = {}): T.QualityGate {
+  return {
+    id: 1,
+    name: 'qualitygate',
+    ...overrides
+  };
+}
+
+export function mockQualityGateStatus(
+  overrides: Partial<QualityGateStatus> = {}
+): QualityGateStatus {
+  return {
+    ignoredConditions: false,
+    failedConditions: [mockQualityGateStatusConditionEnhanced()],
+    key: 'foo',
+    name: 'Foo',
+    status: 'ERROR',
+    ...overrides
+  };
+}
+
+export function mockQualityGateStatusCondition(
+  overrides: Partial<QualityGateStatusCondition> = {}
+): QualityGateStatusCondition {
+  return {
+    actual: '10',
+    error: '0',
+    level: 'ERROR',
+    metric: 'foo',
+    op: 'GT',
+    ...overrides
+  };
+}
+
+export function mockQualityGateStatusConditionEnhanced(
+  overrides: Partial<QualityGateStatusConditionEnhanced> = {}
+): QualityGateStatusConditionEnhanced {
+  return {
+    actual: '10',
+    error: '0',
+    level: 'ERROR',
+    metric: 'foo',
+    op: 'GT',
+    measure: mockMeasureEnhanced({ ...(overrides.measure || {}) }),
+    ...overrides
+  };
+}
+
+export function mockQualityGateProjectStatus(
+  overrides: Partial<QualityGateProjectStatus> = {}
+): QualityGateProjectStatus {
+  return {
+    conditions: [
+      {
+        actualValue: '0',
+        comparator: 'GT',
+        errorThreshold: '1.0',
+        metricKey: 'new_bugs',
+        periodIndex: 1,
+        status: 'OK'
+      }
+    ],
+    ignoredConditions: false,
+    status: 'OK',
+    ...overrides
+  };
+}
+
+export function mockQualityGateApplicationStatus(
+  overrides: Partial<QualityGateApplicationStatus> = {}
+): QualityGateApplicationStatus {
+  return {
+    metrics: [mockMetric(), mockMetric({ name: 'new_bugs', key: 'new_bugs', type: 'INT' })],
+    projects: [
+      {
+        key: 'foo',
+        name: 'Foo',
+        conditions: [
+          {
+            comparator: 'GT',
+            errorThreshold: '1.0',
+            metric: 'coverage',
+            status: 'ERROR',
+            value: '10'
+          },
+          {
+            comparator: 'GT',
+            errorThreshold: '1.0',
+            metric: 'new_bugs',
+            periodIndex: 1,
+            status: 'ERROR',
+            value: '5'
+          }
+        ],
+        status: 'ERROR'
+      },
+      {
+        key: 'bar',
+        name: 'Bar',
+        conditions: [
+          {
+            comparator: 'GT',
+            errorThreshold: '5.0',
+            metric: 'new_bugs',
+            periodIndex: 1,
+            status: 'ERROR',
+            value: '15'
+          }
+        ],
+        status: 'ERROR'
+      }
+    ],
+    status: 'ERROR',
+    ...overrides
+  };
+}
index 6be70a2e4176a4bb7ce87f46620c682e5768fded..8724ebc72bbaaeed5a94472ea238d65fe2447492 100644 (file)
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
+import {
+  QualityGateApplicationStatusChildProject,
+  QualityGateProjectStatus,
+  QualityGateStatusCondition
+} from '../types/quality-gates';
+
 export function extractStatusConditionsFromProjectStatus(
-  projectStatus: T.QualityGateProjectStatus
-): T.QualityGateStatusCondition[] {
+  projectStatus: QualityGateProjectStatus
+): QualityGateStatusCondition[] {
   const { conditions } = projectStatus;
   return conditions
     ? conditions.map(c => ({
@@ -32,3 +38,19 @@ export function extractStatusConditionsFromProjectStatus(
       }))
     : [];
 }
+
+export function extractStatusConditionsFromApplicationStatusChildProject(
+  projectStatus: QualityGateApplicationStatusChildProject
+): QualityGateStatusCondition[] {
+  const { conditions } = projectStatus;
+  return conditions
+    ? conditions.map(c => ({
+        actual: c.value,
+        error: c.errorThreshold,
+        level: c.status,
+        metric: c.metric,
+        op: c.comparator,
+        period: c.periodIndex
+      }))
+    : [];
+}
index 356092537ec857fe646f104371a8ed289d22d101..9b43cec23f399612a72ca184049cfeaca3187d8c 100644 (file)
@@ -325,19 +325,6 @@ export function mockCondition(overrides: Partial<T.Condition> = {}): T.Condition
   };
 }
 
-export function mockQualityGateStatusCondition(
-  overrides: Partial<T.QualityGateStatusCondition> = {}
-): T.QualityGateStatusCondition {
-  return {
-    actual: '10',
-    error: '0',
-    level: 'ERROR',
-    metric: 'foo',
-    op: 'GT',
-    ...overrides
-  };
-}
-
 export function mockSnippetsByComponent(
   component = 'main.js',
   lines: number[] = [16]
@@ -543,14 +530,6 @@ export function mockPeriod(overrides: Partial<T.Period> = {}): T.Period {
   };
 }
 
-export function mockQualityGate(overrides: Partial<T.QualityGate> = {}): T.QualityGate {
-  return {
-    id: 1,
-    name: 'qualitygate',
-    ...overrides
-  };
-}
-
 export function mockQualityProfile(overrides: Partial<Profile> = {}): Profile {
   return {
     activeDeprecatedRuleCount: 2,
@@ -605,26 +584,6 @@ export function mockQualityProfileExporter(override?: Partial<Exporter>): Export
   };
 }
 
-export function mockQualityGateProjectStatus(
-  overrides: Partial<T.QualityGateProjectStatus> = {}
-): T.QualityGateProjectStatus {
-  return {
-    conditions: [
-      {
-        actualValue: '0',
-        comparator: 'GT',
-        errorThreshold: '1.0',
-        metricKey: 'new_bugs',
-        periodIndex: 1,
-        status: 'OK'
-      }
-    ],
-    ignoredConditions: false,
-    status: 'OK',
-    ...overrides
-  };
-}
-
 export function mockRouter(overrides: { push?: Function; replace?: Function } = {}) {
   return {
     createHref: jest.fn(),
index e74645fafaa0a9d3e4830bb2ee1d8d68c2c9f604..dd2ffe3c8d736d0bfb0ef783f7168520103198c6 100644 (file)
  */
 import { getBranchLikeKey } from '../../helpers/branch-like';
 import { mockBranch, mockPullRequest } from '../../helpers/mocks/branch-like';
-import { mockQualityGateStatusCondition } from '../../helpers/testMocks';
+import { mockQualityGateStatusCondition } from '../../helpers/mocks/quality-gates';
 import { BranchLike } from '../../types/branch-like';
+import { QualityGateStatusCondition } from '../../types/quality-gates';
 import reducer, {
   getBranchStatusByBranchLike,
   registerBranchStatusAction,
   State
 } from '../branches';
 
-type TestArgs = [BranchLike, string, T.Status, T.QualityGateStatusCondition[], boolean?];
+type TestArgs = [BranchLike, string, T.Status, QualityGateStatusCondition[], boolean?];
 
 const FAILING_CONDITION = mockQualityGateStatusCondition();
 const COMPONENT = 'foo';
index 4c4add7250ce93af3659155a933691de31cff74a..50fae18e8745c2fae2c030e134e0ece996f62c36 100644 (file)
@@ -18,7 +18,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 import { mockBranch } from '../../helpers/mocks/branch-like';
-import { mockQualityGateStatusCondition } from '../../helpers/testMocks';
+import { mockQualityGateStatusCondition } from '../../helpers/mocks/quality-gates';
 import { registerBranchStatusAction } from '../branches';
 import { fetchBranchStatus, registerBranchStatus } from '../rootActions';
 
@@ -28,7 +28,9 @@ jest.mock('../branches', () => ({
 }));
 
 jest.mock('../../api/quality-gates', () => {
-  const { mockQualityGateProjectStatus } = require.requireActual('../../helpers/testMocks');
+  const { mockQualityGateProjectStatus } = require.requireActual(
+    '../../helpers/mocks/quality-gates'
+  );
   return {
     getQualityGateProjectStatus: jest.fn().mockResolvedValue(
       mockQualityGateProjectStatus({
index 67928e2f86d32849fb970cfa083c42765551573a..f05a531af9874cfdf5ea6dab866e40fe9d30f48d 100644 (file)
  */
 import { getBranchLikeKey } from '../helpers/branch-like';
 import { BranchLike } from '../types/branch-like';
+import { QualityGateStatusCondition } from '../types/quality-gates';
 import { ActionType } from './utils/actions';
 
 export interface BranchStatusData {
-  conditions?: T.QualityGateStatusCondition[];
+  conditions?: QualityGateStatusCondition[];
   ignoredConditions?: boolean;
   status?: T.Status;
 }
@@ -41,7 +42,7 @@ export function registerBranchStatusAction(
   branchLike: BranchLike,
   component: string,
   status: T.Status,
-  conditions?: T.QualityGateStatusCondition[],
+  conditions?: QualityGateStatusCondition[],
   ignoredConditions?: boolean
 ) {
   return {
diff --git a/server/sonar-web/src/main/js/types/application.ts b/server/sonar-web/src/main/js/types/application.ts
new file mode 100644 (file)
index 0000000..255c88e
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2020 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * 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 ApplicationPeriod {
+  date: string;
+  project: string;
+  projectName: string;
+}
diff --git a/server/sonar-web/src/main/js/types/quality-gates.ts b/server/sonar-web/src/main/js/types/quality-gates.ts
new file mode 100644 (file)
index 0000000..e3dbe21
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2020 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * 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 QualityGateProjectStatus {
+  conditions?: QualityGateProjectStatusCondition[];
+  ignoredConditions: boolean;
+  status: T.Status;
+}
+
+export interface QualityGateProjectStatusCondition {
+  actualValue: string;
+  comparator: string;
+  errorThreshold: string;
+  metricKey: string;
+  periodIndex: number;
+  status: T.Status;
+}
+
+export interface QualityGateApplicationStatus {
+  metrics: T.Metric[];
+  projects: QualityGateApplicationStatusChildProject[];
+  status: T.Status;
+}
+
+export interface QualityGateApplicationStatusCondition {
+  comparator: string;
+  errorThreshold?: string;
+  metric: string;
+  periodIndex?: number;
+  onLeak?: boolean;
+  status: string;
+  value: string;
+  warningThreshold?: string;
+}
+
+export interface QualityGateApplicationStatusChildProject {
+  conditions: QualityGateApplicationStatusCondition[];
+  key: string;
+  name: string;
+  status: T.Status;
+}
+
+export interface QualityGateStatus {
+  failedConditions: QualityGateStatusConditionEnhanced[];
+  ignoredConditions?: boolean;
+  key: string;
+  name: string;
+  status: T.Status;
+}
+
+export interface QualityGateStatusCondition {
+  actual?: string;
+  error?: string;
+  level: string;
+  metric: string;
+  op: string;
+  period?: number;
+  warning?: string;
+}
+
+export interface QualityGateStatusConditionEnhanced extends QualityGateStatusCondition {
+  measure: T.MeasureEnhanced;
+}
index c951f28def9d99d93ae10d481e8f7119a50970da..365b9e59c18af3f48e8a56d9ee73d2e6ff4875ba 100644 (file)
@@ -657,35 +657,6 @@ declare namespace T {
     name: string;
   }
 
-  export interface QualityGateProjectStatusCondition {
-    status: Status;
-    metricKey: string;
-    comparator: string;
-    periodIndex: number;
-    errorThreshold: string;
-    actualValue: string;
-  }
-
-  export interface QualityGateProjectStatus {
-    conditions?: QualityGateProjectStatusCondition[];
-    ignoredConditions: boolean;
-    status: Status;
-  }
-
-  export interface QualityGateStatusCondition {
-    actual?: string;
-    error?: string;
-    level: string;
-    metric: string;
-    op: string;
-    period?: number;
-    warning?: string;
-  }
-
-  export interface QualityGateStatusConditionEnhanced extends QualityGateStatusCondition {
-    measure: T.MeasureEnhanced;
-  }
-
   export interface Rule {
     isTemplate?: boolean;
     key: string;