Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autofill the tactical report's action section with opened tasks #3554

Merged
merged 22 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
822f881
testing for changes in report gen form
metroid-samus Jun 28, 2023
315845f
initial commit
metroid-samus Jul 5, 2023
41a1057
Adds tasks to the action section of the tactical report dialogue.
metroid-samus Jul 5, 2023
f03ed28
remove debugging messages
metroid-samus Jul 5, 2023
7dbab87
Merge branch 'master' into enhancement/can-report-action-autofill
metroid-samus Jul 5, 2023
af66769
Update src/dispatch/static/dispatch/src/incident/store.js
metroid-samus Jul 6, 2023
d55eef8
Add TaskReadMinimal model
metroid-samus Jul 11, 2023
5b0b97c
Fix status type
metroid-samus Jul 11, 2023
49d072e
Merge branch 'master' into enhancement/can-report-action-autofill
metroid-samus Jul 12, 2023
8f0f4ce
Remove unused import
metroid-samus Jul 12, 2023
f3ab8d1
Autofill action section of CAN report from Slack
metroid-samus Jul 12, 2023
5dfd6b6
Merge branch 'master' into enhancement/can-report-action-autofill
metroid-samus Jul 13, 2023
7af62ea
Autofill action section of CAN report from Slack with task descriptions
metroid-samus Jul 13, 2023
6920eb7
Merge branch 'master' into enhancement/can-report-action-autofill
metroid-samus Jul 13, 2023
f67896f
Remove package.json from commits
metroid-samus Jul 13, 2023
8b476c4
Add all unresolved tasks to the tactical report if they exist
metroid-samus Jul 14, 2023
1a3094d
Merge branch 'master' into enhancement/can-report-action-autofill
metroid-samus Jul 14, 2023
24ad800
Merge branch 'master' into enhancement/can-report-action-autofill
metroid-samus Aug 3, 2023
4582563
Merge branch 'master' into enhancement/can-report-action-autofill
metroid-samus Aug 3, 2023
c2d36b4
Removing unnecessary forward ref
whitdog47 Aug 8, 2023
4c8b661
Merge branch 'master' into enhancement/can-report-action-autofill
whitdog47 Aug 8, 2023
fd0123a
Merge branch 'master' into enhancement/can-report-action-autofill
whitdog47 Aug 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/dispatch/incident/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,12 @@ class TaskRead(DispatchBase):
weblink: Optional[str]


class TaskReadMinimal(DispatchBase):
id: PrimaryKey
description: Optional[str] = Field(None, nullable=True)
status: TaskStatus = TaskStatus.open


# Pydantic models...
class IncidentBase(DispatchBase):
title: str
Expand Down Expand Up @@ -309,6 +315,7 @@ class IncidentReadMinimal(IncidentBase):
reporters_location: Optional[str]
stable_at: Optional[datetime] = None
tags: Optional[List[TagRead]] = []
tasks: Optional[List[TaskReadMinimal]] = []
total_cost: Optional[float]


Expand Down
10 changes: 10 additions & 0 deletions src/dispatch/plugins/dispatch_slack/incident/interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -1493,6 +1493,16 @@ def handle_report_tactical_command(
actions = tactical_report.details.get("actions")
needs = tactical_report.details.get("needs")

incident = incident_service.get(db_session=db_session, incident_id=context["subject"].id)
if incident.tasks:
actions = "\n".join(
[
"-" + task.description
for task in incident.tasks
if task.status != TaskStatus.resolved
]
)

blocks = [
Input(
label="Conditions",
Expand Down
7 changes: 7 additions & 0 deletions src/dispatch/static/dispatch/src/incident/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,13 @@ const actions = {
showReportDialog({ commit }, incident) {
commit("SET_DIALOG_REPORT", true)
commit("SET_SELECTED", incident)

state.report.tactical.actions = incident.tasks.reduce((result, task) => {
if (task.status == "Resolved") {
return result
}
return (result ? result + "\n" : "") + "- " + task.description
}, "")
metroid-samus marked this conversation as resolved.
Show resolved Hide resolved
},
closeReportDialog({ commit }) {
commit("SET_DIALOG_REPORT", false)
Expand Down
Loading