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
b7cd320d
Commit
b7cd320d
authored
Nov 20, 2014
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lots of cleanups
parent
2272f3e9
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
134 additions
and
155 deletions
+134
-155
dream/platform/src/dream/Input_viewProductionLine.js
dream/platform/src/dream/Input_viewProductionLine.js
+4
-4
dream/platform/src/fieldset/fieldset.js
dream/platform/src/fieldset/fieldset.js
+30
-30
dream/platform/src/jsplumb/jsplumb.js
dream/platform/src/jsplumb/jsplumb.js
+84
-102
dream/platform/src/list_field/listfield.js
dream/platform/src/list_field/listfield.js
+6
-6
dream/platform/src/number_field/numberfield.js
dream/platform/src/number_field/numberfield.js
+4
-5
dream/platform/src/string_field/stringfield.js
dream/platform/src/string_field/stringfield.js
+4
-5
dream/platform/src/toolbox/toolbox.js
dream/platform/src/toolbox/toolbox.js
+2
-3
No files found.
dream/platform/src/dream/Input_viewProductionLine.js
View file @
b7cd320d
...
@@ -3,9 +3,9 @@
...
@@ -3,9 +3,9 @@
"
use strict
"
;
"
use strict
"
;
var
gadget_klass
=
rJS
(
window
);
var
gadget_klass
=
rJS
(
window
);
// TODO: save on parent gadget
function
saveGraph
(
evt
)
{
function
saveGraph
(
evt
)
{
var
gadget
=
this
,
var
gadget
=
this
;
graph_data
;
return
new
RSVP
.
Queue
()
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
.
push
(
function
()
{
// Prevent double click
// Prevent double click
...
@@ -18,11 +18,10 @@
...
@@ -18,11 +18,10 @@
return
graph_gadget
.
getContent
();
return
graph_gadget
.
getContent
();
})
})
.
push
(
function
(
body
)
{
.
push
(
function
(
body
)
{
console
.
log
(
"
saving
"
,
JSON
.
parse
(
body
));
return
gadget
.
aq_putAttachment
({
return
gadget
.
aq_putAttachment
({
"
_id
"
:
gadget
.
props
.
jio_key
,
"
_id
"
:
gadget
.
props
.
jio_key
,
"
_attachment
"
:
"
body.json
"
,
"
_attachment
"
:
"
body.json
"
,
"
_data
"
:
body
,
//JSON.stringify(data
, null, 2),
"
_data
"
:
JSON
.
stringify
(
JSON
.
parse
(
body
)
,
null
,
2
),
"
_mimetype
"
:
"
application/json
"
"
_mimetype
"
:
"
application/json
"
});
});
})
})
...
@@ -44,6 +43,7 @@
...
@@ -44,6 +43,7 @@
gadget_klass
gadget_klass
// TODO Mixin
.
ready
(
function
(
g
)
{
.
ready
(
function
(
g
)
{
g
.
props
=
{};
g
.
props
=
{};
})
})
...
...
dream/platform/src/fieldset/fieldset.js
View file @
b7cd320d
...
@@ -17,15 +17,17 @@
...
@@ -17,15 +17,17 @@
initGadgetMixin
(
gadget_klass
);
initGadgetMixin
(
gadget_klass
);
gadget_klass
gadget_klass
.
declareMethod
(
"
render
"
,
function
(
property_list
,
data
,
key
)
{
.
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
,
var
gadget
=
this
,
queue
,
queue
,
value
,
property
;
property
;
gadget
.
key
=
key
;
// used for recursive fieldsets
gadget
.
props
.
key
=
options
.
key
;
// used for recursive fieldsets
gadget
.
props
.
field_gadget_list
=
[];
gadget
.
props
.
field_gadget_list
=
[];
function
addField
(
property
,
value
)
{
function
addField
(
property_id
,
property_definition
,
value
)
{
var
sub_gadget
;
var
sub_gadget
;
queue
queue
.
push
(
function
()
{
.
push
(
function
()
{
...
@@ -34,39 +36,29 @@
...
@@ -34,39 +36,29 @@
gadget
.
props
.
element
.
insertAdjacentHTML
(
gadget
.
props
.
element
.
insertAdjacentHTML
(
'
beforeend
'
,
'
beforeend
'
,
label_template
({
label_template
({
"
for
"
:
property
.
id
,
"
for
"
:
property
_
id
,
"
name
"
:
(
property
.
name
||
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.
// Create a recursive fieldset for this key.
return
gadget
.
declareGadget
(
"
../fieldset/index.html
"
);
return
gadget
.
declareGadget
(
"
../fieldset/index.html
"
);
}
}
if
(
property
.
type
===
"
number
"
)
{
if
(
property
_definition
.
type
===
"
number
"
)
{
return
gadget
.
declareGadget
(
"
../number_field/index.html
"
);
return
gadget
.
declareGadget
(
"
../number_field/index.html
"
);
}
}
if
(
property
.
choice
)
{
if
(
property
_definition
.
enum
)
{
return
gadget
.
declareGadget
(
"
../list_field/index.html
"
);
return
gadget
.
declareGadget
(
"
../list_field/index.html
"
);
}
}
return
gadget
.
declareGadget
(
"
../string_field/index.html
"
);
return
gadget
.
declareGadget
(
"
../string_field/index.html
"
);
})
})
.
push
(
function
(
gg
)
{
.
push
(
function
(
gg
)
{
sub_gadget
=
gg
;
sub_gadget
=
gg
;
var
choice
=
property
.
choice
||
[],
return
sub_gadget
.
render
({
default_opt
=
choice
[
0
]
?
[
choice
[
0
][
1
]]
:
[
""
];
key
:
property_id
,
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
,
value
:
value
,
items
:
choice
,
property_definition
:
property_definition
default
:
default_opt
});
}});
})
})
.
push
(
function
()
{
.
push
(
function
()
{
return
sub_gadget
.
getElement
();
return
sub_gadget
.
getElement
();
...
@@ -79,13 +71,21 @@
...
@@ -79,13 +71,21 @@
queue
=
new
RSVP
.
Queue
()
queue
=
new
RSVP
.
Queue
()
.
push
(
function
()
{
.
push
(
function
()
{
Object
.
keys
(
property_list
).
forEach
(
function
(
i
)
{
if
(
node_id
)
{
property
=
property_list
[
i
];
addField
(
'
id
'
,
{
'
type
'
:
'
string
'
},
node_id
);
value
=
property
.
_default
===
undefined
?
""
:
property
.
_default
;
}
addField
(
property
,
value
);
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
;
return
queue
;
})
})
...
@@ -99,8 +99,8 @@
...
@@ -99,8 +99,8 @@
.
push
(
function
()
{
return
RSVP
.
all
(
promise_list
);
})
.
push
(
function
()
{
return
RSVP
.
all
(
promise_list
);
})
.
push
(
function
(
result_list
)
{
.
push
(
function
(
result_list
)
{
var
name
,
result
=
{},
content
=
result
;
var
name
,
result
=
{},
content
=
result
;
if
(
gadget
.
key
)
{
if
(
gadget
.
props
.
key
)
{
content
=
result
[
gadget
.
key
]
=
{};
content
=
result
[
gadget
.
props
.
key
]
=
{};
}
}
for
(
i
=
0
;
i
<
result_list
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
result_list
.
length
;
i
+=
1
)
{
for
(
name
in
result_list
[
i
])
{
for
(
name
in
result_list
[
i
])
{
...
...
dream/platform/src/jsplumb/jsplumb.js
View file @
b7cd320d
This diff is collapsed.
Click to expand it.
dream/platform/src/list_field/listfield.js
View file @
b7cd320d
...
@@ -28,18 +28,18 @@
...
@@ -28,18 +28,18 @@
var
select
=
this
.
element
.
getElementsByTagName
(
'
select
'
)[
0
],
var
select
=
this
.
element
.
getElementsByTagName
(
'
select
'
)[
0
],
i
,
i
,
template
,
template
,
field_json
=
options
.
field_json
,
tmp
=
''
;
tmp
=
''
;
select
.
setAttribute
(
'
name
'
,
field_json
.
key
);
select
.
setAttribute
(
'
name
'
,
options
.
key
);
for
(
i
=
0
;
i
<
field_json
.
items
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
options
.
property_definition
.
enum
.
length
;
i
+=
1
)
{
if
(
field_json
.
items
[
i
][
1
]
===
field_json
.
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
tmp
+=
template
({
tmp
+=
template
({
value
:
field_json
.
items
[
i
][
1
],
value
:
options
.
property_definition
.
enum
[
i
],
text
:
field_json
.
items
[
i
][
0
]
text
:
options
.
property_definition
.
enum
[
i
]
});
});
}
}
select
.
innerHTML
+=
tmp
;
select
.
innerHTML
+=
tmp
;
...
...
dream/platform/src/number_field/numberfield.js
View file @
b7cd320d
...
@@ -10,11 +10,10 @@
...
@@ -10,11 +10,10 @@
});
});
})
})
.
declareMethod
(
'
render
'
,
function
(
options
)
{
.
declareMethod
(
'
render
'
,
function
(
options
)
{
var
input
=
this
.
element
.
querySelector
(
'
input
'
),
var
input
=
this
.
element
.
querySelector
(
'
input
'
);
field_json
=
options
.
field_json
||
{};
input
.
setAttribute
(
'
value
'
,
options
.
value
);
input
.
setAttribute
(
'
value
'
,
field_json
.
value
);
input
.
setAttribute
(
'
name
'
,
options
.
key
);
input
.
setAttribute
(
'
name
'
,
field_json
.
key
);
input
.
setAttribute
(
'
title
'
,
options
.
title
||
options
.
key
);
input
.
setAttribute
(
'
title
'
,
field_json
.
title
);
})
})
.
declareMethod
(
'
getContent
'
,
function
()
{
.
declareMethod
(
'
getContent
'
,
function
()
{
...
...
dream/platform/src/string_field/stringfield.js
View file @
b7cd320d
...
@@ -10,11 +10,10 @@
...
@@ -10,11 +10,10 @@
});
});
})
})
.
declareMethod
(
'
render
'
,
function
(
options
)
{
.
declareMethod
(
'
render
'
,
function
(
options
)
{
var
input
=
this
.
element
.
querySelector
(
'
input
'
),
var
input
=
this
.
element
.
querySelector
(
'
input
'
);
field_json
=
options
.
field_json
||
{};
input
.
setAttribute
(
'
value
'
,
options
.
value
||
""
);
input
.
setAttribute
(
'
value
'
,
field_json
.
value
||
""
);
input
.
setAttribute
(
'
name
'
,
options
.
key
);
input
.
setAttribute
(
'
name
'
,
field_json
.
key
);
input
.
setAttribute
(
'
title
'
,
options
.
title
||
options
.
key
);
input
.
setAttribute
(
'
title
'
,
field_json
.
title
);
})
})
.
declareMethod
(
'
getContent
'
,
function
()
{
.
declareMethod
(
'
getContent
'
,
function
()
{
...
...
dream/platform/src/toolbox/toolbox.js
View file @
b7cd320d
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
(
function
(
window
,
document
,
RSVP
,
rJS
,
initGadgetMixin
)
{
(
function
(
window
,
document
,
RSVP
,
rJS
,
initGadgetMixin
)
{
"
use strict
"
;
"
use strict
"
;
// XXX use a renderjs utility function for that
/*jslint nomen: true*/
/*jslint nomen: true*/
var
gadget_klass
=
rJS
(
window
);
var
gadget_klass
=
rJS
(
window
);
function
waitForDragstart
(
tool
)
{
function
waitForDragstart
(
tool
)
{
...
@@ -19,7 +18,7 @@
...
@@ -19,7 +18,7 @@
callback
=
function
(
evt
)
{
callback
=
function
(
evt
)
{
try
{
try
{
evt
.
dataTransfer
.
setData
(
'
application/json
'
,
evt
.
dataTransfer
.
setData
(
'
application/json
'
,
tool
.
dataset
.
class_
definition
);
tool
.
dataset
.
class_
name
);
}
catch
(
e
)
{
}
catch
(
e
)
{
reject
(
e
);
reject
(
e
);
}
}
...
@@ -49,7 +48,7 @@
...
@@ -49,7 +48,7 @@
tool
.
className
=
"
tool
"
+
key
;
tool
.
className
=
"
tool
"
+
key
;
tool
.
textContent
=
_class
.
name
||
key
;
tool
.
textContent
=
_class
.
name
||
key
;
tool
.
draggable
=
true
;
tool
.
draggable
=
true
;
tool
.
dataset
.
class_
definition
=
JSON
.
stringify
([
key
,
_class
]
);
tool
.
dataset
.
class_
name
=
JSON
.
stringify
(
key
);
Object
.
keys
(
_class
.
css
||
{}).
forEach
(
function
(
k
)
{
Object
.
keys
(
_class
.
css
||
{}).
forEach
(
function
(
k
)
{
tool
.
style
[
k
]
=
_class
.
css
[
k
];
tool
.
style
[
k
]
=
_class
.
css
[
k
];
});
});
...
...
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