fastapi-voyager 0.15.0__py3-none-any.whl → 0.15.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fastapi_voyager/er_diagram.py +57 -109
- fastapi_voyager/render.py +12 -2
- fastapi_voyager/server.py +1 -0
- fastapi_voyager/templates/dot/er_diagram.j2 +29 -0
- fastapi_voyager/version.py +1 -1
- fastapi_voyager/web/component/demo.js +5 -5
- fastapi_voyager/web/component/render-graph.js +60 -61
- fastapi_voyager/web/component/route-code-display.js +35 -37
- fastapi_voyager/web/component/schema-code-display.js +50 -53
- fastapi_voyager/web/graph-ui.js +90 -101
- fastapi_voyager/web/graphviz.svg.css +10 -10
- fastapi_voyager/web/graphviz.svg.js +306 -316
- fastapi_voyager/web/icon/site.webmanifest +11 -1
- fastapi_voyager/web/index.html +263 -110
- fastapi_voyager/web/store.js +109 -111
- fastapi_voyager/web/vue-main.js +329 -263
- {fastapi_voyager-0.15.0.dist-info → fastapi_voyager-0.15.2.dist-info}/METADATA +16 -4
- {fastapi_voyager-0.15.0.dist-info → fastapi_voyager-0.15.2.dist-info}/RECORD +21 -20
- {fastapi_voyager-0.15.0.dist-info → fastapi_voyager-0.15.2.dist-info}/WHEEL +0 -0
- {fastapi_voyager-0.15.0.dist-info → fastapi_voyager-0.15.2.dist-info}/entry_points.txt +0 -0
- {fastapi_voyager-0.15.0.dist-info → fastapi_voyager-0.15.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const { defineComponent, ref, watch, onMounted } = window.Vue
|
|
1
|
+
const { defineComponent, ref, watch, onMounted } = window.Vue
|
|
2
2
|
|
|
3
3
|
// Component: SchemaCodeDisplay
|
|
4
4
|
// Props:
|
|
@@ -18,55 +18,52 @@ export default defineComponent({
|
|
|
18
18
|
modelValue: { type: Boolean, default: true },
|
|
19
19
|
},
|
|
20
20
|
setup(props, { emit }) {
|
|
21
|
-
const code = ref("")
|
|
22
|
-
const link = ref("")
|
|
23
|
-
const error = ref("")
|
|
24
|
-
const fields = ref([])
|
|
25
|
-
const tab = ref("fields")
|
|
26
|
-
const loading = ref(false)
|
|
27
|
-
|
|
21
|
+
const code = ref("")
|
|
22
|
+
const link = ref("")
|
|
23
|
+
const error = ref("")
|
|
24
|
+
const fields = ref([]) // schema fields list
|
|
25
|
+
const tab = ref("fields")
|
|
26
|
+
const loading = ref(false)
|
|
28
27
|
|
|
29
28
|
async function highlightLater() {
|
|
30
29
|
// wait a tick for DOM update
|
|
31
30
|
requestAnimationFrame(() => {
|
|
32
31
|
try {
|
|
33
32
|
if (window.hljs) {
|
|
34
|
-
const block = document.querySelector(
|
|
35
|
-
".frv-code-display pre code.language-python"
|
|
36
|
-
);
|
|
33
|
+
const block = document.querySelector(".frv-code-display pre code.language-python")
|
|
37
34
|
if (block) {
|
|
38
35
|
// If already highlighted by highlight.js, remove the flag so it can be highlighted again
|
|
39
36
|
if (block.dataset && block.dataset.highlighted) {
|
|
40
|
-
block.removeAttribute("data-highlighted")
|
|
37
|
+
block.removeAttribute("data-highlighted")
|
|
41
38
|
}
|
|
42
|
-
window.hljs.highlightElement(block)
|
|
39
|
+
window.hljs.highlightElement(block)
|
|
43
40
|
}
|
|
44
41
|
}
|
|
45
42
|
} catch (e) {
|
|
46
|
-
console.warn("highlight failed", e)
|
|
43
|
+
console.warn("highlight failed", e)
|
|
47
44
|
}
|
|
48
|
-
})
|
|
45
|
+
})
|
|
49
46
|
}
|
|
50
47
|
|
|
51
48
|
function resetState() {
|
|
52
|
-
code.value = ""
|
|
53
|
-
link.value = ""
|
|
54
|
-
error.value = null
|
|
55
|
-
fields.value = []
|
|
49
|
+
code.value = ""
|
|
50
|
+
link.value = ""
|
|
51
|
+
error.value = null
|
|
52
|
+
fields.value = []
|
|
56
53
|
// tab.value = "fields";
|
|
57
|
-
loading.value = true
|
|
54
|
+
loading.value = true
|
|
58
55
|
}
|
|
59
56
|
|
|
60
57
|
async function loadSource() {
|
|
61
|
-
if (!props.schemaName) return
|
|
58
|
+
if (!props.schemaName) return
|
|
62
59
|
|
|
63
|
-
error.value = null
|
|
64
|
-
code.value = ""
|
|
65
|
-
link.value = ""
|
|
66
|
-
loading.value = true
|
|
60
|
+
error.value = null
|
|
61
|
+
code.value = ""
|
|
62
|
+
link.value = ""
|
|
63
|
+
loading.value = true
|
|
67
64
|
|
|
68
65
|
// try to fetch from server: /source/{schema_name}
|
|
69
|
-
const payload = { schema_name: props.schemaName }
|
|
66
|
+
const payload = { schema_name: props.schemaName }
|
|
70
67
|
try {
|
|
71
68
|
// validate input: ensure we have a non-empty schemaName
|
|
72
69
|
const resp = await fetch(`source`, {
|
|
@@ -76,13 +73,13 @@ export default defineComponent({
|
|
|
76
73
|
"Content-Type": "application/json",
|
|
77
74
|
},
|
|
78
75
|
body: JSON.stringify(payload),
|
|
79
|
-
})
|
|
76
|
+
})
|
|
80
77
|
// surface server-side validation message for bad request
|
|
81
|
-
const data = await resp.json().catch(() => ({}))
|
|
78
|
+
const data = await resp.json().catch(() => ({}))
|
|
82
79
|
if (resp.ok) {
|
|
83
|
-
code.value = data.source_code || "// no source code available"
|
|
80
|
+
code.value = data.source_code || "// no source code available"
|
|
84
81
|
} else {
|
|
85
|
-
error.value = (data && data.error) || "Failed to load source"
|
|
82
|
+
error.value = (data && data.error) || "Failed to load source"
|
|
86
83
|
}
|
|
87
84
|
|
|
88
85
|
const resp2 = await fetch(`vscode-link`, {
|
|
@@ -92,24 +89,24 @@ export default defineComponent({
|
|
|
92
89
|
"Content-Type": "application/json",
|
|
93
90
|
},
|
|
94
91
|
body: JSON.stringify(payload),
|
|
95
|
-
})
|
|
96
|
-
const data2 = await resp2.json().catch(() => ({}))
|
|
92
|
+
})
|
|
93
|
+
const data2 = await resp2.json().catch(() => ({}))
|
|
97
94
|
if (resp2.ok) {
|
|
98
|
-
link.value = data2.link || "// no vscode link available"
|
|
95
|
+
link.value = data2.link || "// no vscode link available"
|
|
99
96
|
} else {
|
|
100
|
-
error.value = (error.value || "") + ((data2 && data2.error) || "Failed to load source")
|
|
97
|
+
error.value = (error.value || "") + ((data2 && data2.error) || "Failed to load source")
|
|
101
98
|
}
|
|
102
99
|
} catch (e) {
|
|
103
|
-
error.value = "Failed to load source"
|
|
100
|
+
error.value = "Failed to load source"
|
|
104
101
|
} finally {
|
|
105
|
-
loading.value = false
|
|
102
|
+
loading.value = false
|
|
106
103
|
}
|
|
107
104
|
|
|
108
|
-
const schema = props.schemas && props.schemas[props.schemaName]
|
|
109
|
-
fields.value = Array.isArray(schema?.fields) ? schema.fields : []
|
|
105
|
+
const schema = props.schemas && props.schemas[props.schemaName]
|
|
106
|
+
fields.value = Array.isArray(schema?.fields) ? schema.fields : []
|
|
110
107
|
|
|
111
108
|
if (tab.value === "source") {
|
|
112
|
-
highlightLater()
|
|
109
|
+
highlightLater()
|
|
113
110
|
}
|
|
114
111
|
}
|
|
115
112
|
|
|
@@ -118,38 +115,38 @@ export default defineComponent({
|
|
|
118
115
|
() => tab.value,
|
|
119
116
|
(val) => {
|
|
120
117
|
if (val === "source") {
|
|
121
|
-
highlightLater()
|
|
118
|
+
highlightLater()
|
|
122
119
|
}
|
|
123
120
|
}
|
|
124
|
-
)
|
|
121
|
+
)
|
|
125
122
|
|
|
126
123
|
watch(
|
|
127
124
|
() => props.schemaName,
|
|
128
125
|
() => {
|
|
129
|
-
resetState()
|
|
130
|
-
loadSource()
|
|
131
|
-
}
|
|
132
|
-
)
|
|
126
|
+
resetState()
|
|
127
|
+
loadSource()
|
|
128
|
+
}
|
|
129
|
+
)
|
|
133
130
|
|
|
134
131
|
// respond to visibility changes: when shown, clear old data and reload
|
|
135
132
|
watch(
|
|
136
133
|
() => props.modelValue,
|
|
137
134
|
(val) => {
|
|
138
135
|
if (val) {
|
|
139
|
-
resetState()
|
|
140
|
-
loadSource()
|
|
136
|
+
resetState()
|
|
137
|
+
loadSource()
|
|
141
138
|
}
|
|
142
139
|
}
|
|
143
|
-
)
|
|
140
|
+
)
|
|
144
141
|
|
|
145
142
|
onMounted(() => {
|
|
146
143
|
if (props.modelValue) {
|
|
147
|
-
resetState()
|
|
148
|
-
loadSource()
|
|
144
|
+
resetState()
|
|
145
|
+
loadSource()
|
|
149
146
|
}
|
|
150
|
-
})
|
|
147
|
+
})
|
|
151
148
|
|
|
152
|
-
return { link, code, error, fields, tab, loading }
|
|
149
|
+
return { link, code, error, fields, tab, loading }
|
|
153
150
|
},
|
|
154
151
|
template: `
|
|
155
152
|
<div class="frv-code-display" style="border: 1px solid #ccc; border-left: none; position:relative; height:100%; background:#fff;">
|
|
@@ -203,4 +200,4 @@ export default defineComponent({
|
|
|
203
200
|
</div>
|
|
204
201
|
</div>
|
|
205
202
|
`,
|
|
206
|
-
})
|
|
203
|
+
})
|
fastapi_voyager/web/graph-ui.js
CHANGED
|
@@ -1,193 +1,182 @@
|
|
|
1
1
|
export class GraphUI {
|
|
2
2
|
constructor(selector = "#graph", options = {}) {
|
|
3
|
-
this.selector = selector
|
|
4
|
-
this.options = options
|
|
5
|
-
this.graphviz = d3.select(this.selector).graphviz()
|
|
3
|
+
this.selector = selector
|
|
4
|
+
this.options = options // e.g. { onSchemaClick: (name) => {} }
|
|
5
|
+
this.graphviz = d3.select(this.selector).graphviz()
|
|
6
6
|
|
|
7
|
-
this.gv = null
|
|
8
|
-
this.currentSelection = []
|
|
9
|
-
this._init()
|
|
7
|
+
this.gv = null
|
|
8
|
+
this.currentSelection = []
|
|
9
|
+
this._init()
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
_highlight(mode = "bidirectional") {
|
|
13
|
-
let highlightedNodes = $()
|
|
13
|
+
let highlightedNodes = $()
|
|
14
14
|
for (const selection of this.currentSelection) {
|
|
15
|
-
const nodes = this._getAffectedNodes(selection.set, mode)
|
|
16
|
-
highlightedNodes = highlightedNodes.add(nodes)
|
|
15
|
+
const nodes = this._getAffectedNodes(selection.set, mode)
|
|
16
|
+
highlightedNodes = highlightedNodes.add(nodes)
|
|
17
17
|
}
|
|
18
18
|
if (this.gv) {
|
|
19
|
-
this.gv.highlight(highlightedNodes, true)
|
|
20
|
-
this.gv.bringToFront(highlightedNodes)
|
|
19
|
+
this.gv.highlight(highlightedNodes, true)
|
|
20
|
+
this.gv.bringToFront(highlightedNodes)
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
_highlightEdgeNodes() {
|
|
25
|
-
let highlightedNodes = $()
|
|
25
|
+
let highlightedNodes = $()
|
|
26
26
|
const [up, down, edge] = this.currentSelection
|
|
27
|
-
highlightedNodes = highlightedNodes.add(
|
|
28
|
-
|
|
29
|
-
);
|
|
30
|
-
highlightedNodes = highlightedNodes.add(
|
|
31
|
-
this._getAffectedNodes(down.set, down.direction)
|
|
32
|
-
);
|
|
27
|
+
highlightedNodes = highlightedNodes.add(this._getAffectedNodes(up.set, up.direction))
|
|
28
|
+
highlightedNodes = highlightedNodes.add(this._getAffectedNodes(down.set, down.direction))
|
|
33
29
|
highlightedNodes = highlightedNodes.add(edge.set)
|
|
34
30
|
if (this.gv) {
|
|
35
|
-
this.gv.highlight(highlightedNodes, true)
|
|
36
|
-
this.gv.bringToFront(highlightedNodes)
|
|
31
|
+
this.gv.highlight(highlightedNodes, true)
|
|
32
|
+
this.gv.bringToFront(highlightedNodes)
|
|
37
33
|
}
|
|
38
34
|
}
|
|
39
35
|
|
|
40
36
|
_getAffectedNodes($set, mode = "bidirectional") {
|
|
41
|
-
let $result = $().add($set)
|
|
37
|
+
let $result = $().add($set)
|
|
42
38
|
if (mode === "bidirectional" || mode === "downstream") {
|
|
43
39
|
$set.each((i, el) => {
|
|
44
40
|
if (el.className.baseVal === "edge") {
|
|
45
|
-
const edge = $(el).data("name")
|
|
46
|
-
const nodes = this.gv.nodesByName()
|
|
47
|
-
const downStreamNode = edge.split("->")[1]
|
|
41
|
+
const edge = $(el).data("name")
|
|
42
|
+
const nodes = this.gv.nodesByName()
|
|
43
|
+
const downStreamNode = edge.split("->")[1]
|
|
48
44
|
if (downStreamNode) {
|
|
49
|
-
$result.push(nodes[downStreamNode])
|
|
50
|
-
$result = $result.add(
|
|
51
|
-
this.gv.linkedFrom(nodes[downStreamNode], true)
|
|
52
|
-
);
|
|
45
|
+
$result.push(nodes[downStreamNode])
|
|
46
|
+
$result = $result.add(this.gv.linkedFrom(nodes[downStreamNode], true))
|
|
53
47
|
}
|
|
54
48
|
} else {
|
|
55
|
-
$result = $result.add(this.gv.linkedFrom(el, true))
|
|
49
|
+
$result = $result.add(this.gv.linkedFrom(el, true))
|
|
56
50
|
}
|
|
57
|
-
})
|
|
51
|
+
})
|
|
58
52
|
}
|
|
59
53
|
if (mode === "bidirectional" || mode === "upstream") {
|
|
60
54
|
$set.each((i, el) => {
|
|
61
55
|
if (el.className.baseVal === "edge") {
|
|
62
|
-
const edge = $(el).data("name")
|
|
63
|
-
const nodes = this.gv.nodesByName()
|
|
64
|
-
const upStreamNode = edge.split("->")[0]
|
|
56
|
+
const edge = $(el).data("name")
|
|
57
|
+
const nodes = this.gv.nodesByName()
|
|
58
|
+
const upStreamNode = edge.split("->")[0]
|
|
65
59
|
if (upStreamNode) {
|
|
66
|
-
$result.push(nodes[upStreamNode])
|
|
67
|
-
$result = $result.add(this.gv.linkedTo(nodes[upStreamNode], true))
|
|
60
|
+
$result.push(nodes[upStreamNode])
|
|
61
|
+
$result = $result.add(this.gv.linkedTo(nodes[upStreamNode], true))
|
|
68
62
|
}
|
|
69
63
|
} else {
|
|
70
|
-
$result = $result.add(this.gv.linkedTo(el, true))
|
|
64
|
+
$result = $result.add(this.gv.linkedTo(el, true))
|
|
71
65
|
}
|
|
72
|
-
})
|
|
66
|
+
})
|
|
73
67
|
}
|
|
74
|
-
return $result
|
|
68
|
+
return $result
|
|
75
69
|
}
|
|
76
70
|
|
|
77
71
|
highlightSchemaBanner(node) {
|
|
78
|
-
const polygons = node.querySelectorAll("polygon")
|
|
79
|
-
const ele = polygons[2]
|
|
72
|
+
const polygons = node.querySelectorAll("polygon")
|
|
73
|
+
const ele = polygons[2] // select the second polygon
|
|
80
74
|
if (ele) {
|
|
81
|
-
ele.setAttribute(
|
|
75
|
+
ele.setAttribute("stroke-width", "3.5")
|
|
82
76
|
}
|
|
83
77
|
}
|
|
84
78
|
|
|
85
|
-
|
|
86
79
|
_init() {
|
|
87
|
-
const self = this
|
|
80
|
+
const self = this
|
|
88
81
|
$(this.selector).graphviz({
|
|
89
82
|
shrink: null,
|
|
90
83
|
zoom: false,
|
|
91
84
|
ready: function () {
|
|
92
|
-
self.gv = this
|
|
85
|
+
self.gv = this
|
|
93
86
|
|
|
94
|
-
const nodes = self.gv.nodes()
|
|
95
|
-
const edges = self.gv.edges()
|
|
87
|
+
const nodes = self.gv.nodes()
|
|
88
|
+
const edges = self.gv.edges()
|
|
96
89
|
|
|
97
|
-
nodes.off(".graphui")
|
|
98
|
-
edges.off(".graphui")
|
|
90
|
+
nodes.off(".graphui")
|
|
91
|
+
edges.off(".graphui")
|
|
99
92
|
|
|
100
93
|
nodes.on("dblclick.graphui", function (event) {
|
|
101
|
-
event.stopPropagation()
|
|
94
|
+
event.stopPropagation()
|
|
102
95
|
try {
|
|
103
96
|
self.highlightSchemaBanner(this)
|
|
104
|
-
} catch(e) {
|
|
97
|
+
} catch (e) {
|
|
105
98
|
console.log(e)
|
|
106
99
|
}
|
|
107
|
-
const set = $()
|
|
108
|
-
set.push(this)
|
|
109
|
-
const schemaName = event.currentTarget.dataset.name
|
|
100
|
+
const set = $()
|
|
101
|
+
set.push(this)
|
|
102
|
+
const schemaName = event.currentTarget.dataset.name
|
|
110
103
|
if (schemaName) {
|
|
111
104
|
try {
|
|
112
|
-
self.options.onSchemaClick(schemaName)
|
|
105
|
+
self.options.onSchemaClick(schemaName)
|
|
113
106
|
} catch (e) {
|
|
114
|
-
console.warn("onSchemaClick callback failed", e)
|
|
107
|
+
console.warn("onSchemaClick callback failed", e)
|
|
115
108
|
}
|
|
116
109
|
}
|
|
117
|
-
})
|
|
110
|
+
})
|
|
118
111
|
|
|
119
112
|
edges.on("click.graphui", function (event) {
|
|
120
|
-
const up = $()
|
|
121
|
-
const down = $()
|
|
122
|
-
const edge = $()
|
|
123
|
-
const [upStreamNode, downStreamNode] = event.currentTarget.dataset.name.split("->")
|
|
124
|
-
const nodes = self.gv.nodesByName()
|
|
125
|
-
up.push(nodes[upStreamNode])
|
|
126
|
-
down.push(nodes[downStreamNode])
|
|
113
|
+
const up = $()
|
|
114
|
+
const down = $()
|
|
115
|
+
const edge = $()
|
|
116
|
+
const [upStreamNode, downStreamNode] = event.currentTarget.dataset.name.split("->")
|
|
117
|
+
const nodes = self.gv.nodesByName()
|
|
118
|
+
up.push(nodes[upStreamNode])
|
|
119
|
+
down.push(nodes[downStreamNode])
|
|
127
120
|
edge.push(this)
|
|
128
|
-
const upObj = { set: up, direction: "upstream" }
|
|
129
|
-
const downObj = { set: down, direction: "downstream" }
|
|
130
|
-
const edgeOjb = { set: edge, direction: "single"}
|
|
131
|
-
self.currentSelection = [upObj, downObj, edgeOjb]
|
|
121
|
+
const upObj = { set: up, direction: "upstream" }
|
|
122
|
+
const downObj = { set: down, direction: "downstream" }
|
|
123
|
+
const edgeOjb = { set: edge, direction: "single" }
|
|
124
|
+
self.currentSelection = [upObj, downObj, edgeOjb]
|
|
132
125
|
|
|
133
|
-
self._highlightEdgeNodes()
|
|
126
|
+
self._highlightEdgeNodes()
|
|
134
127
|
})
|
|
135
128
|
|
|
136
129
|
nodes.on("click.graphui", function (event) {
|
|
137
|
-
const set = $()
|
|
138
|
-
set.push(this)
|
|
139
|
-
const obj = { set, direction: "bidirectional" }
|
|
130
|
+
const set = $()
|
|
131
|
+
set.push(this)
|
|
132
|
+
const obj = { set, direction: "bidirectional" }
|
|
140
133
|
|
|
141
|
-
const schemaName = event.currentTarget.dataset.name
|
|
142
|
-
console.log("shift click detected")
|
|
134
|
+
const schemaName = event.currentTarget.dataset.name
|
|
135
|
+
console.log("shift click detected")
|
|
143
136
|
if (event.shiftKey && self.options.onSchemaShiftClick) {
|
|
144
137
|
if (schemaName) {
|
|
145
138
|
try {
|
|
146
|
-
self.options.onSchemaShiftClick(schemaName)
|
|
139
|
+
self.options.onSchemaShiftClick(schemaName)
|
|
147
140
|
} catch (e) {
|
|
148
|
-
console.warn("onSchemaShiftClick callback failed", e)
|
|
141
|
+
console.warn("onSchemaShiftClick callback failed", e)
|
|
149
142
|
}
|
|
150
143
|
}
|
|
151
144
|
} else {
|
|
152
|
-
self.currentSelection = [obj]
|
|
153
|
-
self._highlight()
|
|
145
|
+
self.currentSelection = [obj]
|
|
146
|
+
self._highlight()
|
|
154
147
|
}
|
|
155
|
-
})
|
|
148
|
+
})
|
|
156
149
|
|
|
157
150
|
$(document)
|
|
158
151
|
.off("click.graphui")
|
|
159
152
|
.on("click.graphui", function (evt) {
|
|
160
153
|
// if outside container, do nothing
|
|
161
|
-
const graphContainer = $(self.selector)[0]
|
|
162
|
-
if (
|
|
163
|
-
|
|
164
|
-
!evt.target ||
|
|
165
|
-
!graphContainer.contains(evt.target)
|
|
166
|
-
) {
|
|
167
|
-
return;
|
|
154
|
+
const graphContainer = $(self.selector)[0]
|
|
155
|
+
if (!graphContainer || !evt.target || !graphContainer.contains(evt.target)) {
|
|
156
|
+
return
|
|
168
157
|
}
|
|
169
158
|
|
|
170
|
-
let isNode = false
|
|
171
|
-
const $everything = self.gv.$nodes.add(self.gv.$edges).add(self.gv.$clusters)
|
|
172
|
-
const node = evt.target.parentNode
|
|
159
|
+
let isNode = false
|
|
160
|
+
const $everything = self.gv.$nodes.add(self.gv.$edges).add(self.gv.$clusters)
|
|
161
|
+
const node = evt.target.parentNode
|
|
173
162
|
$everything.each(function () {
|
|
174
163
|
if (this === node) {
|
|
175
|
-
isNode = true
|
|
164
|
+
isNode = true
|
|
176
165
|
}
|
|
177
|
-
})
|
|
166
|
+
})
|
|
178
167
|
if (!isNode && self.gv) {
|
|
179
|
-
self.gv.highlight()
|
|
168
|
+
self.gv.highlight()
|
|
180
169
|
if (self.options.resetCb) {
|
|
181
|
-
self.options.resetCb()
|
|
170
|
+
self.options.resetCb()
|
|
182
171
|
}
|
|
183
172
|
}
|
|
184
|
-
})
|
|
173
|
+
})
|
|
185
174
|
},
|
|
186
|
-
})
|
|
175
|
+
})
|
|
187
176
|
}
|
|
188
177
|
|
|
189
178
|
async render(dotSrc, resetZoom = true) {
|
|
190
|
-
const height = this.options.height || "100%"
|
|
179
|
+
const height = this.options.height || "100%"
|
|
191
180
|
return new Promise((resolve, reject) => {
|
|
192
181
|
try {
|
|
193
182
|
this.graphviz
|
|
@@ -201,13 +190,13 @@ export class GraphUI {
|
|
|
201
190
|
.fit(true)
|
|
202
191
|
.renderDot(dotSrc)
|
|
203
192
|
.on("end", () => {
|
|
204
|
-
$(this.selector).data("graphviz.svg").setup()
|
|
205
|
-
if (resetZoom) this.graphviz.resetZoom()
|
|
206
|
-
resolve()
|
|
207
|
-
})
|
|
193
|
+
$(this.selector).data("graphviz.svg").setup()
|
|
194
|
+
if (resetZoom) this.graphviz.resetZoom()
|
|
195
|
+
resolve()
|
|
196
|
+
})
|
|
208
197
|
} catch (err) {
|
|
209
|
-
reject(err)
|
|
198
|
+
reject(err)
|
|
210
199
|
}
|
|
211
|
-
})
|
|
200
|
+
})
|
|
212
201
|
}
|
|
213
202
|
}
|
|
@@ -22,21 +22,21 @@
|
|
|
22
22
|
|
|
23
23
|
/* this element needs tooltip positioning to work */
|
|
24
24
|
.graphviz-svg {
|
|
25
|
-
|
|
25
|
+
position: relative;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/* stop tooltips wrapping */
|
|
29
29
|
.graphviz-svg .tooltip-inner {
|
|
30
|
-
|
|
30
|
+
white-space: nowrap;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/* stop people selecting text on nodes */
|
|
34
34
|
.graphviz-svg text {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
35
|
+
-webkit-touch-callout: none;
|
|
36
|
+
-webkit-user-select: none;
|
|
37
|
+
-khtml-user-select: none;
|
|
38
|
+
-moz-user-select: none;
|
|
39
|
+
-ms-user-select: none;
|
|
40
|
+
user-select: none;
|
|
41
|
+
cursor: default;
|
|
42
|
+
}
|