Skip to content

Commit

Permalink
Merge branch 'master' into test/test-feedback-creation
Browse files Browse the repository at this point in the history
  • Loading branch information
whitdog47 authored Oct 24, 2024
2 parents 976d2ec + 24b78e5 commit f5b32df
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 77 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
# Minimum code coverage per file
COVERAGE_SINGLE: 50
# Minimum total code coverage
COVERAGE_TOTAL: 56
COVERAGE_TOTAL: 55
runs-on: ubuntu-latest
services:
postgres:
Expand Down
2 changes: 1 addition & 1 deletion src/dispatch/static/dispatch/src/case/DetailsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
/>
</v-col>
<v-col cols="6">
<project-select v-model="project" />
<project-select v-model="project" disabled />
</v-col>
<v-col cols="6">
<case-type-select v-model="case_type" :project="project" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,22 +140,8 @@ export default {
},
watch: {
project: {
handler(newProject) {
if (newProject?.id !== this.lastProjectId) {
// Check if we're moving to a valid project (not null)
if (this.lastProjectId) {
this.lastProjectId = newProject.id
this.resetSelection()
this.fetchData()
} else {
// If new project is null/undefined, just update lastProjectId
this.lastProjectId = null
}
}
this.validatePriority()
},
deep: true,
project() {
this.fetchData()
},
},
Expand Down
21 changes: 4 additions & 17 deletions src/dispatch/static/dispatch/src/case/type/CaseTypeSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export default {
}
}
filterOptions = SearchUtils.createParametersFromTableOptions({ ...filterOptions })
filterOptions = SearchUtils.createParametersFromTableOptions({ ...filterOptions }, "CaseType")
CaseTypeApi.getAll(filterOptions)
.then((response) => {
Expand Down Expand Up @@ -169,22 +169,9 @@ export default {
},
watch: {
project: {
handler(newProject) {
if (newProject?.id !== this.lastProjectId) {
// Check if we're moving to a valid project (not null)
if (this.lastProjectId) {
this.lastProjectId = newProject.id
this.resetSelection()
this.fetchData()
} else {
// If new project is null/undefined, just update lastProjectId
this.lastProjectId = null
}
}
this.validateType()
},
deep: true,
project() {
this.validateType()
this.fetchData()
},
},
Expand Down
2 changes: 1 addition & 1 deletion src/dispatch/static/dispatch/src/incident/DetailsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
/>
</v-col>
<v-col cols="6">
<project-select v-model="project" />
<project-select v-model="project" disabled />
</v-col>
<v-col cols="6">
<incident-type-select v-model="incident_type" :project="project" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,23 +130,9 @@ export default {
},
watch: {
project: {
handler(newProject) {
if (newProject?.id !== this.lastProjectId) {
// Check if we're moving to a valid project (not null)
if (this.lastProjectId) {
this.lastProjectId = newProject.id
this.resetSelection()
this.fetchData()
} else {
// If new project is null/undefined, just update lastProjectId
this.lastProjectId = null
}
}
this.validatePriority()
},
deep: true,
project() {
this.validatePriority()
this.fetchData()
},
status() {
this.validatePriority()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
:label="label"
return-object
:loading="loading"
:rules="[validationRule]"
:rules="[is_type_in_project]"
>
<template #item="{ props, item }">
<v-list-item v-bind="props" :title="null">
Expand Down Expand Up @@ -61,46 +61,51 @@ export default {
numItems: 5,
total: 0,
lastProjectId: null,
error: null,
is_type_in_project: () => {
this.validateType()
return this.error
},
}
},
computed: {
selectedIncidentType: {
get() {
return this.modelValue || null
if (!this.modelValue) return null
if (this.modelValue.id) {
return this.items.find((item) => item.id === this.modelValue.id) || null
}
// If we only have a name (e.g., from URL params), find by name
if (this.modelValue.name) {
return this.items.find((item) => item.name === this.modelValue.name) || null
}
return null
},
set(value) {
this.$emit("update:modelValue", value)
this.validateType()
},
},
isTypeValid() {
const project_id = this.project?.id || 0
return this.selectedIncidentType?.project?.id == project_id
},
validationRule() {
return this.isTypeValid || "Only types in selected project are allowed"
},
},
watch: {
project: {
handler(newProject) {
if (newProject?.id !== this.lastProjectId) {
// Check if we're moving to a valid project (not null)
if (this.lastProjectId) {
this.lastProjectId = newProject.id
this.resetSelection()
this.fetchData()
} else {
// If new project is null/undefined, just update lastProjectId
this.lastProjectId = null
}
}
},
project() {
this.validateType()
this.fetchData()
},
},
methods: {
validateType() {
const project_id = this.project?.id || 0
const in_project = this.selectedIncidentType?.project?.id == project_id
if (in_project) {
this.error = true
} else {
this.error = "Only types in selected project are allowed"
}
},
clearSelection() {
this.selectedIncidentType = null
},
Expand All @@ -124,7 +129,10 @@ export default {
}
}
filterOptions = SearchUtils.createParametersFromTableOptions(filterOptions)
filterOptions = SearchUtils.createParametersFromTableOptions(
{ ...filterOptions },
"IncidentType"
)
IncidentTypeApi.getAll(filterOptions)
.then((response) => {
Expand Down

0 comments on commit f5b32df

Please sign in to comment.