From 8fbd00f00f8763b74195cec3e9739dfca8565a2f Mon Sep 17 00:00:00 2001 From: Ildar Iskhakov Date: Thu, 27 Jul 2023 17:42:11 +0800 Subject: [PATCH] Update basic data after installation (#2657) # What this PR does Adding additional `UpdateBasicData` after installation, to handle that case 1. Plugin calls `UpdateBasicData` in parallel to `setupPlugin` which handles sync/install 2. If plugin is not installed, `UpdateBasicData` from step 1 will fail with 403s ## Which issue(s) this PR fixes ## Checklist - [ ] Unit, integration, and e2e (if applicable) tests updated - [ ] Documentation added (or `pr:no public docs` PR label added if not required) - [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not required) --- grafana-plugin/src/plugin/GrafanaPluginRootPage.tsx | 1 - grafana-plugin/src/state/rootBaseStore/index.ts | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/grafana-plugin/src/plugin/GrafanaPluginRootPage.tsx b/grafana-plugin/src/plugin/GrafanaPluginRootPage.tsx index 72133899..de3dcaaa 100644 --- a/grafana-plugin/src/plugin/GrafanaPluginRootPage.tsx +++ b/grafana-plugin/src/plugin/GrafanaPluginRootPage.tsx @@ -103,7 +103,6 @@ export const Root = observer((props: AppRootProps) => { const updateBasicData = async () => { await store.updateBasicData(); - await store.alertGroupStore.fetchIRMPlan(); }; const location = useLocation(); diff --git a/grafana-plugin/src/state/rootBaseStore/index.ts b/grafana-plugin/src/state/rootBaseStore/index.ts index 4075fb4a..a61d6c5a 100644 --- a/grafana-plugin/src/state/rootBaseStore/index.ts +++ b/grafana-plugin/src/state/rootBaseStore/index.ts @@ -125,6 +125,7 @@ export class RootBaseStore { this.escalationPolicyStore.updateWebEscalationPolicyOptions(), this.escalationPolicyStore.updateEscalationPolicyOptions(), this.escalationPolicyStore.updateNumMinutesInWindowOptions(), + this.alertGroupStore.fetchIRMPlan(), ]); } @@ -198,6 +199,7 @@ export class RootBaseStore { * therefore there is no need to trigger an additional/separate sync, nor poll a status */ await PluginState.installPlugin(); + this.updateBasicData(); } catch (e) { return this.setupPluginError( PluginState.getHumanReadableErrorFromOnCallError(e, this.onCallApiUrl, 'install')