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
fa31b4df
Commit
fa31b4df
authored
Mar 25, 2013
by
Sebastien Robin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
display througput on boxes instead of connections
parent
f6919c2a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
19 deletions
+19
-19
ui/src/dream.js
ui/src/dream.js
+19
-19
No files found.
ui/src/dream.js
View file @
fa31b4df
...
@@ -60,6 +60,7 @@
...
@@ -60,6 +60,7 @@
dropOptions
:{
hoverClass
:
"
dragHover
"
},
dropOptions
:{
hoverClass
:
"
dragHover
"
},
anchor
:
"
Continuous
"
anchor
:
"
Continuous
"
});
});
};
};
priv
.
initDialog
=
function
()
{
priv
.
initDialog
=
function
()
{
...
@@ -109,17 +110,14 @@
...
@@ -109,17 +110,14 @@
var
bValid
=
true
,
i
,
i_length
,
box
;
var
bValid
=
true
,
i
,
i_length
,
box
;
allFields
.
removeClass
(
"
ui-state-error
"
);
allFields
.
removeClass
(
"
ui-state-error
"
);
console
.
log
(
"
going to check troughput val
"
,
throughput
.
val
());
bValid
=
bValid
&&
checkRegexp
(
throughput
,
/^
([
0-9
])
+$/
,
"
Througput must be integer.
"
);
bValid
=
bValid
&&
checkRegexp
(
throughput
,
/^
([
0-9
])
+$/
,
"
Througput must be integer.
"
);
if
(
bValid
)
{
if
(
bValid
)
{
console
.
log
(
"
new value is ok...
"
,
throughput
.
val
());
console
.
log
(
"
dialog_connection
"
,
priv
.
dialog_connection
);
// Update the model with new value
// Update the model with new value
i_length
=
model
.
box_list
.
length
;
i_length
=
model
.
box_list
.
length
;
for
(
i
=
0
;
i
<
i_length
;
i
++
)
{
for
(
i
=
0
;
i
<
i_length
;
i
++
)
{
box
=
model
.
box_list
[
i
];
box
=
model
.
box_list
[
i
];
if
(
box
.
id
===
priv
.
dialog_connection
.
sourceI
d
)
{
if
(
box
.
id
===
priv
.
box_i
d
)
{
box
.
throughput
=
parseInt
(
throughput
.
val
(),
10
);
box
.
throughput
=
parseInt
(
throughput
.
val
(),
10
);
}
}
}
}
...
@@ -172,7 +170,6 @@
...
@@ -172,7 +170,6 @@
console
.
log
(
"
in dream, jsPlumb.connect
"
,
box
.
id
,
box
.
target_list
[
j
]);
console
.
log
(
"
in dream, jsPlumb.connect
"
,
box
.
id
,
box
.
target_list
[
j
]);
line
=
jsPlumb
.
connect
({
source
:
box
.
id
,
target
:
box
.
target_list
[
j
],
line
=
jsPlumb
.
connect
({
source
:
box
.
id
,
target
:
box
.
target_list
[
j
],
labelStyle
:
{
cssClass
:
"
component label
"
}});
labelStyle
:
{
cssClass
:
"
component label
"
}});
//, label: box.throughput.toString()});
// Example to change line color
// Example to change line color
// line.setPaintStyle({strokeStyle:"#42a62c", lineWidth:2 });
// line.setPaintStyle({strokeStyle:"#42a62c", lineWidth:2 });
}
}
...
@@ -209,13 +206,14 @@
...
@@ -209,13 +206,14 @@
};
};
// Utility function to update the content of the box
// Utility function to update the content of the box
priv
.
updateBoxContent
=
function
(
box_id
,
title
,
worker
)
{
priv
.
updateBoxContent
=
function
(
box_id
,
title
,
throughput
,
worker
)
{
var
box
,
html_string
;
var
box
,
html_string
;
box
=
$
(
"
#
"
+
box_id
);
box
=
$
(
"
#
"
+
box_id
);
html_string
=
"
<strong>
"
+
title
+
"
</strong>
"
;
html_string
=
"
<strong>
"
+
title
+
"
</strong>
"
;
if
(
worker
!==
undefined
&&
worker
!==
null
)
{
if
(
worker
!==
undefined
&&
worker
!==
null
)
{
html_string
+=
"
<br> (
"
+
worker
+
"
)
"
;
html_string
+=
"
<br> (
"
+
worker
+
"
)
"
;
}
}
html_string
+=
"
<br><strong>througput:
"
+
throughput
+
"
</strong>
"
;
box
.
html
(
html_string
);
box
.
html
(
html_string
);
};
};
...
@@ -260,15 +258,8 @@
...
@@ -260,15 +258,8 @@
priv
.
updateModel
=
function
(
success
)
{
priv
.
updateModel
=
function
(
success
)
{
var
refreshGraph
=
function
(
model
)
{
var
refreshGraph
=
function
(
model
)
{
//console.log("model", model);
var
i
,
i_length
,
box
,
box_list
,
box
,
box_id
;
var
i
,
i_length
,
box
;
//console.log("before i_length");
//console.log("model", model);
//console.log(typeof(model));
//console.log("model.box_list", model["box_list"]);
i_length
=
model
.
box_list
.
length
;
i_length
=
model
.
box_list
.
length
;
//console.log("after i_length");
//console.log("model", model);
for
(
i
=
0
;
i
<
i_length
;
i
++
)
{
for
(
i
=
0
;
i
<
i_length
;
i
++
)
{
//, style: {"background-color":"#FF0000"}
//, style: {"background-color":"#FF0000"}
box
=
model
.
box_list
[
i
];
box
=
model
.
box_list
[
i
];
...
@@ -278,14 +269,23 @@
...
@@ -278,14 +269,23 @@
priv
.
updateBoxStyle
(
box
.
id
,
{
"
background-color
"
:
"
#FF0000
"
});
priv
.
updateBoxStyle
(
box
.
id
,
{
"
background-color
"
:
"
#FF0000
"
});
}
}
// Update content of the box
// Update content of the box
priv
.
updateBoxContent
(
box
.
id
,
box
.
title
,
box
.
worker
);
priv
.
updateBoxContent
(
box
.
id
,
box
.
title
,
box
.
throughput
,
box
.
worker
);
// Update the label
if
(
box
.
target_list
!==
undefined
)
{
priv
.
updateConnectionLabel
(
box
.
id
,
box
.
target_list
[
0
],
box
.
throughput
.
toString
());
};
}
}
// Refresh total throughput value
// Refresh total throughput value
$
(
"
#total_throughput h2
"
).
text
(
model
.
throughput
.
toString
());
$
(
"
#total_throughput h2
"
).
text
(
model
.
throughput
.
toString
());
box_list
=
$
(
"
.window
"
);
// prevent click event listener to open dialog on every box
i_length
=
box_list
.
length
;
for
(
i
=
0
;
i
<
i_length
;
i
++
)
{
box
=
box_list
[
i
];
box_id
=
box
.
id
;
$
(
"
#
"
+
box_id
).
click
(
function
(
box_id
)
{
return
function
()
{
priv
.
box_id
=
box_id
;
$
(
"
#dialog-form
"
).
dialog
(
"
open
"
);
}
}(
box_id
));
}
};
};
priv
.
getModel
(
refreshGraph
);
priv
.
getModel
(
refreshGraph
);
};
};
...
...
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