-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(ui): added basic natworking ResponseProcessor
- Loading branch information
1 parent
3289fb5
commit 56b605d
Showing
6 changed files
with
8,430 additions
and
3 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
src/imports/contexts/tasks/responseProcessors/aggregate/network/Network.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { ResponseProcessorTypes } from '../../ResposeProcessorTypes' | ||
import { ResponseDataTypes } from '../../../../../api/plugins/ResponseDataTypes' | ||
|
||
export const Network = { | ||
name: 'render', | ||
label: 'responseProcessors.render.title', | ||
type: ResponseProcessorTypes.aggregate.name, | ||
dataTypes: [ResponseDataTypes.textList.name], | ||
isResponseProcessor: true, | ||
icon: 'cubes', | ||
schema: {}, | ||
helpers: {}, | ||
renderer: { | ||
template: 'rpNetwork', | ||
load: async function load () { | ||
return import('./renderer/network') | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
src/imports/contexts/tasks/responseProcessors/aggregate/network/renderer/network.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template name="rpNetwork"> | ||
<div class="vis-base-container" style="height: 50vh;"></div> | ||
</template> |
51 changes: 51 additions & 0 deletions
51
src/imports/contexts/tasks/responseProcessors/aggregate/network/renderer/network.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import './network.html' | ||
import { Network } from '../Network' | ||
import vis from 'vis-network/standalone/index' | ||
import 'vis-network/dist/dist/vis-network.css' | ||
|
||
const API = Template.rpNetwork.setDependencies({ | ||
Check failure on line 6 in src/imports/contexts/tasks/responseProcessors/aggregate/network/renderer/network.js GitHub Actions / Javascript lint
|
||
context: [Network], | ||
debug: true | ||
}) | ||
|
||
Template.rpNetwork.onRendered(function () { | ||
const instance = this | ||
|
||
instance.autorun(function () { | ||
const templateData = Template.currentData() | ||
const nodeData = templateData.results | ||
.map(resultDoc => { | ||
return resultDoc.response.map((response, index) => { | ||
return { | ||
id: `${resultDoc._id}-${index}`, | ||
label: response, | ||
createdBy: resultDoc.createdBy, | ||
cid: 1 | ||
} | ||
}) | ||
}) | ||
.flat() | ||
|
||
const nodes = new vis.DataSet(nodeData) | ||
|
||
const container = instance.$('.vis-base-container').get(0) | ||
// provide the data in the vis format | ||
const data = { nodes, edges: undefined } | ||
const options = { | ||
autoResize: true, | ||
width: '100%', | ||
// Height percentual settings have only effect, if all parent height are also set to 100% - See also boocmap.css | ||
height: '100%', | ||
physics: { | ||
enabled: false | ||
}, | ||
interaction: { | ||
keyboard: true | ||
} | ||
} | ||
const net = new vis.Network(container, data, options) | ||
setTimeout(() => { | ||
|
||
}, 3000) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.