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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Papa Tamsir Kane
erp5
Commits
af79277d
Commit
af79277d
authored
Jul 09, 2017
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
graph_editor: comply with jslint
parent
9684f3e7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
20 deletions
+28
-20
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
+5
-3
bt5/erp5_graph_editor/SkinTemplateItem/portal_skins/erp5_graph_editor/dream_graph_editor/jsplumb/test.js.js
...s/erp5_graph_editor/dream_graph_editor/jsplumb/test.js.js
+19
-13
bt5/erp5_graph_editor/SkinTemplateItem/portal_skins/erp5_graph_editor/dream_graph_editor/list_field/listfield.js.js
...raph_editor/dream_graph_editor/list_field/listfield.js.js
+4
-4
No files found.
bt5/erp5_graph_editor/SkinTemplateItem/portal_skins/erp5_graph_editor/dream_graph_editor/jsplumb/jsplumb.js.js
View file @
af79277d
...
@@ -49,13 +49,15 @@
...
@@ -49,13 +49,15 @@
min_x
=
100
,
max_x
=
0
,
min_y
=
100
,
max_y
=
0
;
min_x
=
100
,
max_x
=
0
,
min_y
=
100
,
max_y
=
0
;
// if graph is empty, no need to layout
// if graph is empty, no need to layout
if
(
Object
.
keys
(
graph_data
.
edge
).
length
===
0
)
{
if
(
Object
.
keys
(
graph_data
.
edge
).
length
===
0
)
{
return
resolve
(
graph_data
);
resolve
(
graph_data
);
return
;
}
}
// make a Springy graph with our graph
// make a Springy graph with our graph
$
.
each
(
graph_data
.
node
,
function
(
key
,
value
)
{
$
.
each
(
graph_data
.
node
,
function
(
key
,
value
)
{
if
(
value
.
coordinate
&&
value
.
coordinate
.
top
&&
value
.
coordinate
.
left
)
{
if
(
value
.
coordinate
&&
value
.
coordinate
.
top
&&
value
.
coordinate
.
left
)
{
// graph already has a layout, no need to layout again
// graph already has a layout, no need to layout again
return
resolve
(
graph_data
);
resolve
(
graph_data
);
return
;
}
}
springy_nodes
[
key
]
=
springy_graph
.
newNode
({
node_id
:
key
});
springy_nodes
[
key
]
=
springy_graph
.
newNode
({
node_id
:
key
});
});
});
...
@@ -549,7 +551,7 @@
...
@@ -549,7 +551,7 @@
// XXX incorrect, we need to display this dialog to be able
// XXX incorrect, we need to display this dialog to be able
// to delete a node
// to delete a node
if
(
gadget
.
props
.
data
.
class_definition
[
node_data
.
_class
]
===
undefined
)
{
if
(
gadget
.
props
.
data
.
class_definition
[
node_data
.
_class
]
===
undefined
)
{
return
;
return
false
;
}
}
schema
=
expandSchema
(
gadget
.
props
.
data
.
class_definition
[
node_data
.
_class
],
gadget
.
props
.
data
);
schema
=
expandSchema
(
gadget
.
props
.
data
.
class_definition
[
node_data
.
_class
],
gadget
.
props
.
data
);
if
(
node_edit_popup
.
length
!==
0
)
{
if
(
node_edit_popup
.
length
!==
0
)
{
...
...
bt5/erp5_graph_editor/SkinTemplateItem/portal_skins/erp5_graph_editor/dream_graph_editor/jsplumb/test.js.js
View file @
af79277d
...
@@ -224,8 +224,8 @@
...
@@ -224,8 +224,8 @@
var
graph
=
JSON
.
parse
(
content
).
graph
,
node_coordinate
=
graph
.
node
.
N1
.
coordinate
;
var
graph
=
JSON
.
parse
(
content
).
graph
,
node_coordinate
=
graph
.
node
.
N1
.
coordinate
;
// Since original coordinates where 0,0 we are now about 0.1,0.1
// Since original coordinates where 0,0 we are now about 0.1,0.1
// as we moved 10%
// as we moved 10%
ok
(
node_coordinate
.
top
-
.
1
<
.
1
,
"
Top is ok
"
);
ok
(
node_coordinate
.
top
-
0.1
<
0
.1
,
"
Top is ok
"
);
ok
(
node_coordinate
.
left
-
.
1
<
.
1
,
"
Left is ok
"
);
ok
(
node_coordinate
.
left
-
0.1
<
0
.1
,
"
Left is ok
"
);
});
});
}
}
g
.
declareGadget
(
"
./index.html
"
,
{
g
.
declareGadget
(
"
./index.html
"
,
{
...
@@ -251,7 +251,8 @@
...
@@ -251,7 +251,8 @@
// XXX this condition is actually incorrect. We need to wait
// XXX this condition is actually incorrect. We need to wait
// for the event listener to have been registered for the
// for the event listener to have been registered for the
// dialog buttons. This setTimeout is good enough for now.
// dialog buttons. This setTimeout is good enough for now.
return
setTimeout
(
fillDialog
,
1
e3
);
setTimeout
(
fillDialog
,
1
e3
);
return
;
}
}
// check displayed values
// check displayed values
equal
(
$
(
"
input[name='id']
"
).
val
(),
"
N1
"
);
equal
(
$
(
"
input[name='id']
"
).
val
(),
"
N1
"
);
...
@@ -290,7 +291,8 @@
...
@@ -290,7 +291,8 @@
stop
();
stop
();
function
runTest
()
{
function
runTest
()
{
return
jsplumb_gadget
.
getContent
().
then
(
function
(
content
)
{
return
jsplumb_gadget
.
getContent
().
then
(
function
(
content
)
{
var
node1
=
jsplumb_gadget
.
props
.
main
.
querySelector
(
"
div[title='Node 1']
"
),
node2
=
jsplumb_gadget
.
props
.
main
.
querySelector
(
"
div[title='Node 2']
"
);
var
node1
=
jsplumb_gadget
.
props
.
main
.
querySelector
(
"
div[title='Node 1']
"
),
node2
=
jsplumb_gadget
.
props
.
main
.
querySelector
(
"
div[title='Node 2']
"
);
equal
(
0
,
Object
.
keys
(
JSON
.
parse
(
content
).
graph
.
edge
).
length
,
"
There are no edge at the beginning
"
);
equal
(
0
,
Object
.
keys
(
JSON
.
parse
(
content
).
graph
.
edge
).
length
,
"
There are no edge at the beginning
"
);
jsplumb_gadget
.
props
.
jsplumb_instance
.
connect
({
jsplumb_gadget
.
props
.
jsplumb_instance
.
connect
({
source
:
node1
.
id
,
source
:
node1
.
id
,
...
@@ -334,7 +336,8 @@
...
@@ -334,7 +336,8 @@
// XXX this condition is actually incorrect. We need to wait
// XXX this condition is actually incorrect. We need to wait
// for the event listener to have been registered for the
// for the event listener to have been registered for the
// dialog buttons. This setTimeout is good enough for now.
// dialog buttons. This setTimeout is good enough for now.
return
setTimeout
(
waitForDialogAndDelete
,
1
e3
);
setTimeout
(
waitForDialogAndDelete
,
1
e3
);
return
;
}
}
equal
(
1
,
$
(
"
input[value='Delete']
"
).
length
,
"
There should be one delete button
"
);
equal
(
1
,
$
(
"
input[value='Delete']
"
).
length
,
"
There should be one delete button
"
);
$
(
"
input[value='Delete']
"
).
click
();
$
(
"
input[value='Delete']
"
).
click
();
...
@@ -378,7 +381,8 @@
...
@@ -378,7 +381,8 @@
// XXX this condition is actually incorrect. We need to wait
// XXX this condition is actually incorrect. We need to wait
// for the event listener to have been registered for the
// for the event listener to have been registered for the
// dialog buttons. This setTimeout is good enough for now.
// dialog buttons. This setTimeout is good enough for now.
return
setTimeout
(
fillDialog
,
1
e3
);
setTimeout
(
fillDialog
,
1
e3
);
return
;
}
}
equal
(
$
(
"
input[name='id']
"
).
val
(),
"
N1
"
);
equal
(
$
(
"
input[name='id']
"
).
val
(),
"
N1
"
);
// change the id
// change the id
...
@@ -448,7 +452,8 @@
...
@@ -448,7 +452,8 @@
// XXX this condition is actually incorrect. We need to wait
// XXX this condition is actually incorrect. We need to wait
// for the event listener to have been registered for the
// for the event listener to have been registered for the
// dialog buttons. This setTimeout is good enough for now.
// dialog buttons. This setTimeout is good enough for now.
return
setTimeout
(
fillDialog
,
1
e3
);
setTimeout
(
fillDialog
,
1
e3
);
return
;
}
}
// check displayed values
// check displayed values
equal
(
$
(
"
input[name='id']
"
).
val
(),
node_id
);
equal
(
$
(
"
input[name='id']
"
).
val
(),
node_id
);
...
@@ -520,7 +525,8 @@
...
@@ -520,7 +525,8 @@
// XXX this condition is actually incorrect. We need to wait
// XXX this condition is actually incorrect. We need to wait
// for the event listener to have been registered for the
// for the event listener to have been registered for the
// dialog buttons. This setTimeout is good enough for now.
// dialog buttons. This setTimeout is good enough for now.
return
setTimeout
(
waitForDialogAndDelete
,
1
e3
);
setTimeout
(
waitForDialogAndDelete
,
1
e3
);
return
;
}
}
equal
(
1
,
$
(
"
input[value='Delete']
"
).
length
,
"
There should be one delete button
"
);
equal
(
1
,
$
(
"
input[value='Delete']
"
).
length
,
"
There should be one delete button
"
);
$
(
"
input[value='Delete']
"
).
click
();
$
(
"
input[value='Delete']
"
).
click
();
...
@@ -558,11 +564,11 @@
...
@@ -558,11 +564,11 @@
return
jsplumb_gadget
.
getContent
();
return
jsplumb_gadget
.
getContent
();
}).
then
(
function
(
content
)
{
}).
then
(
function
(
content
)
{
$
.
each
(
JSON
.
parse
(
content
).
graph
.
node
,
function
(
i
,
node
){
$
.
each
(
JSON
.
parse
(
content
).
graph
.
node
,
function
(
i
,
node
){
ok
(
node
.
coordinate
.
top
!==
undefined
,
"
Node have top coordinate
"
)
ok
(
node
.
coordinate
.
top
!==
undefined
,
"
Node have top coordinate
"
)
;
ok
(
0
<=
node
.
coordinate
.
top
<=
1
,
"
Node top coordinate is between [0..1]
"
)
ok
(
0
<=
node
.
coordinate
.
top
<=
1
,
"
Node top coordinate is between [0..1]
"
)
;
ok
(
node
.
coordinate
.
left
!==
undefined
,
"
Node have left coordinate
"
)
ok
(
node
.
coordinate
.
left
!==
undefined
,
"
Node have left coordinate
"
)
;
ok
(
0
<=
node
.
coordinate
.
left
<=
1
,
"
Node left coordinate is between [0..1]
"
)
ok
(
0
<=
node
.
coordinate
.
left
<=
1
,
"
Node left coordinate is between [0..1]
"
)
;
})
})
;
}).
fail
(
error_handler
).
always
(
start
);
}).
fail
(
error_handler
).
always
(
start
);
});
});
});
});
...
...
bt5/erp5_graph_editor/SkinTemplateItem/portal_skins/erp5_graph_editor/dream_graph_editor/list_field/listfield.js.js
View file @
af79277d
...
@@ -14,16 +14,16 @@
...
@@ -14,16 +14,16 @@
}).
declareMethod
(
"
render
"
,
function
(
options
)
{
}).
declareMethod
(
"
render
"
,
function
(
options
)
{
var
select
=
this
.
element
.
getElementsByTagName
(
"
select
"
)[
0
],
i
,
template
,
tmp
=
""
;
var
select
=
this
.
element
.
getElementsByTagName
(
"
select
"
)[
0
],
i
,
template
,
tmp
=
""
;
select
.
setAttribute
(
"
name
"
,
options
.
key
);
select
.
setAttribute
(
"
name
"
,
options
.
key
);
for
(
i
=
0
;
i
<
options
.
property_definition
.
enum
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
options
.
property_definition
[
'
enum
'
]
.
length
;
i
+=
1
)
{
if
(
options
.
property_definition
.
enum
[
i
]
===
options
.
value
)
{
if
(
options
.
property_definition
[
'
enum
'
]
[
i
]
===
options
.
value
)
{
template
=
selected_option_template
;
template
=
selected_option_template
;
}
else
{
}
else
{
template
=
option_template
;
template
=
option_template
;
}
}
// XXX value and text are always same in json schema
// XXX value and text are always same in json schema
tmp
+=
template
({
tmp
+=
template
({
value
:
options
.
property_definition
.
enum
[
i
],
value
:
options
.
property_definition
[
'
enum
'
]
[
i
],
text
:
options
.
property_definition
.
enum
[
i
]
text
:
options
.
property_definition
[
'
enum
'
]
[
i
]
});
});
}
}
select
.
innerHTML
+=
tmp
;
select
.
innerHTML
+=
tmp
;
...
...
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