Example #1
0
    def setup_filters(self, *args, **kwargs):
        project = Project.objects.get(pk=kwargs["pid"])
        self.project_layers = ProjectLayer.objects.filter(project=project)

        in_current_project_filter = TableFilter("in_current_project", "Filter by project layers")

        criteria = Q(projectlayer__in=self.project_layers)

        in_project_action = TableFilterActionToggle("in_project", "Layers added to this project", criteria)

        not_in_project_action = TableFilterActionToggle("not_in_project", "Layers not added to this project", ~criteria)

        in_current_project_filter.add_action(in_project_action)
        in_current_project_filter.add_action(not_in_project_action)
        self.add_filter(in_current_project_filter)
Example #2
0
    def setup_filters(self, *args, **kwargs):
        table_filter = TableFilter("in_current_project", "Filter by project recipes")

        in_project_action = TableFilterActionToggle(
            "in_project",
            "Recipes provided by layers added to this project",
            ProjectFilters.in_project(self.project_layers),
        )

        not_in_project_action = TableFilterActionToggle(
            "not_in_project",
            "Recipes provided by layers not added to this project",
            ProjectFilters.not_in_project(self.project_layers),
        )

        table_filter.add_action(in_project_action)
        table_filter.add_action(not_in_project_action)
        self.add_filter(table_filter)
Example #3
0
    def setup_filters(self, *args, **kwargs):
        project = Project.objects.get(pk=kwargs["pid"])

        in_current_project_filter = TableFilter("in_current_project", "Filter by project machines")

        in_project_action = TableFilterActionToggle(
            "in_project",
            "Machines provided by layers added to this project",
            ProjectFilters.in_project(self.project_layers),
        )

        not_in_project_action = TableFilterActionToggle(
            "not_in_project",
            "Machines provided by layers not added to this project",
            ProjectFilters.not_in_project(self.project_layers),
        )

        in_current_project_filter.add_action(in_project_action)
        in_current_project_filter.add_action(not_in_project_action)
        self.add_filter(in_current_project_filter)
Example #4
0
    def setup_filters(self, *args, **kwargs):
        # Execution outcome types filter
        executed_outcome = TableFilter(name="execution_outcome",
                                       title="Filter Tasks by 'Executed")

        exec_outcome_action_exec = TableFilterActionToggle(
            "executed",
            "Executed Tasks",
            Q(task_executed=True))

        exec_outcome_action_not_exec = TableFilterActionToggle(
            "not_executed",
            "Not Executed Tasks",
            Q(task_executed=False))

        executed_outcome.add_action(exec_outcome_action_exec)
        executed_outcome.add_action(exec_outcome_action_not_exec)

        # Task outcome types filter
        task_outcome = TableFilter(name="task_outcome",
                                   title="Filter Task by 'Outcome'")

        for outcome_enum, title in Task.TASK_OUTCOME:
            if outcome_enum is Task.OUTCOME_NA:
                continue
            action = TableFilterActionToggle(
                title.replace(" ", "_").lower(),
                "%s Tasks" % title,
                Q(outcome=outcome_enum))

            task_outcome.add_action(action)

        # SSTATE outcome types filter
        sstate_outcome = TableFilter(name="sstate_outcome",
                                     title="Filter Task by 'Cache attempt'")

        for sstate_result_enum, title in Task.SSTATE_RESULT:
            action = TableFilterActionToggle(
                title.replace(" ", "_").lower(),
                "Tasks with '%s' attempts" % title,
                Q(sstate_result=sstate_result_enum))

            sstate_outcome.add_action(action)

        self.add_filter(sstate_outcome)
        self.add_filter(executed_outcome)
        self.add_filter(task_outcome)
Example #5
0
    def setup_filters(self, *args, **kwargs):
        # Execution outcome types filter
        executed_outcome = TableFilter(name="execution_outcome",
                                       title="Filter Tasks by 'Executed")

        exec_outcome_action_exec = TableFilterActionToggle(
            "executed", "Executed Tasks", Q(task_executed=True))

        exec_outcome_action_not_exec = TableFilterActionToggle(
            "not_executed", "Not Executed Tasks", Q(task_executed=False))

        executed_outcome.add_action(exec_outcome_action_exec)
        executed_outcome.add_action(exec_outcome_action_not_exec)

        # Task outcome types filter
        task_outcome = TableFilter(name="task_outcome",
                                   title="Filter Task by 'Outcome'")

        for outcome_enum, title in Task.TASK_OUTCOME:
            if outcome_enum is Task.OUTCOME_NA:
                continue
            action = TableFilterActionToggle(
                title.replace(" ", "_").lower(), "%s Tasks" % title,
                Q(outcome=outcome_enum))

            task_outcome.add_action(action)

        # SSTATE outcome types filter
        sstate_outcome = TableFilter(name="sstate_outcome",
                                     title="Filter Task by 'Cache attempt'")

        for sstate_result_enum, title in Task.SSTATE_RESULT:
            action = TableFilterActionToggle(
                title.replace(" ", "_").lower(),
                "Tasks with '%s' attempts" % title,
                Q(sstate_result=sstate_result_enum))

            sstate_outcome.add_action(action)

        self.add_filter(sstate_outcome)
        self.add_filter(executed_outcome)
        self.add_filter(task_outcome)
Example #6
0
    def setup_filters(self, *args, **kwargs):
        # outcomes
        outcome_filter = TableFilter("outcome_filter", "Filter builds by outcome")

        successful_builds_action = TableFilterActionToggle(
            "successful_builds", "Successful builds", Q(outcome=Build.SUCCEEDED)
        )

        failed_builds_action = TableFilterActionToggle("failed_builds", "Failed builds", Q(outcome=Build.FAILED))

        outcome_filter.add_action(successful_builds_action)
        outcome_filter.add_action(failed_builds_action)
        self.add_filter(outcome_filter)

        # started on
        started_on_filter = TableFilter("started_on_filter", "Filter by date when build was started")

        started_today_action = TableFilterActionDay("today", "Today's builds", "started_on", "today")

        started_yesterday_action = TableFilterActionDay("yesterday", "Yesterday's builds", "started_on", "yesterday")

        by_started_date_range_action = TableFilterActionDateRange("date_range", "Build date range", "started_on")

        started_on_filter.add_action(started_today_action)
        started_on_filter.add_action(started_yesterday_action)
        started_on_filter.add_action(by_started_date_range_action)
        self.add_filter(started_on_filter)

        # completed on
        completed_on_filter = TableFilter("completed_on_filter", "Filter by date when build was completed")

        completed_today_action = TableFilterActionDay("today", "Today's builds", "completed_on", "today")

        completed_yesterday_action = TableFilterActionDay(
            "yesterday", "Yesterday's builds", "completed_on", "yesterday"
        )

        by_completed_date_range_action = TableFilterActionDateRange("date_range", "Build date range", "completed_on")

        completed_on_filter.add_action(completed_today_action)
        completed_on_filter.add_action(completed_yesterday_action)
        completed_on_filter.add_action(by_completed_date_range_action)
        self.add_filter(completed_on_filter)

        # failed tasks
        failed_tasks_filter = TableFilter("failed_tasks_filter", "Filter builds by failed tasks")

        criteria = Q(task_build__outcome=Task.OUTCOME_FAILED)

        with_failed_tasks_action = TableFilterActionToggle("with_failed_tasks", "Builds with failed tasks", criteria)

        without_failed_tasks_action = TableFilterActionToggle(
            "without_failed_tasks", "Builds without failed tasks", ~criteria
        )

        failed_tasks_filter.add_action(with_failed_tasks_action)
        failed_tasks_filter.add_action(without_failed_tasks_action)
        self.add_filter(failed_tasks_filter)