Skip to content

Commit 7b5988a

Browse files
committed
added global debug connections menu
SQUASHED: AUTO-COMMIT-src-client-contextmenu.js,AUTO-COMMIT-src-components-halo-Connection.js,
1 parent c89d772 commit 7b5988a

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

src/client/contextmenu.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import Favorites from "src/client/favorites.js"
2121
import { applicationFolder } from 'src/client/vivide/utils.js';
2222
import { createView } from 'src/client/vivide/scripts/loading.js';
2323
import SearchRoots from "src/client/search-roots.js"
24+
import Connection from "src/components/halo/Connection.js";
2425

2526
// import lively from './lively.js'; #TODO resinsert after we support cycles again
2627

@@ -330,6 +331,19 @@ export default class ContextMenu {
330331

331332
// #important
332333
static worldMenuItems(worldContext) {
334+
335+
let connections = []
336+
Connection.allConnections.forEach(connection => {
337+
connections.push(connection)
338+
})
339+
let existingConnectionsMenu = connections.map(connection => [connection.getFullLabel(),
340+
async () => {
341+
let editor = await lively.openComponentInWindow('lively-connection-editor')
342+
lively.setExtent(editor.parentElement, lively.pt(800, 50))
343+
editor.setConnection(connection)
344+
}]);
345+
346+
333347
var items = [
334348
["Workspace", evt => {
335349
this.hide();
@@ -611,6 +625,13 @@ export default class ContextMenu {
611625
}
612626
}]]), undefined, '<i class="fa fa-window-restore" aria-hidden="true"></i>'
613627
],
628+
[
629+
"Debug", [
630+
['Connections', existingConnectionsMenu, '', '<i class="fa fa-arrow-right" aria-hidden="true"></i>']
631+
632+
], undefined, '<i class="fa fa-bug" aria-hidden="true"></i>'
633+
],
634+
614635
["View", [
615636
["Reset View", () => ViewNav.resetView(),
616637
"",'<i class="fa fa-window-restore" aria-hidden="true"></i>'],

src/components/halo/Connection.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,17 @@ export default class Connection {
322322
getLabel() {
323323
return this._sourceProperty + "⇨" + this._targetProperty
324324
}
325+
326+
getFullLabel() {
327+
try {
328+
return lively.elementToCSSName(this.getSource()) + " " + this._sourceProperty +
329+
"⇨" + lively.elementToCSSName(this.getTarget()) + " "+ this._targetProperty
330+
} catch(e) {
331+
return this.getLabel()
332+
}
333+
334+
}
335+
325336

326337
setLabel(string) {
327338
this.label = string // not used...

0 commit comments

Comments
 (0)