-
Notifications
You must be signed in to change notification settings - Fork 516
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui/ux): adds a task edit dialog with create ticket action (#5260)
- Loading branch information
Showing
18 changed files
with
541 additions
and
31 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
src/dispatch/database/revisions/tenant/versions/2024-10-09_b8c1a8a4d957.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,35 @@ | ||
"""Adds tickets to tasks and ticket metadata to incident types | ||
Revision ID: b8c1a8a4d957 | ||
Revises: b057c079c2d5 | ||
Create Date: 2024-10-05 09:06:34.177407 | ||
""" | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "b8c1a8a4d957" | ||
down_revision = "b057c079c2d5" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.add_column( | ||
"incident_type", | ||
sa.Column("task_plugin_metadata", sa.JSON(), nullable=True, server_default="[]"), | ||
) | ||
op.add_column("ticket", sa.Column("task_id", sa.Integer(), nullable=True)) | ||
op.create_foreign_key(None, "ticket", "task", ["task_id"], ["id"], ondelete="CASCADE") | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_constraint(None, "ticket", type_="foreignkey") | ||
op.drop_column("ticket", "task_id") | ||
op.drop_column("incident_type", "task_plugin_metadata") | ||
# ### end Alembic commands ### |
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
127 changes: 127 additions & 0 deletions
127
src/dispatch/static/dispatch/src/incident/TaskEditDialog.vue
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,127 @@ | ||
<template> | ||
<v-dialog v-model="showEditTaskDialog" persistent max-width="750px"> | ||
<v-form @submit.prevent v-slot="{ isValid }"> | ||
<v-card> | ||
<v-card-title> | ||
<span class="text-h5">Edit Task</span> | ||
</v-card-title> | ||
<v-card-text> | ||
<v-row> | ||
<v-col cols="12"> | ||
<v-textarea | ||
v-model="description" | ||
auto-grow | ||
:rows="1" | ||
:max-rows="5" | ||
class="mt-3" | ||
label="Description" | ||
hint="Description of the task." | ||
clearable | ||
required | ||
/> | ||
</v-col> | ||
<v-col cols="12"> | ||
<v-select | ||
v-model="status" | ||
label="Status" | ||
:items="statuses" | ||
hint="The task's current status" | ||
/> | ||
</v-col> | ||
<v-col cols="12"> | ||
<participant-select | ||
v-model="owner" | ||
label="Owner" | ||
hint="The task's current owner" | ||
clearable | ||
required | ||
name="owner" | ||
:rules="[required_and_only_one]" | ||
/> | ||
</v-col> | ||
<v-col cols="12"> | ||
<assignee-combobox | ||
v-model="assignees" | ||
label="Assignee" | ||
hint="The task's current assignee" | ||
clearable | ||
required | ||
name="assignees" | ||
:rules="[required_and_only_one]" | ||
/> | ||
</v-col> | ||
<v-col cols="12" v-if="status == 'Resolved'"> | ||
<date-time-picker-menu label="Resolved At" v-model="resolved_at" /> | ||
</v-col> | ||
<v-col cols="12" v-else> | ||
<date-time-picker-menu label="Resolve By" v-model="resolve_by" /> | ||
</v-col> | ||
</v-row> | ||
</v-card-text> | ||
<v-card-actions> | ||
<v-spacer /> | ||
<v-btn variant="text" @click="closeNewTaskDialog()"> Cancel </v-btn> | ||
<v-btn | ||
:disabled="!isValid.value" | ||
color="green en-1" | ||
variant="text" | ||
@click="updateExistingTask()" | ||
> | ||
OK | ||
</v-btn> | ||
</v-card-actions> | ||
</v-card> | ||
</v-form> | ||
</v-dialog> | ||
</template> | ||
|
||
<script> | ||
import { mapFields } from "vuex-map-fields" | ||
import { mapActions } from "vuex" | ||
import ParticipantSelect from "@/components/ParticipantSelect.vue" | ||
import AssigneeCombobox from "@/task/AssigneeCombobox.vue" | ||
import DateTimePickerMenu from "@/components/DateTimePickerMenu.vue" | ||
export default { | ||
name: "EditTaskDialog", | ||
components: { | ||
AssigneeCombobox, | ||
ParticipantSelect, | ||
DateTimePickerMenu, | ||
}, | ||
data() { | ||
return { | ||
statuses: ["Open", "Resolved"], | ||
required_and_only_one: (value) => { | ||
if (!value || value.length == 0) { | ||
return "This field is required" | ||
} | ||
if (value && value.length > 1) { | ||
return "Only one is allowed" | ||
} | ||
return true | ||
}, | ||
} | ||
}, | ||
computed: { | ||
...mapFields("incident", [ | ||
"dialogs.showEditTaskDialog", | ||
"selected.currentTask.description", | ||
"selected.currentTask", | ||
"selected.currentTask.owner", | ||
"selected.currentTask.assignees", | ||
"selected.currentTask.resolved_at", | ||
"selected.currentTask.resolve_by", | ||
"selected.currentTask.status", | ||
]), | ||
}, | ||
methods: { | ||
...mapActions("incident", ["closeNewTaskDialog", "updateExistingTask"]), | ||
}, | ||
} | ||
</script> |
Oops, something went wrong.