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

Only allow one participant in filter form #4742

Merged
merged 2 commits into from
Jun 18, 2024
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
134 changes: 73 additions & 61 deletions src/dispatch/static/dispatch/src/case/TableFilterDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,69 +5,74 @@
<v-btn color="secondary" v-bind="filterProps"> Filter </v-btn>
</v-badge>
</template>
<v-card>
<v-card-title>
<span class="text-h5">Case Filters</span>
</v-card-title>
<v-list density="compact">
<v-list-item>
<date-window-input v-model="local_reported_at" label="Reported At" />
</v-list-item>
<v-list-item>
<date-window-input v-model="local_closed_at" label="Closed At" />
</v-list-item>
<v-list-item>
<project-combobox v-model="local_project" label="Projects" />
</v-list-item>
<v-list-item>
<case-type-combobox v-model="local_case_type" />
</v-list-item>
<v-list-item>
<case-severity-combobox v-model="local_case_severity" />
</v-list-item>
<v-list-item>
<case-priority-combobox v-model="local_case_priority" />
</v-list-item>
<v-list-item>
<case-status-multi-select v-model="local_status" />
</v-list-item>
<v-list-item>
<tag-type-filter-combobox v-model="local_tag_type" label="Tag Types" />
</v-list-item>
<v-list-item>
<tag-filter-auto-complete
v-model="local_tag"
label="Tags"
model="case"
:project="local_project"
/>
</v-list-item>
<v-list-item>
<v-card class="mx-auto">
<v-card-title>Case Participant</v-card-title>
<v-card-subtitle>Show only cases with this participant</v-card-subtitle>
<participant-select
class="ml-10 mr-5"
v-model="local_participant"
label="Participant"
hint="Show only cases with this participant"
<v-form @submit.prevent v-slot="{ isValid }">
<v-card>
<v-card-title>
<span class="text-h5">Case Filters</span>
</v-card-title>
<v-list density="compact">
<v-list-item>
<date-window-input v-model="local_reported_at" label="Reported At" />
</v-list-item>
<v-list-item>
<date-window-input v-model="local_closed_at" label="Closed At" />
</v-list-item>
<v-list-item>
<project-combobox v-model="local_project" label="Projects" />
</v-list-item>
<v-list-item>
<case-type-combobox v-model="local_case_type" />
</v-list-item>
<v-list-item>
<case-severity-combobox v-model="local_case_severity" />
</v-list-item>
<v-list-item>
<case-priority-combobox v-model="local_case_priority" />
</v-list-item>
<v-list-item>
<case-status-multi-select v-model="local_status" />
</v-list-item>
<v-list-item>
<tag-type-filter-combobox v-model="local_tag_type" label="Tag Types" />
</v-list-item>
<v-list-item>
<tag-filter-auto-complete
v-model="local_tag"
label="Tags"
model="case"
:project="local_project"
clearable
/>
<v-checkbox
class="ml-10 mr-5"
v-model="local_participant_is_assignee"
label="And this participant is the Assignee"
:disabled="local_participant == null"
/>
</v-card>
</v-list-item>
</v-list>
<v-card-actions>
<v-spacer />
<v-btn color="info" variant="text" @click="applyFilters()"> Apply Filters </v-btn>
</v-card-actions>
</v-card>
</v-list-item>
<v-list-item>
<v-card class="mx-auto">
<v-card-title>Case Participant</v-card-title>
<v-card-subtitle>Show only cases with this participant</v-card-subtitle>
<participant-select
class="ml-10 mr-5"
v-model="local_participant"
label="Participant"
hint="Show only cases with this participant"
:project="local_project"
clearable
:rules="[only_one]"
/>
<v-checkbox
class="ml-10 mr-5"
v-model="local_participant_is_assignee"
label="And this participant is the Assignee"
:disabled="local_participant == null"
/>
</v-card>
</v-list-item>
</v-list>
<v-card-actions>
<v-spacer />
<v-btn color="info" :disabled="!isValid.value" variant="text" @click="applyFilters()">
Apply Filters
</v-btn>
</v-card-actions>
</v-card>
</v-form>
</v-dialog>
</template>

Expand Down Expand Up @@ -133,6 +138,13 @@ const numFilters = computed(() => {
])
})

const only_one = (value) => {
if (value && value.length > 1) {
return "Only one is allowed"
}
return true
}

const applyFilters = () => {
let filtered_participant = null
let filtered_assignee = null
Expand Down
155 changes: 83 additions & 72 deletions src/dispatch/static/dispatch/src/incident/TableFilterDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,83 +5,88 @@
<v-btn color="secondary" v-bind="props"> Filter </v-btn>
</v-badge>
</template>
<v-card>
<v-card-title>
<span class="text-h5">Incident Filters</span>
</v-card-title>
<v-list density="compact">
<v-list-item>
<date-window-input v-model="local_reported_at" label="Reported At" />
</v-list-item>
<v-list-item>
<date-window-input v-model="local_closed_at" label="Closed At" />
</v-list-item>
<v-list-item>
<project-combobox v-model="local_project" label="Projects" />
</v-list-item>
<v-list-item>
<incident-type-combobox v-model="local_incident_type" />
</v-list-item>
<v-list-item>
<incident-severity-combobox v-model="local_incident_severity" />
</v-list-item>
<v-list-item>
<incident-priority-combobox v-model="local_incident_priority" />
</v-list-item>
<v-list-item>
<incident-status-multi-select v-model="local_status" />
</v-list-item>
<v-list-item>
<tag-type-filter-combobox v-model="local_tag_type" label="Tag Types" />
</v-list-item>
<v-card variant="outlined" class="ml-4 mr-4 mb-4">
<v-card-subtitle class="mt-2 mb-2">Has <b>all</b> of these tags</v-card-subtitle>
<v-form @submit.prevent v-slot="{ isValid }">
<v-card>
<v-card-title>
<span class="text-h5">Incident Filters</span>
</v-card-title>
<v-list density="compact">
<v-list-item>
<tag-filter-auto-complete
v-model="local_tag_all"
label="Tags"
model="incident"
:project="local_project"
/>
<date-window-input v-model="local_reported_at" label="Reported At" />
</v-list-item>
</v-card>
<v-card variant="outlined" class="ml-4 mr-4">
<v-card-subtitle class="mt-2 mb-2">Has <b>any</b> of these tags</v-card-subtitle>
<v-list-item>
<tag-filter-auto-complete
v-model="local_tag"
label="Tags"
model="incident"
:project="local_project"
/>
<date-window-input v-model="local_closed_at" label="Closed At" />
</v-list-item>
</v-card>
<v-list-item>
<v-card class="mx-auto">
<v-card-title>Incident Participant</v-card-title>
<v-card-subtitle>Show only incidents with this participant</v-card-subtitle>
<participant-select
class="ml-10 mr-5"
v-model="local_participant"
label="Participant"
hint="Show only incidents with this participant"
:project="local_project"
clearable
/>
<v-checkbox
class="ml-10 mr-5"
v-model="local_participant_is_commander"
label="And this participant is the Incident Commander"
:disabled="local_participant == null"
/>
<v-list-item>
<project-combobox v-model="local_project" label="Projects" />
</v-list-item>
<v-list-item>
<incident-type-combobox v-model="local_incident_type" />
</v-list-item>
<v-list-item>
<incident-severity-combobox v-model="local_incident_severity" />
</v-list-item>
<v-list-item>
<incident-priority-combobox v-model="local_incident_priority" />
</v-list-item>
<v-list-item>
<incident-status-multi-select v-model="local_status" />
</v-list-item>
<v-list-item>
<tag-type-filter-combobox v-model="local_tag_type" label="Tag Types" />
</v-list-item>
<v-card variant="outlined" class="ml-4 mr-4 mb-4">
<v-card-subtitle class="mt-2 mb-2">Has <b>all</b> of these tags</v-card-subtitle>
<v-list-item>
<tag-filter-auto-complete
v-model="local_tag_all"
label="Tags"
model="incident"
:project="local_project"
/>
</v-list-item>
</v-card>
</v-list-item>
</v-list>
<v-card-actions>
<v-spacer />
<v-btn color="info" variant="text" @click="applyFilters()"> Apply Filters </v-btn>
</v-card-actions>
</v-card>
<v-card variant="outlined" class="ml-4 mr-4">
<v-card-subtitle class="mt-2 mb-2">Has <b>any</b> of these tags</v-card-subtitle>
<v-list-item>
<tag-filter-auto-complete
v-model="local_tag"
label="Tags"
model="incident"
:project="local_project"
/>
</v-list-item>
</v-card>
<v-list-item>
<v-card class="mx-auto">
<v-card-title>Incident Participant</v-card-title>
<v-card-subtitle>Show only incidents with this participant</v-card-subtitle>
<participant-select
class="ml-10 mr-5"
v-model="local_participant"
label="Participant"
hint="Show only incidents with this participant"
:project="local_project"
clearable
:rules="[only_one]"
/>
<v-checkbox
class="ml-10 mr-5"
v-model="local_participant_is_commander"
label="And this participant is the Incident Commander"
:disabled="local_participant == null"
/>
</v-card>
</v-list-item>
</v-list>
<v-card-actions>
<v-spacer />
<v-btn color="info" :disabled="!isValid.value" variant="text" @click="applyFilters()">
Apply Filters
</v-btn>
</v-card-actions>
</v-card>
</v-form>
</v-dialog>
</template>

Expand Down Expand Up @@ -138,6 +143,12 @@ export default {
local_tag_type: [],
local_participant_is_commander: false,
local_participant: null,
only_one: (value) => {
if (value && value.length > 1) {
return "Only one is allowed"
}
return true
},
}
},

Expand Down
Loading