Plugins: Add sync update all plugins in cloud (#92742)

This commit is contained in:
Hugo Kiyodi Oshiro 2024-09-05 15:04:37 +02:00 committed by GitHub
parent 82fe497b9d
commit c6fb9884a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 9 deletions

View File

@ -218,14 +218,24 @@ export const UpdateAllModal = ({ isOpen, onDismiss, plugins }: Props) => {
}
}, [error, errorMap, inProgress, selectedPlugins]);
const onConfirm = () => {
const onConfirm = async () => {
if (!inProgress) {
setInProgress(true);
plugins.forEach((plugin) => {
if (selectedPlugins?.has(plugin.id)) {
install(plugin.id, plugin.latestVersion, true);
// in cloud the requests need to be sync
if (config.pluginAdminExternalManageEnabled && config.featureToggles.managedPluginsInstall) {
for (let plugin of plugins) {
if (selectedPlugins?.has(plugin.id)) {
await install(plugin.id, plugin.latestVersion, true);
}
}
});
} else {
plugins.forEach((plugin) => {
if (selectedPlugins?.has(plugin.id)) {
install(plugin.id, plugin.latestVersion, true);
}
});
}
}
};

View File

@ -3,7 +3,7 @@ import { ReactElement, useState } from 'react';
import { useLocation } from 'react-router-dom-v5-compat';
import { SelectableValue, GrafanaTheme2, PluginType } from '@grafana/data';
import { config, locationSearchToObject } from '@grafana/runtime';
import { locationSearchToObject } from '@grafana/runtime';
import { Select, RadioButtonGroup, useStyles2, Tooltip, Field, Button } from '@grafana/ui';
import { Page } from 'app/core/components/Page/Page';
import { Trans } from 'app/core/internationalization';
@ -94,10 +94,8 @@ export default function Browse({ route }: GrafanaRouteComponentProps): ReactElem
</Button>
);
const hideUpdateAllButton = config.pluginAdminExternalManageEnabled && config.featureToggles.managedPluginsInstall;
return (
<Page navModel={navModel} actions={hideUpdateAllButton ? undefined : updateAll} subTitle={subTitle}>
<Page navModel={navModel} actions={updateAll} subTitle={subTitle}>
<Page.Contents>
<HorizontalGroup wrap>
<Field label="Search">