From 0cceb149e42485b8b980a025646a022a7316c232 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20C=C3=B4t=C3=A9?= Date: Tue, 31 Mar 2020 13:41:00 -0400 Subject: [PATCH] Adding PagerDuty icon to connectors cards (#60805) * adding PagerDuty icon to connectors cards * Fix jest * remove unnecessary global typings from canvas and sync global typings in xpack with oss Co-authored-by: Andrea Del Rio Co-authored-by: spalger Co-authored-by: Elastic Machine --- examples/alerting_example/tsconfig.json | 4 +-- typings/index.d.ts | 25 +++++++++++++++++++ .../legacy/plugins/canvas/types/webpack.d.ts | 12 --------- .../builtin_action_types/pagerduty.svg | 13 ++++++++++ .../builtin_action_types/pagerduty.test.tsx | 2 +- .../builtin_action_types/pagerduty.tsx | 3 ++- x-pack/typings/index.d.ts | 12 +++++++++ 7 files changed, 54 insertions(+), 17 deletions(-) delete mode 100644 x-pack/legacy/plugins/canvas/types/webpack.d.ts create mode 100644 x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/pagerduty.svg diff --git a/examples/alerting_example/tsconfig.json b/examples/alerting_example/tsconfig.json index 078522b36cb12..fbcec9de439bd 100644 --- a/examples/alerting_example/tsconfig.json +++ b/examples/alerting_example/tsconfig.json @@ -1,9 +1,7 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "outDir": "./target", - "skipLibCheck": true, - "resolveJsonModule": true + "outDir": "./target" }, "include": [ "index.ts", diff --git a/typings/index.d.ts b/typings/index.d.ts index 1c58a92a046df..6d97aca4024c3 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -23,6 +23,27 @@ declare module '*.html' { export default template; } +declare module '*.png' { + const content: string; + // eslint-disable-next-line import/no-default-export + export default content; +} + +declare module '*.svg' { + const content: string; + // eslint-disable-next-line import/no-default-export + export default content; +} + +// allow JSON files to be imported directly without lint errors +// see: https://github.com/palantir/tslint/issues/1264#issuecomment-228433367 +// and: https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#arbitrary-expressions-are-forbidden-in-export-assignments-in-ambient-contexts +declare module '*.json' { + const json: any; + // eslint-disable-next-line import/no-default-export + export default json; +} + type MethodKeysOf = { [K in keyof T]: T[K] extends (...args: any[]) => any ? K : never; }[keyof T]; @@ -37,3 +58,7 @@ type DeeplyMockedKeys = { : DeeplyMockedKeys; } & T; + +type Writable = { + -readonly [K in keyof T]: T[K]; +}; diff --git a/x-pack/legacy/plugins/canvas/types/webpack.d.ts b/x-pack/legacy/plugins/canvas/types/webpack.d.ts deleted file mode 100644 index 8158071e76f08..0000000000000 --- a/x-pack/legacy/plugins/canvas/types/webpack.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -declare module '*.png'; - -declare module '*.svg' { - const content: string; - export = content; -} diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/pagerduty.svg b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/pagerduty.svg new file mode 100644 index 0000000000000..b11dcb3570c26 --- /dev/null +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/pagerduty.svg @@ -0,0 +1,13 @@ + + + + + + + + + diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/pagerduty.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/pagerduty.test.tsx index bb06f7961b20b..7da97b9fe3436 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/pagerduty.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/pagerduty.test.tsx @@ -30,7 +30,7 @@ beforeAll(() => { describe('actionTypeRegistry.get() works', () => { test('action type static data is as expected', () => { expect(actionTypeModel.id).toEqual(ACTION_TYPE_ID); - expect(actionTypeModel.iconClass).toEqual('apps'); + expect(actionTypeModel.iconClass).toEqual('test-file-stub'); }); }); diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/pagerduty.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/pagerduty.tsx index 947d098c46483..da324050f3242 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/pagerduty.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/pagerduty.tsx @@ -25,11 +25,12 @@ import { ActionParamsProps, } from '../../../types'; import { PagerDutyActionParams, PagerDutyActionConnector } from './types'; +import pagerDutySvg from './pagerduty.svg'; export function getActionType(): ActionTypeModel { return { id: '.pagerduty', - iconClass: 'apps', + iconClass: pagerDutySvg, selectMessage: i18n.translate( 'xpack.triggersActionsUI.components.builtinActionTypes.pagerDutyAction.selectMessageText', { diff --git a/x-pack/typings/index.d.ts b/x-pack/typings/index.d.ts index 7696ddbfd73cb..1bf1370ad467f 100644 --- a/x-pack/typings/index.d.ts +++ b/x-pack/typings/index.d.ts @@ -10,6 +10,18 @@ declare module '*.html' { export default template; } +declare module '*.png' { + const content: string; + // eslint-disable-next-line import/no-default-export + export default content; +} + +declare module '*.svg' { + const content: string; + // eslint-disable-next-line import/no-default-export + export default content; +} + declare module 'lodash/internal/toPath' { function toPath(value: string | string[]): string[]; export = toPath;