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
29169e13
Commit
29169e13
authored
Nov 18, 2013
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use the new format in internal data too.
parent
a696a08b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
38 deletions
+44
-38
dream/platform/static/src/dream.js
dream/platform/static/src/dream.js
+11
-14
dream/platform/static/src/dream_launcher.js
dream/platform/static/src/dream_launcher.js
+24
-17
dream/platform/static/src/jsonPlumb.js
dream/platform/static/src/jsonPlumb.js
+9
-7
No files found.
dream/platform/static/src/dream.js
View file @
29169e13
...
...
@@ -102,7 +102,7 @@
$
(
"
#dialog-fieldset
"
).
children
().
remove
();
var
element_id_prefix
=
element_id
.
split
(
"
_
"
)[
0
];
var
property_list
=
configuration
[
element_id_prefix
].
property_list
||
[];
var
previous_data
=
that
.
getData
()[
"
element
"
];
var
previous_data
=
that
.
getData
()[
"
nodes
"
];
var
element_name
=
previous_data
[
element_id
][
'
name
'
]
||
element_id
;
fieldset
.
append
(
...
...
@@ -241,28 +241,25 @@
priv
.
formatForManpy
=
function
(
data
)
{
var
manpy_dict
=
{},
nodes
=
{},
edges
=
{},
edge_id
=
0
;
$
.
each
(
data
[
'
element
'
],
function
(
idx
,
element
)
{
var
clone_
element
=
{};
/* clone the
element
and put content of 'data' at the top level. */
$
.
each
(
element
,
function
(
k
,
v
)
{
$
.
each
(
data
[
'
nodes
'
],
function
(
idx
,
node
)
{
var
clone_
node
=
{};
/* clone the
node
and put content of 'data' at the top level. */
$
.
each
(
node
,
function
(
k
,
v
)
{
if
(
k
==
'
data
'
)
{
$
.
each
(
v
,
function
(
kk
,
vv
)
{
clone_element
[
kk
]
=
vv
;
});
}
else
if
(
k
==
'
successorList
'
)
{
$
.
each
(
v
,
function
(
i
,
successor
)
{
edges
[
edge_id
]
=
[
clone_element
[
'
id
'
],
successor
,
{}];
edge_id
+=
1
;
clone_node
[
kk
]
=
vv
;
});
}
else
if
(
k
==
'
id
'
)
{
true
;
// no need to output
}
else
{
clone_
element
[
k
]
=
v
;
clone_
node
[
k
]
=
v
;
}
});
nodes
[
clone_element
[
'
id
'
]]
=
clone_element
;
nodes
[
node
[
'
id
'
]]
=
clone_node
;
});
manpy_dict
[
'
nodes
'
]
=
nodes
;
manpy_dict
[
'
edges
'
]
=
edges
;
manpy_dict
[
'
edges
'
]
=
data
[
'
edges
'
]
;
manpy_dict
[
'
general
'
]
=
data
[
'
general
'
];
return
manpy_dict
;
};
...
...
dream/platform/static/src/dream_launcher.js
View file @
29169e13
...
...
@@ -239,32 +239,31 @@
},
function
(
err
,
response
)
{
if
(
response
!==
undefined
&&
response
.
data
!==
undefined
)
{
// Add all elements
$
.
each
(
response
.
data
.
element
,
function
(
key
,
value
)
{
$
.
each
(
response
.
data
.
nodes
,
function
(
key
,
value
)
{
var
preference_data
=
response
.
data
.
preference
!==
undefined
?
response
.
data
.
preference
[
value
.
id
]
:
{};
response
.
data
.
preference
[
key
]
:
{};
$
.
each
(
preference_data
,
function
(
preference_key
,
preference_value
)
{
value
[
preference_key
]
=
preference_value
;
});
dream_instance
.
newElement
(
value
);
dream_instance
.
updateElementData
(
value
.
id
,
{
dream_instance
.
updateElementData
(
key
,
{
data
:
value
.
data
||
{}
});
});
$
.
each
(
response
.
data
.
edges
,
function
(
key
,
value
)
{
dream_instance
.
connect
(
value
[
0
],
value
[
1
]);
});
// Now
link elements between them and
update id_container
$
.
each
(
response
.
data
.
element
,
function
(
key
,
value
)
{
// Now update id_container
$
.
each
(
response
.
data
.
nodes
,
function
(
key
,
value
)
{
var
element_id
=
value
.
id
,
prefix
,
suffix
,
splitted_element_id
,
successor_list
=
value
.
successorList
||
[];
prefix
,
suffix
,
splitted_element_id
;
splitted_element_id
=
element_id
.
split
(
"
_
"
);
prefix
=
splitted_element_id
[
0
];
suffix
=
splitted_element_id
[
1
];
id_container
[
prefix
]
=
Math
.
max
((
id_container
[
prefix
]
||
0
),
parseInt
(
suffix
,
10
));
$
.
each
(
successor_list
,
function
(
idx
,
successor_value
)
{
dream_instance
.
connect
(
value
.
id
,
successor_value
);
});
});
dream_instance
.
setGeneralProperties
(
response
.
data
.
general
);
dream_instance
.
initGeneralProperties
();
// XXX
...
...
@@ -305,19 +304,27 @@
if
(
obj
.
results
.
working_ratio
!==
undefined
)
{
/* when there is only one replication, the ratio is given as a float,
otherwise we have a mapping avg, min max */
blockage_data
.
push
([
counter
,
obj
.
results
.
blockage_ratio
.
avg
||
obj
.
results
.
blockage_ratio
]);
if
(
obj
.
results
.
blockage_ratio
!==
undefined
)
{
blockage_data
.
push
([
counter
,
obj
.
results
.
blockage_ratio
.
avg
||
obj
.
results
.
blockage_ratio
]);
}
else
{
blockage_data
.
push
([
counter
,
0.0
]);
}
waiting_data
.
push
([
counter
,
obj
.
results
.
waiting_ratio
.
avg
||
obj
.
results
.
waiting_ratio
]);
failure_data
.
push
([
counter
,
obj
.
results
.
failure_ratio
.
avg
||
obj
.
results
.
failure_ratio
]);
if
(
obj
.
results
.
failure_ratio
!==
undefined
)
{
failure_data
.
push
([
counter
,
obj
.
results
.
failure_ratio
.
avg
||
obj
.
results
.
failure_ratio
]);
}
else
{
failure_data
.
push
([
counter
,
0.0
]);
}
working_data
.
push
([
counter
,
obj
.
results
.
working_ratio
.
avg
||
obj
.
results
.
working_ratio
]);
ticks
.
push
([
counter
,
dream_instance
.
getData
().
element
[
ticks
.
push
([
counter
,
dream_instance
.
getData
().
nodes
[
obj
.
id
].
name
||
obj
.
id
]);
counter
++
;
}
...
...
dream/platform/static/src/jsonPlumb.js
View file @
29169e13
...
...
@@ -91,14 +91,14 @@
});
var
updateConnectionData
=
function
(
connection
,
remove
)
{
var
source_element
;
source_element
=
priv
.
node_container
[
connection
.
sourceId
];
source_element
.
successorList
=
source_element
.
successorList
||
[];
if
(
remove
)
{
source_element
.
successorList
.
splice
(
source_element
.
successorList
.
indexOf
(
connection
.
targetId
));
delete
(
priv
.
edge_container
[
connection
.
id
]);
}
else
{
source_element
.
successorList
.
push
(
connection
.
targetId
);
priv
.
edge_container
[
connection
.
id
]
=
[
connection
.
sourceId
,
connection
.
targetId
,
{}
];
}
priv
.
onDataChange
();
};
...
...
@@ -176,7 +176,8 @@
priv
.
getData
=
function
()
{
return
{
"
element
"
:
priv
.
node_container
,
"
nodes
"
:
priv
.
node_container
,
"
edges
"
:
priv
.
edge_container
,
"
preference
"
:
priv
.
preference_container
,
"
general
"
:
priv
.
general_container
};
...
...
@@ -200,6 +201,7 @@
that
.
start
=
function
()
{
priv
.
node_container
=
{};
priv
.
edge_container
=
{};
priv
.
preference_container
=
{};
priv
.
general_container
=
{};
priv
.
initJsPlumb
();
...
...
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