Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
39da6b8c
Commit
39da6b8c
authored
Dec 09, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
openNodeDialog method invokes startService of sub_gadgets if the have any. Minor clean up
parent
bd74f965
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
53 deletions
+31
-53
dream/platform/src/jsplumb/jsplumb.js
dream/platform/src/jsplumb/jsplumb.js
+31
-53
No files found.
dream/platform/src/jsplumb/jsplumb.js
View file @
39da6b8c
...
@@ -97,17 +97,11 @@
...
@@ -97,17 +97,11 @@
// returns the ID of the node in the graph from its DOM element id
// returns the ID of the node in the graph from its DOM element id
var
node_id
;
var
node_id
;
$
.
each
(
gadget
.
props
.
node_id_to_dom_element_id
,
function
(
k
,
v
)
{
$
.
each
(
gadget
.
props
.
node_id_to_dom_element_id
,
function
(
k
,
v
)
{
console
.
log
(
k
);
console
.
log
(
v
);
console
.
log
(
element_id
);
if
(
v
===
element_id
)
{
if
(
v
===
element_id
)
{
node_id
=
k
;
node_id
=
k
;
return
false
;
return
false
;
}
}
});
});
console
.
log
(
"
getNODEID 2
"
);
console
.
log
(
node_id
);
console
.
log
(
gadget
.
props
.
data
.
graph
.
node
);
return
node_id
;
return
node_id
;
}
}
...
@@ -120,7 +114,6 @@
...
@@ -120,7 +114,6 @@
while
(
gadget
.
props
.
data
.
graph
.
node
[
id
+
n
]
!==
undefined
)
{
while
(
gadget
.
props
.
data
.
graph
.
node
[
id
+
n
]
!==
undefined
)
{
n
+=
1
;
n
+=
1
;
}
}
console
.
log
(
"
generateNODEID 2
"
);
return
id
+
n
;
return
id
+
n
;
}
}
...
@@ -192,10 +185,8 @@
...
@@ -192,10 +185,8 @@
element
,
element
,
relative_position
;
relative_position
;
console
.
log
(
"
updateELEMENTCOORDINATE 2
"
);
if
(
coordinate
===
undefined
)
{
if
(
coordinate
===
undefined
)
{
element
=
$
(
gadget
.
props
.
element
).
find
(
"
#
"
+
element_id
);
element
=
$
(
gadget
.
props
.
element
).
find
(
"
#
"
+
element_id
);
console
.
log
(
"
updateELEMENTCOORDINATE 3
"
);
relative_position
=
convertToRelativePosition
(
relative_position
=
convertToRelativePosition
(
gadget
,
gadget
,
element
.
css
(
'
left
'
),
element
.
css
(
'
left
'
),
...
@@ -205,12 +196,10 @@
...
@@ -205,12 +196,10 @@
left
:
relative_position
[
0
],
left
:
relative_position
[
0
],
top
:
relative_position
[
1
]
top
:
relative_position
[
1
]
};
};
console
.
log
(
"
updateELEMENTCOORDINATE 4
"
);
}
}
gadget
.
props
.
data
.
graph
.
node
[
node_id
].
coordinate
=
coordinate
;
gadget
.
props
.
data
.
graph
.
node
[
node_id
].
coordinate
=
coordinate
;
gadget
.
notifyDataChanged
();
gadget
.
notifyDataChanged
();
console
.
log
(
"
updateELEMENTCOORDINATE 5
"
);
return
coordinate
;
return
coordinate
;
}
}
...
@@ -297,12 +286,10 @@
...
@@ -297,12 +286,10 @@
gadget
.
props
.
jsplumb_instance
.
removeAllEndpoints
(
gadget
.
props
.
jsplumb_instance
.
removeAllEndpoints
(
$
(
gadget
.
props
.
element
).
find
(
"
#
"
+
element_id
)
$
(
gadget
.
props
.
element
).
find
(
"
#
"
+
element_id
)
);
);
console
.
log
(
"
removeELEMENT 2
"
);
$
(
gadget
.
props
.
element
).
find
(
"
#
"
+
element_id
).
remove
();
$
(
gadget
.
props
.
element
).
find
(
"
#
"
+
element_id
).
remove
();
delete
gadget
.
props
.
data
.
graph
.
node
[
node_id
];
delete
gadget
.
props
.
data
.
graph
.
node
[
node_id
];
delete
gadget
.
props
.
node_id_to_dom_element_id
[
node_id
];
delete
gadget
.
props
.
node_id_to_dom_element_id
[
node_id
];
console
.
log
(
"
removeELEMENT 3
"
);
//$.each(gadget.props.data.graph.main_graph.node, function (k, v) {
//$.each(gadget.props.data.graph.main_graph.node, function (k, v) {
$
.
each
(
gadget
.
props
.
data
.
graph
.
edge
,
function
(
k
,
v
)
{
$
.
each
(
gadget
.
props
.
data
.
graph
.
edge
,
function
(
k
,
v
)
{
if
(
node_id
===
v
.
source
||
node_id
===
v
.
destination
)
{
if
(
node_id
===
v
.
source
||
node_id
===
v
.
destination
)
{
...
@@ -316,10 +303,6 @@
...
@@ -316,10 +303,6 @@
function
updateElementData
(
gadget
,
node_id
,
data
)
{
function
updateElementData
(
gadget
,
node_id
,
data
)
{
console
.
log
(
"
updateELEMENTDATA 1
"
);
console
.
log
(
"
updateELEMENTDATA 1
"
);
console
.
log
(
"
updateELEMENTDATA 1
"
);
console
.
log
(
gadget
);
console
.
log
(
node_id
);
console
.
log
(
data
);
var
element_id
=
gadget
.
props
.
node_id_to_dom_element_id
[
node_id
],
var
element_id
=
gadget
.
props
.
node_id_to_dom_element_id
[
node_id
],
new_id
=
data
.
id
;
new_id
=
data
.
id
;
if
(
data
.
data
.
name
)
{
if
(
data
.
data
.
name
)
{
...
@@ -328,22 +311,18 @@
...
@@ -328,22 +311,18 @@
.
append
(
'
<div class="ep"></div></div>
'
);
.
append
(
'
<div class="ep"></div></div>
'
);
gadget
.
props
.
data
.
graph
.
node
[
node_id
].
name
=
data
.
data
.
name
;
gadget
.
props
.
data
.
graph
.
node
[
node_id
].
name
=
data
.
data
.
name
;
}
}
console
.
log
(
"
updateELEMENTDATA 2
"
);
delete
data
.
id
;
delete
data
.
id
;
//$.extend(gadget.props.data.graph.main_graph.node[node_id], data.data);
//$.extend(gadget.props.data.graph.main_graph.node[node_id], data.data);
console
.
log
(
"
updateELEMENTDATA 3
"
);
$
.
extend
(
gadget
.
props
.
data
.
graph
.
node
[
node_id
],
data
.
data
);
$
.
extend
(
gadget
.
props
.
data
.
graph
.
node
[
node_id
],
data
.
data
);
if
(
new_id
&&
new_id
!==
node_id
)
{
if
(
new_id
&&
new_id
!==
node_id
)
{
gadget
.
props
.
data
.
graph
.
node
[
new_id
]
gadget
.
props
.
data
.
graph
.
node
[
new_id
]
=
gadget
.
props
.
data
.
graph
.
node
[
node_id
];
=
gadget
.
props
.
data
.
graph
.
node
[
node_id
];
delete
gadget
.
props
.
data
.
graph
.
node
[
node_id
];
delete
gadget
.
props
.
data
.
graph
.
node
[
node_id
];
console
.
log
(
"
updateELEMENTDATA 4
"
);
gadget
.
props
.
node_id_to_dom_element_id
[
new_id
]
gadget
.
props
.
node_id_to_dom_element_id
[
new_id
]
=
gadget
.
props
.
node_id_to_dom_element_id
[
node_id
];
=
gadget
.
props
.
node_id_to_dom_element_id
[
node_id
];
delete
gadget
.
props
.
node_id_to_dom_element_id
[
node_id
];
delete
gadget
.
props
.
node_id_to_dom_element_id
[
node_id
];
console
.
log
(
"
updateELEMENTDATA 5
"
);
//delete gadget.props.data.graph.main_graph.node[new_id].id;
//delete gadget.props.data.graph.main_graph.node[new_id].id;
//$.each(gadget.props.data.graph.main_graph.node, function (k, v) {
//$.each(gadget.props.data.graph.main_graph.node, function (k, v) {
delete
gadget
.
props
.
data
.
graph
.
node
[
new_id
].
id
;
delete
gadget
.
props
.
data
.
graph
.
node
[
new_id
].
id
;
...
@@ -355,7 +334,6 @@
...
@@ -355,7 +334,6 @@
v
.
destination
=
new_id
;
v
.
destination
=
new_id
;
}
}
});
});
console
.
log
(
"
updateELEMENTDATA 6
"
);
}
}
console
.
log
(
"
updateELEMENTDATA 7
"
);
console
.
log
(
"
updateELEMENTDATA 7
"
);
gadget
.
notifyDataChanged
();
gadget
.
notifyDataChanged
();
...
@@ -609,7 +587,6 @@
...
@@ -609,7 +587,6 @@
delete_promise
;
delete_promise
;
// If we have no definition for this, we do not allow edition.
// If we have no definition for this, we do not allow edition.
console
.
log
(
"
openNODEDIALOG 1.1
"
);
//TODO: node_data._class may not exist
//TODO: node_data._class may not exist
if
(
gadget
.
props
.
data
.
class_definition
[
node_data
.
_class
]
===
undefined
)
{
if
(
gadget
.
props
.
data
.
class_definition
[
node_data
.
_class
]
===
undefined
)
{
return
;
return
;
...
@@ -624,7 +601,6 @@
...
@@ -624,7 +601,6 @@
node_edit_popup
.
remove
();
node_edit_popup
.
remove
();
}
}
console
.
log
(
"
openNODEDIALOG 1.2
"
);
gadget
.
props
.
element
.
appendChild
(
gadget
.
props
.
element
.
appendChild
(
document
.
importNode
(
popup_edit_template
.
content
,
true
).
children
[
0
]
document
.
importNode
(
popup_edit_template
.
content
,
true
).
children
[
0
]
);
);
...
@@ -638,15 +614,11 @@
...
@@ -638,15 +614,11 @@
console
.
log
(
node_edit_popup
.
find
(
"
.node_class
"
).
text
(
node_data
.
_class
));
console
.
log
(
node_edit_popup
.
find
(
"
.node_class
"
).
text
(
node_data
.
_class
));
// Set the name of the popup to the node class
// Set the name of the popup to the node class
node_edit_popup
.
find
(
'
.node_class
'
).
text
(
node_data
.
_class
);
node_edit_popup
.
find
(
'
.node_class
'
).
text
(
node_data
.
_class
);
console
.
log
(
"
openNODEDIALOG 1.4
"
);
fieldset_element
=
node_edit_popup
.
find
(
'
fieldset
'
)[
0
];
fieldset_element
=
node_edit_popup
.
find
(
'
fieldset
'
)[
0
];
console
.
log
(
"
openNODEDIALOG 1.5
"
);
node_edit_popup
.
popup
();
node_edit_popup
.
popup
();
console
.
log
(
"
openNODEDIALOG 1.6
"
);
node_data
.
id
=
node_id
;
// XXX
node_data
.
id
=
node_id
;
// XXX
console
.
log
(
"
openNODEDIALOG 2
"
);
function
save_promise
(
fieldset_gadget
,
node_id
)
{
function
save_promise
(
fieldset_gadget
,
node_id
)
{
return
RSVP
.
Queue
()
return
RSVP
.
Queue
()
.
push
(
function
()
{
.
push
(
function
()
{
...
@@ -698,7 +670,7 @@
...
@@ -698,7 +670,7 @@
console
.
log
(
"
^^^^^^^^^^^^^^^^^^^
"
);
console
.
log
(
"
^^^^^^^^^^^^^^^^^^^
"
);
console
.
log
(
"
^^^^^^^^^^^^^^^^^^^
"
);
console
.
log
(
"
^^^^^^^^^^^^^^^^^^^
"
);
console
.
log
(
"
^^^^^^^^^^^^^^^^^^^
"
);
console
.
log
(
"
^^^^^^^^^^^^^^^^^^^
"
);
console
.
log
(
node_data
);
console
.
log
(
fieldset_gadget
);
console
.
log
(
"
^^^^^^^^^^^^^^^^^^^
"
);
console
.
log
(
"
^^^^^^^^^^^^^^^^^^^
"
);
console
.
log
(
"
^^^^^^^^^^^^^^^^^^^
"
);
console
.
log
(
"
^^^^^^^^^^^^^^^^^^^
"
);
console
.
log
(
"
^^^^^^^^^^^^^^^^^^^
"
);
console
.
log
(
"
^^^^^^^^^^^^^^^^^^^
"
);
...
@@ -708,13 +680,36 @@
...
@@ -708,13 +680,36 @@
node_id
)]);
node_id
)]);
})
})
.
push
(
function
(
fieldset_gadget
)
{
.
push
(
function
(
fieldset_gadget
)
{
console
.
log
(
fieldset_gadget
[
0
]);
return
RSVP
.
Queue
()
.
push
(
function
()
{
console
.
log
(
fieldset_gadget
[
0
]);
fieldset_gadget
[
0
].
startService
();
})
.
push
(
function
()
{
console
.
log
(
"
:::::::::::::::::::
"
);
console
.
log
(
"
:::::::::::::::::::
"
);
console
.
log
(
"
:::::::::::::::::::
"
);
console
.
log
(
fieldset_gadget
);
console
.
log
(
"
:::::::::::::::::::
"
);
console
.
log
(
"
:::::::::::::::::::
"
);
console
.
log
(
"
:::::::::::::::::::
"
);
node_edit_popup
.
enhanceWithin
();
node_edit_popup
.
enhanceWithin
();
node_edit_popup
.
popup
(
'
open
'
);
node_edit_popup
.
popup
(
'
open
'
);
return
fieldset_gadget
[
0
];
return
fieldset_gadget
[
0
];
});
})
})
.
push
(
function
(
fieldset_gadget
)
{
.
push
(
function
(
fieldset_gadget
)
{
// Expose the dialog handling promise so that we can wait for it in
// Expose the dialog handling promise so that we can wait for it in
// test.
// test.
console
.
log
(
"
:::::::::::::::::::2
"
);
console
.
log
(
"
:::::::::::::::::::2
"
);
console
.
log
(
"
:::::::::::::::::::2
"
);
console
.
log
(
fieldset_gadget
);
// gadget.props.field_gadget_list.push(field_gadget_list);
console
.
log
(
"
:::::::::::::::::::2
"
);
console
.
log
(
"
:::::::::::::::::::2
"
);
console
.
log
(
"
:::::::::::::::::::2
"
);
gadget
.
props
.
dialog_promise
=
RSVP
.
any
([
gadget
.
props
.
dialog_promise
=
RSVP
.
any
([
save_promise
(
fieldset_gadget
,
node_id
),
save_promise
(
fieldset_gadget
,
node_id
),
delete_promise
delete_promise
...
@@ -762,7 +757,6 @@
...
@@ -762,7 +757,6 @@
function
addNode
(
gadget
,
node_id
,
node_data
)
{
function
addNode
(
gadget
,
node_id
,
node_data
)
{
console
.
log
(
"
addNODE 0
"
);
console
.
log
(
"
addNODE 0
"
);
console
.
log
(
node_data
);
var
render_element
=
$
(
gadget
.
props
.
main
),
var
render_element
=
$
(
gadget
.
props
.
main
),
class_definition
=
gadget
.
props
.
data
.
class_definition
[
node_data
.
_class
],
class_definition
=
gadget
.
props
.
data
.
class_definition
[
node_data
.
_class
],
coordinate
=
node_data
.
coordinate
,
coordinate
=
node_data
.
coordinate
,
...
@@ -771,30 +765,22 @@
...
@@ -771,30 +765,22 @@
absolute_position
,
absolute_position
,
domElement
;
domElement
;
console
.
log
(
"
addNODE 1
"
);
dom_element_id
=
generateDomElementId
(
gadget
.
props
.
element
);
dom_element_id
=
generateDomElementId
(
gadget
.
props
.
element
);
gadget
.
props
.
node_id_to_dom_element_id
[
node_id
]
=
dom_element_id
;
gadget
.
props
.
node_id_to_dom_element_id
[
node_id
]
=
dom_element_id
;
console
.
log
(
"
addNODE 2
"
);
node_data
.
name
=
node_data
.
name
||
class_definition
.
name
;
node_data
.
name
=
node_data
.
name
||
class_definition
.
name
;
console
.
log
(
"
addNODE 2.5
"
);
//gadget.props.data.graph.main_graph.node[node_id] = node_data;
//gadget.props.data.graph.main_graph.node[node_id] = node_data;
gadget
.
props
.
data
.
graph
.
node
[
node_id
]
=
node_data
;
gadget
.
props
.
data
.
graph
.
node
[
node_id
]
=
node_data
;
console
.
log
(
"
addNODE 3
"
);
if
(
coordinate
===
undefined
)
{
if
(
coordinate
===
undefined
)
{
coordinate
=
{
top
:
0
,
left
:
0
};
coordinate
=
{
top
:
0
,
left
:
0
};
}
}
console
.
log
(
"
addNODE 4
"
);
node_data
.
coordinate
=
updateElementCoordinate
(
node_data
.
coordinate
=
updateElementCoordinate
(
gadget
,
gadget
,
node_id
,
node_id
,
coordinate
coordinate
);
);
console
.
log
(
"
addNODE 4.5
"
);
console
.
log
(
node_data
);
// XXX make node template an option, or use CSS from class_definition
// XXX make node template an option, or use CSS from class_definition
/*jslint nomen: true*/
/*jslint nomen: true*/
...
@@ -808,7 +794,6 @@
...
@@ -808,7 +794,6 @@
"
text/html
"
"
text/html
"
).
querySelector
(
'
.window
'
);
).
querySelector
(
'
.window
'
);
render_element
.
append
(
domElement
);
render_element
.
append
(
domElement
);
console
.
log
(
"
addNODE 5
"
);
waitForNodeClick
(
gadget
,
domElement
);
waitForNodeClick
(
gadget
,
domElement
);
//waitForNodeClick(gadget, domElement, class_definition);
//waitForNodeClick(gadget, domElement, class_definition);
...
@@ -818,7 +803,6 @@
...
@@ -818,7 +803,6 @@
coordinate
.
left
,
coordinate
.
left
,
coordinate
.
top
coordinate
.
top
);
);
console
.
log
(
"
addNODE 6
"
);
box
.
css
(
"
top
"
,
absolute_position
[
1
]);
box
.
css
(
"
top
"
,
absolute_position
[
1
]);
box
.
css
(
"
left
"
,
absolute_position
[
0
]);
box
.
css
(
"
left
"
,
absolute_position
[
0
]);
updateNodeStyle
(
gadget
,
dom_element_id
);
updateNodeStyle
(
gadget
,
dom_element_id
);
...
@@ -859,9 +843,7 @@
...
@@ -859,9 +843,7 @@
function
resolver
(
resolve
,
reject
)
{
function
resolver
(
resolve
,
reject
)
{
console
.
log
(
"
wait for DROP resolver1
"
);
console
.
log
(
"
wait for DROP resolver1
"
);
callback
=
function
(
evt
)
{
callback
=
function
(
evt
)
{
console
.
log
(
"
wait for DROP resolver2
"
);
try
{
try
{
console
.
log
(
"
wait for DROP resolver3
"
);
var
class_name
=
JSON
.
parse
(
var
class_name
=
JSON
.
parse
(
evt
.
dataTransfer
.
getData
(
'
application/json
'
)
evt
.
dataTransfer
.
getData
(
'
application/json
'
)
),
),
...
@@ -871,10 +853,6 @@
...
@@ -871,10 +853,6 @@
evt
.
clientX
-
offset
.
left
+
"
px
"
,
evt
.
clientX
-
offset
.
left
+
"
px
"
,
evt
.
clientY
-
offset
.
top
+
"
px
"
evt
.
clientY
-
offset
.
top
+
"
px
"
);
);
console
.
log
(
"
wait for DROP resolver4
"
);
console
.
log
(
class_name
);
console
.
log
(
offset
);
console
.
log
(
relative_position
);
addNode
(
gadget
,
addNode
(
gadget
,
generateNodeId
(
gadget
,
{
_class
:
class_name
}),
generateNodeId
(
gadget
,
{
_class
:
class_name
}),
{
{
...
@@ -884,7 +862,6 @@
...
@@ -884,7 +862,6 @@
},
},
_class
:
class_name
_class
:
class_name
});
});
console
.
log
(
"
wait for DROP resolver5
"
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
"
wait for DROP resolver100
"
);
console
.
log
(
"
wait for DROP resolver100
"
);
reject
(
e
);
reject
(
e
);
...
@@ -972,7 +949,7 @@
...
@@ -972,7 +949,7 @@
],
],
Container
:
this
.
props
.
main
Container
:
this
.
props
.
main
});
});
console
.
log
(
"
startservice WORKFLOW EDITOR2
"
);
draggable
(
gadget
);
draggable
(
gadget
);
this
.
props
.
nodes_click_monitor
=
RSVP
.
Monitor
();
this
.
props
.
nodes_click_monitor
=
RSVP
.
Monitor
();
...
@@ -981,11 +958,11 @@
...
@@ -981,11 +958,11 @@
$
.
each
(
this
.
props
.
data
.
graph
.
node
,
function
(
key
,
value
)
{
$
.
each
(
this
.
props
.
data
.
graph
.
node
,
function
(
key
,
value
)
{
addNode
(
gadget
,
key
,
value
);
addNode
(
gadget
,
key
,
value
);
});
});
console
.
log
(
"
startservice WORKFLOW EDITOR3
"
);
$
.
each
(
this
.
props
.
data
.
graph
.
edge
,
function
(
key
,
value
)
{
$
.
each
(
this
.
props
.
data
.
graph
.
edge
,
function
(
key
,
value
)
{
addEdge
(
gadget
,
key
,
value
);
addEdge
(
gadget
,
key
,
value
);
});
});
console
.
log
(
"
startservice WORKFLOW EDITOR7
"
);
console
.
log
(
"
startservice WORKFLOW EDITOR4
"
);
return
RSVP
.
all
([
return
RSVP
.
all
([
waitForDrop
(
gadget
),
waitForDrop
(
gadget
),
waitForConnection
(
gadget
),
waitForConnection
(
gadget
),
...
@@ -994,5 +971,6 @@
...
@@ -994,5 +971,6 @@
gadget
.
props
.
nodes_click_monitor
gadget
.
props
.
nodes_click_monitor
]);
]);
});
});
}(
RSVP
,
rJS
,
$
,
jsPlumb
,
Handlebars
,
loopEventListener
,
}(
RSVP
,
rJS
,
$
,
jsPlumb
,
Handlebars
,
loopEventListener
,
promiseEventListener
,
DOMParser
));
promiseEventListener
,
DOMParser
));
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment