From 40774875e6f0419baf6fa4faf3eda08ef681b98c Mon Sep 17 00:00:00 2001 From: Dominik Broj Date: Fri, 12 Jan 2024 16:45:24 +0100 Subject: [PATCH] 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 Co-authored-by: Rares Mardare --- Tiltfile | 2 +- grafana-plugin/src/components/GForm/GForm.tsx | 1 - grafana-plugin/src/models/label/label.ts | 4 ++++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Tiltfile b/Tiltfile index 08372752..d9c51cfd 100644 --- a/Tiltfile +++ b/Tiltfile @@ -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( diff --git a/grafana-plugin/src/components/GForm/GForm.tsx b/grafana-plugin/src/components/GForm/GForm.tsx index fdb523f8..20c83e3a 100644 --- a/grafana-plugin/src/components/GForm/GForm.tsx +++ b/grafana-plugin/src/components/GForm/GForm.tsx @@ -190,7 +190,6 @@ class GForm extends React.Component { {({ 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; } diff --git a/grafana-plugin/src/models/label/label.ts b/grafana-plugin/src/models/label/label.ts index fc41e4cc..7ae05591 100644 --- a/grafana-plugin/src/models/label/label.ts +++ b/grafana-plugin/src/models/label/label.ts @@ -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',