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
5d64718c
Commit
5d64718c
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
Update build version.
parent
1b278b20
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
179 additions
and
1 deletion
+179
-1
dream/platform/static/dream/document_page_mixin.js
dream/platform/static/dream/document_page_mixin.js
+4
-1
dream/platform/static/dream/exit_stat.html
dream/platform/static/dream/exit_stat.html
+70
-0
dream/platform/static/dream/exit_stat.js
dream/platform/static/dream/exit_stat.js
+105
-0
No files found.
dream/platform/static/dream/document_page_mixin.js
View file @
5d64718c
...
...
@@ -6,7 +6,7 @@
var
key
=
this
.
props
.
jio_key
,
gadget
=
this
;
return
new
RSVP
.
Queue
().
push
(
function
()
{
// XXX Conditional simulation menu
return
RSVP
.
all
([
gadget
.
whoWantToDisplayThisDocumentPage
(
"
edit_table
"
,
key
),
gadget
.
whoWantToDisplayThisDocumentPage
(
"
run_simulation
"
,
key
),
gadget
.
whoWantToDisplayThisDocumentPage
(
"
manage_document
"
,
key
),
gadget
.
whoWantToDisplayThisDocumentPage
(
"
station_utilisation_graph
"
,
key
),
gadget
.
whoWantToDisplayThisDocumentPage
(
"
queue_stat_graph
"
,
key
),
gadget
.
whoWantToDisplayThisDocumentPage
(
"
debug_json
"
,
key
)
]);
return
RSVP
.
all
([
gadget
.
whoWantToDisplayThisDocumentPage
(
"
edit_table
"
,
key
),
gadget
.
whoWantToDisplayThisDocumentPage
(
"
run_simulation
"
,
key
),
gadget
.
whoWantToDisplayThisDocumentPage
(
"
manage_document
"
,
key
),
gadget
.
whoWantToDisplayThisDocumentPage
(
"
station_utilisation_graph
"
,
key
),
gadget
.
whoWantToDisplayThisDocumentPage
(
"
queue_stat_graph
"
,
key
),
gadget
.
whoWantToDisplayThisDocumentPage
(
"
exit_stat
"
,
key
),
gadget
.
whoWantToDisplayThisDocumentPage
(
"
debug_json
"
,
key
)
]);
}).
push
(
function
(
result_list
)
{
return
[
{
link
:
result_list
[
0
],
...
...
@@ -25,6 +25,9 @@
title
:
"
Queues Statistics
"
},
{
link
:
result_list
[
5
],
title
:
"
Exit Statistics
"
},
{
link
:
result_list
[
6
],
title
:
"
Debug JSON
"
}
];
});
...
...
dream/platform/static/dream/exit_stat.html
0 → 100644
View file @
5d64718c
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<title>
Exit Statistics
</title>
<script
src=
"../lib/rsvp.min.js"
type=
"text/javascript"
></script>
<script
src=
"../lib/renderjs.min.js"
type=
"text/javascript"
></script>
<script
src=
"../lib/handlebars.min.js"
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/static/dream/exit_stat.js
0 → 100644
View file @
5d64718c
/*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
(
function
(
g
)
{
g
.
props
=
{};
}).
ready
(
function
(
g
)
{
return
g
.
getElement
().
push
(
function
(
element
)
{
g
.
props
.
element
=
element
;
});
}).
declareAcquiredMethod
(
"
aq_getAttachment
"
,
"
jio_getAttachment
"
).
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
);
\ 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