Skip to content

Commit

Permalink
Filter by project in SearchPopovers
Browse files Browse the repository at this point in the history
  • Loading branch information
wssheldon committed Dec 5, 2023
1 parent 15d7c8c commit 9db9ace
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 34 deletions.
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { onMounted, ref } from "vue"
import { ref, watch } from "vue"
import CasePriorityApi from "@/case/priority/api"
import CaseApi from "@/case/api"
import SearchPopover from "@/components/SearchPopover.vue"
Expand All @@ -11,21 +11,35 @@ type CasePriority = {
name: string
}
defineProps<{ casePriority: string }>()
const props = defineProps<{ casePriority: string; project: string }>()
const store = useStore()
const { setSaving } = useSavingState()
const casePriorities: Ref<CasePriority[]> = ref([])
const currentProject: Ref<string> = ref(props.project)
onMounted(async () => {
try {
const options = { itemsPerPage: -1 }
const response = await CasePriorityApi.getAll(options)
casePriorities.value = response.data.items.map((item: any) => item.name)
} catch (error) {
console.error("Error fetching priorities:", error)
}
})
watch(
() => props.project,
async (newVal) => {
currentProject.value = newVal
if (newVal) {
try {
const options = {
itemsPerPage: -1,
filter: JSON.stringify([
{ and: [{ model: "Project", field: "name", op: "==", value: newVal }] },
]),
}
const response = await CasePriorityApi.getAll(options)
casePriorities.value = response.data.items.map((item: any) => item.name)
} catch (error) {
console.error("Error fetching priorities:", error)
}
}
},
{ immediate: true }
)
const selectCasePriority = async (casePriorityName: string) => {
// Fetch the participant object from the API
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { onMounted, ref } from "vue"
import { watch, ref } from "vue"
import CaseSeverityApi from "@/case/severity/api"
import CaseApi from "@/case/api"
import SearchPopover from "@/components/SearchPopover.vue"
Expand All @@ -11,21 +11,35 @@ type CaseSeverity = {
name: string
}
defineProps<{ caseSeverity: string }>()
const props = defineProps<{ caseSeverity: string; project: string }>()
const store = useStore()
const { setSaving } = useSavingState()
const caseSeveritys: Ref<CaseSeverity[]> = ref([])
const currentProject: Ref<string> = ref(props.project)
onMounted(async () => {
try {
const options = { itemsPerPage: -1 }
const response = await CaseSeverityApi.getAll(options)
caseSeveritys.value = response.data.items.map((item: any) => item.name)
} catch (error) {
console.error("Error fetching case severities:", error)
}
})
watch(
() => props.project,
async (newVal) => {
currentProject.value = newVal
if (newVal) {
try {
const options = {
itemsPerPage: -1,
filter: JSON.stringify([
{ and: [{ model: "Project", field: "name", op: "==", value: newVal }] },
]),
}
const response = await CaseSeverityApi.getAll(options)
caseSeveritys.value = response.data.items.map((item: any) => item.name)
} catch (error) {
console.error("Error fetching priorities:", error)
}
}
},
{ immediate: true }
)
const selectCaseSeverity = async (caseSeverityName: string) => {
// Fetch the participant object from the API
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { onMounted, ref } from "vue"
import { watch, ref } from "vue"
import CaseTypeApi from "@/case/type/api"
import CaseApi from "@/case/api"
import SearchPopover from "@/components/SearchPopover.vue"
Expand All @@ -11,21 +11,35 @@ type CaseType = {
name: string
}
defineProps<{ caseType: string }>()
const props = defineProps<{ caseType: string; project: string }>()
const store = useStore()
const { setSaving } = useSavingState()
const caseTypes: Ref<CaseType[]> = ref([])
const currentProject: Ref<string> = ref(props.project)
onMounted(async () => {
try {
const options = { itemsPerPage: -1 }
const response = await CaseTypeApi.getAll(options)
caseTypes.value = response.data.items.map((item: any) => item.name)
} catch (error) {
console.error("Error fetching case types:", error)
}
})
watch(
() => props.project,
async (newVal) => {
currentProject.value = newVal
if (newVal) {
try {
const options = {
itemsPerPage: -1,
filter: JSON.stringify([
{ and: [{ model: "Project", field: "name", op: "==", value: newVal }] },
]),
}
const response = await CaseTypeApi.getAll(options)
caseTypes.value = response.data.items.map((item: any) => item.name)
} catch (error) {
console.error("Error fetching priorities:", error)
}
}
},
{ immediate: true }
)
const selectCaseType = async (caseTypeName: string) => {
// Fetch the participant object from the API
Expand Down

0 comments on commit 9db9ace

Please sign in to comment.