forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RAM] Make RuleStatusDropdown shareable (elastic#130205)
* Add shareable e dropdown and move snooze interval to localstorage * Add internal components sandbox page and status dropdown test * Remove components sandbox tab * Fix typecheck * Fix typechecks and tests * Attempt to deflake tests * Reenable previousSnoozeInterval from props and prefix storage key * Export missing apis * Fix tooltip for indefinite snooze * Attempt to deflake functional test * Modularize Sandbox * Up triggersActionsUi package limit
- Loading branch information
Showing
21 changed files
with
259 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...public/application/internal/shareable_components_sandbox/rule_status_dropdown_sandbox.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React, { useState } from 'react'; | ||
import { getRuleStatusDropdownLazy } from '../../../common/get_rule_status_dropdown'; | ||
|
||
export const RuleStatusDropdownSandbox: React.FC<{}> = () => { | ||
const [enabled, setEnabled] = useState(true); | ||
const [snoozeEndTime, setSnoozeEndTime] = useState<Date | null>(null); | ||
const [muteAll, setMuteAll] = useState(false); | ||
|
||
return getRuleStatusDropdownLazy({ | ||
rule: { | ||
enabled, | ||
snoozeEndTime, | ||
muteAll, | ||
}, | ||
enableRule: async () => { | ||
setEnabled(true); | ||
setMuteAll(false); | ||
setSnoozeEndTime(null); | ||
}, | ||
disableRule: async () => setEnabled(false), | ||
snoozeRule: async (time) => { | ||
if (time === -1) { | ||
setSnoozeEndTime(null); | ||
setMuteAll(true); | ||
} else { | ||
setSnoozeEndTime(new Date(time)); | ||
setMuteAll(false); | ||
} | ||
}, | ||
unsnoozeRule: async () => { | ||
setMuteAll(false); | ||
setSnoozeEndTime(null); | ||
}, | ||
onRuleChanged: () => {}, | ||
isEditable: true, | ||
}); | ||
}; |
20 changes: 20 additions & 0 deletions
20
...public/application/internal/shareable_components_sandbox/shareable_components_sandbox.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { RuleStatusDropdownSandbox } from './rule_status_dropdown_sandbox'; | ||
|
||
export const InternalShareableComponentsSandbox: React.FC<{}> = () => { | ||
return ( | ||
<> | ||
<RuleStatusDropdownSandbox /> | ||
</> | ||
); | ||
}; | ||
|
||
// eslint-disable-next-line import/no-default-export | ||
export { InternalShareableComponentsSandbox as default }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.