Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Knowledge Space WP Plugin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
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
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
alg
Knowledge Space WP Plugin
Commits
5ce84608
Commit
5ce84608
authored
3 years ago
by
Matthias Konitzny
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
d040e18b
aecdc864
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
editor/js/editor.js
+2
-0
2 additions, 0 deletions
editor/js/editor.js
editor/js/graph.js
+18
-10
18 additions, 10 deletions
editor/js/graph.js
editor/js/manageddata.js
+3
-2
3 additions, 2 deletions
editor/js/manageddata.js
with
23 additions
and
12 deletions
editor/js/editor.js
+
2
−
0
View file @
5ce84608
...
@@ -15,6 +15,7 @@ window.onload = function () {
...
@@ -15,6 +15,7 @@ window.onload = function () {
// Deactivate physics after a short delay
// Deactivate physics after a short delay
setTimeout
(()
=>
{
setTimeout
(()
=>
{
graph
.
stopPhysics
();
graph
.
stopPhysics
();
graph
.
storeCurrentData
(
"
Physics stopped
"
);
},
STOP_PHYSICS_DELAY
);
},
STOP_PHYSICS_DELAY
);
});
});
};
};
...
@@ -64,6 +65,7 @@ function load() {
...
@@ -64,6 +65,7 @@ function load() {
.
onLinkClick
((
link
)
=>
state
.
onLinkClick
(
link
));
.
onLinkClick
((
link
)
=>
state
.
onLinkClick
(
link
));
graph
.
onChangeCallbacks
.
push
((
data
)
=>
{
graph
.
onChangeCallbacks
.
push
((
data
)
=>
{
graphObj
.
cooldownTicks
(
0
);
graphObj
.
graphData
(
data
);
graphObj
.
graphData
(
data
);
});
});
}
}
This diff is collapsed.
Click to expand it.
editor/js/graph.js
+
18
−
10
View file @
5ce84608
...
@@ -17,6 +17,8 @@ const IMAGE_SRC = PLUGIN_PATH + "datasets/images/";
...
@@ -17,6 +17,8 @@ const IMAGE_SRC = PLUGIN_PATH + "datasets/images/";
const
LINK_PARAMS
=
[
LINK_TYPE
];
const
LINK_PARAMS
=
[
LINK_TYPE
];
const
NODE_PARAMS
=
[
NODE_ID
,
NODE_LABEL
,
NODE_IMAGE
,
NODE_DESCRIPTION
];
const
NODE_PARAMS
=
[
NODE_ID
,
NODE_LABEL
,
NODE_IMAGE
,
NODE_DESCRIPTION
];
const
LINK_SIM_PARAMS
=
[
"
index
"
];
const
NODE_SIM_PARAMS
=
[
"
index
"
,
"
x
"
,
"
y
"
,
"
vx
"
,
"
vy
"
,
"
fx
"
,
"
fy
"
];
// Based on https://github.com/d3/d3-force#simulation_nodes
const
JSON_CONFIG
=
PLUGIN_PATH
+
"
datasets/aud1.json
"
;
const
JSON_CONFIG
=
PLUGIN_PATH
+
"
datasets/aud1.json
"
;
...
@@ -41,7 +43,7 @@ class Graph extends ManagedData {
...
@@ -41,7 +43,7 @@ class Graph extends ManagedData {
this
.
triggerOnChange
();
this
.
triggerOnChange
();
}
}
format
Data
(
data
)
{
storable
Data
(
data
)
{
return
this
.
getCleanData
(
data
,
true
);
return
this
.
getCleanData
(
data
,
true
);
}
}
...
@@ -151,7 +153,7 @@ class Graph extends ManagedData {
...
@@ -151,7 +153,7 @@ class Graph extends ManagedData {
);
);
}
}
getCleanData
(
data
=
undefined
,
position
s
=
false
)
{
getCleanData
(
data
=
undefined
,
simulationParameter
s
=
false
)
{
if
(
data
===
undefined
)
{
if
(
data
===
undefined
)
{
data
=
this
.
data
;
data
=
this
.
data
;
}
}
...
@@ -161,33 +163,33 @@ class Graph extends ManagedData {
...
@@ -161,33 +163,33 @@ class Graph extends ManagedData {
cleanData
[
GRAPH_NODES
]
=
[];
cleanData
[
GRAPH_NODES
]
=
[];
data
[
GRAPH_LINKS
].
forEach
((
link
)
=>
data
[
GRAPH_LINKS
].
forEach
((
link
)
=>
cleanData
[
GRAPH_LINKS
].
push
(
this
.
getCleanLink
(
link
))
cleanData
[
GRAPH_LINKS
].
push
(
this
.
getCleanLink
(
link
,
simulationParameters
))
);
);
data
[
GRAPH_NODES
].
forEach
((
node
)
=>
data
[
GRAPH_NODES
].
forEach
((
node
)
=>
cleanData
[
GRAPH_NODES
].
push
(
this
.
getCleanNode
(
node
,
position
s
))
cleanData
[
GRAPH_NODES
].
push
(
this
.
getCleanNode
(
node
,
simulationParameter
s
))
);
);
console
.
log
(
cleanData
);
return
cleanData
;
return
cleanData
;
}
}
getCleanNode
(
node
,
position
s
)
{
getCleanNode
(
node
,
simulationParameter
s
)
{
var
cleanNode
=
{};
var
cleanNode
=
{};
NODE_PARAMS
.
forEach
((
param
)
=>
{
NODE_PARAMS
.
forEach
((
param
)
=>
{
cleanNode
[
param
]
=
node
[
param
];
cleanNode
[
param
]
=
node
[
param
];
});
});
if
(
positions
)
{
if
(
simulationParameters
)
{
cleanNode
.
fx
=
node
.
fx
;
NODE_SIM_PARAMS
.
forEach
((
param
)
=>
{
cleanNode
.
fy
=
node
.
fy
;
cleanNode
[
param
]
=
node
[
param
];
});
}
}
return
cleanNode
;
return
cleanNode
;
}
}
getCleanLink
(
link
)
{
getCleanLink
(
link
,
simulationParameters
)
{
var
cleanLink
=
{};
var
cleanLink
=
{};
// Source and target nodes
// Source and target nodes
...
@@ -200,6 +202,12 @@ class Graph extends ManagedData {
...
@@ -200,6 +202,12 @@ class Graph extends ManagedData {
cleanLink
[
param
]
=
link
[
param
];
cleanLink
[
param
]
=
link
[
param
];
});
});
if
(
simulationParameters
)
{
LINK_SIM_PARAMS
.
forEach
((
param
)
=>
{
cleanLink
[
param
]
=
link
[
param
];
});
}
return
cleanLink
;
return
cleanLink
;
}
}
...
...
This diff is collapsed.
Click to expand it.
editor/js/manageddata.js
+
3
−
2
View file @
5ce84608
...
@@ -36,12 +36,12 @@ class ManagedData {
...
@@ -36,12 +36,12 @@ class ManagedData {
return
true
;
return
true
;
}
}
format
Data
(
data
)
{
storable
Data
(
data
)
{
return
data
;
return
data
;
}
}
storeCurrentData
(
description
)
{
storeCurrentData
(
description
)
{
var
formattedData
=
this
.
format
Data
(
this
.
data
);
var
formattedData
=
this
.
storable
Data
(
this
.
data
);
this
.
history
.
unshift
({
this
.
history
.
unshift
({
description
:
description
,
description
:
description
,
...
@@ -51,5 +51,6 @@ class ManagedData {
...
@@ -51,5 +51,6 @@ class ManagedData {
// Forget about the currently stored potential future
// Forget about the currently stored potential future
this
.
history
.
splice
(
0
,
this
.
historyPosition
);
this
.
history
.
splice
(
0
,
this
.
historyPosition
);
this
.
historyPosition
=
0
;
this
.
historyPosition
=
0
;
console
.
log
(
this
.
history
[
0
]);
}
}
}
}
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