Skip to content

Commit 3db9a41

Browse files
authored
Merge pull request #21 from PanDAWMS/dev-tania
migrate away from primeng
2 parents e552892 + ca2a411 commit 3db9a41

71 files changed

Lines changed: 7525 additions & 9211 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎backend/rest_api/job/constants.py‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,5 @@
99
"4": "Job Termination and Kill Signals",
1010
"5": "Software and Environment Issues",
1111
"6": "Internal and Unknown Errors",
12-
"7": "Brokerage Errors",
13-
"8": "DDM Errors",
14-
"9": "Task Buffer Errors",
15-
"10": "PanDA Job Dispatcher Errors",
16-
"11": "PanDA Supervisor Errors",
17-
"12": "Transformation Errors",
1812
}
1913
)

‎backend/rest_api/job/models.py‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,40 @@ class Meta:
2020
app_label = "job"
2121
db_table = f'"{settings.DB_SCHEMAS['panda']}"."error_descriptions"'
2222
unique_together = (("component", "code"),)
23+
24+
25+
class JobBaseModel(models.Model):
26+
"""
27+
Base model for job-related models
28+
"""
29+
30+
pandaid = models.BigIntegerField(db_column="pandaid", blank=False, null=False, primary_key=True)
31+
creationtime = models.DateTimeField(db_column="creationtime", blank=False, null=False)
32+
computingsite = models.CharField(max_length=32, db_column="computingsite", blank=True, null=True)
33+
username = models.CharField(max_length=64, db_column="produsername", blank=True, null=True)
34+
jobstatus = models.CharField(max_length=16, db_column="jobstatus", blank=True, null=True)
35+
36+
class Meta:
37+
abstract = True
38+
39+
40+
class JobsActive4(JobBaseModel):
41+
"""
42+
JobsActive4 model
43+
"""
44+
45+
class Meta:
46+
managed = False
47+
app_label = "job"
48+
db_table = f'"{settings.DB_SCHEMAS["panda"]}"."jobsactive4"'
49+
50+
51+
class JobsArchived4(JobBaseModel):
52+
"""
53+
JobsArchived4 model - jobs that have been archived from the active table, typically younger than 4 days.
54+
"""
55+
56+
class Meta:
57+
managed = False
58+
app_label = "job"
59+
db_table = f'"{settings.DB_SCHEMAS["panda"]}"."jobsarchived4"'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
p,atlas-adc-pandamon,error_description,read,{},{},allow
22
p,atlas-adc-pandamon,error_description,write,{},{},allow
3+
p,atlas-adc-pandamon,error_description,delete,{},{},allow
34
p,atlas,job,read,{},{},allow
45
p,atlas,task,read,{},{},allow

‎backend/rest_api/oauth/views.py‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,14 @@
3838

3939

4040
@login_required
41-
def redirect_after_login_view(request: HttpRequest) -> HttpResponse:
41+
def redirect_after_login_view(request: HttpRequest, *args, **kwargs) -> HttpResponse:
4242
"""
4343
Redirect user to the URL stored in the session after successful login.
4444
4545
Args:
4646
request (HttpRequest): The HTTP request object.
47+
*args: Variable length argument list.
48+
**kwargs: Arbitrary keyword arguments.
4749
Returns:
4850
HttpResponse: The HTTP response object with a redirect to the frontend.
4951
"""
@@ -62,12 +64,14 @@ def redirect_after_login_view(request: HttpRequest) -> HttpResponse:
6264
return response
6365

6466

65-
def logout_view(request: HttpRequest) -> JsonResponse:
67+
def logout_view(request: HttpRequest, *args, **kwargs) -> JsonResponse:
6668
"""
6769
Logout view that logout the user, clears the session and deletes the session cookie.
6870
6971
Args:
7072
request (HttpRequest): The HTTP request object.
73+
*args: Variable length argument list.
74+
**kwargs: Arbitrary keyword arguments.
7175
Returns:
7276
JsonResponse: The JSON response indicating successful logout.
7377
"""

‎backend/rest_api/search/__init__.py‎

Whitespace-only changes.

‎backend/rest_api/search/apps.py‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
# Authors:
19+
# Tatiana Korchuganova <tatiana.korchuganova@cern.ch>
20+
21+
"""Apps.py for the search application."""
22+
23+
from django.apps import AppConfig
24+
25+
26+
class SearchConfig(AppConfig):
27+
"""Django AppConfig for the Search application."""
28+
29+
default_auto_field = "django.db.models.BigAutoField"
30+
name = "rest_api.search"

‎backend/rest_api/search/tests.py‎

Whitespace-only changes.

‎backend/rest_api/search/urls.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from django.urls import path
2+
3+
from .views import QuickSearchAPIView
4+
5+
urlpatterns = [
6+
path("global/", QuickSearchAPIView.as_view(), name="global-search"),
7+
]

‎backend/rest_api/search/utils.py‎

Whitespace-only changes.

‎backend/rest_api/search/views.py‎

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
from rest_api.task.models import JediTask
2+
from rest_framework import status
3+
from rest_framework.response import Response
4+
from rest_framework.views import APIView
5+
6+
7+
class QuickSearchAPIView(APIView):
8+
"""
9+
Global search endpoint for lightweight system-wide routing.
10+
11+
This view serves as a fast triage system, routing queries by format (e.g., numeric IDs) to minimize database search overhead.
12+
"""
13+
14+
def get(self, request, *args, **kwargs) -> Response:
15+
"""
16+
Handles global search queries.
17+
18+
Checks if the query 'q' is a numeric ID and performs fast primary key
19+
lookups across Tasks and Datasets.
20+
21+
Args:
22+
request (Request): DRF request containing query params.
23+
*args: Variable length argument list.
24+
**kwargs: Arbitrary keyword arguments.
25+
26+
Returns:
27+
Response: A DRF Response object containing:
28+
- A list of matching result dictionaries with fields: `title`, `type`, and `id` (on HTTP 200 OK).
29+
- An empty list if no query parameter is provided (on HTTP 400 Bad Request).
30+
- An error message if a string query is passed (on HTTP 501 Not Implemented).
31+
"""
32+
query = request.query_params.get("q", "").strip()
33+
if not query:
34+
return Response([], status=status.HTTP_400_BAD_REQUEST)
35+
36+
results = []
37+
if query.isdigit():
38+
target_id = int(query)
39+
40+
# check if the target_id exists in Jobs, Tasks, or Files
41+
if JediTask.objects.filter(jeditaskid=target_id).exists():
42+
results.append({"title": f"Task #{target_id}", "type": "task", "id": f"{target_id}"})
43+
44+
else:
45+
return Response({"error": "String search is not implemented yet."}, status=status.HTTP_501_NOT_IMPLEMENTED)
46+
47+
return Response(results, status=status.HTTP_200_OK)

0 commit comments

Comments
 (0)