1
0
Fork 0
mirror of https://git.sr.ht/~ashkeel/strimertul synced 2024-09-20 02:00:49 +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: {}, info: {},
warn: { warn: {
backgroundColor: '$yellow4', backgroundColor: '$yellow4',
'&:hover': { '&:not(:disabled)': {
backgroundColor: '$yellow5', '&:hover': {
}, backgroundColor: '$yellow5',
"&[data-state='on']": { },
backgroundColor: '$yellow8', "&[data-state='on']": {
backgroundColor: '$yellow8',
},
}, },
}, },
error: { error: {
backgroundColor: '$red4', backgroundColor: '$red4',
'&:hover': { '&:not(:disabled)': {
backgroundColor: '$red5', '&:hover': {
}, backgroundColor: '$red5',
"&[data-state='on']": { },
backgroundColor: '$red8', "&[data-state='on']": {
backgroundColor: '$red8',
},
}, },
}, },
}, },
@ -289,14 +293,14 @@ const LogEntriesContainer = styled('div', {
}); });
interface LogDialogProps { interface LogDialogProps {
initialFilter: LogLevel; initialFilter: LogLevel[];
} }
function LogDialog({ initialFilter }: LogDialogProps) { function LogDialog({ initialFilter }: LogDialogProps) {
const logEntries = useSelector((state: RootState) => state.logging.messages); const logEntries = useSelector((state: RootState) => state.logging.messages);
const [filter, setFilter] = useState({ const [filter, setFilter] = useState({
...emptyFilter, ...emptyFilter,
[initialFilter]: true, ...Object.fromEntries(initialFilter.map((f) => [f, true])),
}); });
const { t } = useTranslation(); const { t } = useTranslation();
const enabled = levels.filter((level) => filter[level]); 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> </Dialog>
</div> </div>
); );

View file

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