Skip to content

Commit

Permalink
Merge branch 'master' into bugfix/format-timeline-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
whitdog47 authored Nov 3, 2023
2 parents bd103fe + c4fba84 commit 33f909b
Show file tree
Hide file tree
Showing 14 changed files with 173 additions and 279 deletions.
8 changes: 4 additions & 4 deletions requirements-base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ deprecation==2.1.0
# via pdpyras
dnspython==2.4.2
# via email-validator
duo-client==5.1.0
duo-client==5.2.0
# via -r requirements-base.in
ecdsa==0.18.0
# via python-jose
Expand Down Expand Up @@ -212,7 +212,7 @@ lxml==4.9.3
# premailer
mako==1.2.4
# via alembic
markdown==3.5
markdown==3.5.1
# via -r requirements-base.in
markupsafe==2.1.3
# via
Expand Down Expand Up @@ -278,7 +278,7 @@ preshed==3.0.8
# via
# spacy
# thinc
protobuf==4.24.4
protobuf==4.25.0
# via
# -r requirements-base.in
# google-api-core
Expand Down Expand Up @@ -382,7 +382,7 @@ scipy==1.11.2
# via statsmodels
sentry-asgi==0.2.0
# via -r requirements-base.in
sentry-sdk==1.32.0
sentry-sdk==1.34.0
# via
# -r requirements-base.in
# sentry-asgi
Expand Down
6 changes: 1 addition & 5 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ asttokens==2.2.1
# stack-data
attrs==22.1.0
# via -r requirements-dev.in
backcall==0.2.0
# via ipython
black==23.10.1
# via -r requirements-dev.in
cfgv==3.4.0
Expand Down Expand Up @@ -44,7 +42,7 @@ identify==2.5.27
# via pre-commit
iniconfig==2.0.0
# via pytest
ipython==8.16.1
ipython==8.17.2
# via -r requirements-dev.in
jedi==0.19.0
# via ipython
Expand All @@ -64,8 +62,6 @@ pathspec==0.11.2
# via black
pexpect==4.8.0
# via ipython
pickleshare==0.7.5
# via ipython
platformdirs==3.10.0
# via
# black
Expand Down
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 @@ -25,6 +25,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']
ParticipantSelect: typeof import('./src/components/ParticipantSelect.vue')['default']
Refresh: typeof import('./src/components/Refresh.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
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 @@ -131,7 +131,7 @@ import CaseSeveritySelect from "@/case/severity/CaseSeveritySelect.vue"
import CaseTypeSelect from "@/case/type/CaseTypeSelect.vue"
import DateTimePickerMenu from "@/components/DateTimePickerMenu.vue"
import IncidentFilterCombobox from "@/incident/IncidentFilterCombobox.vue"
import ParticipantSelect from "@/incident/ParticipantSelect.vue"
import ParticipantSelect from "@/components/ParticipantSelect.vue"
import ProjectSelect from "@/project/ProjectSelect.vue"
import TagFilterAutoComplete from "@/tag/TagFilterAutoComplete.vue"
Expand Down
2 changes: 1 addition & 1 deletion src/dispatch/static/dispatch/src/case/HandoffDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import { mapFields } from "vuex-map-fields"
import { mapActions } from "vuex"
import ParticipantSelect from "@/incident/ParticipantSelect.vue"
import ParticipantSelect from "@/components/ParticipantSelect.vue"
export default {
name: "CaseHandoffDialog",
Expand Down
127 changes: 0 additions & 127 deletions src/dispatch/static/dispatch/src/case/ParticipantSelect.vue

This file was deleted.

139 changes: 139 additions & 0 deletions src/dispatch/static/dispatch/src/components/ParticipantSelect.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
<template>
<v-autocomplete
:items="items"
:label="labelProp"
:loading="loading"
v-model:search="search"
clearable
hide-selected
item-title="individual.name"
item-value="individual.id"
return-object
chips
:hide-no-data="false"
v-model="participant"
@update:modelValue="handleClear"

Check warning on line 15 in src/dispatch/static/dispatch/src/components/ParticipantSelect.vue

View workflow job for this annotation

GitHub Actions / build

v-on event '@update:modelValue' must be hyphenated
>
<template #no-data>
<v-list-item v-if="!loading">
<v-list-item-title>
No individuals matching <strong>"{{ search }}".</strong>
</v-list-item-title>
</v-list-item>
</template>
<template #item="{ props, item }">
<v-list-item v-bind="props" :subtitle="item.raw.individual.email" />
</template>
<template #append-item v-if="items.length < total.value">
<v-list-item @click="loadMore()">
<v-list-item-subtitle> Load More </v-list-item-subtitle>
</v-list-item>
</template>
<template #chip="data">
<v-chip v-bind="data.props" pill>
<template #prepend>
<v-avatar color="teal" start> {{ initials(data.item.title) }} </v-avatar>
</template>
{{ data.item.title }}
</v-chip>
</template>
</v-autocomplete>
</template>

<script>
import { ref, watch, toRefs, onMounted } from "vue"
import { initials } from "@/filters"
import { debounce } from "lodash"
import IndividualApi from "@/individual/api"
export default {
name: "ParticipantSelect",
props: {
labelProp: {
// Define the labelProp
type: String,
default: "Participant",
},
initialValue: {
type: Object,
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)
let total = ref(0)
const search = ref(props.initialValue.name)
let debouncedGetIndividualData = null
const getIndividualData = async (searchVal, page = currentPage.value) => {
loading.value = true
let filterOptions = {
q: searchVal,
sortBy: ["name"],
descending: [false],
itemsPerPage: numItems.value * page,
}
await IndividualApi.getAll(filterOptions).then((response) => {
console.log(response.data.items)
items.value = response.data.items.map(function (x) {
return { individual: x }
})
total.value = response.data.total
})
loading.value = false
}
onMounted(() => {
debouncedGetIndividualData = debounce(getIndividualData, 300)
debouncedGetIndividualData(search.value)
})
const loadMore = async () => {
currentPage.value++
numItems.value += 10
await debouncedGetIndividualData(search.value)
}
const handleClear = (newValue) => {
if (!newValue) {
items.value = []
search.value = null
participant.value = null
numItems.value = 10
currentPage.value = 1
}
}
watch(search, async (newVal, oldVal) => {
if (oldVal !== newVal) {
numItems.value = 10
await debouncedGetIndividualData(newVal)
}
})
return {
getIndividualData,
handleClear,
initials,
items,
labelProp,

Check failure on line 130 in src/dispatch/static/dispatch/src/components/ParticipantSelect.vue

View workflow job for this annotation

GitHub Actions / build

Duplicate key 'labelProp'. May cause name collision in script or template tag
loading,
loadMore,
participant,
search,
total,
}
},
}
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ import ProjectCombobox from "@/project/ProjectCombobox.vue"
import RouterUtils from "@/router/utils"
import SearchUtils from "@/search/utils"
import TagFilterAutoComplete from "@/tag/TagFilterAutoComplete.vue"
import ParticipantSelect from "@/incident/ParticipantSelect.vue"
import ParticipantSelect from "@/components/ParticipantSelect.vue"
let today = function () {
let now = new Date()
Expand Down
Loading

0 comments on commit 33f909b

Please sign in to comment.