Skip to content

Commit ee70466

Browse files
authored
Add issue reporting (#50)
* Added a form to the header for reporting issues * Use a dev tag for testing on ndip-test * Update report issue pane based on user feedback * Clean up the app header * Reduce space between report issue and help * Refactor and cleanup the app header * Address more feedback * Rename subjects to topics and indent values * Consolidate help and info panels * Fix right margin of list items * Remove dev tag
1 parent 170ac8d commit ee70466

21 files changed

Lines changed: 3424 additions & 3556 deletions

.env.sample

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,8 @@ MONITORING_URL=http://your_prometheus_server/alerts
5858
ALERTS_URL=http://your_prometheus_server/api/v1/alerts
5959
# The endpoint for checking all possible alerts
6060
TARGETS_URL=http://your_prometheus_server/api/v1/targets
61+
62+
# Issue reporting settings
63+
GITLAB_ISSUES_API_ENDPOINT=https://code.ornl.gov/api/v4/projects/20733/issues
64+
GITLAB_ACCESS_TOKEN=secret
65+
VITE_SUPPORT_EMAIL=ndip@ornl.gov

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### nova-dashboard, 0.21.0
2+
3+
* Added a form to the header for reporting issues (thanks to John Duggan).
4+
15
### nova-dashboard, 0.20.4
26

37
* Changed the endpoint used to retrieve the Galaxy API key to generate a new key if needed (thanks to John Duggan).

pixi.lock

Lines changed: 228 additions & 223 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "nova-dashboard"
3-
version = "0.20.4"
3+
version = "0.21.0"
44
description = ""
55
authors = [
66
{ name = "Yakubov, Sergey", email = "yakubovs@ornl.gov" },

src/launcher_app/galaxy.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,14 @@ def is_admin(self) -> bool:
146146
except Exception:
147147
return False
148148

149+
def is_logged_in(self) -> bool:
150+
try:
151+
with self.connection.connect() as connection:
152+
connection.galaxy_instance.users.get_current_user()
153+
return True
154+
except Exception:
155+
return False
156+
149157
def launch_job(self, tool_id: str, inputs: dict[str, str]) -> str:
150158
with self.connection.connect() as connection:
151159
if inputs:

src/launcher_app/issue.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
"""Defines a class for interacting GitLab to create issues."""
2+
3+
from typing import Any, Dict
4+
5+
from django.conf import settings
6+
from requests import post
7+
8+
9+
class IssueManager:
10+
"""Class to create GitLab issues."""
11+
12+
def submit(self, data: Dict[str, Any]) -> str:
13+
response = post(
14+
settings.GITLAB_ISSUES_API_ENDPOINT,
15+
headers={"PRIVATE-TOKEN": settings.GITLAB_ACCESS_TOKEN},
16+
json={
17+
"description": f"""# Reported By
18+
19+
{data["email"]}
20+
21+
# Mode of Contact
22+
23+
Issue submission form
24+
25+
# Issue Description
26+
27+
{data["description"]}
28+
29+
# Internal Issue Links""",
30+
"title": f"{data['topic']}",
31+
},
32+
)
33+
result = response.json()
34+
35+
return result["web_url"]

src/launcher_app/settings.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@
125125
ALERTS_URL = os.environ.get("ALERTS_URL", "")
126126
TARGETS_URL = os.environ.get("TARGETS_URL", "")
127127

128+
# Issue reporting settings
129+
GITLAB_ISSUES_API_ENDPOINT = os.environ.get("GITLAB_ISSUES_API_ENDPOINT")
130+
GITLAB_ACCESS_TOKEN = os.environ.get("GITLAB_ACCESS_TOKEN")
131+
128132
# Internationalization
129133
# https://docs.djangoproject.com/en/5.1/topics/i18n/
130134

src/launcher_app/urls.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
path("api/galaxy/monitor/", views.galaxy_monitor),
3232
path("api/galaxy/stop/", views.galaxy_stop),
3333
path("api/galaxy/tools/", views.galaxy_tools),
34+
path("api/issue/", views.report_issue),
3435
path("api/notification/", views.notification),
3536
]
3637

src/launcher_app/views.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from requests import request as proxy_request
1818

1919
from .galaxy import GalaxyManager
20+
from .issue import IssueManager
2021
from .notification import NotificationManager
2122
from .status import StatusManager
2223

@@ -112,6 +113,22 @@ def galaxy_tools(request: HttpRequest) -> JsonResponse:
112113
return _create_galaxy_error(e, tools={})
113114

114115

116+
@require_POST
117+
def report_issue(request: HttpRequest) -> HttpResponse:
118+
issue_manager = IssueManager()
119+
120+
try:
121+
data = json.loads(request.body)
122+
galaxy_manager = GalaxyManager(data.get("api_key", ""))
123+
if not galaxy_manager.is_logged_in():
124+
raise PermissionDenied()
125+
url = issue_manager.submit(data)
126+
except Exception:
127+
return HttpResponseBadRequest("unable to process request")
128+
129+
return JsonResponse({"url": url})
130+
131+
115132
@require_http_methods(["GET", "POST"])
116133
def notification(request: HttpRequest) -> HttpResponse:
117134
notification_manager = NotificationManager()

src/vue/package.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@
1414
"@mdi/font": "^7.4.47",
1515
"js-cookie": "^3.0.5",
1616
"lodash.merge": "^4.6.2",
17-
"pinia": "^2.1.7",
17+
"pinia": "^2.3.1",
1818
"toml": "^3.0.0",
19-
"vue": "^3.4.29",
20-
"vue-router": "^4.3.3"
19+
"vue": "^3.5.31",
20+
"vue-router": "^4.6.4"
2121
},
2222
"devDependencies": {
23-
"@rushstack/eslint-patch": "^1.8.0",
24-
"@vitejs/plugin-vue": "^5.0.5",
23+
"@rushstack/eslint-patch": "^1.16.1",
24+
"@vitejs/plugin-vue": "^5.2.4",
2525
"@vue/eslint-config-prettier": "^9.0.0",
26-
"eslint": "^8.57.0",
27-
"eslint-plugin-vue": "^9.23.0",
28-
"prettier": "^3.2.5",
29-
"prettier-eslint": "^16.3.0",
30-
"sass-embedded": "^1.77.8",
31-
"vite": "^5.3.1",
32-
"vite-plugin-vuetify": "^2.0.4",
33-
"vue-eslint-parser": "^8.0.0",
34-
"vuetify": "^3.7.0"
26+
"eslint": "^8.57.1",
27+
"eslint-plugin-vue": "^9.33.0",
28+
"prettier": "^3.8.1",
29+
"prettier-eslint": "^16.4.2",
30+
"sass-embedded": "^1.98.0",
31+
"vite": "^5.4.21",
32+
"vite-plugin-vuetify": "^2.1.3",
33+
"vue-eslint-parser": "^8.3.0",
34+
"vuetify": "^3.12.4"
3535
}
3636
}

0 commit comments

Comments
 (0)