mirror of
https://github.com/grafana/grafana.git
synced 2025-02-20 11:48:34 -06:00
* feat: display the deprecation context for a plugin if it is available * Update public/app/features/plugins/admin/components/PluginDetailsDeprecatedWarning.tsx Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com> * feat: only extend the basic message with custom context --------- Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>
29 lines
916 B
TypeScript
29 lines
916 B
TypeScript
import React, { useState } from 'react';
|
|
|
|
import { Alert } from '@grafana/ui';
|
|
|
|
import { CatalogPlugin } from '../types';
|
|
|
|
type Props = {
|
|
className?: string;
|
|
plugin: CatalogPlugin;
|
|
};
|
|
|
|
export function PluginDetailsDeprecatedWarning(props: Props): React.ReactElement | null {
|
|
const { className, plugin } = props;
|
|
const [dismissed, setDismissed] = useState(false);
|
|
const isWarningVisible = plugin.isDeprecated && !dismissed;
|
|
let deprecationMessage = `This ${plugin.type} plugin is deprecated and has been removed from the catalog. No further updates will be made to the
|
|
plugin.`;
|
|
|
|
if (plugin.details?.statusContext) {
|
|
deprecationMessage += ` More information: ${plugin.details.statusContext}`;
|
|
}
|
|
|
|
return isWarningVisible ? (
|
|
<Alert severity="warning" title="Deprecated" className={className} onRemove={() => setDismissed(true)}>
|
|
<p>{deprecationMessage}</p>
|
|
</Alert>
|
|
) : null;
|
|
}
|