Skip to content
This repository was archived by the owner on Sep 3, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 0 additions & 21 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.

1 change: 0 additions & 1 deletion src/dispatch/static/dispatch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
"@vue-flow/minimap": "^1.2.0",
"@vueuse/core": "^10.5.0",
"@vueuse/integrations": "^10.6.1",
"@wdns/vuetify-resize-drawer": "^3.2.0",
"apexcharts": "^3.44.0",
"axios": "^0.21.4",
"d3-force": "^3.0.0",
Expand Down
58 changes: 57 additions & 1 deletion src/dispatch/static/dispatch/src/case/EditSheet.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
<template>
<v-form @submit.prevent v-slot="{ isValid }">
<v-navigation-drawer location="right" width="900">
<v-navigation-drawer
location="right"
:width="navigation.width"
:style="{ transition: isResizing ? 'none' : 'width 0.2s ease' }"
>
<div
class="resize-handle"
@mousedown="startResize"
@mouseenter="handleHover = true"
@mouseleave="handleHover = false"
:style="{
position: 'absolute',
left: '0',
top: '0',
bottom: '0',
width: '4px',
cursor: 'ew-resize',
background: handleHover ? '#ff0000' : 'transparent',
zIndex: 1000,
transition: 'background 0.2s ease',
}"
/>
<template #prepend>
<v-list-item lines="two">
<v-list-item-title class="text-h6">
Expand Down Expand Up @@ -111,6 +132,13 @@ export default {
data() {
return {
tab: null,
navigation: {
width: parseInt(localStorage.getItem("case-drawer-width")) || 900,
minWidth: 400,
maxWidth: 1200,
},
isResizing: false,
handleHover: false,
}
},

Expand All @@ -137,10 +165,23 @@ export default {
this.fetchDetails()
},

mounted() {
document.addEventListener("mousemove", this.onMouseMove)
document.addEventListener("mouseup", this.onMouseUp)
},

beforeUnmount() {
document.removeEventListener("mousemove", this.onMouseMove)
document.removeEventListener("mouseup", this.onMouseUp)
},

watch: {
"$route.params.name": function () {
this.fetchDetails()
},
"navigation.width": function (newWidth) {
localStorage.setItem("case-drawer-width", newWidth.toString())
},
},

methods: {
Expand All @@ -149,6 +190,21 @@ export default {
this.getDetails({ name: this.$route.params.name })
}
},
startResize(e) {
this.isResizing = true
e.preventDefault()
},
onMouseMove(e) {
if (!this.isResizing) return

const newWidth = window.innerWidth - e.clientX
if (newWidth >= this.navigation.minWidth && newWidth <= this.navigation.maxWidth) {
this.navigation.width = newWidth
}
},
onMouseUp() {
this.isResizing = false
},
...mapActions("case_management", [
"save",
"getDetails",
Expand Down
58 changes: 52 additions & 6 deletions src/dispatch/static/dispatch/src/incident/EditSheet.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
<template>
<v-form @submit.prevent v-slot="{ isValid }">
<VResizeDrawer
<v-navigation-drawer
location="right"
handle-position="border"
handle-border-width="2"
:width="navigation.width"
ref="drawer"
:permanent="$vuetify.display.mdAndDown"
:style="{ transition: isResizing ? 'none' : 'width 0.2s ease' }"
>
<div
class="resize-handle"
@mousedown="startResize"
@mouseenter="handleHover = true"
@mouseleave="handleHover = false"
:style="{
position: 'absolute',
left: '0',
top: '0',
bottom: '0',
width: '4px',
cursor: 'ew-resize',
background: handleHover ? '#ff0000' : 'transparent',
zIndex: 1000,
transition: 'background 0.2s ease',
}"
/>
<template #prepend>
<v-list-item lines="two">
<v-list-item-title class="text-h6">
Expand Down Expand Up @@ -74,7 +90,7 @@
<workflow-instance-tab v-model="workflow_instances" />
</v-window-item>
</v-window>
</VResizeDrawer>
</v-navigation-drawer>
</v-form>
</template>

Expand Down Expand Up @@ -112,10 +128,12 @@ export default {
return {
tab: null,
navigation: {
width: 800,
borderSize: 3,
width: parseInt(localStorage.getItem("incident-drawer-width")) || 800,
minWidth: 400,
maxWidth: 1200,
},
isResizing: false,
handleHover: false,
}
},

Expand All @@ -139,6 +157,16 @@ export default {
this.fetchDetails()
},

mounted() {
document.addEventListener("mousemove", this.onMouseMove)
document.addEventListener("mouseup", this.onMouseUp)
},

beforeUnmount() {
document.removeEventListener("mousemove", this.onMouseMove)
document.removeEventListener("mouseup", this.onMouseUp)
},

watch: {
"$route.params.name": function () {
this.fetchDetails()
Expand All @@ -154,6 +182,9 @@ export default {
}
},
},
"navigation.width": function (newWidth) {
localStorage.setItem("incident-drawer-width", newWidth.toString())
},
},

methods: {
Expand All @@ -162,6 +193,21 @@ export default {
this.getDetails({ name: this.$route.params.name })
}
},
startResize(e) {
this.isResizing = true
e.preventDefault()
},
onMouseMove(e) {
if (!this.isResizing) return

const newWidth = window.innerWidth - e.clientX
if (newWidth >= this.navigation.minWidth && newWidth <= this.navigation.maxWidth) {
this.navigation.width = newWidth
}
},
onMouseUp() {
this.isResizing = false
},
...mapActions("incident", ["save", "getDetails", "closeEditSheet"]),
},
}
Expand Down
2 changes: 0 additions & 2 deletions src/dispatch/static/dispatch/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import "@formkit/themes/genesis"
// : null

import { plugin, defaultConfig } from "@formkit/vue"
import VResizeDrawer from "@wdns/vuetify-resize-drawer"

import "roboto-fontface/css/roboto/roboto-fontface.css"
import "font-awesome/css/font-awesome.css"
Expand Down Expand Up @@ -44,7 +43,6 @@ if (SENTRY_ENABLED) {
app.use(vuetifyPlugin)
app.use(router)
app.use(store)
app.component("VResizeDrawer", VResizeDrawer)
// if (FORMKIT_PRO_PROJECT_KEY) {
// const proModule = import.meta.env.VITE_FORMKIT_PRO_PROJECT_KEY
// ? await import(/* @vite-ignore */ "@formkit/pro")
Expand Down
35 changes: 35 additions & 0 deletions tests/static/e2e/drawer-functionality.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import register from "./utils/register"
import { test, expect } from "./fixtures/dispatch-fixtures"

test.describe("Drawer Functionality", () => {
test.beforeEach(async ({ authPage }) => {
await register(authPage)
})

test("Should open incident drawer", async ({ page, incidentsPage }) => {
// Navigate to incidents page
await incidentsPage.goto()

// Wait for the incidents table to load
await page.waitForSelector("table")

// Click on the kebab menu (three dots) for the first incident
const firstIncidentKebab = page.locator("tr").nth(1).getByRole("button").nth(2)
await firstIncidentKebab.click()

// Click on "View / Edit" option
const viewEditOption = page.getByText("View / Edit", { exact: true })
await viewEditOption.click()

await page.waitForTimeout(1000)

// Wait for the drawer to open and be visible
const drawer = page.locator(".v-navigation-drawer").first()
await expect(drawer).toBeVisible()

// Test making a change in the drawer
// Navigate to the Details tab
const detailsTab = page.getByRole("tab", { name: "Details" })
await detailsTab.click()
})
})
Loading