mirror of
https://github.com/Unleash/unleash.git
synced 2025-09-19 17:52:45 +02:00
* fix: strategy dialogue * fix: fontweight dropdown * fix: eventlog padding * refactor: history * refactor: use material ui styling conventions for history * refactor: add empty state for features * refactor: variant dialog * refactor: delete unused variant config * fix: variant typography * fix: remove unused styles file * fix: footer * feat: protected routes * fix: rename app * fix: remove console log * fix: convert app to typescript * fix: add standalone login screen * fix: cleanup * fix: add theme colors for login * fix: update tests * fix: swap route with ProtectedRoute * fix: remove unused redirect * fix: use redirect to correctly setup breadcrumbs * refactor: isUnauthorized * fix: reset loading count on logout * fix: create a more comprehensive auth check * feat: add unleash logo
94 lines
2.5 KiB
JavaScript
94 lines
2.5 KiB
JavaScript
import { List, Switch, FormControlLabel } from '@material-ui/core';
|
|
import PropTypes from 'prop-types';
|
|
|
|
import { formatFullDateTimeWithLocale } from '../../common/util';
|
|
|
|
import EventJson from './EventJson/EventJson';
|
|
import PageContent from '../../common/PageContent/PageContent';
|
|
import HeaderTitle from '../../common/HeaderTitle';
|
|
import EventCard from './EventCard/EventCard';
|
|
|
|
import { useStyles } from './EventLog.styles.js';
|
|
|
|
const EventLog = ({
|
|
updateSetting,
|
|
title,
|
|
history,
|
|
settings,
|
|
displayInline,
|
|
location,
|
|
hideName,
|
|
}) => {
|
|
const styles = useStyles();
|
|
const toggleShowDiff = () => {
|
|
updateSetting('showData', !settings.showData);
|
|
};
|
|
const formatFulldateTime = v => {
|
|
return formatFullDateTimeWithLocale(v, location.locale);
|
|
};
|
|
|
|
const showData = settings.showData;
|
|
|
|
if (!history || history.length < 0) {
|
|
return null;
|
|
}
|
|
|
|
let entries;
|
|
|
|
const renderListItemCards = entry => (
|
|
<div key={entry.id} className={styles.eventEntry}>
|
|
<EventCard
|
|
entry={entry}
|
|
timeFormatted={formatFulldateTime(entry.createdAt)}
|
|
/>
|
|
</div>
|
|
);
|
|
|
|
if (showData) {
|
|
entries = history.map(entry => (
|
|
<EventJson key={`log${entry.id}`} entry={entry} />
|
|
));
|
|
} else {
|
|
entries = history.map(renderListItemCards);
|
|
}
|
|
|
|
return (
|
|
<PageContent
|
|
disablePadding={displayInline}
|
|
disableBorder={displayInline}
|
|
headerContent={
|
|
<HeaderTitle
|
|
title={title}
|
|
actions={
|
|
<FormControlLabel
|
|
control={
|
|
<Switch
|
|
checked={showData}
|
|
onChange={toggleShowDiff}
|
|
color="primary"
|
|
/>
|
|
}
|
|
label="Full events"
|
|
/>
|
|
}
|
|
/>
|
|
}
|
|
>
|
|
<div className={styles.history}>
|
|
<List>{entries}</List>
|
|
</div>
|
|
</PageContent>
|
|
);
|
|
};
|
|
|
|
EventLog.propTypes = {
|
|
updateSettings: PropTypes.func,
|
|
title: PropTypes.string,
|
|
settings: PropTypes.object,
|
|
displayInline: PropTypes.bool,
|
|
location: PropTypes.object,
|
|
hideName: PropTypes.bool,
|
|
};
|
|
|
|
export default EventLog;
|