aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main
diff options
context:
space:
mode:
authorGuillaume Jambet <guillaume.jambet@sonarsource.com>2018-01-31 18:47:59 +0100
committerGuillaume Jambet <guillaume.jambet@gmail.com>2018-03-01 15:21:05 +0100
commit21b4be2173e36fef157e46582060e265edb1bf45 (patch)
tree8e94b30ef647a93fb1c24750fec518458615c2aa /server/sonar-web/src/main
parent3c5c062c8bf27f5ed93c72871d9d9ddcf4c0c548 (diff)
downloadsonarqube-21b4be2173e36fef157e46582060e265edb1bf45.tar.gz
sonarqube-21b4be2173e36fef157e46582060e265edb1bf45.zip
SONAR-10344 api/webhooks/search returns webhooks for global and project
Diffstat (limited to 'server/sonar-web/src/main')
-rw-r--r--server/sonar-web/src/main/js/api/webhooks.ts16
-rw-r--r--server/sonar-web/src/main/js/app/types.ts15
-rw-r--r--server/sonar-web/src/main/js/apps/webhooks/components/App.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/webhooks/components/WebhookItem.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/webhooks/components/WebhooksList.tsx15
5 files changed, 25 insertions, 29 deletions
diff --git a/server/sonar-web/src/main/js/api/webhooks.ts b/server/sonar-web/src/main/js/api/webhooks.ts
index fa526855e02..547702464b1 100644
--- a/server/sonar-web/src/main/js/api/webhooks.ts
+++ b/server/sonar-web/src/main/js/api/webhooks.ts
@@ -19,21 +19,7 @@
*/
import { getJSON } from '../helpers/request';
import throwGlobalError from '../app/utils/throwGlobalError';
-
-export interface Delivery {
- id: string;
- at: string;
- success: boolean;
- httpStatus: number;
- durationMs: number;
-}
-
-export interface Webhook {
- key: string;
- name: string;
- url: string;
- latestDelivery?: Delivery;
-}
+import { Webhook } from '../app/types';
export function searchWebhooks(data: {
organization: string | undefined;
diff --git a/server/sonar-web/src/main/js/app/types.ts b/server/sonar-web/src/main/js/app/types.ts
index 13b8bac9f66..43f2c58bad5 100644
--- a/server/sonar-web/src/main/js/app/types.ts
+++ b/server/sonar-web/src/main/js/app/types.ts
@@ -383,3 +383,18 @@ export enum Visibility {
Public = 'public',
Private = 'private'
}
+
+export interface Webhook {
+ key: string;
+ latestDelivery?: WebhookDelivery;
+ name: string;
+ url: string;
+}
+
+export interface WebhookDelivery {
+ at: string;
+ durationMs: number;
+ httpStatus: number;
+ id: string;
+ success: boolean;
+}
diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/App.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/App.tsx
index 36f26f55913..e1d559ef307 100644
--- a/server/sonar-web/src/main/js/apps/webhooks/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/webhooks/components/App.tsx
@@ -21,13 +21,13 @@ import * as React from 'react';
import { Helmet } from 'react-helmet';
import PageHeader from './PageHeader';
import WebhooksList from './WebhooksList';
-import { searchWebhooks, Webhook } from '../../../api/webhooks';
-import { LightComponent, Organization } from '../../../app/types';
+import { searchWebhooks } from '../../../api/webhooks';
+import { LightComponent, Organization, Webhook } from '../../../app/types';
import { translate } from '../../../helpers/l10n';
interface Props {
- organization: Organization | undefined;
component?: LightComponent;
+ organization: Organization | undefined;
}
interface State {
diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/WebhookItem.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/WebhookItem.tsx
index 1be6a9da181..f156900d581 100644
--- a/server/sonar-web/src/main/js/apps/webhooks/components/WebhookItem.tsx
+++ b/server/sonar-web/src/main/js/apps/webhooks/components/WebhookItem.tsx
@@ -18,7 +18,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { Webhook } from '../../../api/webhooks';
+import { Webhook } from '../../../app/types';
interface Props {
webhook: Webhook;
diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/WebhooksList.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/WebhooksList.tsx
index 61689e75561..600fad4e8d3 100644
--- a/server/sonar-web/src/main/js/apps/webhooks/components/WebhooksList.tsx
+++ b/server/sonar-web/src/main/js/apps/webhooks/components/WebhooksList.tsx
@@ -19,7 +19,7 @@
*/
import * as React from 'react';
import WebhookItem from './WebhookItem';
-import { Webhook } from '../../../api/webhooks';
+import { Webhook } from '../../../app/types';
import { translate } from '../../../helpers/l10n';
interface Props {
@@ -36,21 +36,16 @@ export default class WebhooksList extends React.PureComponent<Props> {
</thead>
);
- renderNoWebhooks = () => (
- <tr>
- <td>{translate('webhooks.no_result')}</td>
- </tr>
- );
-
render() {
const { webhooks } = this.props;
+ if (webhooks.length < 1) {
+ return <p>{translate('webhooks.no_result')}</p>;
+ }
return (
<table className="data zebra">
{this.renderHeader()}
<tbody>
- {webhooks.length > 0
- ? webhooks.map(webhook => <WebhookItem key={webhook.key} webhook={webhook} />)
- : this.renderNoWebhooks()}
+ {webhooks.map(webhook => <WebhookItem key={webhook.key} webhook={webhook} />)}
</tbody>
</table>
);