Do not unpack arguments directly on exported items
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -10,7 +10,7 @@ import { BackstagePlugin } from '@backstage/core-plugin-api';
|
||||
import { ConfigApi } from '@backstage/core-plugin-api';
|
||||
import { DiscoveryApi } from '@backstage/core-plugin-api';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { PropsWithChildren } from 'react';
|
||||
import { ReactNode } from 'react';
|
||||
|
||||
// Warning: (ae-missing-release-tag) "EntityPagerDutyCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
@@ -65,12 +65,7 @@ export class PagerDutyClient implements PagerDutyApi {
|
||||
// Warning: (ae-forgotten-export) The symbol "TriggerAlarmRequest" needs to be exported by the entry point index.d.ts
|
||||
//
|
||||
// (undocumented)
|
||||
triggerAlarm({
|
||||
integrationKey,
|
||||
source,
|
||||
description,
|
||||
userName,
|
||||
}: TriggerAlarmRequest): Promise<Response>;
|
||||
triggerAlarm(request: TriggerAlarmRequest): Promise<Response>;
|
||||
}
|
||||
|
||||
// Warning: (ae-missing-release-tag) "pagerDutyPlugin" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
@@ -84,9 +79,7 @@ export { pagerDutyPlugin as plugin };
|
||||
// Warning: (ae-missing-release-tag) "TriggerButton" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export function TriggerButton({
|
||||
children,
|
||||
}: PropsWithChildren<TriggerButtonProps>): JSX.Element;
|
||||
export function TriggerButton(props: TriggerButtonProps): JSX.Element;
|
||||
|
||||
// Warning: (ae-missing-release-tag) "UnauthorizedError" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
|
||||
@@ -91,12 +91,9 @@ export class PagerDutyClient implements PagerDutyApi {
|
||||
return oncalls;
|
||||
}
|
||||
|
||||
triggerAlarm({
|
||||
integrationKey,
|
||||
source,
|
||||
description,
|
||||
userName,
|
||||
}: TriggerAlarmRequest): Promise<Response> {
|
||||
triggerAlarm(request: TriggerAlarmRequest): Promise<Response> {
|
||||
const { integrationKey, source, description, userName } = request;
|
||||
|
||||
const body = JSON.stringify({
|
||||
event_action: 'trigger',
|
||||
routing_key: integrationKey,
|
||||
|
||||
@@ -13,14 +13,16 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import React, { useCallback, PropsWithChildren, useState } from 'react';
|
||||
import React, { useCallback, ReactNode, useState } from 'react';
|
||||
import { makeStyles, Button } from '@material-ui/core';
|
||||
import { BackstageTheme } from '@backstage/theme';
|
||||
|
||||
import { usePagerdutyEntity } from '../../hooks';
|
||||
import { TriggerDialog } from '../TriggerDialog';
|
||||
|
||||
export type TriggerButtonProps = {};
|
||||
export type TriggerButtonProps = {
|
||||
children?: ReactNode;
|
||||
};
|
||||
|
||||
const useStyles = makeStyles<BackstageTheme>(theme => ({
|
||||
buttonStyle: {
|
||||
@@ -32,9 +34,7 @@ const useStyles = makeStyles<BackstageTheme>(theme => ({
|
||||
},
|
||||
}));
|
||||
|
||||
export function TriggerButton({
|
||||
children,
|
||||
}: PropsWithChildren<TriggerButtonProps>) {
|
||||
export function TriggerButton(props: TriggerButtonProps) {
|
||||
const { buttonStyle } = useStyles();
|
||||
const { integrationKey } = usePagerdutyEntity();
|
||||
const [dialogShown, setDialogShown] = useState<boolean>(false);
|
||||
@@ -56,7 +56,7 @@ export function TriggerButton({
|
||||
disabled={disabled}
|
||||
>
|
||||
{integrationKey
|
||||
? children ?? 'Create Incident'
|
||||
? props.children ?? 'Create Incident'
|
||||
: 'Missing integration key'}
|
||||
</Button>
|
||||
{integrationKey && (
|
||||
|
||||
Reference in New Issue
Block a user