mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
chore: project identifier for all the search items and take project id as query params (#1663)
This commit is contained in:
parent
7763cca9a2
commit
916fca53ac
@ -1240,7 +1240,7 @@ urlpatterns = [
|
|||||||
## End Importer
|
## End Importer
|
||||||
# Search
|
# Search
|
||||||
path(
|
path(
|
||||||
"workspaces/<str:slug>/projects/<uuid:project_id>/search/",
|
"workspaces/<str:slug>/search/",
|
||||||
GlobalSearchEndpoint.as_view(),
|
GlobalSearchEndpoint.as_view(),
|
||||||
name="global-search",
|
name="global-search",
|
||||||
),
|
),
|
||||||
|
@ -63,7 +63,7 @@ class GlobalSearchEndpoint(BaseAPIView):
|
|||||||
workspace__slug=slug,
|
workspace__slug=slug,
|
||||||
)
|
)
|
||||||
|
|
||||||
if workspace_search == "false":
|
if workspace_search == "false" and project_id:
|
||||||
issues = issues.filter(project_id=project_id)
|
issues = issues.filter(project_id=project_id)
|
||||||
|
|
||||||
return issues.distinct().values(
|
return issues.distinct().values(
|
||||||
@ -87,13 +87,14 @@ class GlobalSearchEndpoint(BaseAPIView):
|
|||||||
workspace__slug=slug,
|
workspace__slug=slug,
|
||||||
)
|
)
|
||||||
|
|
||||||
if workspace_search == "false":
|
if workspace_search == "false" and project_id:
|
||||||
cycles = cycles.filter(project_id=project_id)
|
cycles = cycles.filter(project_id=project_id)
|
||||||
|
|
||||||
return cycles.distinct().values(
|
return cycles.distinct().values(
|
||||||
"name",
|
"name",
|
||||||
"id",
|
"id",
|
||||||
"project_id",
|
"project_id",
|
||||||
|
"project__identifier",
|
||||||
"workspace__slug",
|
"workspace__slug",
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -109,13 +110,14 @@ class GlobalSearchEndpoint(BaseAPIView):
|
|||||||
workspace__slug=slug,
|
workspace__slug=slug,
|
||||||
)
|
)
|
||||||
|
|
||||||
if workspace_search == "false":
|
if workspace_search == "false" and project_id:
|
||||||
modules = modules.filter(project_id=project_id)
|
modules = modules.filter(project_id=project_id)
|
||||||
|
|
||||||
return modules.distinct().values(
|
return modules.distinct().values(
|
||||||
"name",
|
"name",
|
||||||
"id",
|
"id",
|
||||||
"project_id",
|
"project_id",
|
||||||
|
"project__identifier",
|
||||||
"workspace__slug",
|
"workspace__slug",
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -131,13 +133,14 @@ class GlobalSearchEndpoint(BaseAPIView):
|
|||||||
workspace__slug=slug,
|
workspace__slug=slug,
|
||||||
)
|
)
|
||||||
|
|
||||||
if workspace_search == "false":
|
if workspace_search == "false" and project_id:
|
||||||
pages = pages.filter(project_id=project_id)
|
pages = pages.filter(project_id=project_id)
|
||||||
|
|
||||||
return pages.distinct().values(
|
return pages.distinct().values(
|
||||||
"name",
|
"name",
|
||||||
"id",
|
"id",
|
||||||
"project_id",
|
"project_id",
|
||||||
|
"project__identifier",
|
||||||
"workspace__slug",
|
"workspace__slug",
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -153,20 +156,22 @@ class GlobalSearchEndpoint(BaseAPIView):
|
|||||||
workspace__slug=slug,
|
workspace__slug=slug,
|
||||||
)
|
)
|
||||||
|
|
||||||
if workspace_search == "false":
|
if workspace_search == "false" and project_id:
|
||||||
issue_views = issue_views.filter(project_id=project_id)
|
issue_views = issue_views.filter(project_id=project_id)
|
||||||
|
|
||||||
return issue_views.distinct().values(
|
return issue_views.distinct().values(
|
||||||
"name",
|
"name",
|
||||||
"id",
|
"id",
|
||||||
"project_id",
|
"project_id",
|
||||||
|
"project__identifier",
|
||||||
"workspace__slug",
|
"workspace__slug",
|
||||||
)
|
)
|
||||||
|
|
||||||
def get(self, request, slug, project_id):
|
def get(self, request, slug):
|
||||||
try:
|
try:
|
||||||
query = request.query_params.get("search", False)
|
query = request.query_params.get("search", False)
|
||||||
workspace_search = request.query_params.get("workspace_search", "false")
|
workspace_search = request.query_params.get("workspace_search", "false")
|
||||||
|
project_id = request.query_params.get("project_id", False)
|
||||||
|
|
||||||
if not query:
|
if not query:
|
||||||
return Response(
|
return Response(
|
||||||
|
Loading…
Reference in New Issue
Block a user