2021-11-02 07:41:08 -05:00
|
|
|
import React, { ReactElement } from 'react';
|
2022-04-22 08:33:13 -05:00
|
|
|
|
2021-09-20 02:08:00 -05:00
|
|
|
import { PluginErrorCode } from '@grafana/data';
|
2022-04-22 08:33:13 -05:00
|
|
|
import { selectors } from '@grafana/e2e-selectors';
|
2021-09-20 02:08:00 -05:00
|
|
|
import { Alert } from '@grafana/ui';
|
2022-04-22 08:33:13 -05:00
|
|
|
|
2021-09-20 02:08:00 -05:00
|
|
|
import { CatalogPlugin } from '../types';
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
className?: string;
|
|
|
|
plugin: CatalogPlugin;
|
|
|
|
};
|
|
|
|
|
2021-11-02 07:41:08 -05:00
|
|
|
export function PluginDetailsDisabledError({ className, plugin }: Props): ReactElement | null {
|
2021-09-20 02:08:00 -05:00
|
|
|
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>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-11-02 07:41:08 -05:00
|
|
|
function renderDescriptionFromError(error?: PluginErrorCode): ReactElement {
|
2021-09-20 02:08:00 -05:00
|
|
|
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>
|
2022-06-29 07:48:23 -05:00
|
|
|
We failed to run this plugin due to an unkown reason and have therefore disabled it. We recommend you to
|
2021-09-20 02:08:00 -05:00
|
|
|
reinstall the plugin to make sure you are running a working version of this plugin.
|
|
|
|
</p>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|