Coverage for core/constants.py: 100%

8 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-10-10 18:35 +0000

1from dataclasses import dataclass 

2 

3from django.utils.translation import gettext_lazy as _ 

4from rq.job import JobStatus 

5 

6__all__ = ( 

7 'JOB_LOG_ENTRY_LEVELS', 

8 'RQ_TASK_STATUSES', 

9) 

10 

11 

12@dataclass 

13class Badge: 

14 label: str 

15 color: str 

16 

17 

18RQ_TASK_STATUSES = { 

19 JobStatus.QUEUED: Badge(_('Queued'), 'cyan'), 

20 JobStatus.FINISHED: Badge(_('Finished'), 'green'), 

21 JobStatus.FAILED: Badge(_('Failed'), 'red'), 

22 JobStatus.STARTED: Badge(_('Started'), 'blue'), 

23 JobStatus.DEFERRED: Badge(_('Deferred'), 'gray'), 

24 JobStatus.SCHEDULED: Badge(_('Scheduled'), 'purple'), 

25 JobStatus.STOPPED: Badge(_('Stopped'), 'orange'), 

26 JobStatus.CANCELED: Badge(_('Cancelled'), 'yellow'), 

27} 

28 

29JOB_LOG_ENTRY_LEVELS = { 

30 'debug': Badge(_('Debug'), 'gray'), 

31 'info': Badge(_('Info'), 'blue'), 

32 'warning': Badge(_('Warning'), 'orange'), 

33 'error': Badge(_('Error'), 'red'), 

34}