Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing issue where case type parameter in route is not resolving #4102

Merged
merged 6 commits into from
Dec 12, 2023
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
29 changes: 28 additions & 1 deletion src/dispatch/static/dispatch/src/case/ReportSubmissionCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ import CasePrioritySelect from "@/case/priority/CasePrioritySelect.vue"
import ProjectSelect from "@/project/ProjectSelect.vue"
import DocumentApi from "@/document/api"
import TagFilterAutoComplete from "@/tag/TagFilterAutoComplete.vue"
import SearchUtils from "@/search/utils"
import CaseTypeApi from "@/case/type/api"

export default {
setup() {
Expand Down Expand Up @@ -224,7 +226,32 @@ export default {
}

if (this.$route.query.case_type) {
this.case_type = { name: this.$route.query.case_type }
let filterOptions = {
q: "",
sortBy: ["name"],
descending: [false],
itemsPerPage: this.numItems,
}

if (this.project) {
filterOptions = {
filters: {
project: [this.project],
name: [this.$route.query.case_type],
enabled: ["true"],
},
...filterOptions,
}
}

filterOptions = SearchUtils.createParametersFromTableOptions({ ...filterOptions })
CaseTypeApi.getAll(filterOptions).then((response) => {
if (response.data.items.length > 0) {
this.case_type = response.data.items[0]
} else {
this.case_type = this.$route.query.case_type
}
})
}

if (this.$route.query.case_priority) {
Expand Down
10 changes: 7 additions & 3 deletions src/dispatch/static/dispatch/src/case/type/CaseTypeSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export default {
q: "",
sortBy: ["name"],
descending: [false],
itemsPerPage: this.numItems,
itemsPerPage: -1,
}

if (this.project) {
Expand All @@ -120,9 +120,13 @@ export default {

filterOptions = SearchUtils.createParametersFromTableOptions({ ...filterOptions })

if (this.items.length == 0) {
CaseTypeApi.getAll(filterOptions).then((response) => {
this.items = response.data.items
})
}
filterOptions.itemsPerPage = this.numItems
CaseTypeApi.getAll(filterOptions).then((response) => {
this.items = response.data.items

this.total = response.data.total
this.loading = false

Expand Down
Loading