mirror of
https://github.com/grafana/grafana.git
synced 2025-02-20 11:48:34 -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>
28 lines
951 B
TypeScript
28 lines
951 B
TypeScript
import React from 'react';
|
|
|
|
import { PluginErrorCode } from '@grafana/data';
|
|
import { Badge } from '@grafana/ui';
|
|
|
|
type Props = { error?: PluginErrorCode };
|
|
|
|
export function PluginDisabledBadge({ error }: Props): React.ReactElement {
|
|
const tooltip = errorCodeToTooltip(error);
|
|
return <Badge icon="exclamation-triangle" text="Disabled" color="red" tooltip={tooltip} />;
|
|
}
|
|
|
|
function errorCodeToTooltip(error?: PluginErrorCode): string | undefined {
|
|
switch (error) {
|
|
case PluginErrorCode.modifiedSignature:
|
|
return 'Plugin disabled due to modified content';
|
|
case PluginErrorCode.invalidSignature:
|
|
return 'Plugin disabled due to invalid plugin signature';
|
|
case PluginErrorCode.missingSignature:
|
|
return 'Plugin disabled due to missing plugin signature';
|
|
case null:
|
|
case undefined:
|
|
return 'Plugin disabled';
|
|
default:
|
|
return `Plugin disabled due to unknown error${error ? `: ${error}` : ''}`;
|
|
}
|
|
}
|