Skip to content
This repository was archived by the owner on Sep 3, 2025. It is now read-only.

Commit 20d6738

Browse files
authored
Fixes issue where tags expected a project field from the bulk endpoint, this is no longer provided with the minimalist model (#2929)
1 parent a62a3bd commit 20d6738

File tree

4 files changed

+20
-27
lines changed

4 files changed

+20
-27
lines changed

src/dispatch/database/service.py

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
11
import json
22
import logging
3-
43
from collections import namedtuple
54
from collections.abc import Iterable
65
from inspect import signature
76
from itertools import chain
8-
from six import string_types
9-
from sortedcontainers import SortedSet
10-
117
from typing import List
12-
from pydantic.error_wrappers import ErrorWrapper, ValidationError
13-
from pydantic import BaseModel
14-
from pydantic.types import Json, constr
158

169
from fastapi import Depends, Query
17-
18-
from sqlalchemy import and_, not_, or_, orm, func, desc
10+
from pydantic import BaseModel
11+
from pydantic.error_wrappers import ErrorWrapper, ValidationError
12+
from pydantic.types import Json, constr
13+
from six import string_types
14+
from sortedcontainers import SortedSet
15+
from sqlalchemy import and_, desc, func, not_, or_, orm
1916
from sqlalchemy.exc import InvalidRequestError, ProgrammingError
2017
from sqlalchemy.orm.mapper import Mapper
2118
from sqlalchemy_filters import apply_pagination, apply_sort
2219
from sqlalchemy_filters.exceptions import BadFilterFormat, FieldNotFound
2320
from sqlalchemy_filters.models import Field, get_model_from_spec
2421

2522
from dispatch.auth.models import DispatchUser
26-
from dispatch.auth.service import get_current_user, get_current_role
23+
from dispatch.auth.service import get_current_role, get_current_user
24+
from dispatch.case.models import Case
2725
from dispatch.data.query.models import Query as QueryModel
2826
from dispatch.data.source.models import Source
2927
from dispatch.enums import UserRoles, Visibility
@@ -37,13 +35,7 @@
3735
from dispatch.search.fulltext.composite_search import CompositeSearch
3836
from dispatch.task.models import Task
3937

40-
from .core import (
41-
Base,
42-
get_class_by_tablename,
43-
get_model_name_by_tablename,
44-
get_db,
45-
)
46-
38+
from .core import Base, get_class_by_tablename, get_db, get_model_name_by_tablename
4739

4840
log = logging.getLogger(__file__)
4941

@@ -352,6 +344,7 @@ def apply_filter_specific_joins(model: Base, filter_spec: dict, query: orm.query
352344
(Incident, "Tag"): (Incident.tags, True),
353345
(Incident, "TagType"): (Incident.tags, True),
354346
(Incident, "Term"): (Incident.terms, True),
347+
(Case, "Tag"): (Case.tags, True),
355348
}
356349
filters = build_filters(filter_spec)
357350
filter_models = get_named_models(filters)[0]

src/dispatch/static/dispatch/src/incident/DetailsTab.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,13 @@
106106
</v-row>
107107
</v-flex>
108108
<v-flex xs12>
109-
<tag-filter-auto-complete label="Tags" v-model="tags" model="incident" :model-id="id" />
109+
<tag-filter-auto-complete
110+
label="Tags"
111+
v-model="tags"
112+
:project="project"
113+
model="incident"
114+
:model-id="id"
115+
/>
110116
</v-flex>
111117
<v-flex xs12>
112118
<incident-filter-combobox label="Duplicates" v-model="duplicates" :project="project" />

src/dispatch/static/dispatch/src/tag/TagFilterAutoComplete.vue

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,15 @@
2727
</template>
2828
<template v-slot:selection="{ item, index }">
2929
<v-chip close @click:close="value.splice(index, 1)">
30-
<span v-if="item.tag_type">
31-
<span v-if="!project">{{ item.project.name }}/</span>{{ item.tag_type.name }}/
32-
</span>
30+
<span v-if="item.tag_type"> {{ item.tag_type.name }}/ </span>
3331
<a :href="item.uri" target="_blank" :title="item.description">
3432
{{ item.name }}
3533
</a>
3634
</v-chip>
3735
</template>
3836
<template v-slot:item="data">
3937
<v-list-item-content>
40-
<v-list-item-title>
41-
<span v-if="!project">{{ data.item.project.name }}/</span>{{ data.item.tag_type.name }}/{{
42-
data.item.name
43-
}}
44-
</v-list-item-title>
38+
<v-list-item-title> {{ data.item.tag_type.name }}/{{ data.item.name }} </v-list-item-title>
4539
<v-list-item-subtitle style="width: 200px" class="text-truncate">
4640
{{ data.item.description }}
4741
</v-list-item-subtitle>

src/dispatch/static/dispatch/src/tag_type/TagTypeFilterCombobox.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
</template>
3333
<template v-slot:item="data">
3434
<v-list-item-content>
35-
<v-list-item-title> {{ data.item.project.name }}/{{ data.item.name }} </v-list-item-title>
35+
<v-list-item-title> {{ data.item.name }} </v-list-item-title>
3636
<v-list-item-subtitle style="width: 200px" class="text-truncate">
3737
{{ data.item.description }}
3838
</v-list-item-subtitle>

0 commit comments

Comments
 (0)