Skip to content

Commit

Permalink
Workaround for bug # #241
Browse files Browse the repository at this point in the history
  • Loading branch information
gerboland committed Feb 27, 2024
1 parent e811d32 commit 3fce161
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/components/AppConfig/AppConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export const AppConfig = ({ plugin }: AppConfigProps) => {
});
} catch (e) {
setIsUpdating(false);
throw (e);
throw e;
}
// If disabling LLM features, no health check needed
if (settings.openAI?.provider !== undefined) {
Expand Down Expand Up @@ -212,13 +212,17 @@ export const updateGcomProvisionedPluginSettings = (data: Partial<PluginMeta>) =
const response = getBackendSrv().fetch({
url: `/api/plugins/grafana-llm-app/resources/save-plugin-settings`,
method: 'POST',
data
data,
});

return lastValueFrom(response);
};

export const updateAndSavePluginSettings = async (pluginId: string, persistToGcom = false, data: Partial<PluginMeta>) => {
export const updateAndSavePluginSettings = async (
pluginId: string,
persistToGcom = false,
data: Partial<PluginMeta>
) => {
const gcomPluginData = {
jsonData: data.jsonData,
secureJsonData: data.secureJsonData,
Expand All @@ -234,6 +238,9 @@ export const updateAndSavePluginSettings = async (pluginId: string, persistToGco
await updateGrafanaPluginSettings(pluginId, data).then((response: FetchResponse) => {
if (!response.ok) {
throw response.data;
} else {
// Reloading the page as the plugin meta changes made here wouldn't be propagated throughout the app.
window.location.reload();
}
});
};
Expand Down

0 comments on commit 3fce161

Please sign in to comment.