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
1b278b20
Commit
1b278b20
authored
Jun 06, 2014
by
Romain Courteaud
Committed by
Jérome Perrin
Aug 11, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate exit statistics widget
parent
f70ce67a
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
241 additions
and
9 deletions
+241
-9
dream/platform/src/index.html
dream/platform/src/index.html
+0
-6
dream/platform/src/src/dream.js
dream/platform/src/src/dream.js
+0
-2
dream/platform/src2/dream/document_page_mixin.js
dream/platform/src2/dream/document_page_mixin.js
+3
-1
dream/platform/src2/dream/exit_stat.html
dream/platform/src2/dream/exit_stat.html
+70
-0
dream/platform/src2/dream/exit_stat.js
dream/platform/src2/dream/exit_stat.js
+168
-0
No files found.
dream/platform/src/index.html
View file @
1b278b20
...
...
@@ -74,7 +74,6 @@
<ul>
<li><a
href=
"#station_utilisation_graph"
>
Stations Utilization
</a></li>
<li><a
href=
"#capacity_utilisation_graph"
>
Capacity Utilization
</a></li>
<li><a
href=
"#exit_stat"
>
Exit Statistics
</a></li>
<li><a
href=
"#job_gantt"
>
Job Gantt
</a></li>
<li><a
href=
"#job_schedule_spreadsheet"
>
Job Schedule
</a></li>
</ul>
...
...
@@ -84,11 +83,6 @@
<div
id=
"capacity_graphs"
></div>
</div>
<div
id=
"exit_stat"
>
<h1>
Exit Statistics
</h1>
<div></div>
</div>
<div
id=
"job_gantt"
style=
'width:1320px; height:800px;'
></div>
<div
id=
"job_schedule_spreadsheet"
style=
"overflow: scroll;"
></div>
...
...
dream/platform/src/src/dream.js
View file @
1b278b20
...
...
@@ -22,8 +22,6 @@
(
function
(
scope
,
$
,
jsPlumb
,
console
)
{
"
use strict
"
;
function
capacity_utilisation_graph_widget
(
input_data
,
output_data
)
{
var
available_capacity_by_station
=
{},
capacity_usage_by_station
=
{};
...
...
dream/platform/src2/dream/document_page_mixin.js
View file @
1b278b20
...
...
@@ -25,6 +25,7 @@
"
queue_stat_graph
"
,
key
),
gadget
.
whoWantToDisplayThisDocumentPage
(
"
exit_stat
"
,
key
),
gadget
.
whoWantToDisplayThisDocumentPage
(
"
debug_json
"
,
key
)
]);
})
...
...
@@ -35,7 +36,8 @@
{
link
:
result_list
[
2
],
title
:
"
Manage document
"
},
{
link
:
result_list
[
3
],
title
:
"
Stations Utilization
"
},
{
link
:
result_list
[
4
],
title
:
"
Queues Statistics
"
},
{
link
:
result_list
[
5
],
title
:
"
Debug JSON
"
}
{
link
:
result_list
[
5
],
title
:
"
Exit Statistics
"
},
{
link
:
result_list
[
6
],
title
:
"
Debug JSON
"
}
];
});
});
...
...
dream/platform/src2/dream/exit_stat.html
0 → 100644
View file @
1b278b20
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<title>
Exit Statistics
</title>
<script
src=
"../<%= copy.rsvp.relative_dest %>"
type=
"text/javascript"
></script>
<script
src=
"../<%= copy.renderjs.relative_dest %>"
type=
"text/javascript"
></script>
<script
src=
"../<%= copy.handlebars.relative_dest %>"
type=
"text/javascript"
></script>
<script
src=
"document_page_mixin.js"
type=
"text/javascript"
></script>
<script
src=
"exit_stat.js"
type=
"text/javascript"
></script>
<script
id=
"interval-through-metric-template"
type=
"text/x-handlebars-template"
>
<
tr
>
<
td
>
Daily
Attainment
<
/td
>
<
td
>
{{
#
interval_list
}}
{{
interval
}}
<
i
class
=
"
fa {{icon}}
"
/><
br
/>
{{
/
interval_list
}}
<
/td
>
<
/tr
>
<
tr
>
<
td
>
Average
Daily
Line
Attainment
<
/td
>
<
td
>
{{
average
}}
%<
td
>
<
/tr
>
</script>
<script
id=
"simple-metric-template"
type=
"text/x-handlebars-template"
>
<
tr
>
<
td
>
{{
metric
}}
<
/td
>
<
td
>
{{
value
}}
<
/td
>
<
/tr
>
</script>
<script
id=
"metric-object-template"
type=
"text/x-handlebars-template"
>
<
tr
>
<
td
>
{{
metric
}}
<
/td
>
<
td
>
<
table
width
=
'
100%
'
>
<
tbody
>
<
tr
>
<
td
>
Average
<
/td
>
<
td
>
{{
avg
}}
<
/td
>
<
/tr
>
<
tr
>
<
td
>
Lower
Bound
<
/td
>
<
td
>
{{
lb
}}
<
/td
>
<
/tr
>
<
tr
>
<
td
>
Upper
Bound
<
/td
>
<
td
>
{{
ub
}}
<
/td
>
<
/tr
>
<
/tbody
>
<
/table
>
<
/td
>
<
/tr
>
</script>
<script
id=
"header-template"
type=
"text/x-handlebars-template"
>
<
tr
>
<
th
colspan
=
'
2
'
>
{{
name
}}
<
/th
>
<
/tr
>
</script>
</head>
<body>
<table>
</table>
</body>
</html>
dream/platform/src2/dream/exit_stat.js
0 → 100644
View file @
1b278b20
/*global console, rJS, RSVP, initDocumentPageMixin, Handlebars */
/*jslint nomen: true */
(
function
(
window
,
rJS
,
RSVP
,
initDocumentPageMixin
,
Handlebars
)
{
"
use strict
"
;
/////////////////////////////////////////////////////////////////
// Handlebars
/////////////////////////////////////////////////////////////////
// Precompile the templates while loading the first gadget instance
var
gadget_klass
=
rJS
(
window
),
header_source
=
gadget_klass
.
__template_element
.
getElementById
(
"
header-template
"
)
.
innerHTML
,
header_template
=
Handlebars
.
compile
(
header_source
),
metric_object_source
=
gadget_klass
.
__template_element
.
getElementById
(
"
metric-object-template
"
)
.
innerHTML
,
metric_object_template
=
Handlebars
.
compile
(
metric_object_source
),
metric_simple_source
=
gadget_klass
.
__template_element
.
getElementById
(
"
simple-metric-template
"
)
.
innerHTML
,
metric_simple_template
=
Handlebars
.
compile
(
metric_simple_source
),
metric_interval_source
=
gadget_klass
.
__template_element
.
getElementById
(
"
interval-through-metric-template
"
)
.
innerHTML
,
metric_interval_template
=
Handlebars
.
compile
(
metric_interval_source
);
/////////////////////////////////////////////////////////////////
// Calculate widget
/////////////////////////////////////////////////////////////////
function
calculate_average
(
attainment_list
)
{
return
((
attainment_list
.
reduce
(
function
(
a
,
b
)
{
return
a
+
b
;
}
)
/
attainment_list
.
length
)
*
100
).
toFixed
(
2
);
}
function
calculate_exit_stat
(
output_data
)
{
var
elementList
=
output_data
.
elementList
,
i
,
j
,
metric
,
metric_value
,
element
,
interval_value
,
interval_list
,
attainment_list
,
throughputTarget
=
parseFloat
(
output_data
.
general
.
throughputTarget
),
result
=
""
;
for
(
i
=
0
;
i
<
elementList
.
length
;
i
+=
1
)
{
element
=
elementList
[
i
];
if
(
element
.
_class
===
'
Dream.Exit
'
)
{
result
+=
"
<table>
"
;
result
+=
header_template
({
name
:
element
.
name
||
element
.
id
});
for
(
metric
in
element
.
results
)
{
if
(
element
.
results
.
hasOwnProperty
(
metric
))
{
metric_value
=
element
.
results
[
metric
];
if
(
metric
===
'
intervalThroughputList
'
)
{
interval_list
=
[];
attainment_list
=
[];
for
(
j
=
0
;
j
<
metric_value
.
length
;
j
+=
1
)
{
interval_value
=
metric_value
[
j
];
attainment_list
.
push
((
interval_value
/
throughputTarget
));
if
(
interval_value
>
throughputTarget
)
{
interval_list
.
push
({
interval
:
interval_value
,
icon
:
"
fa-smile-o
"
});
}
else
{
interval_list
.
push
({
interval
:
interval_value
,
icon
:
"
fa-frown-o
"
});
}
}
result
+=
metric_interval_template
({
interval_list
:
interval_list
,
average
:
calculate_average
(
attainment_list
)
});
}
else
{
if
(
typeof
metric_value
===
"
object
"
)
{
if
(
metric_value
.
ub
===
metric_value
.
lb
)
{
metric_value
=
metric_value
.
ub
;
}
else
{
metric_value
.
metric
=
metric
;
metric_value
.
avg
=
metric_value
.
avg
.
toFixed
(
2
);
metric_value
.
lb
=
metric_value
.
lb
.
toFixed
(
2
);
metric_value
.
ub
=
metric_value
.
ub
.
toFixed
(
2
);
metric_value
=
metric_object_template
(
metric_value
);
}
}
if
(
typeof
metric_value
===
"
number
"
)
{
metric_value
=
metric_value
.
toFixed
(
2
);
}
// Rename some metric to something more meaningful
if
(
metric
===
"
lifespan
"
)
{
metric
=
"
Cycle Time
"
;
}
if
(
metric
===
"
takt_time
"
)
{
metric
=
"
Average Departure Rate
"
;
}
result
+=
metric_simple_template
({
metric
:
metric
,
value
:
metric_value
});
}
}
}
result
+=
"
</table>
"
;
}
}
return
result
;
}
initDocumentPageMixin
(
gadget_klass
);
gadget_klass
/////////////////////////////////////////////////////////////////
// ready
/////////////////////////////////////////////////////////////////
// Init local properties
.
ready
(
function
(
g
)
{
g
.
props
=
{};
})
// Assign the element to a variable
.
ready
(
function
(
g
)
{
return
g
.
getElement
()
.
push
(
function
(
element
)
{
g
.
props
.
element
=
element
;
});
})
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.
declareAcquiredMethod
(
"
aq_getAttachment
"
,
"
jio_getAttachment
"
)
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
jio_key
=
options
.
id
,
gadget
=
this
;
gadget
.
props
.
jio_key
=
jio_key
;
return
gadget
.
aq_getAttachment
({
"
_id
"
:
gadget
.
props
.
jio_key
,
"
_attachment
"
:
"
simulation.json
"
})
.
push
(
function
(
simulation_json
)
{
var
result
=
calculate_exit_stat
(
// XXX Hardcoded result
JSON
.
parse
(
simulation_json
)[
0
].
result
);
gadget
.
props
.
element
.
innerHTML
=
result
;
});
});
}(
window
,
rJS
,
RSVP
,
initDocumentPageMixin
,
Handlebars
));
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