mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Angular deprecation: Add Angular badge in plugin catalog page * Angular deprecation: Add alert in plugin details page * Angular deprecation: Disable install button if for Angular plugins * removed extra console.log * Add tests for Angular badge * Add tests for PluginDetailsAngularDeprecation * Add tests for InstallControlsButton * Add tests for ExternallyManagedButton * Table tests * Catalog: Update angular deprecation message * PR review feedback * Update tests * Update copy for angular tooltip and alert * Update tests * Fix test warnings * Fix angularDetected not being set for remote catalog plugins * Dynamic alert text based on grafana config * Moved deprecation message to a separate function * Removed unused Props in PluginAngularBadge
41 lines
1.3 KiB
TypeScript
41 lines
1.3 KiB
TypeScript
import React from 'react';
|
|
|
|
import { Alert } from '@grafana/ui';
|
|
|
|
type Props = {
|
|
className?: string;
|
|
angularSupportEnabled?: boolean;
|
|
};
|
|
|
|
function deprecationMessage(angularSupportEnabled?: boolean): string {
|
|
const msg = 'This plugin uses a deprecated, legacy platform based on AngularJS and ';
|
|
if (angularSupportEnabled === undefined) {
|
|
return msg + ' may be incompatible depending on your Grafana configuration.';
|
|
}
|
|
if (angularSupportEnabled) {
|
|
return msg + ' will stop working in future releases of Grafana.';
|
|
}
|
|
return msg + ' is incompatible with your current Grafana configuration.';
|
|
}
|
|
|
|
// An Alert showing information about Angular deprecation notice.
|
|
// If the plugin does not use Angular (!plugin.angularDetected), it returns null.
|
|
export function PluginDetailsAngularDeprecation({
|
|
className,
|
|
angularSupportEnabled,
|
|
}: Props): React.ReactElement | null {
|
|
return (
|
|
<Alert severity="warning" title="Angular plugin" className={className}>
|
|
<p>{deprecationMessage(angularSupportEnabled)}</p>
|
|
<a
|
|
href="https://grafana.com/docs/grafana/latest/developers/angular_deprecation/"
|
|
className="external-link"
|
|
target="_blank"
|
|
rel="noreferrer"
|
|
>
|
|
Read more about Angular support deprecation.
|
|
</a>
|
|
</Alert>
|
|
);
|
|
}
|