-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(slack): edit command to update the metadata of an incident (#96)
* Add edit command to update an incident * fix(incidents): save environment in IncidentUpdate * fix(ui): display edits in the web UI timeline * fix(slack): display edits in Slack update --------- Co-authored-by: Gabriel Dugny <[email protected]>
- Loading branch information
1 parent
7fbaea4
commit 2f3bfc6
Showing
10 changed files
with
301 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from __future__ import annotations | ||
|
||
from django import forms | ||
|
||
from firefighter.incidents.models import Environment | ||
|
||
|
||
def initial_environments() -> Environment: | ||
return Environment.objects.get(default=True) | ||
|
||
|
||
class EditMetaForm(forms.Form): | ||
title = forms.CharField( | ||
label="Title", | ||
max_length=128, | ||
min_length=10, | ||
widget=forms.TextInput(attrs={"placeholder": "What's going on?"}), | ||
) | ||
description = forms.CharField( | ||
label="Summary", | ||
widget=forms.Textarea( | ||
attrs={ | ||
"placeholder": "Help people responding to the incident. This will be posted to #tech-incidents and on our internal status page.\nThis description can be edited later." | ||
} | ||
), | ||
min_length=10, | ||
max_length=1200, | ||
) | ||
environment = forms.ModelChoiceField( | ||
label="Environment", | ||
queryset=Environment.objects.all(), | ||
initial=initial_environments, | ||
) |
27 changes: 27 additions & 0 deletions
27
src/firefighter/incidents/migrations/0004_incidentupdate_environment.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Generated by Django 4.2.14 on 2024-09-27 10:06 | ||
|
||
from django.db import migrations, models | ||
|
||
import firefighter.incidents.models.environment | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("incidents", "0003_delete_featureteam"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="incidentupdate", | ||
name="environment", | ||
field=models.ForeignKey( | ||
blank=True, | ||
null=True, | ||
on_delete=models.SET( | ||
firefighter.incidents.models.environment.Environment.get_default | ||
), | ||
to="incidents.environment", | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.