Skip to content

Commit

Permalink
Fixing linting
Browse files Browse the repository at this point in the history
  • Loading branch information
kevgliss committed Nov 6, 2023
1 parent 9fe6ed1 commit b366f5a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 28 deletions.
1 change: 1 addition & 0 deletions src/dispatch/static/dispatch/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ declare module '@vue/runtime-core' {
MonacoEditor: typeof import('./src/components/MonacoEditor.vue')['default']
NotificationSnackbarsWrapper: typeof import('./src/components/NotificationSnackbarsWrapper.vue')['default']
PageHeader: typeof import('./src/components/PageHeader.vue')['default']
ParticipantAutoComplete: typeof import('./src/components/ParticipantAutoComplete.vue')['default']
ParticipantSelect: typeof import('./src/components/ParticipantSelect.vue')['default']
ProjectAutoComplete: typeof import('./src/components/ProjectAutoComplete.vue')['default']
Refresh: typeof import('./src/components/Refresh.vue')['default']
Expand Down
25 changes: 12 additions & 13 deletions src/dispatch/static/dispatch/src/components/AutoComplete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
:hide-no-data="false"
v-model:search="search"
v-model="selectedModel"
@update:modelValue="handleClear"
@update:model-value="handleClear"
>
<template #no-data>
<v-list-item v-if="!loading">
Expand All @@ -21,11 +21,7 @@
</template>
<template #item="{ props, item }">
<slot name="item" :props="props" :item="item">
<v-list-item
v-bind="props"
:title="item.title"
:subtitle="item.raw[subtitle]"
></v-list-item>
<v-list-item v-bind="props" :title="item.title" :subtitle="item.raw[subtitle]" />
</slot>
</template>
<template #append-item v-if="items.length < total.value">
Expand Down Expand Up @@ -72,15 +68,15 @@ export default {
},
emits: ["update:modelValue"],
setup(props, { emit }) {
const { resource, title, identifier, subtitle, label, modelValue } = toRefs(props)
const { resource, modelValue } = toRefs(props)
let loading = ref(false)
let items = ref([])
let numItems = ref(10)
let currentPage = ref(1)
let total = ref(0)
let selectedModel = ref(modelValue.value)
let search = ref(modelValue.value ? modelValue.value[title.value] : "")
let search = ref(modelValue.value ? modelValue.value[props.title.value] : "")
let debouncedGetData = debounce((searchVal, page = currentPage.value) => {
loading.value = true
Expand Down Expand Up @@ -130,18 +126,21 @@ export default {
emit(
"update:modelValue",
newVal
? items.value.find((item) => item[identifier.value] == newVal[identifier.value])
? items.value.find(
(item) => item[props.identifier.value] == newVal[props.identifier.value]
)
: null
)
})
watch(modelValue, (newValue) => {
selectedModel.value = newValue
search.value = newValue ? newValue[props.title] : ""
})
return {
initials,
items,
label,
title,
identifier,
subtitle,
loading,
handleClear,
loadMore,
Expand Down
14 changes: 4 additions & 10 deletions src/dispatch/static/dispatch/src/components/ParticipantSelect.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<v-autocomplete
:items="items"
:label="labelProp"
:label="label"
:loading="loading"
v-model:search="search"
clearable
Expand All @@ -12,7 +12,7 @@
chips
:hide-no-data="false"
v-model="participant"
@update:modelValue="handleClear"
@update:model-value="handleClear"
>
<template #no-data>
<v-list-item v-if="!loading">
Expand Down Expand Up @@ -41,7 +41,7 @@
</template>

<script>
import { ref, watch, toRefs, onMounted } from "vue"
import { ref, watch, onMounted } from "vue"
import { initials } from "@/filters"
import { debounce } from "lodash"
Expand All @@ -50,8 +50,7 @@ import IndividualApi from "@/individual/api"
export default {
name: "ParticipantSelect",
props: {
labelProp: {
// Define the labelProp
label: {
type: String,
default: "Participant",
},
Expand All @@ -61,11 +60,8 @@ export default {
},
},
setup(props) {
const { labelProp } = toRefs(props) // toRefs make props reactive
let loading = ref(false)
let items = ref([])
console.log(items)
let numItems = ref(10)
let participant = ref({ ...props.initialValue })
let currentPage = ref(1)
Expand All @@ -84,7 +80,6 @@ export default {
}
await IndividualApi.getAll(filterOptions).then((response) => {
console.log(response.data.items)
items.value = response.data.items.map(function (x) {
return { individual: x }
})
Expand Down Expand Up @@ -127,7 +122,6 @@ export default {
handleClear,
initials,
items,
labelProp,
loading,
loadMore,
participant,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
title="name"
identifier="id"
subtitle="description"
v-model="modelValue"
v-model="internalModelValue"
:label="label"
>
</AutoComplete>
/>
</template>

<script>
Expand All @@ -22,7 +21,7 @@ export default {
props: {
modelValue: {
type: Object,
default: () => null,
default: () => ({}),
},
label: {
type: String,
Expand All @@ -47,7 +46,7 @@ export default {
})
return {
modelValue: internalModelValue,
internalModelValue,
}
},
}
Expand Down

0 comments on commit b366f5a

Please sign in to comment.