argus-alm 0.12.9__py3-none-any.whl → 0.13.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- argus/client/base.py +1 -1
- argus/client/driver_matrix_tests/cli.py +2 -2
- argus/client/driver_matrix_tests/client.py +1 -1
- argus/client/generic/cli.py +2 -2
- argus/client/generic_result.py +3 -2
- argus/client/sct/client.py +3 -3
- argus/client/sirenada/client.py +1 -1
- {argus_alm-0.12.9.dist-info → argus_alm-0.13.0.dist-info}/METADATA +2 -4
- argus_alm-0.13.0.dist-info/RECORD +20 -0
- argus/backend/.gitkeep +0 -0
- argus/backend/cli.py +0 -41
- argus/backend/controller/__init__.py +0 -0
- argus/backend/controller/admin.py +0 -20
- argus/backend/controller/admin_api.py +0 -354
- argus/backend/controller/api.py +0 -529
- argus/backend/controller/auth.py +0 -67
- argus/backend/controller/client_api.py +0 -108
- argus/backend/controller/main.py +0 -274
- argus/backend/controller/notification_api.py +0 -72
- argus/backend/controller/notifications.py +0 -13
- argus/backend/controller/team.py +0 -126
- argus/backend/controller/team_ui.py +0 -18
- argus/backend/controller/testrun_api.py +0 -482
- argus/backend/controller/view_api.py +0 -162
- argus/backend/db.py +0 -100
- argus/backend/error_handlers.py +0 -21
- argus/backend/events/event_processors.py +0 -34
- argus/backend/models/__init__.py +0 -0
- argus/backend/models/result.py +0 -138
- argus/backend/models/web.py +0 -389
- argus/backend/plugins/__init__.py +0 -0
- argus/backend/plugins/core.py +0 -225
- argus/backend/plugins/driver_matrix_tests/controller.py +0 -63
- argus/backend/plugins/driver_matrix_tests/model.py +0 -421
- argus/backend/plugins/driver_matrix_tests/plugin.py +0 -22
- argus/backend/plugins/driver_matrix_tests/raw_types.py +0 -62
- argus/backend/plugins/driver_matrix_tests/service.py +0 -60
- argus/backend/plugins/driver_matrix_tests/udt.py +0 -42
- argus/backend/plugins/generic/model.py +0 -79
- argus/backend/plugins/generic/plugin.py +0 -16
- argus/backend/plugins/generic/types.py +0 -13
- argus/backend/plugins/loader.py +0 -40
- argus/backend/plugins/sct/controller.py +0 -185
- argus/backend/plugins/sct/plugin.py +0 -38
- argus/backend/plugins/sct/resource_setup.py +0 -178
- argus/backend/plugins/sct/service.py +0 -491
- argus/backend/plugins/sct/testrun.py +0 -272
- argus/backend/plugins/sct/udt.py +0 -101
- argus/backend/plugins/sirenada/model.py +0 -113
- argus/backend/plugins/sirenada/plugin.py +0 -17
- argus/backend/service/admin.py +0 -27
- argus/backend/service/argus_service.py +0 -688
- argus/backend/service/build_system_monitor.py +0 -188
- argus/backend/service/client_service.py +0 -122
- argus/backend/service/event_service.py +0 -18
- argus/backend/service/jenkins_service.py +0 -240
- argus/backend/service/notification_manager.py +0 -150
- argus/backend/service/release_manager.py +0 -230
- argus/backend/service/results_service.py +0 -317
- argus/backend/service/stats.py +0 -540
- argus/backend/service/team_manager_service.py +0 -83
- argus/backend/service/testrun.py +0 -559
- argus/backend/service/user.py +0 -307
- argus/backend/service/views.py +0 -258
- argus/backend/template_filters.py +0 -27
- argus/backend/tests/__init__.py +0 -0
- argus/backend/tests/argus_web.test.yaml +0 -39
- argus/backend/tests/conftest.py +0 -44
- argus/backend/tests/results_service/__init__.py +0 -0
- argus/backend/tests/results_service/test_best_results.py +0 -70
- argus/backend/util/common.py +0 -65
- argus/backend/util/config.py +0 -38
- argus/backend/util/encoders.py +0 -41
- argus/backend/util/logsetup.py +0 -81
- argus/backend/util/module_loaders.py +0 -30
- argus/backend/util/send_email.py +0 -91
- argus/client/generic_result_old.py +0 -143
- argus/db/.gitkeep +0 -0
- argus/db/argus_json.py +0 -14
- argus/db/cloud_types.py +0 -125
- argus/db/config.py +0 -135
- argus/db/db_types.py +0 -139
- argus/db/interface.py +0 -370
- argus/db/testrun.py +0 -740
- argus/db/utils.py +0 -15
- argus_alm-0.12.9.dist-info/RECORD +0 -96
- /argus/{backend → common}/__init__.py +0 -0
- /argus/{backend/util → common}/enums.py +0 -0
- /argus/{backend/plugins/sct/types.py → common/sct_types.py} +0 -0
- /argus/{backend/plugins/sirenada/types.py → common/sirenada_types.py} +0 -0
- {argus_alm-0.12.9.dist-info → argus_alm-0.13.0.dist-info}/LICENSE +0 -0
- {argus_alm-0.12.9.dist-info → argus_alm-0.13.0.dist-info}/WHEEL +0 -0
- {argus_alm-0.12.9.dist-info → argus_alm-0.13.0.dist-info}/entry_points.txt +0 -0
argus/backend/controller/main.py
DELETED
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
import datetime
|
|
2
|
-
import json
|
|
3
|
-
import logging
|
|
4
|
-
from uuid import UUID
|
|
5
|
-
from flask import (
|
|
6
|
-
Blueprint, flash, g, redirect, render_template, request, session, url_for, make_response
|
|
7
|
-
)
|
|
8
|
-
from argus.backend.controller.notifications import bp as notifications_bp
|
|
9
|
-
from argus.backend.controller.team_ui import bp as teams_bp
|
|
10
|
-
from argus.backend.service.argus_service import ArgusService
|
|
11
|
-
from argus.backend.models.web import WebFileStorage
|
|
12
|
-
from argus.backend.service.user import UserService, login_required
|
|
13
|
-
from argus.backend.service.views import UserViewService
|
|
14
|
-
|
|
15
|
-
LOGGER = logging.getLogger(__name__)
|
|
16
|
-
|
|
17
|
-
bp = Blueprint('main', __name__)
|
|
18
|
-
bp.register_blueprint(notifications_bp)
|
|
19
|
-
bp.register_blueprint(teams_bp)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
@bp.route("/test_runs")
|
|
23
|
-
@login_required
|
|
24
|
-
def test_runs():
|
|
25
|
-
return render_template("test_runs.html.j2")
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
@bp.route("/test_run/<string:run_id>")
|
|
29
|
-
@login_required
|
|
30
|
-
def test_run(run_id: UUID):
|
|
31
|
-
return render_template("test_run.html.j2", id=run_id)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
@bp.route("/test/<string:test_id>/runs")
|
|
35
|
-
@login_required
|
|
36
|
-
def runs(test_id: UUID):
|
|
37
|
-
additional_runs = request.args.getlist("additionalRuns[]")
|
|
38
|
-
return render_template("standalone_test_with_runs.html.j2", test_id=test_id, additional_runs=additional_runs)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
@bp.route("/")
|
|
42
|
-
def home():
|
|
43
|
-
return redirect(url_for("main.run_dashboard"))
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
@bp.route("/run_dashboard")
|
|
47
|
-
@bp.route("/workspace")
|
|
48
|
-
@login_required
|
|
49
|
-
def run_dashboard():
|
|
50
|
-
return render_template('dashboard.html.j2')
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
@bp.route("/releases")
|
|
54
|
-
@login_required
|
|
55
|
-
def releases():
|
|
56
|
-
service = ArgusService()
|
|
57
|
-
all_releases = service.get_releases()
|
|
58
|
-
return render_template("releases.html.j2", releases=all_releases)
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
@bp.route("/views")
|
|
62
|
-
@login_required
|
|
63
|
-
def views():
|
|
64
|
-
service = UserViewService()
|
|
65
|
-
all_views = service.get_all_views()
|
|
66
|
-
return render_template("views.html.j2", views=sorted(all_views, key=lambda view: view.created or datetime.datetime.fromtimestamp(0), reverse=True))
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
@bp.route("/view/<string:view_name>")
|
|
70
|
-
@login_required
|
|
71
|
-
def view_dashboard(view_name: str):
|
|
72
|
-
service = UserViewService()
|
|
73
|
-
view = service.get_view_by_name(view_name=view_name)
|
|
74
|
-
data_json = view
|
|
75
|
-
view["widget_settings"] = json.loads(view["widget_settings"])
|
|
76
|
-
return render_template("view_dashboard.html.j2", data=data_json)
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
@bp.route("/alert_debug")
|
|
80
|
-
@login_required
|
|
81
|
-
def alert_debug():
|
|
82
|
-
alert_type = request.args.get("type", "success")
|
|
83
|
-
message = request.args.get("message", "No message provided")
|
|
84
|
-
flash(message=message, category=alert_type)
|
|
85
|
-
return render_template("flash_debug.html.j2")
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
@bp.route("/dashboard/<string:release_name>")
|
|
89
|
-
@login_required
|
|
90
|
-
def release_dashboard(release_name: str):
|
|
91
|
-
service = ArgusService()
|
|
92
|
-
release, release_groups, release_tests = service.get_data_for_release_dashboard(
|
|
93
|
-
release_name=release_name)
|
|
94
|
-
data_json = {
|
|
95
|
-
"release": dict(release.items()),
|
|
96
|
-
"groups": [dict(group.items()) for group in release_groups],
|
|
97
|
-
"tests": [dict(test.items()) for test in release_tests],
|
|
98
|
-
}
|
|
99
|
-
return render_template("release_dashboard.html.j2", release_name=release_name, data=data_json)
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
@bp.route("/release/<string:name>/scheduler")
|
|
103
|
-
@login_required
|
|
104
|
-
def release_scheduler(name: str):
|
|
105
|
-
service = ArgusService()
|
|
106
|
-
release, release_groups, release_tests = service.get_data_for_release_dashboard(
|
|
107
|
-
release_name=name)
|
|
108
|
-
data_json = {
|
|
109
|
-
"release": dict(release.items()),
|
|
110
|
-
"groups": [dict(group.items()) for group in release_groups],
|
|
111
|
-
"tests": [dict(test.items()) for test in release_tests],
|
|
112
|
-
}
|
|
113
|
-
return render_template("release_schedule.html.j2", release_name=name, data=data_json)
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
@bp.route("/release/<string:name>/duty")
|
|
117
|
-
@login_required
|
|
118
|
-
def duty_planner(name: str):
|
|
119
|
-
service = ArgusService()
|
|
120
|
-
release, release_groups, release_tests = service.get_data_for_release_dashboard(
|
|
121
|
-
release_name=name)
|
|
122
|
-
data_json = {
|
|
123
|
-
"release": dict(release.items()),
|
|
124
|
-
"groups": [dict(group.items()) for group in release_groups],
|
|
125
|
-
"tests": [dict(test.items()) for test in release_tests],
|
|
126
|
-
}
|
|
127
|
-
return render_template("duty_planner.html.j2", release_name=name, data=data_json)
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
@bp.route("/error/")
|
|
131
|
-
def error():
|
|
132
|
-
return render_template("error.html.j2", type=request.args.get("type", 400))
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
@bp.route("/profile/")
|
|
136
|
-
@login_required
|
|
137
|
-
def profile():
|
|
138
|
-
first_run = session.pop("first_run_info", None)
|
|
139
|
-
token_generated = session.pop("token_generated", None)
|
|
140
|
-
|
|
141
|
-
return render_template("profile.html.j2", first_run=first_run, token_generated=token_generated)
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
@bp.route("/profile/oauth/github", methods=["GET"])
|
|
145
|
-
def profile_oauth_github_callback():
|
|
146
|
-
req_state = request.args.get('state', '')
|
|
147
|
-
if req_state != session["csrf_token"]:
|
|
148
|
-
return redirect(url_for("main.error", type=403))
|
|
149
|
-
|
|
150
|
-
req_code = request.args.get("code", "WTF")
|
|
151
|
-
service = UserService()
|
|
152
|
-
try:
|
|
153
|
-
first_run_info = service.github_callback(req_code)
|
|
154
|
-
except Exception as exc: # pylint: disable=broad-except
|
|
155
|
-
LOGGER.error("An error occured in callback", exc_info=True)
|
|
156
|
-
flash(message=exc.args[0], category="error")
|
|
157
|
-
return redirect(url_for("main.error", type=403))
|
|
158
|
-
if first_run_info:
|
|
159
|
-
session["first_run_info"] = first_run_info
|
|
160
|
-
|
|
161
|
-
if path := session.pop("redirect_target"):
|
|
162
|
-
return redirect(path)
|
|
163
|
-
return redirect(url_for("main.profile"))
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
@bp.route("/storage/picture/<string:picture_id>")
|
|
167
|
-
@login_required
|
|
168
|
-
def get_picture(picture_id: str):
|
|
169
|
-
res = make_response()
|
|
170
|
-
try:
|
|
171
|
-
picture = WebFileStorage.get(id=picture_id)
|
|
172
|
-
with open(picture.filepath, "rb") as file:
|
|
173
|
-
res.set_data(file.read())
|
|
174
|
-
res.content_type = "image/*"
|
|
175
|
-
res.status = 200
|
|
176
|
-
except FileNotFoundError: # pylint: disable=broad-except
|
|
177
|
-
res.status = 404
|
|
178
|
-
res.content_type = "text/plain"
|
|
179
|
-
res.set_data("404 NOT FOUND")
|
|
180
|
-
|
|
181
|
-
res.cache_control.max_age = 86400
|
|
182
|
-
res.cache_control.public = True
|
|
183
|
-
return res
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
@bp.route("/profile/update/picture", methods=["POST"])
|
|
187
|
-
@login_required
|
|
188
|
-
def upload_file():
|
|
189
|
-
req_file = request.files.get("filedata")
|
|
190
|
-
picture_data = req_file.stream.read()
|
|
191
|
-
picture_name = req_file.filename
|
|
192
|
-
if not req_file.content_type.startswith("image/"):
|
|
193
|
-
flash(
|
|
194
|
-
message=f"Expected image/*, got {req_file.content_type}", category="error")
|
|
195
|
-
return redirect(url_for("main.profile"))
|
|
196
|
-
if not picture_data:
|
|
197
|
-
flash(message="No picture provided", category="error")
|
|
198
|
-
return redirect(url_for("main.profile"))
|
|
199
|
-
|
|
200
|
-
service = UserService()
|
|
201
|
-
filename, filepath = service.save_profile_picture_to_disk(
|
|
202
|
-
picture_name, picture_data, g.user.username)
|
|
203
|
-
service.update_profile_picture(filename, filepath)
|
|
204
|
-
|
|
205
|
-
return redirect(url_for("main.profile"))
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
@bp.route("/profile/update/name", methods=["POST"])
|
|
209
|
-
@login_required
|
|
210
|
-
def update_full_name():
|
|
211
|
-
new_name = request.values.get("new_name")
|
|
212
|
-
if not new_name:
|
|
213
|
-
flash(message="Incorrect new name", category="error")
|
|
214
|
-
else:
|
|
215
|
-
service = UserService()
|
|
216
|
-
service.update_name(g.user, new_name)
|
|
217
|
-
flash("Successfully changed name!", category="success")
|
|
218
|
-
return redirect(url_for("main.profile"))
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
@bp.route("/profile/update/email", methods=["POST"])
|
|
222
|
-
@login_required
|
|
223
|
-
def update_email():
|
|
224
|
-
new_email = request.values.get("new_email")
|
|
225
|
-
if not new_email:
|
|
226
|
-
flash("Incorrect new email", category="error")
|
|
227
|
-
else:
|
|
228
|
-
service = UserService()
|
|
229
|
-
service.update_email(g.user, new_email)
|
|
230
|
-
flash("Successfully changed email!", category="success")
|
|
231
|
-
return redirect(url_for("main.profile"))
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
@bp.route("/profile/update/password", methods=["POST"])
|
|
235
|
-
@login_required
|
|
236
|
-
def update_password():
|
|
237
|
-
old_password = request.values.get("old_password")
|
|
238
|
-
new_password = request.values.get("new_password")
|
|
239
|
-
new_password_confirm = request.values.get("new_password_confirm")
|
|
240
|
-
if not old_password:
|
|
241
|
-
flash("Old password wasn't provided", category="error")
|
|
242
|
-
return redirect(url_for("main.profile"))
|
|
243
|
-
if not new_password:
|
|
244
|
-
flash("New password wasn't provided", category="error")
|
|
245
|
-
return redirect(url_for("main.profile"))
|
|
246
|
-
|
|
247
|
-
if not new_password == new_password_confirm:
|
|
248
|
-
flash("New password doesn't match confirmation!", category="error")
|
|
249
|
-
return redirect(url_for("main.profile"))
|
|
250
|
-
|
|
251
|
-
service = UserService()
|
|
252
|
-
try:
|
|
253
|
-
service.update_password(
|
|
254
|
-
g.user, old_password=old_password, new_password=new_password)
|
|
255
|
-
except Exception: # pylint: disable=broad-except
|
|
256
|
-
flash("Old password is incorrect", category="error")
|
|
257
|
-
return redirect(url_for("main.profile"))
|
|
258
|
-
|
|
259
|
-
flash("Successfully changed password!")
|
|
260
|
-
return redirect(url_for("main.profile"))
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
@bp.route("/profile/jobs", methods=["GET"])
|
|
264
|
-
@login_required
|
|
265
|
-
def profile_jobs():
|
|
266
|
-
return render_template("profile_jobs.html.j2")
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
@bp.route("/profile/schedules", methods=["GET"])
|
|
270
|
-
@login_required
|
|
271
|
-
def profile_schedules():
|
|
272
|
-
service = ArgusService()
|
|
273
|
-
schedules = service.get_schedules_for_user(g.user)
|
|
274
|
-
return render_template("profile_schedules.html.j2", schedules=schedules)
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
from flask import (
|
|
3
|
-
Blueprint,
|
|
4
|
-
g,
|
|
5
|
-
request,
|
|
6
|
-
)
|
|
7
|
-
from argus.backend.error_handlers import handle_api_exception
|
|
8
|
-
from argus.backend.service.notification_manager import NotificationManagerService
|
|
9
|
-
from argus.backend.service.user import api_login_required
|
|
10
|
-
from argus.backend.util.common import get_payload
|
|
11
|
-
|
|
12
|
-
bp = Blueprint('notifications', __name__, url_prefix='/notifications')
|
|
13
|
-
LOGGER = logging.getLogger(__name__)
|
|
14
|
-
bp.register_error_handler(Exception, handle_api_exception)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
@bp.route("/get")
|
|
18
|
-
@api_login_required
|
|
19
|
-
def get_notification():
|
|
20
|
-
notification_id = request.args.get("id")
|
|
21
|
-
if not notification_id:
|
|
22
|
-
raise Exception("No notification id provided")
|
|
23
|
-
service = NotificationManagerService()
|
|
24
|
-
notification = service.get_notificaton(
|
|
25
|
-
receiver=g.user.id, notification_id=notification_id)
|
|
26
|
-
return {
|
|
27
|
-
"status": "ok",
|
|
28
|
-
"response": notification.to_dict()
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
@bp.route("/get_unread")
|
|
33
|
-
@api_login_required
|
|
34
|
-
def get_unread_count():
|
|
35
|
-
service = NotificationManagerService()
|
|
36
|
-
unread_count = service.get_unread_count(receiver=g.user.id)
|
|
37
|
-
return {
|
|
38
|
-
"status": "ok",
|
|
39
|
-
"response": unread_count
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
@bp.route("/summary")
|
|
44
|
-
@api_login_required
|
|
45
|
-
def get_summary():
|
|
46
|
-
after = request.args.get("afterId")
|
|
47
|
-
limit = request.args.get("limit")
|
|
48
|
-
limit = int(limit) if limit else 20
|
|
49
|
-
service = NotificationManagerService()
|
|
50
|
-
notifications = service.get_notifications(
|
|
51
|
-
receiver=g.user.id,
|
|
52
|
-
limit=limit,
|
|
53
|
-
after=after
|
|
54
|
-
)
|
|
55
|
-
return {
|
|
56
|
-
"status": "ok",
|
|
57
|
-
"response": [n.to_dict_short_summary() for n in notifications]
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
@bp.route("/read", methods=["POST"])
|
|
62
|
-
@api_login_required
|
|
63
|
-
def read_notification():
|
|
64
|
-
payload = get_payload(request)
|
|
65
|
-
service = NotificationManagerService()
|
|
66
|
-
status = service.read_notification(
|
|
67
|
-
receiver=g.user.id, notification_id=payload["id"])
|
|
68
|
-
|
|
69
|
-
return {
|
|
70
|
-
"status": "ok",
|
|
71
|
-
"response": status
|
|
72
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
from flask import (
|
|
2
|
-
Blueprint,
|
|
3
|
-
render_template,
|
|
4
|
-
)
|
|
5
|
-
from argus.backend.service.user import login_required
|
|
6
|
-
|
|
7
|
-
bp = Blueprint('notifications', __name__, url_prefix='/notifications')
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
@bp.route("/")
|
|
11
|
-
@login_required
|
|
12
|
-
def index():
|
|
13
|
-
return render_template("profile_notifications.html.j2")
|
argus/backend/controller/team.py
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
from uuid import UUID
|
|
3
|
-
from flask import (
|
|
4
|
-
Blueprint,
|
|
5
|
-
request
|
|
6
|
-
)
|
|
7
|
-
from argus.backend.error_handlers import handle_api_exception
|
|
8
|
-
from argus.backend.models.web import User
|
|
9
|
-
from argus.backend.service.argus_service import ArgusService
|
|
10
|
-
from argus.backend.service.user import api_login_required
|
|
11
|
-
from argus.backend.util.common import get_payload
|
|
12
|
-
from argus.backend.service.team_manager_service import TeamManagerService
|
|
13
|
-
|
|
14
|
-
bp = Blueprint('team_api', __name__, url_prefix='/team')
|
|
15
|
-
LOGGER = logging.getLogger(__name__)
|
|
16
|
-
bp.register_error_handler(Exception, handle_api_exception)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
@bp.route("/create", methods=["POST"])
|
|
20
|
-
@api_login_required
|
|
21
|
-
def team_create():
|
|
22
|
-
payload = get_payload(request)
|
|
23
|
-
result = TeamManagerService().create_team(
|
|
24
|
-
name=payload["name"],
|
|
25
|
-
leader=UUID(payload["leader"]),
|
|
26
|
-
members=[UUID(m) for m in payload["members"]],
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
return {
|
|
30
|
-
"status": "ok",
|
|
31
|
-
"response": result
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
@bp.route("/<string:team_id>/get")
|
|
36
|
-
@api_login_required
|
|
37
|
-
def team_get(team_id: str):
|
|
38
|
-
result = TeamManagerService().get_team_by_id(UUID(team_id))
|
|
39
|
-
|
|
40
|
-
return {
|
|
41
|
-
"status": "ok",
|
|
42
|
-
"response": result
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
@bp.route("/<string:team_id>/delete", methods=["DELETE"])
|
|
47
|
-
@api_login_required
|
|
48
|
-
def team_delete(team_id: str):
|
|
49
|
-
TeamManagerService().delete_team(UUID(team_id))
|
|
50
|
-
|
|
51
|
-
return {
|
|
52
|
-
"status": "ok",
|
|
53
|
-
"response": {
|
|
54
|
-
"team_id": team_id,
|
|
55
|
-
"status": "deleted",
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
@bp.route("/<string:team_id>/edit", methods=["POST"])
|
|
60
|
-
@api_login_required
|
|
61
|
-
def team_edit(team_id: str):
|
|
62
|
-
payload = get_payload(request)
|
|
63
|
-
team = TeamManagerService().edit_team(
|
|
64
|
-
team_id=UUID(payload["id"]),
|
|
65
|
-
name=payload["name"],
|
|
66
|
-
members=[UUID(m) for m in payload["members"]],
|
|
67
|
-
)
|
|
68
|
-
|
|
69
|
-
return {
|
|
70
|
-
"status": "ok",
|
|
71
|
-
"response": {
|
|
72
|
-
"team_id": team_id,
|
|
73
|
-
"status": "updated",
|
|
74
|
-
"team": team,
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
@bp.route("/<string:team_id>/motd/edit", methods=["POST"])
|
|
79
|
-
@api_login_required
|
|
80
|
-
def team_edit_motd(team_id: str):
|
|
81
|
-
payload = get_payload(request)
|
|
82
|
-
TeamManagerService().edit_team_motd(
|
|
83
|
-
team_id=UUID(payload["id"]),
|
|
84
|
-
message=payload["motd"],
|
|
85
|
-
)
|
|
86
|
-
|
|
87
|
-
return {
|
|
88
|
-
"status": "ok",
|
|
89
|
-
"response": {
|
|
90
|
-
"team_id": team_id,
|
|
91
|
-
"status": "updated",
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
@bp.route("/user/<string:user_id>/teams")
|
|
96
|
-
@api_login_required
|
|
97
|
-
def user_teams(user_id: str):
|
|
98
|
-
result = TeamManagerService().get_users_teams(user_id=UUID(user_id))
|
|
99
|
-
|
|
100
|
-
return {
|
|
101
|
-
"status": "ok",
|
|
102
|
-
"response": result
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
@bp.route("/user/<string:user_id>/jobs")
|
|
107
|
-
@api_login_required
|
|
108
|
-
def user_jobs(user_id: str):
|
|
109
|
-
user = User.get(id=UUID(user_id))
|
|
110
|
-
result = list(ArgusService().get_jobs_for_user(user))
|
|
111
|
-
|
|
112
|
-
return {
|
|
113
|
-
"status": "ok",
|
|
114
|
-
"response": result
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
@bp.route("/leader/<string:user_id>/teams")
|
|
119
|
-
@api_login_required
|
|
120
|
-
def leader_teams(user_id: str):
|
|
121
|
-
result = TeamManagerService().get_teams_for_user(user_id=UUID(user_id))
|
|
122
|
-
|
|
123
|
-
return {
|
|
124
|
-
"status": "ok",
|
|
125
|
-
"response": result
|
|
126
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
from uuid import UUID
|
|
3
|
-
from flask import (
|
|
4
|
-
Blueprint, flash, g, redirect, render_template, request, session, url_for, make_response
|
|
5
|
-
)
|
|
6
|
-
from argus.backend.controller.notifications import bp as notifications_bp
|
|
7
|
-
from argus.backend.service.argus_service import ArgusService
|
|
8
|
-
from argus.backend.models.web import WebFileStorage
|
|
9
|
-
from argus.backend.service.user import UserService, login_required
|
|
10
|
-
|
|
11
|
-
LOGGER = logging.getLogger(__name__)
|
|
12
|
-
|
|
13
|
-
bp = Blueprint('teams', __name__, url_prefix="/teams")
|
|
14
|
-
|
|
15
|
-
@bp.route("/")
|
|
16
|
-
@login_required
|
|
17
|
-
def index():
|
|
18
|
-
return render_template("teams.html.j2")
|