mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Plugin Catalog: support Grafana instances that cannot communicate with gcom (#39638)
* added possibility to track if remote plugins could be fetched. * adding hook to detect if remote plugins are available. * feat(catalog): disable installed/all filter if remote plugins are unavailable * feat(Plugins/Admin): hide the install controls if GCOM is not available * refactor(Plugins/Admin): group `@grafana` dependencies * fix(Plugins/Admin): don't show an error alert if a remote plugin is not available * feat(Plugins/Admin): prefer to use the local version of the readme * chore(Plugins/Admin): type the mocked state properly * test(Plugins/Admin): add tests for the Plugin Details when GCOM is not available * test(Plugins/Admin): add tests for the Browse when GCOM is not available Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com> Co-authored-by: Levente Balogh <balogh.levente.hu@gmail.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { useEffect } from 'react';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
import { fetchAll, fetchDetails, install, uninstall } from './actions';
|
||||
import { fetchAll, fetchDetails, fetchRemotePlugins, install, uninstall } from './actions';
|
||||
import { CatalogPlugin, PluginCatalogStoreState } from '../types';
|
||||
import {
|
||||
find,
|
||||
@@ -63,6 +63,11 @@ export const useUninstall = () => {
|
||||
return (id: string) => dispatch(uninstall(id));
|
||||
};
|
||||
|
||||
export const useIsRemotePluginsAvailable = () => {
|
||||
const error = useSelector(selectRequestError(fetchRemotePlugins.typePrefix));
|
||||
return error === null;
|
||||
};
|
||||
|
||||
export const useFetchStatus = () => {
|
||||
const isLoading = useSelector(selectIsRequestPending(fetchAll.typePrefix));
|
||||
const error = useSelector(selectRequestError(fetchAll.typePrefix));
|
||||
|
||||
Reference in New Issue
Block a user