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

Fixes issue where tags list expected a project field #2929

Merged
merged 1 commit into from
Feb 1, 2023
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
27 changes: 10 additions & 17 deletions src/dispatch/database/service.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
import json
import logging

from collections import namedtuple
from collections.abc import Iterable
from inspect import signature
from itertools import chain
from six import string_types
from sortedcontainers import SortedSet

from typing import List
from pydantic.error_wrappers import ErrorWrapper, ValidationError
from pydantic import BaseModel
from pydantic.types import Json, constr

from fastapi import Depends, Query

from sqlalchemy import and_, not_, or_, orm, func, desc
from pydantic import BaseModel
from pydantic.error_wrappers import ErrorWrapper, ValidationError
from pydantic.types import Json, constr
from six import string_types
from sortedcontainers import SortedSet
from sqlalchemy import and_, desc, func, not_, or_, orm
from sqlalchemy.exc import InvalidRequestError, ProgrammingError
from sqlalchemy.orm.mapper import Mapper
from sqlalchemy_filters import apply_pagination, apply_sort
from sqlalchemy_filters.exceptions import BadFilterFormat, FieldNotFound
from sqlalchemy_filters.models import Field, get_model_from_spec

from dispatch.auth.models import DispatchUser
from dispatch.auth.service import get_current_user, get_current_role
from dispatch.auth.service import get_current_role, get_current_user
from dispatch.case.models import Case
from dispatch.data.query.models import Query as QueryModel
from dispatch.data.source.models import Source
from dispatch.enums import UserRoles, Visibility
Expand All @@ -37,13 +35,7 @@
from dispatch.search.fulltext.composite_search import CompositeSearch
from dispatch.task.models import Task

from .core import (
Base,
get_class_by_tablename,
get_model_name_by_tablename,
get_db,
)

from .core import Base, get_class_by_tablename, get_db, get_model_name_by_tablename

log = logging.getLogger(__file__)

Expand Down Expand Up @@ -352,6 +344,7 @@ def apply_filter_specific_joins(model: Base, filter_spec: dict, query: orm.query
(Incident, "Tag"): (Incident.tags, True),
(Incident, "TagType"): (Incident.tags, True),
(Incident, "Term"): (Incident.terms, True),
(Case, "Tag"): (Case.tags, True),
}
filters = build_filters(filter_spec)
filter_models = get_named_models(filters)[0]
Expand Down
8 changes: 7 additions & 1 deletion src/dispatch/static/dispatch/src/incident/DetailsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,13 @@
</v-row>
</v-flex>
<v-flex xs12>
<tag-filter-auto-complete label="Tags" v-model="tags" model="incident" :model-id="id" />
<tag-filter-auto-complete
label="Tags"
v-model="tags"
:project="project"
model="incident"
:model-id="id"
/>
</v-flex>
<v-flex xs12>
<incident-filter-combobox label="Duplicates" v-model="duplicates" :project="project" />
Expand Down
10 changes: 2 additions & 8 deletions src/dispatch/static/dispatch/src/tag/TagFilterAutoComplete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,15 @@
</template>
<template v-slot:selection="{ item, index }">
<v-chip close @click:close="value.splice(index, 1)">
<span v-if="item.tag_type">
<span v-if="!project">{{ item.project.name }}/</span>{{ item.tag_type.name }}/
</span>
<span v-if="item.tag_type"> {{ item.tag_type.name }}/ </span>
<a :href="item.uri" target="_blank" :title="item.description">
{{ item.name }}
</a>
</v-chip>
</template>
<template v-slot:item="data">
<v-list-item-content>
<v-list-item-title>
<span v-if="!project">{{ data.item.project.name }}/</span>{{ data.item.tag_type.name }}/{{
data.item.name
}}
</v-list-item-title>
<v-list-item-title> {{ data.item.tag_type.name }}/{{ data.item.name }} </v-list-item-title>
<v-list-item-subtitle style="width: 200px" class="text-truncate">
{{ data.item.description }}
</v-list-item-subtitle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</template>
<template v-slot:item="data">
<v-list-item-content>
<v-list-item-title> {{ data.item.project.name }}/{{ data.item.name }} </v-list-item-title>
<v-list-item-title> {{ data.item.name }} </v-list-item-title>
<v-list-item-subtitle style="width: 200px" class="text-truncate">
{{ data.item.description }}
</v-list-item-subtitle>
Expand Down