⚝
One Hat Cyber Team
⚝
Your IP:
216.73.217.4
Server IP:
41.128.143.86
Server:
Linux host.raqmix.cloud 6.8.0-1025-azure #30~22.04.1-Ubuntu SMP Wed Mar 12 15:28:20 UTC 2025 x86_64
Server Software:
Apache
PHP Version:
8.3.23
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
grafana
/
public
/
app
/
features
/
explore
/
View File Name :
SupplementaryResultError.tsx
import { css } from '@emotion/css'; import React, { useState } from 'react'; import { DataQueryError, GrafanaTheme2 } from '@grafana/data'; import { Alert, AlertVariant, Button, useTheme2 } from '@grafana/ui'; type Props = { error?: DataQueryError; title: string; severity?: AlertVariant; suggestedAction?: string; onSuggestedAction?(): void; onRemove?(): void; }; export function SupplementaryResultError(props: Props) { const [isOpen, setIsOpen] = useState(false); const SHORT_ERROR_MESSAGE_LIMIT = 100; const { error, title, suggestedAction, onSuggestedAction, onRemove, severity = 'warning' } = props; // generic get-error-message-logic, taken from // /public/app/features/explore/ErrorContainer.tsx const message = error?.message || error?.data?.message || ''; const showButton = !isOpen && message.length > SHORT_ERROR_MESSAGE_LIMIT; const theme = useTheme2(); const styles = getStyles(theme); return (
{showButton ? (
{ setIsOpen(true); }} > Show details
) : ( message )} {suggestedAction && onSuggestedAction && (
{suggestedAction}
)}
); } const getStyles = (theme: GrafanaTheme2) => { return { supplementaryErrorContainer: css({ width: '50%', minWidth: `${theme.breakpoints.values.sm}px`, margin: '0 auto', }), suggestedActionWrapper: css({ height: theme.spacing(6), ['button']: { position: 'absolute', right: theme.spacing(2), top: theme.spacing(7), }, }), }; };