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
fa89e89d
Commit
fa89e89d
authored
Nov 25, 2014
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update static version
parent
84ce9458
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
550 additions
and
304 deletions
+550
-304
dream/platform/static/dream/Input_viewProductionLine.js
dream/platform/static/dream/Input_viewProductionLine.js
+7
-16
dream/platform/static/fieldset/fieldset.js
dream/platform/static/fieldset/fieldset.js
+27
-28
dream/platform/static/jsplumb/index.html
dream/platform/static/jsplumb/index.html
+2
-1
dream/platform/static/jsplumb/jsplumb.js
dream/platform/static/jsplumb/jsplumb.js
+160
-204
dream/platform/static/jsplumb/test.html
dream/platform/static/jsplumb/test.html
+18
-0
dream/platform/static/jsplumb/test.js
dream/platform/static/jsplumb/test.js
+287
-0
dream/platform/static/lib/jquery.jsplumb.js
dream/platform/static/lib/jquery.jsplumb.js
+8
-8
dream/platform/static/list_field/listfield.js
dream/platform/static/list_field/listfield.js
+7
-6
dream/platform/static/number_field/numberfield.js
dream/platform/static/number_field/numberfield.js
+4
-4
dream/platform/static/string_field/stringfield.js
dream/platform/static/string_field/stringfield.js
+4
-4
dream/platform/static/toolbox/index.html
dream/platform/static/toolbox/index.html
+0
-13
dream/platform/static/toolbox/toolbox.js
dream/platform/static/toolbox/toolbox.js
+26
-20
No files found.
dream/platform/static/dream/Input_viewProductionLine.js
View file @
fa89e89d
...
...
@@ -2,6 +2,7 @@
(
function
(
window
,
rJS
,
RSVP
,
loopEventListener
)
{
"
use strict
"
;
var
gadget_klass
=
rJS
(
window
);
// TODO: save on parent gadget
function
saveGraph
(
evt
)
{
var
gadget
=
this
;
return
new
RSVP
.
Queue
().
push
(
function
()
{
...
...
@@ -11,23 +12,12 @@
}
return
gadget
.
getDeclaredGadget
(
"
productionline_graph
"
);
}).
push
(
function
(
graph_gadget
)
{
return
graph_gadget
.
getData
();
}).
push
(
function
(
data
)
{
graph_data
=
data
;
// Always get a fresh version, to prevent deleting spreadsheet & co
return
gadget
.
aq_getAttachment
({
_id
:
gadget
.
props
.
jio_key
,
_attachment
:
"
body.json
"
});
return
graph_gadget
.
getContent
();
}).
push
(
function
(
body
)
{
var
data
=
JSON
.
parse
(
body
),
json_graph_data
=
JSON
.
parse
(
graph_data
);
data
.
nodes
=
json_graph_data
.
nodes
;
data
.
edges
=
json_graph_data
.
edges
;
data
.
preference
=
json_graph_data
.
preference
;
return
gadget
.
aq_putAttachment
({
_id
:
gadget
.
props
.
jio_key
,
_attachment
:
"
body.json
"
,
_data
:
JSON
.
stringify
(
data
,
null
,
2
),
_data
:
JSON
.
stringify
(
JSON
.
parse
(
body
)
,
null
,
2
),
_mimetype
:
"
application/json
"
});
}).
push
(
function
()
{
...
...
@@ -56,7 +46,7 @@
}
this
.
timeout
=
window
.
setTimeout
(
saveGraph
.
bind
(
this
),
100
);
}).
declareMethod
(
"
render
"
,
function
(
options
)
{
var
jio_key
=
options
.
id
,
gadget
=
this
;
var
jio_key
=
options
.
id
,
gadget
=
this
,
data
;
gadget
.
props
.
jio_key
=
jio_key
;
return
new
RSVP
.
Queue
().
push
(
function
()
{
/*jslint nomen: true*/
...
...
@@ -65,11 +55,12 @@
_attachment
:
"
body.json
"
}),
gadget
.
getDeclaredGadget
(
"
productionline_graph
"
)
]);
}).
push
(
function
(
result_list
)
{
return
result_list
[
1
].
render
(
result_list
[
0
]);
data
=
result_list
[
0
];
return
result_list
[
1
].
render
(
data
);
}).
push
(
function
()
{
return
gadget
.
getDeclaredGadget
(
"
productionline_toolbox
"
);
}).
push
(
function
(
toolbox_gadget
)
{
toolbox_gadget
.
render
();
toolbox_gadget
.
render
(
data
);
});
}).
declareMethod
(
"
startService
"
,
function
()
{
var
g
=
this
,
graph
;
...
...
dream/platform/static/fieldset/fieldset.js
View file @
fa89e89d
...
...
@@ -9,47 +9,39 @@
// Precompile the templates while loading the first gadget instance
var
gadget_klass
=
rJS
(
window
),
source
=
gadget_klass
.
__template_element
.
getElementById
(
"
label-template
"
).
innerHTML
,
label_template
=
Handlebars
.
compile
(
source
);
initGadgetMixin
(
gadget_klass
);
gadget_klass
.
declareMethod
(
"
render
"
,
function
(
property_list
,
data
,
key
)
{
var
gadget
=
this
,
queue
,
value
,
property
;
gadget
.
key
=
key
;
gadget_klass
.
declareMethod
(
"
render
"
,
function
(
options
,
node_id
)
{
// XXX node_id is added like a property so that one can change the node
// id
var
gadget
=
this
,
queue
;
gadget
.
props
.
key
=
options
.
key
;
// used for recursive fieldsets
gadget
.
props
.
field_gadget_list
=
[];
function
addField
(
property
,
value
)
{
function
addField
(
property
_id
,
property_definition
,
value
)
{
var
sub_gadget
;
queue
.
push
(
function
()
{
// XXX this is incorrect for recursive fieldsets.
// we should use nested fieldset with legend
gadget
.
props
.
element
.
insertAdjacentHTML
(
"
beforeend
"
,
label_template
({
"
for
"
:
property
.
id
,
name
:
property
.
name
||
property
.
id
"
for
"
:
property
_
id
,
name
:
property
_definition
.
name
||
property_
id
}));
if
(
property
.
_class
===
"
Dream.PropertyLis
t
"
)
{
if
(
property
_definition
.
type
===
"
objec
t
"
)
{
// Create a recursive fieldset for this key.
return
gadget
.
declareGadget
(
"
../fieldset/index.html
"
);
}
if
(
property
.
type
===
"
number
"
)
{
if
(
property
_definition
.
type
===
"
number
"
)
{
return
gadget
.
declareGadget
(
"
../number_field/index.html
"
);
}
if
(
property
.
choice
)
{
if
(
property
_definition
.
enum
)
{
return
gadget
.
declareGadget
(
"
../list_field/index.html
"
);
}
return
gadget
.
declareGadget
(
"
../string_field/index.html
"
);
}).
push
(
function
(
gg
)
{
sub_gadget
=
gg
;
var
choice
=
property
.
choice
||
[],
default_opt
=
choice
[
0
]
?
[
choice
[
0
][
1
]
]
:
[
""
];
value
=
data
[
property
.
id
]
===
undefined
?
value
:
data
[
property
.
id
];
if
(
gg
.
__title
===
"
Fieldset
"
)
{
// XXX there must be a better way instead of using __title ?
return
gg
.
render
(
property
.
property_list
,
value
,
property
.
id
);
}
return
sub_gadget
.
render
({
field_json
:
{
title
:
property
.
description
||
""
,
key
:
property
.
id
,
value
:
value
,
items
:
choice
,
"
default
"
:
default_opt
}
key
:
property_id
,
value
:
value
,
property_definition
:
property_definition
});
}).
push
(
function
()
{
return
sub_gadget
.
getElement
();
...
...
@@ -59,10 +51,17 @@
});
}
queue
=
new
RSVP
.
Queue
().
push
(
function
()
{
Object
.
keys
(
property_list
).
forEach
(
function
(
i
)
{
property
=
property_list
[
i
];
value
=
property
.
_default
===
undefined
?
""
:
property
.
_default
;
addField
(
property
,
value
);
if
(
node_id
)
{
addField
(
"
id
"
,
{
type
:
"
string
"
},
node_id
);
}
Object
.
keys
(
options
.
property_definition
.
properties
).
forEach
(
function
(
property_name
)
{
var
property_definition
=
options
.
property_definition
.
properties
[
property_name
],
value
=
(
options
.
value
||
{})[
property_name
]
===
undefined
?
property_definition
.
_default
:
options
.
value
[
property_name
];
// XXX some properties are not editable
if
(
property_name
!==
"
coordinate
"
&&
property_name
!==
"
_class
"
)
{
addField
(
property_name
,
property_definition
,
value
);
}
});
});
return
queue
;
...
...
@@ -75,8 +74,8 @@
return
RSVP
.
all
(
promise_list
);
}).
push
(
function
(
result_list
)
{
var
name
,
result
=
{},
content
=
result
;
if
(
gadget
.
key
)
{
content
=
result
[
gadget
.
key
]
=
{};
if
(
gadget
.
props
.
key
)
{
content
=
result
[
gadget
.
props
.
key
]
=
{};
}
for
(
i
=
0
;
i
<
result_list
.
length
;
i
+=
1
)
{
for
(
name
in
result_list
[
i
])
{
...
...
dream/platform/static/jsplumb/index.html
View file @
fa89e89d
...
...
@@ -7,9 +7,10 @@
<script
src=
"../lib/jquery.js"
></script>
<script
src=
"../lib/jquery-ui.js"
></script>
<script
src=
"../lib/jquerymobile.js"
></script>
<script
src=
"../lib/rsvp.min.js"
></script>
<script
src=
"../lib/renderjs.min.js"
></script>
<script
src=
"../lib/jquery.jsplumb.
min.
js"
></script>
<script
src=
"../lib/jquery.jsplumb.js"
></script>
<script
src=
"../lib/handlebars.min.js"
></script>
<script
id=
"node-template"
type=
"text/x-handlebars-template"
>
...
...
dream/platform/static/jsplumb/jsplumb.js
View file @
fa89e89d
This diff is collapsed.
Click to expand it.
dream/platform/static/jsplumb/test.html
0 → 100644
View file @
fa89e89d
<!doctype html>
<html>
<head>
<meta
charset=
"utf-8"
>
<link
rel=
"stylesheet"
href=
"../lib/qunit.css"
>
<script
src=
"../lib/rsvp.min.js"
></script>
<script
src=
"../lib/renderjs.min.js"
></script>
<script
src=
"../lib/qunit.js"
></script>
<script
src=
"../lib/jquery.js"
></script>
<script
src=
"../lib/jquery.simulate.js"
></script>
<script
src=
"test.js"
></script>
</head>
<body>
<div
id=
"qunit"
></div>
<div
id=
"qunit-fixture"
></div>
</body>
</html>
dream/platform/static/jsplumb/test.js
0 → 100644
View file @
fa89e89d
This diff is collapsed.
Click to expand it.
dream/platform/static/lib/jquery.jsplumb.js
View file @
fa89e89d
...
...
@@ -949,17 +949,17 @@
newFunction
=
newFunction
||
function
()
{
};
return
function
()
{
var
r
=
null
;
try
{
//
try {
r
=
newFunction
.
apply
(
this
,
arguments
);
}
catch
(
e
)
{
jsPlumbUtil
.
log
(
"
jsPlumb function failed :
"
+
e
);
}
//
} catch (e) {
//
jsPlumbUtil.log("jsPlumb function failed : " + e);
//
}
if
(
returnOnThisValue
==
null
||
(
r
!==
returnOnThisValue
))
{
try
{
//
try {
r
=
wrappedFunction
.
apply
(
this
,
arguments
);
}
catch
(
e
)
{
jsPlumbUtil
.
log
(
"
wrapped function failed :
"
+
e
);
}
//
} catch (e) {
//
jsPlumbUtil.log("wrapped function failed : " + e);
//
}
}
return
r
;
};
...
...
dream/platform/static/list_field/listfield.js
View file @
fa89e89d
...
...
@@ -12,17 +12,18 @@
g
.
element
=
element
;
});
}).
declareMethod
(
"
render
"
,
function
(
options
)
{
var
select
=
this
.
element
.
getElementsByTagName
(
"
select
"
)[
0
],
i
,
template
,
field_json
=
options
.
field_json
,
tmp
=
""
;
select
.
setAttribute
(
"
name
"
,
field_json
.
key
);
for
(
i
=
0
;
i
<
field_json
.
items
.
length
;
i
+=
1
)
{
if
(
field_json
.
items
[
i
][
1
]
===
field_json
.
value
)
{
var
select
=
this
.
element
.
getElementsByTagName
(
"
select
"
)[
0
],
i
,
template
,
tmp
=
""
;
select
.
setAttribute
(
"
name
"
,
options
.
key
);
for
(
i
=
0
;
i
<
options
.
property_definition
.
enum
.
length
;
i
+=
1
)
{
if
(
options
.
property_definition
.
enum
[
i
]
===
options
.
value
)
{
template
=
selected_option_template
;
}
else
{
template
=
option_template
;
}
// XXX value and text are always same in json schema
tmp
+=
template
({
value
:
field_json
.
items
[
i
][
1
],
text
:
field_json
.
items
[
i
][
0
]
value
:
options
.
property_definition
.
enum
[
i
],
text
:
options
.
property_definition
.
enum
[
i
]
});
}
select
.
innerHTML
+=
tmp
;
...
...
dream/platform/static/number_field/numberfield.js
View file @
fa89e89d
...
...
@@ -6,10 +6,10 @@
gadget
.
element
=
element
;
});
}).
declareMethod
(
"
render
"
,
function
(
options
)
{
var
input
=
this
.
element
.
querySelector
(
"
input
"
)
,
field_json
=
options
.
field_json
||
{}
;
input
.
setAttribute
(
"
value
"
,
field_json
.
value
);
input
.
setAttribute
(
"
name
"
,
field_json
.
key
);
input
.
setAttribute
(
"
title
"
,
field_json
.
title
);
var
input
=
this
.
element
.
querySelector
(
"
input
"
);
input
.
setAttribute
(
"
value
"
,
options
.
value
);
input
.
setAttribute
(
"
name
"
,
options
.
key
);
input
.
setAttribute
(
"
title
"
,
options
.
title
||
options
.
key
);
}).
declareMethod
(
"
getContent
"
,
function
()
{
var
input
=
this
.
element
.
querySelector
(
"
input
"
),
result
=
{};
if
(
input
.
value
!==
""
)
{
...
...
dream/platform/static/string_field/stringfield.js
View file @
fa89e89d
...
...
@@ -6,10 +6,10 @@
gadget
.
element
=
element
;
});
}).
declareMethod
(
"
render
"
,
function
(
options
)
{
var
input
=
this
.
element
.
querySelector
(
"
input
"
)
,
field_json
=
options
.
field_json
||
{}
;
input
.
setAttribute
(
"
value
"
,
field_json
.
value
||
""
);
input
.
setAttribute
(
"
name
"
,
field_json
.
key
);
input
.
setAttribute
(
"
title
"
,
field_json
.
title
);
var
input
=
this
.
element
.
querySelector
(
"
input
"
);
input
.
setAttribute
(
"
value
"
,
options
.
value
||
""
);
input
.
setAttribute
(
"
name
"
,
options
.
key
);
input
.
setAttribute
(
"
title
"
,
options
.
title
||
options
.
key
);
}).
declareMethod
(
"
getContent
"
,
function
()
{
var
input
=
this
.
element
.
querySelector
(
"
input
"
),
result
=
{};
result
[
input
.
getAttribute
(
"
name
"
)]
=
input
.
value
;
...
...
dream/platform/static/toolbox/index.html
View file @
fa89e89d
...
...
@@ -5,21 +5,8 @@
<link
rel=
"stylesheet"
href=
"../lib/jquery-ui.css"
>
<link
rel=
"stylesheet"
href=
"toolbox.css"
>
<script
src=
"../lib/jquery.js"
></script>
<script
src=
"../lib/jquery-ui.js"
></script>
<script
src=
"../lib/rsvp.min.js"
></script>
<script
src=
"../lib/renderjs.min.js"
></script>
<script
src=
"../lib/handlebars.min.js"
></script>
<script
id=
"tool-template"
type=
"text/x-handlebars-template"
>
<
div
id
=
"
{{key}}
"
class
=
"
tool {{key}}
"
draggable
=
"
true
"
>
{{
name
}}
<
ul
/>
<
/div
>
</script>
<script
src=
"../dream/mixin_gadget.js"
></script>
<script
src=
"../dream/mixin_promise.js"
></script>
...
...
dream/platform/static/toolbox/toolbox.js
View file @
fa89e89d
/*global window, document, RSVP, rJS,
Handlebars,
initGadgetMixin*/
(
function
(
window
,
document
,
RSVP
,
rJS
,
Handlebars
,
initGadgetMixin
)
{
/*global window, document, RSVP, rJS, initGadgetMixin*/
(
function
(
window
,
document
,
RSVP
,
rJS
,
initGadgetMixin
)
{
"
use strict
"
;
/*jslint nomen: true*/
var
gadget_klass
=
rJS
(
window
)
,
tool_template_source
=
gadget_klass
.
__template_element
.
getElementById
(
"
tool-template
"
).
innerHTML
,
tool_template
=
Handlebars
.
compile
(
tool_template_source
)
;
var
gadget_klass
=
rJS
(
window
);
function
waitForDragstart
(
tool
)
{
var
callback
;
function
canceller
()
{
...
...
@@ -14,7 +14,7 @@
function
itsANonResolvableTrap
(
resolve
,
reject
)
{
callback
=
function
(
evt
)
{
try
{
evt
.
dataTransfer
.
setData
(
"
text/html
"
,
tool
.
outerHTML
);
evt
.
dataTransfer
.
setData
(
"
application/json
"
,
tool
.
dataset
.
class_name
);
}
catch
(
e
)
{
reject
(
e
);
}
...
...
@@ -24,22 +24,28 @@
return
new
RSVP
.
Promise
(
itsANonResolvableTrap
,
canceller
);
}
initGadgetMixin
(
gadget_klass
);
gadget_klass
.
declareAcquiredMethod
(
"
getConfigurationDict
"
,
"
getConfigurationDict
"
).
declareMethod
(
"
render
"
,
function
()
{
var
g
=
this
;
return
g
.
getConfigurationDict
().
push
(
function
(
config_dict
)
{
var
tools_container
=
document
.
createElement
(
"
div
"
);
tools_container
.
className
=
"
tools-container
"
;
Object
.
keys
(
config_dict
).
forEach
(
function
(
key
)
{
var
name
=
config_dict
[
key
].
name
||
key
.
split
(
"
-
"
)[
1
];
if
(
key
!==
"
Dream-Configuration
"
)
{
tools_container
.
innerHTML
+=
tool_template
({
key
:
key
,
name
:
name
});
}
});
g
.
props
.
element
.
querySelector
(
"
.tools
"
).
appendChild
(
tools_container
);
gadget_klass
.
declareMethod
(
"
render
"
,
function
(
json_data
)
{
var
data
=
JSON
.
parse
(
json_data
),
tools_container
=
document
.
createElement
(
"
div
"
);
/* display all nodes in the palette.
*/
tools_container
.
className
=
"
tools-container
"
;
Object
.
keys
(
data
.
class_definition
).
forEach
(
function
(
key
)
{
var
_class
=
data
.
class_definition
[
key
],
tool
;
// XXX "expand" the json schema "allOF" etc
if
(
_class
.
_class
===
"
node
"
)
{
tool
=
document
.
createElement
(
"
div
"
);
// XXX maybe allow to configure the class name ?
tool
.
className
=
"
tool
"
+
key
;
tool
.
textContent
=
_class
.
name
||
key
;
tool
.
draggable
=
true
;
tool
.
dataset
.
class_name
=
JSON
.
stringify
(
key
);
Object
.
keys
(
_class
.
css
||
{}).
forEach
(
function
(
k
)
{
tool
.
style
[
k
]
=
_class
.
css
[
k
];
});
tools_container
.
appendChild
(
tool
);
}
});
this
.
props
.
element
.
querySelector
(
"
.tools
"
).
appendChild
(
tools_container
);
}).
declareMethod
(
"
startService
"
,
function
()
{
var
promiseArray
=
[];
[].
forEach
.
call
(
this
.
props
.
element
.
querySelectorAll
(
"
.tool
"
),
function
(
tool
)
{
...
...
@@ -47,4 +53,4 @@
});
return
RSVP
.
all
(
promiseArray
);
});
})(
window
,
document
,
RSVP
,
rJS
,
Handlebars
,
initGadgetMixin
);
\ No newline at end of file
})(
window
,
document
,
RSVP
,
rJS
,
initGadgetMixin
);
\ No newline at end of file
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