Skip to content

Commit

Permalink
remove Qualifier role from incident management (#54)
Browse files Browse the repository at this point in the history
* Add new FeatureTeam model

FIR-307

* set Admin register for FeatureTeam

FIR-307

* remove qualifier code

* Feature Team as mandatory pick at front end

FIR-307

* add migrations to raid app

FIR-307

* use incident details Feature Team pick to qualify ticket

FIR-308

* set import export Feature Team data

FIR-308

* chore: add explicit django-import-export

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Roc Itxart <[email protected]>
Co-authored-by: Gabriel Dugny <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
4 people authored May 14, 2024
1 parent 4f358db commit e5bb968
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 3 deletions.
37 changes: 36 additions & 1 deletion pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ dependencies = [
"drf-standardized-errors>=0.12.6",
"aiohttp>=3.9.1", # Transitive dependency of slack_sdk
"nh3>=0.2.15",
"django-import-export>=4.0.0",
]
requires-python = ">=3.11,<4.0"
license = {file = "LICENSE"}
Expand Down
1 change: 1 addition & 0 deletions src/firefighter/firefighter/settings/components/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"django_filters",
"taggit",
"django_tables2",
"import_export",
# SSO Auth
"oauth2_authcodeflow",
# Celery integration
Expand Down
13 changes: 13 additions & 0 deletions src/firefighter/raid/admin.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
from __future__ import annotations

from django.contrib import admin
from import_export.admin import ImportExportModelAdmin

from firefighter.jira_app.admin import JiraIssueAdmin
from firefighter.raid.models import (
FeatureTeam,
JiraTicket,
JiraTicketImpact,
RaidArea,
)
from firefighter.raid.resources import FeatureTeamResource


class JiraTicketImpactInline(admin.TabularInline[JiraTicketImpact, JiraTicket]):
Expand Down Expand Up @@ -36,3 +39,13 @@ class RaidAreaAdmin(admin.ModelAdmin[RaidArea]):
list_filter = ["area"]
search_fields = ["id", "name"]
ordering = ["area", "name"]


@admin.register(FeatureTeam)
class FeatureTeamAdmin(ImportExportModelAdmin):
resource_class = FeatureTeamResource
model = FeatureTeam
list_display = [
"name",
"jira_project_key",
]
7 changes: 5 additions & 2 deletions src/firefighter/raid/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from firefighter.firefighter.http_client import HttpClient
from firefighter.firefighter.utils import get_in
from firefighter.jira_app.client import JiraClient
from firefighter.raid.models import FeatureTeam

if TYPE_CHECKING:
from jira import Project
Expand Down Expand Up @@ -94,13 +95,15 @@ def create_issue( # noqa: PLR0912, PLR0913, C901, PLR0917
extra_args["customfield_10201"] = {"value": platform}
if environments:
extra_args["customfield_11049"] = [{"value": e} for e in environments]

if len(description_addendum) > 0:
description_addendum_str = "\n *Additional Information* \n" + "\n".join(
description_addendum
)
description += description_addendum_str
project = project if project else RAID_JIRA_PROJECT_KEY
feature_team = FeatureTeam.objects.filter(name=suggested_team_routing).get()
project = (
feature_team.jira_project_key if feature_team else RAID_JIRA_PROJECT_KEY
)
issue = self.jira.create_issue(
project=project,
summary=summary,
Expand Down
15 changes: 15 additions & 0 deletions src/firefighter/raid/resources.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from __future__ import annotations

from import_export import resources

from firefighter.raid.models import FeatureTeam


class FeatureTeamResource(resources.ModelResource):
class Meta:
model = FeatureTeam
skip_unchanged = True
report_skipped = False
fields = ("id", "name", "jira_project_key")
import_order = ("name", "jira_project_key")
export_order = ("name", "jira_project_key")

0 comments on commit e5bb968

Please sign in to comment.