From 822f8819032ac65c4341a4602e54b60ee2e40a10 Mon Sep 17 00:00:00 2001 From: Avery & Samus Date: Wed, 28 Jun 2023 09:59:52 -0700 Subject: [PATCH 01/13] testing for changes in report gen form --- src/dispatch/static/dispatch/src/incident/ReportDialog.vue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/dispatch/static/dispatch/src/incident/ReportDialog.vue b/src/dispatch/static/dispatch/src/incident/ReportDialog.vue index f0e126ddda4f..437c742f9fa3 100644 --- a/src/dispatch/static/dispatch/src/incident/ReportDialog.vue +++ b/src/dispatch/static/dispatch/src/incident/ReportDialog.vue @@ -21,13 +21,15 @@ hint="The current state of the incident." clearable auto-grow - /> + > 12345 + + >{{ for (let i; i < 5; i++ ) {i} }} From 315845ff3e5c54cbb10a84f59a07cb7b0b0f8674 Mon Sep 17 00:00:00 2001 From: Avery Lee Date: Wed, 5 Jul 2023 09:56:48 -0700 Subject: [PATCH 02/13] initial commit --- src/dispatch/auth/models.py | 2 ++ src/dispatch/static/dispatch/src/incident/ReportDialog.vue | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/dispatch/auth/models.py b/src/dispatch/auth/models.py index bbac7781f81f..4afb697b313e 100644 --- a/src/dispatch/auth/models.py +++ b/src/dispatch/auth/models.py @@ -73,6 +73,8 @@ def token(self): "exp": exp, "email": self.email, } + print("JWT_ALG", DISPATCH_JWT_ALG) + print("JWT_SECRET", DISPATCH_JWT_SECRET) return jwt.encode(data, DISPATCH_JWT_SECRET, algorithm=DISPATCH_JWT_ALG) def get_organization_role(self, organization_slug: OrganizationSlug): diff --git a/src/dispatch/static/dispatch/src/incident/ReportDialog.vue b/src/dispatch/static/dispatch/src/incident/ReportDialog.vue index 437c742f9fa3..be10d54cf970 100644 --- a/src/dispatch/static/dispatch/src/incident/ReportDialog.vue +++ b/src/dispatch/static/dispatch/src/incident/ReportDialog.vue @@ -2,7 +2,7 @@ - Create Report + Create Report - ASDF @@ -17,7 +17,7 @@ status reports. Date: Wed, 5 Jul 2023 15:19:20 -0700 Subject: [PATCH 03/13] Adds tasks to the action section of the tactical report dialogue. --- src/dispatch/incident/models.py | 1 + .../static/dispatch/src/incident/ReportDialog.vue | 11 ++++------- src/dispatch/static/dispatch/src/incident/store.js | 7 +++++++ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/dispatch/incident/models.py b/src/dispatch/incident/models.py index 6ba743b4751d..4903483eced4 100644 --- a/src/dispatch/incident/models.py +++ b/src/dispatch/incident/models.py @@ -300,6 +300,7 @@ class IncidentReadMinimal(IncidentBase): reporters_location: Optional[str] stable_at: Optional[datetime] = None tags: Optional[List[TagRead]] = [] + tasks: Optional[List[TaskRead]] = [] total_cost: Optional[float] diff --git a/src/dispatch/static/dispatch/src/incident/ReportDialog.vue b/src/dispatch/static/dispatch/src/incident/ReportDialog.vue index be10d54cf970..f0e126ddda4f 100644 --- a/src/dispatch/static/dispatch/src/incident/ReportDialog.vue +++ b/src/dispatch/static/dispatch/src/incident/ReportDialog.vue @@ -2,7 +2,7 @@ - Create Report - ASDF + Create Report @@ -17,19 +17,17 @@ status reports. 12345 - + /> {{ for (let i; i < 5; i++ ) {i} }} + /> diff --git a/src/dispatch/static/dispatch/src/incident/store.js b/src/dispatch/static/dispatch/src/incident/store.js index 09ed7f029d38..b1a43016b35c 100644 --- a/src/dispatch/static/dispatch/src/incident/store.js +++ b/src/dispatch/static/dispatch/src/incident/store.js @@ -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" : result) + "- " + task.description + }, "") }, closeReportDialog({ commit }) { commit("SET_DIALOG_REPORT", false) From f03ed283321cc1187433c040c6fb4b83fe439057 Mon Sep 17 00:00:00 2001 From: Avery Lee Date: Wed, 5 Jul 2023 15:41:56 -0700 Subject: [PATCH 04/13] remove debugging messages --- src/dispatch/auth/models.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/dispatch/auth/models.py b/src/dispatch/auth/models.py index 4afb697b313e..bbac7781f81f 100644 --- a/src/dispatch/auth/models.py +++ b/src/dispatch/auth/models.py @@ -73,8 +73,6 @@ def token(self): "exp": exp, "email": self.email, } - print("JWT_ALG", DISPATCH_JWT_ALG) - print("JWT_SECRET", DISPATCH_JWT_SECRET) return jwt.encode(data, DISPATCH_JWT_SECRET, algorithm=DISPATCH_JWT_ALG) def get_organization_role(self, organization_slug: OrganizationSlug): From af66769b55b27f05178971d529bce4eb43756489 Mon Sep 17 00:00:00 2001 From: Avery Date: Thu, 6 Jul 2023 15:54:12 -0700 Subject: [PATCH 05/13] Update src/dispatch/static/dispatch/src/incident/store.js Co-authored-by: David Whittaker <84562015+whitdog47@users.noreply.github.com> --- src/dispatch/static/dispatch/src/incident/store.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dispatch/static/dispatch/src/incident/store.js b/src/dispatch/static/dispatch/src/incident/store.js index b1a43016b35c..2d9ac3228195 100644 --- a/src/dispatch/static/dispatch/src/incident/store.js +++ b/src/dispatch/static/dispatch/src/incident/store.js @@ -210,7 +210,7 @@ const actions = { if (task.status == "Resolved") { return result } - return (result ? result + "\n" : result) + "- " + task.description + return (result ? result + "\n" : "") + "- " + task.description }, "") }, closeReportDialog({ commit }) { From d55eef817f28511763962b65bc976517b1940254 Mon Sep 17 00:00:00 2001 From: Avery Lee Date: Tue, 11 Jul 2023 11:17:05 -0700 Subject: [PATCH 06/13] Add TaskReadMinimal model --- src/dispatch/incident/models.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/dispatch/incident/models.py b/src/dispatch/incident/models.py index 4903483eced4..c08dfe044bba 100644 --- a/src/dispatch/incident/models.py +++ b/src/dispatch/incident/models.py @@ -246,6 +246,12 @@ class TaskRead(DispatchBase): weblink: Optional[str] +class TaskReadMinimal(DispatchBase): + id: PrimaryKey + description: Optional[str] = Field(None, nullable=True) + status: Optional[bool] + + # Pydantic models... class IncidentBase(DispatchBase): title: str @@ -300,7 +306,7 @@ class IncidentReadMinimal(IncidentBase): reporters_location: Optional[str] stable_at: Optional[datetime] = None tags: Optional[List[TagRead]] = [] - tasks: Optional[List[TaskRead]] = [] + tasks: Optional[List[TaskReadMinimal]] = [] total_cost: Optional[float] From 5b0b97c794e4f8fdf5289830e9bc93966fc13c77 Mon Sep 17 00:00:00 2001 From: Avery Lee Date: Tue, 11 Jul 2023 14:18:56 -0700 Subject: [PATCH 07/13] Fix status type --- src/dispatch/incident/models.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/dispatch/incident/models.py b/src/dispatch/incident/models.py index c08dfe044bba..664860673a29 100644 --- a/src/dispatch/incident/models.py +++ b/src/dispatch/incident/models.py @@ -246,10 +246,16 @@ class TaskRead(DispatchBase): weblink: Optional[str] +TaskReadMinimal = ForwardRef("TaskReadMinimal") + + class TaskReadMinimal(DispatchBase): id: PrimaryKey description: Optional[str] = Field(None, nullable=True) - status: Optional[bool] + status: TaskStatus = TaskStatus.open + + +TaskReadMinimal.update_forward_refs() # Pydantic models... From 8f0f4cef0251d2dbd561af666936ed5f68324ce3 Mon Sep 17 00:00:00 2001 From: Avery Lee Date: Wed, 12 Jul 2023 10:26:09 -0700 Subject: [PATCH 08/13] Remove unused import --- src/dispatch/plugins/dispatch_slack/incident/interactive.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/dispatch/plugins/dispatch_slack/incident/interactive.py b/src/dispatch/plugins/dispatch_slack/incident/interactive.py index a946232cdc35..e1f04f01b9dc 100644 --- a/src/dispatch/plugins/dispatch_slack/incident/interactive.py +++ b/src/dispatch/plugins/dispatch_slack/incident/interactive.py @@ -1,6 +1,7 @@ import logging import uuid from datetime import datetime, timedelta +from functools import reduce from typing import Any import pytz @@ -1490,6 +1491,9 @@ def handle_report_tactical_command( conditions = tactical_report.details.get("conditions") actions = tactical_report.details.get("actions") needs = tactical_report.details.get("needs") + else: + incident = incident_service.get(db_session=db_session, incident_id=context["subject"].id) + actions = "\n".join(["-" + task for task in incident.tasks if task.status != "Resolved"]) blocks = [ Input( From f3ab8d1af7f9d7f26a90e67637a0349517acf86c Mon Sep 17 00:00:00 2001 From: Avery Lee Date: Wed, 12 Jul 2023 10:19:28 -0700 Subject: [PATCH 09/13] Autofill action section of CAN report from Slack --- package.json | 5 +++++ src/dispatch/plugins/dispatch_slack/incident/interactive.py | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 package.json diff --git a/package.json b/package.json new file mode 100644 index 000000000000..03164ca85787 --- /dev/null +++ b/package.json @@ -0,0 +1,5 @@ +{ + "devDependencies": { + "@playwright/test": "^1.35.1" + } +} diff --git a/src/dispatch/plugins/dispatch_slack/incident/interactive.py b/src/dispatch/plugins/dispatch_slack/incident/interactive.py index e1f04f01b9dc..deaed99f0c27 100644 --- a/src/dispatch/plugins/dispatch_slack/incident/interactive.py +++ b/src/dispatch/plugins/dispatch_slack/incident/interactive.py @@ -1,7 +1,6 @@ import logging import uuid from datetime import datetime, timedelta -from functools import reduce from typing import Any import pytz From 7af62eafadd87bc9005811e9a82c4baca8316400 Mon Sep 17 00:00:00 2001 From: Avery Lee Date: Thu, 13 Jul 2023 15:30:41 -0700 Subject: [PATCH 10/13] Autofill action section of CAN report from Slack with task descriptions --- src/dispatch/plugins/dispatch_slack/incident/interactive.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/dispatch/plugins/dispatch_slack/incident/interactive.py b/src/dispatch/plugins/dispatch_slack/incident/interactive.py index deaed99f0c27..b21b571f337c 100644 --- a/src/dispatch/plugins/dispatch_slack/incident/interactive.py +++ b/src/dispatch/plugins/dispatch_slack/incident/interactive.py @@ -1492,7 +1492,9 @@ def handle_report_tactical_command( needs = tactical_report.details.get("needs") else: incident = incident_service.get(db_session=db_session, incident_id=context["subject"].id) - actions = "\n".join(["-" + task for task in incident.tasks if task.status != "Resolved"]) + actions = "\n".join( + ["-" + task.description for task in incident.tasks if task.status != "Resolved"] + ) blocks = [ Input( From f67896fab730cf3ed72844415fd25e2b3b1b0902 Mon Sep 17 00:00:00 2001 From: Avery Lee Date: Thu, 13 Jul 2023 15:55:13 -0700 Subject: [PATCH 11/13] Remove package.json from commits --- package.json | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 package.json diff --git a/package.json b/package.json deleted file mode 100644 index 03164ca85787..000000000000 --- a/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "devDependencies": { - "@playwright/test": "^1.35.1" - } -} From 8b476c45e20ee1d94fdc4d42add5858d2fd93882 Mon Sep 17 00:00:00 2001 From: Avery Lee Date: Fri, 14 Jul 2023 16:34:50 -0700 Subject: [PATCH 12/13] Add all unresolved tasks to the tactical report if they exist --- .../plugins/dispatch_slack/incident/interactive.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/dispatch/plugins/dispatch_slack/incident/interactive.py b/src/dispatch/plugins/dispatch_slack/incident/interactive.py index b21b571f337c..4f52c7e09ac9 100644 --- a/src/dispatch/plugins/dispatch_slack/incident/interactive.py +++ b/src/dispatch/plugins/dispatch_slack/incident/interactive.py @@ -1490,10 +1490,15 @@ def handle_report_tactical_command( conditions = tactical_report.details.get("conditions") actions = tactical_report.details.get("actions") needs = tactical_report.details.get("needs") - else: - incident = incident_service.get(db_session=db_session, incident_id=context["subject"].id) + + 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 != "Resolved"] + [ + "-" + task.description + for task in incident.tasks + if task.status != TaskStatus.resolved + ] ) blocks = [ From c2d36b4bd302cff9ce4249d340f707e0836baf5f Mon Sep 17 00:00:00 2001 From: David Whittaker Date: Tue, 8 Aug 2023 16:24:15 -0700 Subject: [PATCH 13/13] Removing unnecessary forward ref --- src/dispatch/incident/models.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/dispatch/incident/models.py b/src/dispatch/incident/models.py index 78a5f835ccbf..4be0ce20ef9e 100644 --- a/src/dispatch/incident/models.py +++ b/src/dispatch/incident/models.py @@ -255,18 +255,12 @@ class TaskRead(DispatchBase): weblink: Optional[str] -TaskReadMinimal = ForwardRef("TaskReadMinimal") - - class TaskReadMinimal(DispatchBase): id: PrimaryKey description: Optional[str] = Field(None, nullable=True) status: TaskStatus = TaskStatus.open -TaskReadMinimal.update_forward_refs() - - # Pydantic models... class IncidentBase(DispatchBase): title: str