mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 01:53:33 -06:00
* add special handling on the plugin gathering side to check whether secrets manager plugins are enabled or not * show disabled badge in front end if the plugin is not enabled * Only show error in disabled badge hover if one is present (otherwise it shows "undefined") * refactor to make use of fields already available in the DTO * fix typo * if there is no error returned for the plugin, just show 'disabled' * fix typo * Update public/app/features/plugins/admin/components/Badges/PluginDisabledBadge.tsx Co-authored-by: Levente Balogh <balogh.levente.hu@gmail.com> * Update frontendsettings.go add clarifying comment * fix unit test * rework task to use new frontend property combined with plugin type to determine if the plugin should be disabled * Update helpers.test.ts revert test change * fix unit test * bogus commit to trigger precommit * undo commit * run precommit manually Co-authored-by: Levente Balogh <balogh.levente.hu@gmail.com>
78 lines
2.7 KiB
TypeScript
78 lines
2.7 KiB
TypeScript
import React, { ReactElement } from 'react';
|
|
|
|
import { PluginErrorCode } from '@grafana/data';
|
|
import { selectors } from '@grafana/e2e-selectors';
|
|
import { Alert } from '@grafana/ui';
|
|
|
|
import { CatalogPlugin } from '../types';
|
|
|
|
type Props = {
|
|
className?: string;
|
|
plugin: CatalogPlugin;
|
|
};
|
|
|
|
export function PluginDetailsDisabledError({ className, plugin }: Props): ReactElement | null {
|
|
if (!plugin.isDisabled) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<Alert
|
|
severity="error"
|
|
title="Plugin disabled"
|
|
className={className}
|
|
aria-label={selectors.pages.PluginPage.disabledInfo}
|
|
>
|
|
{renderDescriptionFromError(plugin.error)}
|
|
<p>Please contact your server administrator to get this resolved.</p>
|
|
<a
|
|
href="https://grafana.com/docs/grafana/latest/administration/cli/#plugins-commands"
|
|
className="external-link"
|
|
target="_blank"
|
|
rel="noreferrer"
|
|
>
|
|
Read more about managing plugins
|
|
</a>
|
|
</Alert>
|
|
);
|
|
}
|
|
|
|
function renderDescriptionFromError(error?: PluginErrorCode): ReactElement {
|
|
switch (error) {
|
|
case PluginErrorCode.modifiedSignature:
|
|
return (
|
|
<p>
|
|
Grafana Labs checks each plugin to verify that it has a valid digital signature. While doing this, we
|
|
discovered that the content of this plugin does not match its signature. We can not guarantee the trustworthy
|
|
of this plugin and have therefore disabled it. We recommend you to reinstall the plugin to make sure you are
|
|
running a verified version of this plugin.
|
|
</p>
|
|
);
|
|
case PluginErrorCode.invalidSignature:
|
|
return (
|
|
<p>
|
|
Grafana Labs checks each plugin to verify that it has a valid digital signature. While doing this, we
|
|
discovered that it was invalid. We can not guarantee the trustworthy of this plugin and have therefore
|
|
disabled it. We recommend you to reinstall the plugin to make sure you are running a verified version of this
|
|
plugin.
|
|
</p>
|
|
);
|
|
case PluginErrorCode.missingSignature:
|
|
return (
|
|
<p>
|
|
Grafana Labs checks each plugin to verify that it has a valid digital signature. While doing this, we
|
|
discovered that there is no signature for this plugin. We can not guarantee the trustworthy of this plugin and
|
|
have therefore disabled it. We recommend you to reinstall the plugin to make sure you are running a verified
|
|
version of this plugin.
|
|
</p>
|
|
);
|
|
default:
|
|
return (
|
|
<p>
|
|
We failed to run this plugin due to an unkown reason and have therefore disabled it. We recommend you to
|
|
reinstall the plugin to make sure you are running a working version of this plugin.
|
|
</p>
|
|
);
|
|
}
|
|
}
|