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

Connect new API to the old dashboard #147

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions app/dashboard/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ def static_html_proxy(path):
@app.route(
"/_ajax/test/regression",
defaults={"api": "TEST_REGRESSION_API_ENDPOINT"}, methods=["GET"])
@app.route(
"/_ajax/nodes",
defaults={"api": "NEW_API_ENDPOINT"}, methods=["GET"])
def ajax_get(api):
if validate_csrf(request.headers.get(CSRF_TOKEN_H, None)):
return backend.ajax_get(request, app_conf_get(api), timeout=60 * 20)
Expand Down
1 change: 1 addition & 0 deletions app/dashboard/default_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
TEST_GROUP_API_ENDPOINT = "/test/group"
TEST_CASE_API_ENDPOINT = "/test/case"
TEST_REGRESSION_API_ENDPOINT = "/test/regression"
NEW_API_ENDPOINT = "/nodes"

# Default date range to show the results. The higher the value, the more
# data will need to be loaded from the server and parsed. It can take time
Expand Down
10 changes: 9 additions & 1 deletion app/dashboard/static/js/app/tables/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ define([
tooltipNode.setAttribute('title', defaults.warning);
tooltipNode.appendChild(html.warning());
break;
case 'DONE':
tooltipNode.setAttribute('title', defaults.done);
tooltipNode.appendChild(html.success());
break;
default:
tooltipNode.setAttribute('title', defaults.default);
tooltipNode.appendChild(html.unknown());
Expand Down Expand Up @@ -255,7 +259,11 @@ define([
node = _dateNode(date).firstElementChild;
rendered = node.outerHTML;
} else {
created = new Date(date.$date);
if (date.$date) {
created = new Date(date.$date);
} else {
created = new Date(date);
}
rendered = created.toCustomISODate();
}
} else {
Expand Down
1 change: 1 addition & 0 deletions app/dashboard/static/js/app/tables/job.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ define([
pass: 'Build completed',
build: 'Building',
fail: 'Build failed',
done: 'Job done',
default: 'Unknown status'
};

Expand Down
8 changes: 7 additions & 1 deletion app/dashboard/static/js/app/utils/html.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/*!
* kernelci dashboard.
*
* Copyright (C) 2022 Collabora Ltd.
*
* Copyright (C) 2014, 2015, 2016, 2017 Linaro Ltd.
*
* This program is free software; you can redistribute it and/or modify it under
Expand Down Expand Up @@ -513,7 +515,11 @@ define([

frag = document.createDocumentFragment();

created = new Date(date.$date);
if (date.$date) {
created = new Date(date.$date);
} else {
created = new Date(date);
}
timeNode = frag.appendChild(document.createElement('time'));
timeNode.setAttribute('datetime', created.toISOString());
timeNode.appendChild(
Expand Down
Loading