Skip to content

Commit

Permalink
Fixes conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
mvilanova committed Dec 7, 2023
2 parents 08c98a3 + 0689503 commit 3098cce
Show file tree
Hide file tree
Showing 18 changed files with 398 additions and 199 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
npm ci -D --prefix src/dispatch/static/dispatch
npm install -D @playwright/test
- name: Install playwright browsers
run: npx playwright install --with-deps
run: npx playwright install --with-deps chromium
- name: Setup sample database
run: dispatch database restore --dump-file data/dispatch-sample-data.dump && dispatch database upgrade
- name: Run tests
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ python-dateutil==2.8.2
# via faker
pyyaml==6.0.1
# via pre-commit
ruff==0.1.6
ruff==0.1.7
# via -r requirements-dev.in
six==1.16.0
# via
Expand Down
4 changes: 2 additions & 2 deletions src/dispatch/case/messaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def send_case_close_reminder(case: Case, db_session: SessionLocal):
items = [
{
"name": case.name,
"dispatch_ui_case_url": f"{DISPATCH_UI_URL}/{case.project.organization.name}/cases/{case.id}", # noqa
"dispatch_ui_case_url": f"{DISPATCH_UI_URL}/{case.project.organization.name}/cases/{case.name}", # noqa
"title": case.title,
"status": case.status,
}
Expand Down Expand Up @@ -77,7 +77,7 @@ def send_case_triage_reminder(case: Case, db_session: SessionLocal):
"name": case.name,
"title": case.title,
"status": case.status,
"dispatch_ui_case_url": f"{DISPATCH_UI_URL}/{case.project.organization.name}/cases/{case.id}", # noqa
"dispatch_ui_case_url": f"{DISPATCH_UI_URL}/{case.project.organization.name}/cases/{case.name}", # noqa
}
]

Expand Down
2 changes: 2 additions & 0 deletions src/dispatch/conversation/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ def create_case_conversation(case: Case, conversation_target: str, db_session: S
if not conversation_target:
conversation_target = case.case_type.conversation_target

conversation = None

if conversation_target:
try:
conversation = plugin.instance.create_threaded(
Expand Down
2 changes: 1 addition & 1 deletion src/dispatch/plugins/dispatch_slack/case/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def create_case_message(case: Case, channel_id: str) -> list[Block]:
accessory=Button(
text="View",
action_id="button-link",
url=f"{DISPATCH_UI_URL}/{case.project.organization.slug}/cases/{case.id}",
url=f"{DISPATCH_UI_URL}/{case.project.organization.slug}/cases/{case.name}",
),
),
Section(text=f"*Description* \n {case.description}"),
Expand Down
6 changes: 3 additions & 3 deletions src/dispatch/static/dispatch/package-lock.json

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

Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ const handleResolutionUpdate = (newResolution) => {
<v-col cols="10">
<CasePrioritySearchPopover
:case-priority="modelValue.case_priority?.name"
:project="modelValue.project?.name"
class="pl-6"
/>
</v-col>
Expand All @@ -121,6 +122,7 @@ const handleResolutionUpdate = (newResolution) => {
<v-col cols="10">
<CaseSeveritySearchPopover
:case-severity="modelValue.case_severity?.name"
:project="modelValue.project?.name"
class="pl-6"
/>
</v-col>
Expand All @@ -131,7 +133,11 @@ const handleResolutionUpdate = (newResolution) => {
<div class="dispatch-font">Type</div>
</v-col>
<v-col cols="10">
<CaseTypeSearchPopover :case-type="modelValue.case_type?.name" class="pl-6" />
<CaseTypeSearchPopover
:case-type="modelValue.case_type?.name"
:project="modelValue.project?.name"
class="pl-6"
/>
</v-col>
</v-row>

Expand Down
23 changes: 18 additions & 5 deletions src/dispatch/static/dispatch/src/case/CaseSignalInstanceTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<v-container>
<v-row>
<!-- Column for Data Table -->
<v-col cols="3">
<v-card min-width="350" class="signal-card" elevation="0">
<v-col cols="3" class="d-flex">
<v-card class="signal-card flex-card" elevation="0">
<v-virtual-scroll :items="signalInstances" height="828" class="pt-2">
<template #default="{ item }">
<div class="d-flex align-center">
<span style="font-size: 0.8rem" class="pl-8">
<span class="pl-8 signal-name">
{{ item.signal.name }}
</span>
<span class="pl-1 dispatch-text-paragraph">
Expand All @@ -23,8 +23,8 @@
</v-card>
</v-col>
<!-- Column for Raw Signal Viewer -->
<v-col cols="9">
<v-card elevation="0" class="signal-card pt-2">
<v-col cols="9" class="d-flex">
<v-card class="signal-card flex-card" elevation="0">
<span class="dispatch-text-paragraph">
<!-- {{ selectedItem.signal.name }} -->
</span>
Expand Down Expand Up @@ -110,4 +110,17 @@ watch(
border: 0.5px solid rgb(216, 216, 216) !important;
border-radius: 8px !important;
}
.flex-card {
flex: 1;
min-width: 0; // Allow the card to shrink below its content size
overflow: hidden; // Clip the content and add ... if the content is too big
}
.signal-name {
font-size: 0.8rem;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>
164 changes: 94 additions & 70 deletions src/dispatch/static/dispatch/src/case/CaseStatusSelectGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,83 +70,107 @@
</v-item-group>
</template>

<script>
import { mapActions } from "vuex"
<script setup>
import { computed, watch, ref } from "vue"
import { useStore } from "vuex"
import { useSavingState } from "@/composables/useSavingState"
import DTooltip from "@/components/DTooltip.vue"
import CaseApi from "@/case/api"
export default {
name: "CaseStatusSelectGroup",
props: {
modelValue: {
type: Object,
required: false,
default: () => ({}),
},
const props = defineProps({
modelValue: {
type: Object,
required: false,
default: () => ({}),
},
components: {
DTooltip,
})
const store = useStore()
const { setSaving } = useSavingState()
let selectedStatus = ref(null)
let dialogVisible = ref(false)
let activeStatus = ref(props.modelValue.status)
const statuses = computed(() => [
{
name: "New",
label: "Created",
color: "red",
hoverClass: "hover-card-three",
sheetClass: "rounded-s-xl arrow",
tooltip: props.modelValue.created_at,
},
data() {
return {
selectedStatus: null,
dialogVisible: false,
}
{
name: "Triage",
label: "Triaged",
color: "red",
hoverClass: "hover-card-two",
sheetClass: "arrow",
tooltip: props.modelValue.triage_at,
},
computed: {
statuses() {
return [
{
name: "New",
label: "New",
color: "red",
hoverClass: "hover-card-three",
sheetClass: "rounded-s-xl arrow",
tooltip: this.modelValue.created_at,
},
{
name: "Triage",
label: "Triaged",
color: "red",
hoverClass: "hover-card-two",
sheetClass: "arrow",
tooltip: this.modelValue.triage_at,
},
{
name: "Closed",
label: "Closed",
color: "green",
hoverClass: "hover-card",
sheetClass: "arrow",
tooltip: this.modelValue.closed_at,
},
{
name: "Escalated",
label: "Escalated",
color: "red",
hoverClass: "",
sheetClass: "rounded-e-xl end-sheet",
tooltip: this.modelValue.escalated_at,
},
]
},
{
name: "Closed",
label: "Closed",
color: "green",
hoverClass: "hover-card",
sheetClass: "arrow",
tooltip: props.modelValue.closed_at,
},
methods: {
...mapActions("case_management", ["save_page"]),
changeStatus(newStatus) {
// eslint-disable-next-line vue/no-mutating-props
this.modelValue.status = newStatus
this.save_page()
this.dialogVisible = false
this.selectedStatus = null
},
openDialog(newStatus) {
this.selectedStatus = newStatus
this.dialogVisible = true
},
isActiveStatus(status) {
return this.modelValue.status === status
},
{
name: "Escalated",
label: "Escalated",
color: "red",
hoverClass: "",
sheetClass: "rounded-e-xl end-sheet",
tooltip: props.modelValue.escalated_at,
},
])
const changeStatus = async (newStatus) => {
const caseDetails = store.state.case_management.selected
const previousStatus = activeStatus.value
// Optimistically update the UI
activeStatus.value = newStatus
selectedStatus.value = null
dialogVisible.value = false
caseDetails.status = newStatus
try {
setSaving(true)
await CaseApi.update(caseDetails.id, caseDetails)
setSaving(false)
} catch (e) {
console.error(`Failed to update case status`, e)
// If the API call fails, revert the active status change
activeStatus.value = previousStatus
store.commit(
"notification_backend/addBeNotification",
{
text: `Failed to update case status`,
type: "exception",
},
{ root: true }
)
}
}
const openDialog = (newStatus) => {
selectedStatus.value = newStatus
dialogVisible.value = true
}
watch(
() => props.modelValue.status,
(newStatus) => {
activeStatus.value = newStatus
}
)
const isActiveStatus = (status) => {
return activeStatus.value === status
}
</script>

Expand Down
42 changes: 29 additions & 13 deletions src/dispatch/static/dispatch/src/case/Page.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<div>
<PageHeader
:case-id="caseDetails.id"
:case-name="caseDetails.name"
:case-visibility="caseDetails.visibility"
:case-status="caseDetails.status"
Expand Down Expand Up @@ -92,21 +93,36 @@ const toggleDrawer = () => {
}
const fetchDetails = async () => {
const caseId = parseInt(route.params.id, 10)
const caseName = route.params.name
loading.value = true
try {
// get the full data set
CaseApi.get(caseId).then((response) => {
caseDetails.value = response.data
// Save the fetched case details to the Vuex store
store.commit("case_management/SET_SELECTED", response.data)
})
} catch (e) {
console.error("Failed to fetch case details", e)
caseDetails.value = caseDefaults
CaseApi.getAll({
filter: JSON.stringify([
{ and: [{ model: "Case", field: "name", op: "==", value: caseName }] },
]),
}).then((response) => {
if (response.data.items.length) {
// get the full data set
return CaseApi.get(response.data.items[0].id).then((response) => {
caseDetails.value = response.data
// Save the fetched case details to the Vuex store
store.commit("case_management/SET_SELECTED", response.data)
loading.value = false
})
} else {
caseDetails.value = caseDefaults
store.commit(
"notification_backend/addBeNotification",
{
text: `Case '${caseName}' could not be found.`,
type: "exception",
},
{ root: true }
)
}
loading.value = false
}
})
}
const saveCaseDetails = async () => {
Expand All @@ -132,7 +148,7 @@ const handleDescriptionUpdate = (newDescription) => {
}
watch(
() => route.params.id,
() => route.params.name,
(newName, oldName) => {
if (newName !== oldName) {
fetchDetails()
Expand Down
Loading

0 comments on commit 3098cce

Please sign in to comment.