Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
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
iv
erp5
Commits
ef8611e7
Commit
ef8611e7
authored
Aug 25, 2016
by
iv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5Workflow: remove state/transition edition pop-in from erp5_graph_editor
parent
8c7e13f1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
162 deletions
+1
-162
bt5/erp5_graph_editor/SkinTemplateItem/portal_skins/erp5_graph_editor/dream_graph_editor/jsplumb/jsplumb.js.js
...rp5_graph_editor/dream_graph_editor/jsplumb/jsplumb.js.js
+1
-162
No files found.
bt5/erp5_graph_editor/SkinTemplateItem/portal_skins/erp5_graph_editor/dream_graph_editor/jsplumb/jsplumb.js.js
View file @
ef8611e7
...
@@ -460,153 +460,6 @@
...
@@ -460,153 +460,6 @@
return
clone
(
expanded_class_definition
);
return
clone
(
expanded_class_definition
);
}
}
function
openEdgeEditionDialog
(
gadget
,
connection
)
{
var
edge_id
=
connection
.
id
,
edge_data
=
gadget
.
props
.
data
.
graph
.
edge
[
edge_id
],
edit_popup
=
$
(
gadget
.
props
.
element
).
find
(
"
#popup-edit-template
"
),
schema
,
fieldset_element
,
delete_promise
;
schema
=
expandSchema
(
gadget
.
props
.
data
.
class_definition
[
edge_data
.
_class
],
gadget
.
props
.
data
);
// We do not edit source & destination on edge this way.
delete
schema
.
properties
.
source
;
delete
schema
.
properties
.
destination
;
gadget
.
props
.
element
.
insertAdjacentHTML
(
"
beforeend
"
,
popup_edit_template
);
edit_popup
=
$
(
gadget
.
props
.
element
).
find
(
"
#edit-popup
"
);
edit_popup
.
find
(
"
.node_class
"
).
text
(
connection
.
name
||
connection
.
_class
);
fieldset_element
=
edit_popup
.
find
(
"
fieldset
"
)[
0
];
edit_popup
.
dialog
();
edit_popup
.
show
();
function
save_promise
(
fieldset_gadget
,
edge_id
)
{
return
RSVP
.
Queue
().
push
(
function
()
{
return
promiseEventListener
(
edit_popup
.
find
(
"
.graph_editor_validate_button
"
)[
0
],
"
click
"
,
false
);
}).
push
(
function
(
evt
)
{
var
data
=
{
id
:
$
(
evt
.
target
[
1
]).
val
(),
data
:
{}
};
return
fieldset_gadget
.
getContent
().
then
(
function
(
r
)
{
$
.
extend
(
data
.
data
,
gadget
.
props
.
data
.
graph
.
edge
[
connection
.
id
]);
$
.
extend
(
data
.
data
,
r
);
// to redraw, we remove the edge and add again.
// but we want to disable events on connection, since event
// handling promise are executed asynchronously in undefined order,
// we cannot just remove and /then/ add, because the new edge is
// added before the old is removed.
connection
.
ignoreEvent
=
true
;
gadget
.
props
.
jsplumb_instance
.
detach
(
connection
);
addEdge
(
gadget
,
r
.
id
,
data
.
data
);
});
});
}
delete_promise
=
new
RSVP
.
Queue
().
push
(
function
()
{
return
promiseEventListener
(
edit_popup
.
find
(
"
.graph_editor_delete_button
"
)[
0
],
"
click
"
,
false
);
}).
push
(
function
()
{
// connectionDetached event will remove the edge from data
gadget
.
props
.
jsplumb_instance
.
detach
(
connection
);
});
return
gadget
.
declareGadget
(
"
../fieldset/index.html
"
,
{
element
:
fieldset_element
,
scope
:
"
fieldset
"
}).
push
(
function
(
fieldset_gadget
)
{
return
RSVP
.
all
([
fieldset_gadget
,
fieldset_gadget
.
render
({
value
:
edge_data
,
property_definition
:
schema
},
edge_id
)]);
}).
push
(
function
(
fieldset_gadget
)
{
edit_popup
.
dialog
(
"
open
"
);
return
fieldset_gadget
[
0
];
}).
push
(
function
(
fieldset_gadget
)
{
fieldset_gadget
.
startService
();
// XXX
return
fieldset_gadget
;
}).
push
(
function
(
fieldset_gadget
)
{
// Expose the dialog handling promise so that we can wait for it in
// test.
gadget
.
props
.
dialog_promise
=
RSVP
.
any
([
save_promise
(
fieldset_gadget
,
edge_id
),
delete_promise
]);
return
gadget
.
props
.
dialog_promise
;
}).
push
(
function
()
{
edit_popup
.
dialog
(
"
close
"
);
edit_popup
.
remove
();
delete
gadget
.
props
.
dialog_promise
;
});
}
function
openNodeEditionDialog
(
gadget
,
element
)
{
var
node_id
=
getNodeId
(
gadget
,
element
.
id
),
node_data
=
gadget
.
props
.
data
.
graph
.
node
[
node_id
],
node_edit_popup
=
$
(
gadget
.
props
.
element
).
find
(
"
#popup-edit-template
"
),
schema
,
fieldset_element
,
delete_promise
;
// If we have no definition for this, we do not allow edition.
// XXX incorrect, we need to display this dialog to be able
// to delete a node
if
(
gadget
.
props
.
data
.
class_definition
[
node_data
.
_class
]
===
undefined
)
{
return
;
}
schema
=
expandSchema
(
gadget
.
props
.
data
.
class_definition
[
node_data
.
_class
],
gadget
.
props
.
data
);
if
(
node_edit_popup
.
length
!==
0
)
{
node_edit_popup
.
remove
();
}
gadget
.
props
.
element
.
insertAdjacentHTML
(
"
beforeend
"
,
popup_edit_template
);
node_edit_popup
=
$
(
gadget
.
props
.
element
).
find
(
"
#edit-popup
"
);
// Set the name of the popup to the node class
node_edit_popup
.
find
(
"
.node_class
"
).
text
(
node_data
.
name
||
node_data
.
_class
);
fieldset_element
=
node_edit_popup
.
find
(
"
fieldset
"
)[
0
];
node_edit_popup
.
dialog
();
node_data
.
id
=
node_id
;
function
save_promise
(
fieldset_gadget
,
node_id
)
{
return
RSVP
.
Queue
().
push
(
function
()
{
return
promiseEventListener
(
node_edit_popup
.
find
(
"
.graph_editor_validate_button
"
)[
0
],
"
click
"
,
false
);
}).
push
(
function
(
evt
)
{
var
data
=
{
// XXX id should not be handled differently ...
id
:
$
(
evt
.
target
[
1
]).
val
(),
data
:
{}
};
return
fieldset_gadget
.
getContent
().
then
(
function
(
r
)
{
$
.
extend
(
data
.
data
,
r
);
updateElementData
(
gadget
,
node_id
,
data
);
});
});
}
delete_promise
=
new
RSVP
.
Queue
().
push
(
function
()
{
return
promiseEventListener
(
node_edit_popup
.
find
(
"
.graph_editor_delete_button
"
)[
0
],
"
click
"
,
false
);
}).
push
(
function
()
{
return
removeElement
(
gadget
,
node_id
);
});
return
gadget
.
declareGadget
(
"
../fieldset/index.html
"
,
{
element
:
fieldset_element
,
scope
:
"
fieldset
"
}).
push
(
function
(
fieldset_gadget
)
{
return
RSVP
.
all
([
fieldset_gadget
,
fieldset_gadget
.
render
({
value
:
node_data
,
property_definition
:
schema
},
node_id
)]);
}).
push
(
function
(
fieldset_gadget
)
{
node_edit_popup
.
dialog
(
"
open
"
);
return
fieldset_gadget
[
0
];
}).
push
(
function
(
fieldset_gadget
)
{
fieldset_gadget
.
startService
();
// XXX this should not be needed anymore.
return
fieldset_gadget
;
}).
push
(
function
(
fieldset_gadget
)
{
// Expose the dialog handling promise so that we can wait for it in
// test.
gadget
.
props
.
dialog_promise
=
RSVP
.
any
([
save_promise
(
fieldset_gadget
,
node_id
),
delete_promise
]);
return
gadget
.
props
.
dialog_promise
;
}).
push
(
function
()
{
node_edit_popup
.
dialog
(
"
close
"
);
node_edit_popup
.
remove
();
delete
gadget
.
props
.
dialog_promise
;
});
}
function
waitForNodeClick
(
gadget
,
node
)
{
gadget
.
props
.
nodes_click_monitor
.
monitor
(
loopEventListener
(
node
,
"
dblclick
"
,
false
,
openNodeEditionDialog
.
bind
(
null
,
gadget
,
node
)));
}
function
waitForConnection
(
gadget
)
{
function
waitForConnection
(
gadget
)
{
return
loopJsplumbBind
(
gadget
,
"
connection
"
,
function
(
info
,
originalEvent
)
{
return
loopJsplumbBind
(
gadget
,
"
connection
"
,
function
(
info
,
originalEvent
)
{
updateConnectionData
(
gadget
,
info
.
connection
,
false
);
updateConnectionData
(
gadget
,
info
.
connection
,
false
);
...
@@ -619,12 +472,6 @@
...
@@ -619,12 +472,6 @@
});
});
}
}
function
waitForConnectionClick
(
gadget
)
{
return
loopJsplumbBind
(
gadget
,
"
click
"
,
function
(
connection
)
{
return
openEdgeEditionDialog
(
gadget
,
connection
);
});
}
function
addNode
(
gadget
,
node_id
,
node_data
)
{
function
addNode
(
gadget
,
node_id
,
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
],
...
@@ -653,7 +500,6 @@
...
@@ -653,7 +500,6 @@
name
:
node_data
.
name
||
node_data
.
id
name
:
node_data
.
name
||
node_data
.
id
}),
"
text/html
"
).
querySelector
(
"
.window
"
);
}),
"
text/html
"
).
querySelector
(
"
.window
"
);
render_element
.
append
(
domElement
);
render_element
.
append
(
domElement
);
waitForNodeClick
(
gadget
,
domElement
);
box
=
$
(
gadget
.
props
.
element
).
find
(
"
#
"
+
dom_element_id
);
box
=
$
(
gadget
.
props
.
element
).
find
(
"
#
"
+
dom_element_id
);
absolute_position
=
convertToAbsolutePosition
(
gadget
,
coordinate
.
left
,
coordinate
.
top
);
absolute_position
=
convertToAbsolutePosition
(
gadget
,
coordinate
.
left
,
coordinate
.
top
);
if
(
class_definition
&&
class_definition
.
css
)
{
if
(
class_definition
&&
class_definition
.
css
)
{
...
@@ -761,13 +607,7 @@
...
@@ -761,13 +607,7 @@
}
}
this
.
props
.
main
=
this
.
props
.
element
.
querySelector
(
"
.graph_container
"
);
this
.
props
.
main
=
this
.
props
.
element
.
querySelector
(
"
.graph_container
"
);
/*
$(this.props.main).resizable({
resize : function(event, ui) {
jsplumb_instance.repaint(ui.helper);
}
});
*/
if
(
data
)
{
if
(
data
)
{
this
.
props
.
data
=
JSON
.
parse
(
data
);
this
.
props
.
data
=
JSON
.
parse
(
data
);
...
@@ -831,7 +671,6 @@
...
@@ -831,7 +671,6 @@
return
RSVP
.
all
([
waitForDrop
(
gadget
),
return
RSVP
.
all
([
waitForDrop
(
gadget
),
waitForConnection
(
gadget
),
waitForConnection
(
gadget
),
waitForConnectionDetached
(
gadget
),
waitForConnectionDetached
(
gadget
),
waitForConnectionClick
(
gadget
),
gadget
.
props
.
nodes_click_monitor
gadget
.
props
.
nodes_click_monitor
]);
]);
});
});
...
...
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