1
0
Fork 0
mirror of https://git.sr.ht/~ashkeel/strimertul synced 2024-09-18 01:50:50 +00:00

fix: always show log messages with higher severity than chosen one

This commit is contained in:
Ash Keel 2022-12-24 14:07:27 +01:00
parent 7b9c773b51
commit 7e7b796450
No known key found for this signature in database
GPG key ID: BAD8D93E7314ED3E
2 changed files with 22 additions and 14 deletions

View file

@ -82,20 +82,24 @@ const LevelToggle = styled(MultiToggleItem, {
info: {},
warn: {
backgroundColor: '$yellow4',
'&:hover': {
backgroundColor: '$yellow5',
},
"&[data-state='on']": {
backgroundColor: '$yellow8',
'&:not(:disabled)': {
'&:hover': {
backgroundColor: '$yellow5',
},
"&[data-state='on']": {
backgroundColor: '$yellow8',
},
},
},
error: {
backgroundColor: '$red4',
'&:hover': {
backgroundColor: '$red5',
},
"&[data-state='on']": {
backgroundColor: '$red8',
'&:not(:disabled)': {
'&:hover': {
backgroundColor: '$red5',
},
"&[data-state='on']": {
backgroundColor: '$red8',
},
},
},
},
@ -289,14 +293,14 @@ const LogEntriesContainer = styled('div', {
});
interface LogDialogProps {
initialFilter: LogLevel;
initialFilter: LogLevel[];
}
function LogDialog({ initialFilter }: LogDialogProps) {
const logEntries = useSelector((state: RootState) => state.logging.messages);
const [filter, setFilter] = useState({
...emptyFilter,
[initialFilter]: true,
...Object.fromEntries(initialFilter.map((f) => [f, true])),
});
const { t } = useTranslation();
const enabled = levels.filter((level) => filter[level]);
@ -413,7 +417,11 @@ function LogViewer() {
}
}}
>
{activeDialog ? <LogDialog initialFilter={activeDialog} /> : null}
{activeDialog ? (
<LogDialog
initialFilter={levels.slice(levels.indexOf(activeDialog))}
/>
) : null}
</Dialog>
</div>
);

View file

@ -272,7 +272,7 @@ export const MultiToggleItem = styled(ToggleGroup.Item, {
},
"&[data-state='on']": {
...button['&:not(:disabled)']['&:active'],
background: '$gray8',
backgroundColor: '$gray8',
},
},
});