Skip to content
Snippets Groups Projects
Commit c012fe91 authored by Wact B. Prot's avatar Wact B. Prot
Browse files

..

parent 1d067e7e
No related branches found
No related tags found
No related merge requests found
No preview for this file type
......@@ -39,8 +39,10 @@ def gen_count():
def get_info(url):
p = urlparse(url)
db = p.path.replace("/","")
host = p.hostname.split(".")[0]
return db, host
def gen_ext_name(d, h):
......@@ -49,15 +51,16 @@ def gen_ext_name(d, h):
def get_nodes_and_edges(jobs, gen, hosts, dbs):
nodes = []
edges = []
idx = 0
for job in jobs:
s = job.get("source")
t = job.get("target")
if s and t:
s_db, s_host = get_info(s)
t_db, t_host = get_info(t)
s_ext_db_name = gen_ext_name(s_db, s_host)
t_ext_db_name = gen_ext_name(t_db, t_host)
s_db_name = gen_ext_name(s_db, s_host)
t_db_name = gen_ext_name(t_db, t_host)
if s_host not in hosts:
hosts[s_host] = gen.__next__()
......@@ -67,17 +70,16 @@ def get_nodes_and_edges(jobs, gen, hosts, dbs):
hosts[t_host] = gen.__next__()
nodes.append({"id": hosts[t_host], "label": t_host, "group": "server"})
if s_ext_db_name not in dbs:
dbs[s_ext_db_name] = gen.__next__()
nodes.append({"id": dbs[s_ext_db_name], "label": s_db, "group": "db"})
if t_ext_db_name not in dbs:
dbs[t_ext_db_name] = gen.__next__()
nodes.append({"id": dbs[t_ext_db_name], "label": t_db, "group": "db"})
edges.append({"from": dbs[s_ext_db_name] , "to":dbs[t_ext_db_name] , "arrow_type": "to"})
edges.append({"from": hosts[s_host] , "to":dbs[s_ext_db_name], "arrow_type":"box"})
edges.append({"from": hosts[t_host] , "to":dbs[t_ext_db_name], "arrow_type":"box"})
if s_db_name not in dbs:
dbs[s_db_name] = gen.__next__()
nodes.append({"id": dbs[s_db_name], "label": s_db, "group": "db"})
if t_db_name not in dbs:
dbs[t_db_name] = gen.__next__()
nodes.append({"id": dbs[t_db_name], "label": t_db, "group": "db"})
edges.append({"from": dbs[s_db_name] , "to":dbs[t_db_name] , "arrow_type": "to" })
edges.append({"from": hosts[s_host] , "to":dbs[s_db_name], "arrow_type":"box"})
edges.append({"from": hosts[t_host] , "to":dbs[t_db_name], "arrow_type":"box"})
return nodes, edges
\ No newline at end of file
This diff is collapsed.
......@@ -5,20 +5,26 @@
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="az table">
<meta name="author" content="wactbprot">
<title>AZ-Liste</title>
<title>repl graph</title>
<!-- Bootstrap core CSS -->
<link href="../css/bootstrap.min.css" rel="stylesheet" >
<link href="../css/datatables.min.css" rel="stylesheet">
<style>
#net {
width: 1400px;
height: 900px;
border: 1px solid lightgray;
}
body {
color: #d3d3d3;
font: 12pt arial;
background-color: #222222;
}
#net {
width: 1400px;
height: 900px;
border: 1px solid #444444;
background-color: #222222;
}
</style>
<!-- Custom styles for this template -->
<link rel="shortcut icon" href="../logo/favicon.ico">
</head>
<body class="d-flex flex-column h-10">
......@@ -41,24 +47,21 @@
<script type="text/javascript" charset="utf8" src="../js/jquery-3.4.1.min.js"></script>
<script type="text/javascript" charset="utf8" src="../js/popper.min.js"></script>
<script type="text/javascript" charset="utf8" src="../js/bootstrap.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/vis-network/standalone/umd/vis-network.min.js"></script>
<script type="text/javascript" charset="utf8">
<script type="text/javascript" charset="utf8" src="../js/vis-network.min.js"></script>
<script type="text/javascript" charset="utf8">
var nodes = new vis.DataSet([
{% for node in nodes %}
{id: {{node.id}}, label: "{{node.label}}" , group: "{{node.group}}" },
{%endfor%}
]);
var edges = new vis.DataSet([
var edges = new vis.DataSet([
{% for edge in edges %}
{from: {{edge.from}}, to: {{edge.to}} , arrows:"{{edge.arrow_type}}"},
{from: {{edge.from}}, to: {{edge.to}} , arrows:"{{edge.arrow_type}}" , shadow: { color: "#FF9900" }},
{%endfor%}
]);
// create a network
var container = document.getElementById('net');
// provide the data in the vis format
var data = {
var container = document.getElementById('net');
var data = {
nodes: nodes,
edges: edges
};
......@@ -70,7 +73,7 @@
groups: {
server: {
shape: "box",
color: "#FF9900" // orange
color: "#FF9900"
},
db: {
shape: "box"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment