Skip to content
Snippets Groups Projects
Select Git revision
  • 8dbf63a6e25375526c803f61332ae8aaa5f5326b
  • main default
  • 35-cgu
  • 34-peertube-support
  • 27-add-autoplay-to-iframe
  • 33-bug-on-youtube-embed-urls
  • RC-Rekall-v1.1-fix_lpo
  • tuleap-140-go-back-to-my-capsules-page-when-i-m-on-capsule-preview-page
  • RC-Rekall-v1.2-fix10
  • RC-Rekall-v1.2-fix9
  • RC-Rekall-v1.2-fix8
  • RC-Rekall-v1.2-fix7
  • RC-Rekall-v1.2-fix6
  • RC-Rekall-v1.2-fix5
  • RC-Rekall-v1.2-fix4
  • RC-Rekall-v1.2-fix3
  • RC-Rekall-v1.2-fix2
  • RC-Rekall-v1.2-fix1
  • RC-Rekall-v1.1-fix-3
  • RC-Rekall-v1.1-fix-2
  • RC-Rekall-v1.1-fix-1
  • RC-Rekall-v1.1-delivered
  • preprod20220209-1535
23 results

create_test_db.sh

Blame
  • ErrorContent.js 1.90 KiB
    import React, { Component } from 'react';
    import PropTypes from 'prop-types';
    import ExpansionPanel from '@material-ui/core/ExpansionPanel';
    import ExpansionPanelSummary from '@material-ui/core/ExpansionPanelSummary';
    import ExpansionPanelDetails from '@material-ui/core/ExpansionPanelDetails';
    import Typography from '@material-ui/core/Typography';
    import Alert from '@material-ui/lab/Alert';
    import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
    import { PluginHook } from './PluginHook';
    
    /** */
    export class ErrorContent extends Component {
      /** */
      render() {
        const {
          classes,
          error,
          metadata,
          showJsError,
          t,
        } = this.props;
    
        if (!showJsError) return null;
    
        return (
          <>
            <Alert elevation={6} variant="filled" severity="error">
              {t('errorDialogTitle')}
            </Alert>
    
            {showJsError && (
              <ExpansionPanel square className={classes.alert}>
                <ExpansionPanelSummary
                  expandIcon={<ExpandMoreIcon />}
                >
                  <Typography>{t('jsError', { message: error.message, name: error.name })}</Typography>
                </ExpansionPanelSummary>
                <ExpansionPanelDetails className={classes.details}>
                  <pre>{ t('jsStack', { stack: error.stack }) }</pre>
                  { metadata && (
                    <pre>{JSON.stringify(metadata, null, 2)}</pre>
                  )}
                </ExpansionPanelDetails>
              </ExpansionPanel>
            )}
            <PluginHook {...this.props} />
          </>
        );
      }
    }
    
    ErrorContent.propTypes = {
      classes: PropTypes.objectOf(PropTypes.string).isRequired,
      error: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
      metadata: PropTypes.object, // eslint-disable-line react/forbid-prop-types
      showJsError: PropTypes.bool,
      t: PropTypes.func,
    };
    
    ErrorContent.defaultProps = {
      metadata: null,
      showJsError: true,
      t: key => key,
    };