fix webhook form (#3665)

# What this PR does
- prevent infinite loop in webhook form

## Which issue(s) this PR fixes
https://github.com/grafana/oncall-private/issues/2443
https://github.com/grafana/support-escalations/issues/8960

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)

---------

Co-authored-by: Maxim Mordasov <maxim.mordasov@grafana.com>
Co-authored-by: Rares Mardare <rares.mardare@grafana.com>
This commit is contained in:
Dominik Broj 2024-01-12 16:45:24 +01:00 committed by GitHub
parent d0904ca405
commit 40774875e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 2 deletions

View file

@ -11,7 +11,7 @@ if not running_under_parent_tiltfile:
# Load the custom Grafana extensions
v1alpha1.extension_repo(
name="grafana-tilt-extensions",
ref="main",
ref="v1.2.0",
url="https://github.com/grafana/tilt-extensions",
)
v1alpha1.extension(

View file

@ -190,7 +190,6 @@ class GForm extends React.Component<GFormProps, {}> {
{({ register, errors, control, getValues, setValue }) => {
const renderField = (formItem: FormItem, formIndex: number) => {
if (formItem.isVisible && !formItem.isVisible(getValues())) {
setValue(formItem.name, undefined); // clear input value on hide
return null;
}

View file

@ -56,6 +56,7 @@ export class LabelStore extends BaseStore {
}
@WithGlobalNotification({ success: 'New key has been added', failure: 'Failed to add new key' })
@action.bound
async createKey(name: string) {
const data = await makeRequest(`${this.path}`, {
method: 'POST',
@ -65,6 +66,7 @@ export class LabelStore extends BaseStore {
}
@WithGlobalNotification({ success: 'New value has been added', failure: 'Failed to add new value' })
@action.bound
async createValue(keyId: ApiSchemas['LabelKey']['id'], value: string) {
const result = await makeRequest(`${this.path}id/${keyId}/values`, {
method: 'POST',
@ -74,6 +76,7 @@ export class LabelStore extends BaseStore {
}
@WithGlobalNotification({ success: 'Key has been renamed', failure: 'Failed to rename key' })
@action.bound
async updateKey(keyId: ApiSchemas['LabelKey']['id'], name: string) {
const result = await makeRequest(`${this.path}id/${keyId}`, {
method: 'PUT',
@ -83,6 +86,7 @@ export class LabelStore extends BaseStore {
}
@WithGlobalNotification({ success: 'Value has been renamed', failure: 'Failed to rename value' })
@action.bound
async updateKeyValue(keyId: ApiSchemas['LabelKey']['id'], valueId: ApiSchemas['LabelValue']['id'], name: string) {
const result = await makeRequest(`${this.path}id/${keyId}/values/${valueId}`, {
method: 'PUT',