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
48c8a61c
Commit
48c8a61c
authored
Mar 26, 2013
by
Sebastien Robin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add worker count to make the demo more friendly
parent
79a0156c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
5 deletions
+32
-5
dream/platform/__init__.py
dream/platform/__init__.py
+1
-1
ui/css/demo-new.css
ui/css/demo-new.css
+11
-1
ui/index.html
ui/index.html
+4
-0
ui/src/dream_launcher.js
ui/src/dream_launcher.js
+16
-3
No files found.
dream/platform/__init__.py
View file @
48c8a61c
...
...
@@ -41,7 +41,7 @@ def setModel():
@
app
.
route
(
"/updateModel"
,
methods
=
[
"POST"
,
"OPTIONS"
])
@
crossdomain
(
origin
=
'*'
)
def
set
Model
():
def
update
Model
():
app
.
logger
.
debug
(
'updateModel'
)
data
[
'model'
]
=
request
.
json
return
"ok"
...
...
ui/css/demo-new.css
View file @
48c8a61c
...
...
@@ -86,12 +86,22 @@ body {
border-radius
:
10px
;
}
#total_workers
{
position
:
absolute
;
width
:
100px
;
height
:
80px
;
border
:
2px
solid
;
margin-top
:
80px
;
margin-left
:
720px
;
border-radius
:
10px
;
}
#total_throughput
{
position
:
absolute
;
width
:
100px
;
height
:
80px
;
border
:
2px
solid
;
margin-top
:
135
px
;
margin-top
:
200
px
;
margin-left
:
720px
;
border-radius
:
10px
;
}
...
...
ui/index.html
View file @
48c8a61c
...
...
@@ -21,6 +21,10 @@
<ul>
</ul>
</div>
<div
id=
"total_workers"
>
Workers
<h2>
0
</h2>
</div>
<div
id=
"total_throughput"
>
Throughput
<h2></h2>
...
...
ui/src/dream_launcher.js
View file @
48c8a61c
(
function
(
$
)
{
(
function
(
$
,
_
)
{
"
use strict
"
;
jsPlumb
.
bind
(
"
ready
"
,
function
()
{
var
graph_data
=
{},
dream_instance
,
available_people
=
{},
people_list
,
i
,
i_length
;
i
,
i_length
,
updateWorkerCount
;
graph_data
.
throughput
=
0
;
graph_data
.
box_list
=
[
{
id
:
'
window1
'
,
title
:
'
attach1
'
,
throughput
:
30
,
target_list
:
[
'
window2
'
],
coordinate
:
{
top
:
5
,
left
:
5
}},
...
...
@@ -28,6 +28,17 @@
$
(
"
#not_available ul
"
).
append
(
'
<li class="ui-state-default">
'
+
people_list
[
i
]
+
"
</li>
"
);
}
updateWorkerCount
=
function
()
{
var
available_worker_length
=
0
,
available_worker_values
=
_
.
values
(
available_people
);
_
.
each
(
available_worker_values
,
function
(
value
)
{
if
(
value
===
true
)
{
available_worker_length
+=
1
;
}
});
$
(
"
#total_workers h2
"
).
text
(
available_worker_length
.
toString
());
}
// Make list of people draggable, update list of people depending
// to make them available or not
$
(
"
#available li
"
).
draggable
({
appendTo
:
"
body
"
});
...
...
@@ -36,14 +47,16 @@
drop
:
function
(
event
,
ui
)
{
available_people
[
ui
.
draggable
.
text
()]
=
true
;
dream_instance
.
setSimulationParameters
(
available_people
);
updateWorkerCount
();
}
});
$
(
"
#not_available
"
).
droppable
({
drop
:
function
(
event
,
ui
)
{
available_people
[
ui
.
draggable
.
text
()]
=
false
;
dream_instance
.
setSimulationParameters
(
available_people
);
updateWorkerCount
();
}
});
})
})(
jQuery
);
\ No newline at end of file
})(
jQuery
,
_
);
\ 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