-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcallbacks.py
55 lines (40 loc) · 1.52 KB
/
callbacks.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# This file is part of https://github.com/SpringQL/web-console which is licensed under MIT OR Apache-2.0. See file LICENSE-MIT or LICENSE-APACHE for full license details.
from dash.dependencies import Input, Output, State
import json
from app import app
from redis_client import redis_client
@app.callback(Output('stream-name', 'children'),
Input('cytoscape-pipeline', 'selectedNodeData'))
def updateStreamName(nodes):
if not nodes:
return "(no stream selected)"
node = nodes[0]
return node['id']
@app.callback(Output('stream-def-content', 'children'),
Input('cytoscape-pipeline', 'selectedNodeData'))
def updateStreamDefContent(nodes):
if not nodes:
return ""
node = nodes[0]
return node['stream_def']
@app.callback(Output('stream-upstream-content', 'children'),
Input('cytoscape-pipeline', 'selectedNodeData'))
def updateStreamUpstreamContent(nodes):
if not nodes:
return ""
node = nodes[0]
return node['stream_upstream_pump_def']
@app.callback(Output('cytoscape-pipeline', 'elements'),
Input('btn-update-pipeline', 'n_clicks_timestamp'))
def updatePipelineElements(_btn):
j = redis_client.get('pipeline')
if not j:
j = '{}'
return json.loads(j)
@app.callback(Output('cytoscape-task-graph', 'elements'),
Input('btn-update-task-graph', 'n_clicks_timestamp'))
def updateTaskGraphElements(_btn):
j = redis_client.get('task-graph')
if not j:
j = '{}'
return json.loads(j)