-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ResponseOps][Stack Connectors] Opsgenie connector UI #142411
Conversation
Pinging @elastic/response-ops (Team:ResponseOps) |
import React from 'react'; | ||
import { LogoProps } from '../../types'; | ||
|
||
const Logo = (props: LogoProps) => <EuiIcon type="casesApp" size="xl" />; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just using the cases logo until we get the Opsgenie one.
@@ -46,7 +46,6 @@ export { | |||
SlackConnectorTypeId, | |||
TeamsConnectorTypeId, | |||
WebhookConnectorTypeId, | |||
OpsgenieConnectorTypeId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this to the common folder so that the ui can access it too.
@@ -62,55 +62,14 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { | |||
await nameInput.click(); | |||
} | |||
|
|||
async function defineIndexThresholdAlert(alertName: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this into the rules.common
service.
@@ -279,22 +289,6 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { | |||
}); | |||
}); | |||
|
|||
async function createConnector(connectorName: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved these to the utils.ts file. Maybe we should move them to the service api like cases 🤷♂️
|
||
const currentSubAction = useRef<string>(subAction ?? OpsgenieSubActions.CreateAlert); | ||
|
||
const actionOptions = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this can be moved outside the component as it is not depend on the props or the state.
const createBtnIsVisible = await createBtn.isDisplayed(); | ||
if (createBtnIsVisible) { | ||
await createBtn.click(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think is better to fail if the button does not exist. You can use testSubjets.existsOrFail
.
const testSubjects = getService('testSubjects'); | ||
|
||
return { | ||
async clickCreateFirstConnectorButton() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: the naming is a bit confusing. Maybe we can call it createConnectorFromEmptyPrompt
or similar.
await find.clickByCssSelector( | ||
'[data-test-subj="create-connector-flyout-save-btn"]:not(disabled)' | ||
); | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can do:
await find.clickByCssSelector( | |
'[data-test-subj="create-connector-flyout-save-btn"]:not(disabled)' | |
); | |
}, | |
const button = await testSubjects.find("create-connector-flyout-save-btn") | |
const isDisabled = await button.isEnabled() // or button.getAttribute('disabled') | |
expect(isDisabled).toBe(false) | |
}, |
return connector; | ||
}; | ||
|
||
export const getConnector = async ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should use get the connector by ID: https://www.elastic.co/guide/en/kibana/current/get-connector-api.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason to use this function is when we don't have the connector id. A few of the tests create the connector via the UI instead of an API call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll update the name to getConnectorByName
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see. Thanks!
}) | ||
.expect(200); | ||
|
||
await common.navigateToApp('triggersActionsConnectors'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think API utils functions should not do side effects like navigating to UI components.
getService: FtrProviderContext['getService']; | ||
}) => { | ||
const common = getPageObject('common'); | ||
const supertest = getService('supertest'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is better if we pass the supertest
directly as an argument.
import { FtrProviderContext } from '../../../ftr_provider_context'; | ||
import { getTestActionData } from '../../../lib/get_test_data'; | ||
|
||
export const createConnectorAndObjectRemover = async ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: As it is not generic and creates a slack connector maybe is better to rename it to createSlackConnectorAndObjectRemover
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LTGM! I tested and everything is working as expected. Thank you so much for adding the test services 🚀
💚 Build Succeeded
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Page load bundle
Unknown metric groupsAPI count
async chunk count
ESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
* Starting opsgenie backend * Adding more integration tests * Updating readme * Starting ui * Adding hash and alias * Fixing tests * Switch to platinum for now * Adding server side translations * Fixing merge issues * Fixing file location error * Working ui * Default alias is working * Almost working validation fails sometimes * Adding end to end tests * Adding more tests * Adding note and description fields * Removing todo * Fixing test errors * Addressing feedback * Trying to fix test flakiness
Issue: #142776
This PR implements the Opsgenie connector's UI for phase 1 of the issue.
For creating the alert it includes the fields:
message
,description
, andalias
. For closing the alert it includes the fields:note
andalias
.Notes
Testing
Refer to this PR's testing section for details on how to create an Opsgenie environment: #142164
Examples
Connector card icon
Create Opsgenie Connector
Test Connector
Creating alert
Closing alert
Create alert when rules fires
Close alert when rule recovers
Release Notes
This feature allows users to create and close alerts within Opsgenie.