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
185e642f
Commit
185e642f
authored
Jan 22, 2015
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit static version
parent
8addc690
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
85 additions
and
71 deletions
+85
-71
dream/platform/static/dream/Input_viewSimulation.html
dream/platform/static/dream/Input_viewSimulation.html
+2
-2
dream/platform/static/dream/Output_viewCapacityUtilisationGraph.js
...tform/static/dream/Output_viewCapacityUtilisationGraph.js
+5
-5
dream/platform/static/dream/Output_viewJobGantt.js
dream/platform/static/dream/Output_viewJobGantt.js
+7
-7
dream/platform/static/dream/Output_viewJobScheduleSpreadsheet.js
...latform/static/dream/Output_viewJobScheduleSpreadsheet.js
+6
-6
dream/platform/static/dream/Output_viewStationUtilisationGraph.js
...atform/static/dream/Output_viewStationUtilisationGraph.js
+65
-50
dream/platform/static/dream/index.js
dream/platform/static/dream/index.js
+0
-1
No files found.
dream/platform/static/dream/Input_viewSimulation.html
View file @
185e642f
...
...
@@ -20,12 +20,12 @@
</head>
<body>
<form
class=
"run_form"
>
<button
type=
"submit"
class=
"ui-btn ui-btn-b ui-btn-inline
ui-icon-refresh ui-btn-icon-right"
>
Run Simulation
</button>
<fieldset>
<div
data-gadget-url=
"../fieldset/index.html"
data-gadget-scope=
"fieldset"
></div>
</fieldset>
<button
type=
"submit"
class=
"ui-btn ui-btn-b ui-btn-inline
ui-icon-refresh ui-btn-icon-right"
>
Run Simulation
</button>
</form>
</body>
</html>
dream/platform/static/dream/Output_viewCapacityUtilisationGraph.js
View file @
185e642f
...
...
@@ -2,10 +2,10 @@
/*jslint unparam: true */
(
function
(
window
,
rJS
,
$
,
initGadgetMixin
)
{
"
use strict
"
;
function
capacity_utilisation_graph_widget
(
all_data
)
{
var
available_capacity_by_station
=
{},
station_id
,
series
,
graph_list
=
[],
options
,
capacity_usage_by_station
=
{},
input_data
=
all_data
.
input
,
output_data
=
all_data
.
result
;
function
capacity_utilisation_graph_widget
(
data
,
result_id
)
{
var
available_capacity_by_station
=
{},
station_id
,
series
,
graph_list
=
[],
options
,
capacity_usage_by_station
=
{},
input_data
=
data
,
output_data
=
data
.
result
.
result_list
[
result_id
]
;
// Compute availability by station
$
.
each
(
input_data
.
nodes
,
function
(
idx
,
obj
)
{
$
.
each
(
input_data
.
graph
.
node
,
function
(
idx
,
obj
)
{
var
available_capacity
=
[];
if
(
obj
.
intervalCapacity
!==
undefined
)
{
$
.
each
(
obj
.
intervalCapacity
,
function
(
i
,
capacity
)
{
...
...
@@ -56,7 +56,7 @@
}
}
};
graph_list
.
push
([
input_data
.
nodes
[
station_id
].
name
||
station_id
,
series
,
options
]);
graph_list
.
push
([
input_data
.
graph
.
node
[
station_id
].
name
||
station_id
,
series
,
options
]);
}
}
return
graph_list
;
...
...
@@ -71,7 +71,7 @@
_id
:
gadget
.
props
.
jio_key
,
_attachment
:
"
simulation.json
"
}).
push
(
function
(
simulation_json
)
{
gadget
.
props
.
result_list
=
capacity_utilisation_graph_widget
(
JSON
.
parse
(
simulation_json
)
[
gadget
.
props
.
result
]
);
gadget
.
props
.
result_list
=
capacity_utilisation_graph_widget
(
JSON
.
parse
(
simulation_json
)
,
gadget
.
props
.
result
);
});
}).
declareMethod
(
"
startService
"
,
function
()
{
var
element
=
$
(
this
.
props
.
element
),
graph
;
...
...
dream/platform/static/dream/Output_viewJobGantt.js
View file @
185e642f
...
...
@@ -6,7 +6,7 @@
gantt
.
templates
.
task_class
=
function
(
start
,
end
,
obj
)
{
return
obj
.
parent
?
"
sub_task
"
:
""
;
};
function
job_gantt_widget
(
all_data
)
{
function
job_gantt_widget
(
data
,
result_id
)
{
// XXX: use dhx_gantt zoom level feature (
// http://dhtmlx.com/docs/products/dhtmlxGantt/02_features.html )
var
now
=
new
Date
(),
start_date
,
gantt_data
=
{
...
...
@@ -26,7 +26,7 @@
open
:
true
}
],
link
:
[]
},
input_data
=
all_data
.
input
,
output_data
=
all_data
.
result
;
},
input_data
=
data
,
output_data
=
data
.
result
.
result_list
[
result_id
]
;
// temporary hack
now
.
setHours
(
0
);
now
.
setMinutes
(
0
);
...
...
@@ -40,7 +40,7 @@
function
isVisibleStation
(
station
)
{
// we should be able to define in the backend which
// station is visible
return
input_data
.
nodes
[
station
].
family
!==
"
Buffer
"
&&
input_data
.
nodes
[
station
].
family
!==
"
Exit
"
;
return
input_data
.
graph
.
node
[
station
].
family
!==
"
Buffer
"
&&
input_data
.
graph
.
node
[
station
].
family
!==
"
Exit
"
;
}
$
.
each
(
output_data
.
elementList
.
sort
(
function
(
a
,
b
)
{
return
a
.
id
<
b
.
id
?
-
1
:
1
;
...
...
@@ -49,9 +49,9 @@
if
(
obj
.
family
===
"
Job
"
)
{
// find the corresponding input
// find the input order and order component for this job
for
(
node_key
in
input_data
.
nodes
)
{
if
(
input_data
.
nodes
.
hasOwnProperty
(
node_key
))
{
node
=
input_data
.
nodes
[
node_key
];
for
(
node_key
in
input_data
.
graph
.
node
)
{
if
(
input_data
.
graph
.
node
.
hasOwnProperty
(
node_key
))
{
node
=
input_data
.
graph
.
node
[
node_key
];
if
(
node
.
wip
)
{
for
(
i
=
0
;
i
<
node
.
wip
.
length
;
i
+=
1
)
{
order
=
node
.
wip
[
i
];
...
...
@@ -173,7 +173,7 @@
_id
:
gadget
.
props
.
jio_key
,
_attachment
:
"
simulation.json
"
}).
push
(
function
(
simulation_json
)
{
gadget
.
props
.
result
=
job_gantt_widget
(
JSON
.
parse
(
simulation_json
)
[
gadget
.
props
.
result
]
);
gadget
.
props
.
result
=
job_gantt_widget
(
JSON
.
parse
(
simulation_json
)
,
gadget
.
props
.
result
);
});
}).
declareMethod
(
"
startService
"
,
function
()
{
$
(
this
.
props
.
element
).
find
(
"
.gant_container
"
).
dhx_gantt
({
...
...
dream/platform/static/dream/Output_viewJobScheduleSpreadsheet.js
View file @
185e642f
...
...
@@ -2,8 +2,8 @@
/*jslint nomen: true */
(
function
(
window
,
rJS
,
RSVP
,
moment
,
initGadgetMixin
)
{
"
use strict
"
;
function
job_schedule_spreadsheet_widget
(
all_data
)
{
var
now
=
new
Date
(),
name
,
input_data
=
all_data
.
input
,
output_data
=
all_data
.
result
,
spreadsheet_data
=
[],
spreadsheet_header
=
[
[
"
Jobs
"
,
"
ID
"
,
"
Project Manager
"
,
"
Due Date
"
,
"
Priority
"
,
"
Entrance Time
"
,
"
Processing Time
"
,
"
Station ID
"
,
"
Step No.
"
]
],
simulation_start_date
=
new
Date
(
input_data
.
general
.
currentDate
||
now
.
getTime
()),
i
,
j
,
k
,
obj
,
node
,
component
,
order
,
node_id
,
due_date
,
entrance_date
,
duration
,
schedule
,
input_job
=
null
,
input_order
=
null
;
function
job_schedule_spreadsheet_widget
(
data
,
result_id
)
{
var
now
=
new
Date
(),
name
,
input_data
=
data
,
output_data
=
data
.
result
.
result_list
[
result_id
]
,
spreadsheet_data
=
[],
spreadsheet_header
=
[
[
"
Jobs
"
,
"
ID
"
,
"
Project Manager
"
,
"
Due Date
"
,
"
Priority
"
,
"
Entrance Time
"
,
"
Processing Time
"
,
"
Station ID
"
,
"
Step No.
"
]
],
simulation_start_date
=
new
Date
(
input_data
.
general
.
currentDate
||
now
.
getTime
()),
i
,
j
,
k
,
obj
,
node
,
component
,
order
,
node_id
,
due_date
,
entrance_date
,
duration
,
schedule
,
input_job
=
null
,
input_order
=
null
;
// XXX why ?
now
.
setHours
(
0
);
now
.
setMinutes
(
0
);
...
...
@@ -18,9 +18,9 @@
input_order
=
null
;
// find the input order and order component for this job
// XXX this has no real meaning with capacity project
for
(
node_id
in
input_data
.
nodes
)
{
if
(
input_data
.
nodes
.
hasOwnProperty
(
node_id
))
{
node
=
input_data
.
nodes
[
node_id
];
for
(
node_id
in
input_data
.
graph
.
node
)
{
if
(
input_data
.
graph
.
node
.
hasOwnProperty
(
node_id
))
{
node
=
input_data
.
graph
.
node
[
node_id
];
if
(
node
.
wip
)
{
for
(
j
=
0
;
j
<
node
.
wip
.
length
;
j
+=
1
)
{
order
=
node
.
wip
[
j
];
...
...
@@ -120,7 +120,7 @@
_attachment
:
"
simulation.json
"
}),
gadget
.
getDeclaredGadget
(
"
tableeditor
"
)
]);
}).
push
(
function
(
result_list
)
{
return
result_list
[
1
].
render
(
JSON
.
stringify
(
job_schedule_spreadsheet_widget
(
JSON
.
parse
(
result_list
[
0
])
[
gadget
.
props
.
result
]
)));
return
result_list
[
1
].
render
(
JSON
.
stringify
(
job_schedule_spreadsheet_widget
(
JSON
.
parse
(
result_list
[
0
])
,
gadget
.
props
.
result
)));
});
}).
declareMethod
(
"
startService
"
,
function
()
{
return
this
.
getDeclaredGadget
(
"
tableeditor
"
).
push
(
function
(
tableeditor
)
{
...
...
dream/platform/static/dream/Output_viewStationUtilisationGraph.js
View file @
185e642f
...
...
@@ -2,65 +2,81 @@
/*jslint unparam: true */
(
function
(
window
,
rJS
,
$
,
initGadgetMixin
)
{
"
use strict
"
;
function
getRequestedValue
(
object
,
key
)
{
var
value
=
0
;
if
(
object
.
results
[
key
]
!==
undefined
)
{
if
(
object
.
results
[
key
].
avg
!==
undefined
)
{
value
=
object
.
results
[
key
].
avg
;
}
else
{
value
=
object
.
results
[
key
];
}
}
return
value
;
}
function
station_utilisation_graph_widget
(
output_data
,
config
)
{
var
data
=
{},
ticks
=
[],
counter
=
1
,
key
,
series
=
[],
options
;
// initialize the data dict holding the properties requested
for
(
key
in
config
)
{
if
(
config
.
hasOwnProperty
(
key
))
{
data
[
key
]
=
[];
}
}
function
station_utilisation_graph_widget
(
output_data
)
{
var
blockage_data
=
[],
waiting_data
=
[],
failure_data
=
[],
working_data
=
[],
ticks
=
[],
counter
=
1
,
series
,
options
;
// XXX output is still elementList ???
$
.
each
(
output_data
.
elementList
.
sort
(
function
(
a
,
b
)
{
return
a
.
id
<
b
.
id
?
-
1
:
1
;
}),
function
(
idx
,
obj
)
{
var
ctrl_flag
=
false
,
reqKey
,
request
,
i
;
// determine weather the current
// obj has the requested key
for
(
reqKey
in
config
)
{
if
(
config
.
hasOwnProperty
(
reqKey
))
{
if
(
obj
.
results
!==
undefined
&&
obj
.
results
[
config
[
reqKey
][
0
]]
!==
undefined
)
{
// control flag, if the results contain
// entities that have working ratios
ctrl_flag
=
true
;
b
reak
;
// add each object that has a working ratio
if
(
obj
.
results
!==
undefined
&&
obj
.
results
.
working_ratio
!==
undefined
)
{
/* when there is only one replication, the ratio is given as a float,
otherwise we have a mapping avg, ub lb */
var
blockage_ratio
=
0
,
working_ratio
=
0
,
waiting_ratio
=
0
,
failure_ratio
=
0
;
if
(
obj
.
results
.
blockage_ratio
!==
undefined
)
{
if
(
obj
.
results
.
blockage_ratio
.
avg
!==
undefined
)
{
blockage_ratio
=
obj
.
results
.
blockage_ratio
.
avg
;
}
else
{
b
lockage_ratio
=
obj
.
results
.
blockage_ratio
;
}
}
}
// if the obj contains the requested key
if
(
ctrl_flag
===
true
)
{
for
(
reqKey
in
config
)
{
if
(
config
.
hasOwnProperty
(
reqKey
))
{
request
=
0
;
for
(
i
=
0
;
i
<=
config
[
reqKey
].
length
-
1
;
i
+=
1
)
{
request
+=
getRequestedValue
(
obj
,
config
[
reqKey
][
i
]);
}
data
[
reqKey
].
push
([
counter
,
request
]);
blockage_data
.
push
([
counter
,
blockage_ratio
]);
// XXX merge setup & loading ratio in working ratio for now
if
(
obj
.
results
.
setup_ratio
!==
undefined
)
{
if
(
obj
.
results
.
setup_ratio
.
avg
!==
undefined
)
{
working_ratio
+=
obj
.
results
.
setup_ratio
.
avg
;
}
else
{
working_ratio
+=
obj
.
results
.
setup_ratio
;
}
}
if
(
obj
.
results
.
loading_ratio
!==
undefined
)
{
if
(
obj
.
results
.
loading_ratio
.
avg
!==
undefined
)
{
working_ratio
+=
obj
.
results
.
loading_ratio
.
avg
;
}
else
{
working_ratio
+=
obj
.
results
.
loading_ratio
;
}
}
if
(
obj
.
results
.
working_ratio
!==
undefined
)
{
if
(
obj
.
results
.
working_ratio
.
avg
!==
undefined
)
{
working_ratio
+=
obj
.
results
.
working_ratio
.
avg
;
}
else
{
working_ratio
+=
obj
.
results
.
working_ratio
;
}
}
working_data
.
push
([
counter
,
working_ratio
]);
if
(
obj
.
results
.
waiting_ratio
!==
undefined
)
{
if
(
obj
.
results
.
waiting_ratio
.
avg
!==
undefined
)
{
waiting_ratio
=
obj
.
results
.
waiting_ratio
.
avg
;
}
else
{
waiting_ratio
=
obj
.
results
.
waiting_ratio
;
}
}
waiting_data
.
push
([
counter
,
waiting_ratio
]);
if
(
obj
.
results
.
failure_ratio
!==
undefined
)
{
if
(
obj
.
results
.
failure_ratio
.
avg
!==
undefined
)
{
failure_ratio
=
obj
.
results
.
failure_ratio
.
avg
;
}
else
{
failure_ratio
=
obj
.
results
.
failure_ratio
;
}
}
failure_data
.
push
([
counter
,
failure_ratio
]);
ticks
.
push
([
counter
,
obj
.
id
]);
counter
+=
1
;
}
});
for
(
key
in
data
)
{
if
(
data
.
hasOwnProperty
(
key
))
{
series
.
push
({
label
:
key
,
data
:
data
[
key
]
});
}
}
series
=
[
{
label
:
"
Working
"
,
data
:
working_data
},
{
label
:
"
Waiting
"
,
data
:
waiting_data
},
{
label
:
"
Failures
"
,
data
:
failure_data
},
{
label
:
"
Blockage
"
,
data
:
blockage_data
}
];
options
=
{
xaxis
:
{
minTickSize
:
1
,
...
...
@@ -72,7 +88,7 @@
series
:
{
bars
:
{
show
:
true
,
barWidth
:
.
7
,
barWidth
:
.
8
,
align
:
"
center
"
},
stack
:
true
...
...
@@ -90,8 +106,7 @@
_id
:
gadget
.
props
.
jio_key
,
_attachment
:
"
simulation.json
"
}).
push
(
function
(
simulation_json
)
{
var
json_data
=
JSON
.
parse
(
simulation_json
),
config
=
json_data
.
application_configuration
.
output
[
options
.
action
].
configuration
.
data
;
gadget
.
props
.
result_list
=
station_utilisation_graph_widget
(
json_data
.
result
.
result_list
[
gadget
.
props
.
result
],
config
);
gadget
.
props
.
result_list
=
station_utilisation_graph_widget
(
JSON
.
parse
(
simulation_json
).
result
.
result_list
[
gadget
.
props
.
result
]);
});
}).
declareMethod
(
"
startService
"
,
function
()
{
// XXX Manually calculate width and height when resizing
...
...
dream/platform/static/dream/index.js
View file @
185e642f
...
...
@@ -193,7 +193,6 @@
});
}).
push
(
function
(
sim_json
)
{
var
document_list
=
JSON
.
parse
(
sim_json
).
result
.
result_list
;
console
.
log
(
JSON
.
parse
(
sim_json
).
result
);
return
document_list
[
options
.
result
].
score
+
"
"
+
document_list
[
options
.
result
].
key
;
});
}
else
{
...
...
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