PluginsList Panel: Redirect to catalog app for updating plugins (#34893)

* feat(pluginlistpanel): if catalog app is enabled redirect user if plugin is upgradable

* refactor(catalog): update copy if plugin is disabled
This commit is contained in:
Jack Westbrook
2021-05-31 13:53:40 +02:00
committed by GitHub
parent 98c849d4cc
commit 8c93899b15
3 changed files with 22 additions and 10 deletions

View File

@@ -3,6 +3,7 @@ import { useAsync } from 'react-use';
import { css, cx } from '@emotion/css';
import { GrafanaTheme, PanelProps, PluginMeta, PluginType } from '@grafana/data';
import { CustomScrollbar, ModalsController, stylesFactory, Tooltip, useStyles } from '@grafana/ui';
import { config, locationService } from '@grafana/runtime';
import { contextSrv } from 'app/core/services/context_srv';
import { getBackendSrv } from 'app/core/services/backend_srv';
import { UpdatePluginModal } from './components/UpdatePluginModal';
@@ -48,13 +49,16 @@ export function PluginList(props: PanelProps) {
className={cx(styles.message, styles.messageUpdate)}
onClick={(e) => {
e.preventDefault();
showModal(UpdatePluginModal, {
pluginID: plugin.id,
pluginName: plugin.name,
onDismiss: hideModal,
isOpen: true,
});
if (config.pluginAdminEnabled) {
locationService.push(`/a/grafana-plugin-admin-app/plugin/${plugin.id}`);
} else {
showModal(UpdatePluginModal, {
pluginID: plugin.id,
pluginName: plugin.name,
onDismiss: hideModal,
isOpen: true,
});
}
}}
>
Update available!