unpack props inside component bodies

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2023-02-27 15:31:15 +01:00
parent babbaa9391
commit 65454876fb
51 changed files with 253 additions and 297 deletions
+2 -9
View File
@@ -214,19 +214,12 @@ export class SplunkOnCallClient implements SplunkOnCallApi {
// (undocumented)
getUsers(): Promise<User[]>;
// (undocumented)
incidentAction({
routingKey,
incidentType,
incidentId,
incidentDisplayName,
incidentMessage,
incidentStartTime,
}: TriggerAlarmRequest): Promise<Response>;
incidentAction(options: TriggerAlarmRequest): Promise<Response>;
}
// @public (undocumented)
export const SplunkOnCallPage: {
({ title, subtitle, pageTitle }: SplunkOnCallPageProps): JSX.Element;
(props: SplunkOnCallPageProps): JSX.Element;
defaultProps: {
title: string;
subtitle: string;
+12 -10
View File
@@ -114,14 +114,16 @@ export class SplunkOnCallClient implements SplunkOnCallApi {
return policies;
}
async incidentAction({
routingKey,
incidentType,
incidentId,
incidentDisplayName,
incidentMessage,
incidentStartTime,
}: TriggerAlarmRequest): Promise<Response> {
async incidentAction(options: TriggerAlarmRequest): Promise<Response> {
const {
routingKey,
incidentType,
incidentId,
incidentDisplayName,
incidentMessage,
incidentStartTime,
} = options;
const body = JSON.stringify({
message_type: incidentType,
...(incidentId ? { entity_id: incidentId } : {}),
@@ -132,7 +134,7 @@ export class SplunkOnCallClient implements SplunkOnCallApi {
...(incidentStartTime ? { state_start_time: incidentStartTime } : {}),
});
const options = {
const request = {
method: 'POST',
headers: {
Accept: 'application/json',
@@ -143,7 +145,7 @@ export class SplunkOnCallClient implements SplunkOnCallApi {
const url = `${this.config.eventsRestEndpoint}/${routingKey}`;
return this.request(url, options);
return this.request(url, request);
}
private async findByUrl<T>(url: string): Promise<T> {
@@ -38,11 +38,8 @@ export type SplunkOnCallPageProps = {
pageTitle?: string;
};
export const SplunkOnCallPage = ({
title,
subtitle,
pageTitle,
}: SplunkOnCallPageProps): JSX.Element => {
export const SplunkOnCallPage = (props: SplunkOnCallPageProps): JSX.Element => {
const { title, subtitle, pageTitle } = props;
const classes = useStyles();
return (