mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
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:
parent
98c849d4cc
commit
8c93899b15
@ -1,6 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Page } from 'components/Page';
|
import { Page } from 'components/Page';
|
||||||
import { AppRootProps, NavModelItem } from '@grafana/data';
|
import { AppRootProps, NavModelItem } from '@grafana/data';
|
||||||
|
import { css } from '@emotion/css';
|
||||||
|
|
||||||
export const NotEnabled = ({ onNavChanged }: AppRootProps) => {
|
export const NotEnabled = ({ onNavChanged }: AppRootProps) => {
|
||||||
const node: NavModelItem = {
|
const node: NavModelItem = {
|
||||||
@ -16,8 +17,16 @@ export const NotEnabled = ({ onNavChanged }: AppRootProps) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Page>
|
<Page>
|
||||||
To enabled installing plugins, set the{' '}
|
To enable installing plugins, please refer to the{' '}
|
||||||
<a href="https://grafana.com/docs/grafana/latest/plugins/catalog">Plugin Catalog</a> instructions
|
<a
|
||||||
|
className={css`
|
||||||
|
text-decoration: underline;
|
||||||
|
`}
|
||||||
|
href="https://grafana.com/docs/grafana/latest/plugins/catalog"
|
||||||
|
>
|
||||||
|
Plugin Catalog
|
||||||
|
</a>{' '}
|
||||||
|
instructions
|
||||||
</Page>
|
</Page>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -86,7 +86,6 @@ class AppRootPage extends Component<Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onNavChanged = (nav: NavModel) => {
|
onNavChanged = (nav: NavModel) => {
|
||||||
console.log('NAV CHANGED!!!', nav);
|
|
||||||
this.setState({ nav });
|
this.setState({ nav });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ import { useAsync } from 'react-use';
|
|||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
import { GrafanaTheme, PanelProps, PluginMeta, PluginType } from '@grafana/data';
|
import { GrafanaTheme, PanelProps, PluginMeta, PluginType } from '@grafana/data';
|
||||||
import { CustomScrollbar, ModalsController, stylesFactory, Tooltip, useStyles } from '@grafana/ui';
|
import { CustomScrollbar, ModalsController, stylesFactory, Tooltip, useStyles } from '@grafana/ui';
|
||||||
|
import { config, locationService } from '@grafana/runtime';
|
||||||
import { contextSrv } from 'app/core/services/context_srv';
|
import { contextSrv } from 'app/core/services/context_srv';
|
||||||
import { getBackendSrv } from 'app/core/services/backend_srv';
|
import { getBackendSrv } from 'app/core/services/backend_srv';
|
||||||
import { UpdatePluginModal } from './components/UpdatePluginModal';
|
import { UpdatePluginModal } from './components/UpdatePluginModal';
|
||||||
@ -48,13 +49,16 @@ export function PluginList(props: PanelProps) {
|
|||||||
className={cx(styles.message, styles.messageUpdate)}
|
className={cx(styles.message, styles.messageUpdate)}
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
if (config.pluginAdminEnabled) {
|
||||||
showModal(UpdatePluginModal, {
|
locationService.push(`/a/grafana-plugin-admin-app/plugin/${plugin.id}`);
|
||||||
pluginID: plugin.id,
|
} else {
|
||||||
pluginName: plugin.name,
|
showModal(UpdatePluginModal, {
|
||||||
onDismiss: hideModal,
|
pluginID: plugin.id,
|
||||||
isOpen: true,
|
pluginName: plugin.name,
|
||||||
});
|
onDismiss: hideModal,
|
||||||
|
isOpen: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Update available!
|
Update available!
|
||||||
|
Loading…
Reference in New Issue
Block a user