Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dashboard-sdk
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Polaris
dashboard-sdk
Commits
cbb0846f
Commit
cbb0846f
authored
Jan 12, 2023
by
Max Lou
Browse files
Options
Downloads
Patches
Plain Diff
Fix: redraw charts on sidebar close
parent
cd82e6ff
No related branches found
No related tags found
No related merge requests found
Pipeline
#889818
passed
Jan 12, 2023
Stage: deploy
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/js/main.js
+2
-16
2 additions, 16 deletions
src/js/main.js
src/js/utils.js
+14
-0
14 additions, 0 deletions
src/js/utils.js
with
16 additions
and
16 deletions
src/js/main.js
+
2
−
16
View file @
cbb0846f
import
{
getData
,
initGrid
}
from
"
./utils
"
;
import
*
as
d3
from
"
d3
"
;
import
{
getResult
,
initGrid
}
from
"
./utils
"
;
import
{
LineChartWidget
,
BarChartWidget
,
...
...
@@ -12,19 +11,6 @@ import { CourseRatingChart } from "./charts/custom/courseRatingChart";
const
token
=
"
eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJjb250ZXh0X2lkIjoidXNlcjFAcG9sYXJpcy5jb20iLCJleHAiOjE2NzQwNDc1MTUsImVuZ2luZXMiOlsyLDQsNSw2LDUsMTNdLCJlbmdpbmVzX3dpdGhfY29udGV4dCI6WzExLDEyXX0.ASnyAZ9jalb2vzx4zoT7tf9_BLhgsHfLt0GRLYag-9AqojLbL7y6NKr_3eKNVmE5yylYttN705zaTVW8pzGAfmYpM0OFlWwr1Je_AXd3sNvAxERjV2cBNg5uDggi4gUCT6xqQ7K3nwy1l_q1SsWBPHmhDmcJbVmfH3Y0DNeUaf0WyXjKDLIalKLQV9DwuRUcDUqq6FT0P9EG1_DyBTihJKEInD4gNQzNHwTibJrLdK8UMz_PeDRZT1jrv40bsKoyc4vIJvZdiE9q3ti93fZXLkc9I6OOqsBqEl7l2H2WEuEEUXoLEK0j2tb7_X367y8d9i-7jLuvc406uFVdAqPQ_XoRK689eL7wPDwl2KU7mvrZv1mIxnxe-OIVAPLq8LTzMFdCnf1rdDORLRjjAHOCrszE_2oKE9ciE3pW_0OxeOkR8dAX6uKXIURgZd2fYIO4Cn97LQBTEGR04eKe2YAIovGM9_SqC2x10H7VwcEkHLHpUTNLeR9rrrNu36hPgIvH
"
;
async
function
getResult
()
{
const
response
=
await
fetch
(
"
http://vs-code-cloud.digitallearning.gmbh:8003/api/v1/provider/result
"
,
{
headers
:
{
Authorization
:
`Basic
${
token
}
`
,
},
}
);
const
data
=
await
response
.
json
();
return
data
;
}
const
items
=
[
{
x
:
4
,
...
...
@@ -84,7 +70,7 @@ const items = [
},
];
getResult
().
then
((
data
)
=>
{
getResult
(
token
).
then
((
data
)
=>
{
const
widgets
=
{
"
second-widget
"
:
new
BarChartWidget
(
"
Statements H5P
"
,
...
...
This diff is collapsed.
Click to expand it.
src/js/utils.js
+
14
−
0
View file @
cbb0846f
...
...
@@ -2,6 +2,19 @@ import "gridstack/dist/gridstack.min.css";
import
{
GridStack
}
from
"
gridstack
"
;
export
async
function
getResult
(
token
)
{
const
response
=
await
fetch
(
"
http://vs-code-cloud.digitallearning.gmbh:8003/api/v1/provider/result
"
,
{
headers
:
{
Authorization
:
`Basic
${
token
}
`
,
},
}
);
const
data
=
await
response
.
json
();
return
data
;
}
export
function
plotCharts
(
nodes
,
widgets
)
{
for
(
const
node
of
nodes
)
{
const
widget
=
widgets
[
node
.
widgetId
];
...
...
@@ -100,6 +113,7 @@ export function initGrid(widgets, items) {
sidebar
.
className
=
"
sidebar-hidden
"
;
const
avWidgets
=
document
.
getElementById
(
"
available-widgets
"
);
removeAllChildNodes
(
avWidgets
);
plotCharts
(
grid
.
engine
.
nodes
,
widgets
);
}
else
{
sidebar
.
className
=
"
sidebar
"
;
drawAvailableWidgets
(
widgets
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment