|
19 | 19 | DASHBOARD_RETRIEVAL_VALUE_CONFIG_PATH, |
20 | 20 | REPORT_RETRIEVAL_MINMAX_CONFIG_PATH, |
21 | 21 | REPORT_RETRIEVAL_VALUE_CONFIG_PATH, |
22 | | - REPORT_DATE_FILTER, |
23 | | - REPORT_TIME_FILTER, |
24 | 22 | REPORT_PATCH_FLAG, |
25 | 23 | ) |
26 | 24 | from ..instance import SNowInstance |
|
31 | 29 | # - We currently don't support maps because they are clickable and would require a more evolved cheat function |
32 | 30 | SUPPORTED_PLOT_TYPES = ["area", "bar", "column", "line", "pie", "spline"] |
33 | 31 |
|
| 32 | +# Get report filter config |
| 33 | +config = SNowInstance().report_filter_config |
| 34 | +if config is None: |
| 35 | + REPORT_DATE_FILTER = REPORT_TIME_FILTER = None |
| 36 | +else: |
| 37 | + REPORT_DATE_FILTER = config["report_date_filter"] |
| 38 | + REPORT_TIME_FILTER = config["report_time_filter"] |
| 39 | +del config |
| 40 | + |
34 | 41 |
|
35 | 42 | class DashboardRetrievalTask(AbstractServiceNowTask, ABC): |
36 | 43 | """ |
@@ -299,6 +306,12 @@ def get_init_scripts(self) -> List[str]: |
299 | 306 | def setup_goal(self, page: playwright.sync_api.Page) -> Tuple[str | dict]: |
300 | 307 | super().setup_goal(page=page) |
301 | 308 |
|
| 309 | + # Check that the report filters are properly setup |
| 310 | + if REPORT_DATE_FILTER is None or REPORT_TIME_FILTER is None: |
| 311 | + raise RuntimeError( |
| 312 | + "The report date and time filters are not set. Please run the install script to set them." |
| 313 | + ) |
| 314 | + |
302 | 315 | # Configure task |
303 | 316 | # ... sample a configuration |
304 | 317 | self.config = ( |
@@ -619,6 +632,12 @@ def _generate_random_config( |
619 | 632 | The types of questions to sample from (uniformely) |
620 | 633 |
|
621 | 634 | """ |
| 635 | + # Check that the report filters are properly setup |
| 636 | + if REPORT_DATE_FILTER is None or REPORT_TIME_FILTER is None: |
| 637 | + raise RuntimeError( |
| 638 | + "The report date and time filters are not set. Please run the install script to set them." |
| 639 | + ) |
| 640 | + |
622 | 641 | # Generate a bunch of reports based on valid table fields |
623 | 642 | ON_THE_FLY_REPORTS = [] |
624 | 643 | for table in [ |
|
0 commit comments