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
a81401f1
Commit
a81401f1
authored
Jun 05, 2014
by
Romain Courteaud
Committed by
Jérome Perrin
Aug 11, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update built version.
parent
d4e911b4
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
143 additions
and
2 deletions
+143
-2
dream/platform/static/dream/debug_json.js
dream/platform/static/dream/debug_json.js
+2
-1
dream/platform/static/dream/document_page_mixin.js
dream/platform/static/dream/document_page_mixin.js
+4
-1
dream/platform/static/dream/station_utilisation_graph.html
dream/platform/static/dream/station_utilisation_graph.html
+17
-0
dream/platform/static/dream/station_utilisation_graph.js
dream/platform/static/dream/station_utilisation_graph.js
+120
-0
No files found.
dream/platform/static/dream/debug_json.js
View file @
a81401f1
...
...
@@ -22,7 +22,8 @@
})
]);
}).
push
(
function
(
result_list
)
{
gadget
.
props
.
element
.
querySelector
(
"
.json_input
"
).
textContent
=
result_list
[
0
];
gadget
.
props
.
element
.
querySelector
(
"
.json_output
"
).
textContent
=
result_list
[
1
];
// XXX Hardcoded result
gadget
.
props
.
element
.
querySelector
(
"
.json_output
"
).
textContent
=
JSON
.
stringify
(
JSON
.
parse
(
result_list
[
1
])[
0
].
result
);
});
});
})(
window
,
rJS
,
RSVP
,
initDocumentPageMixin
);
\ No newline at end of file
dream/platform/static/dream/document_page_mixin.js
View file @
a81401f1
...
...
@@ -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
(
"
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
(
"
debug_json
"
,
key
)
]);
}).
push
(
function
(
result_list
)
{
return
[
{
link
:
result_list
[
0
],
...
...
@@ -19,6 +19,9 @@
title
:
"
Manage document
"
},
{
link
:
result_list
[
3
],
title
:
"
Stations Utilization
"
},
{
link
:
result_list
[
4
],
title
:
"
Debug JSON
"
}
];
});
...
...
dream/platform/static/dream/station_utilisation_graph.html
0 → 100644
View file @
a81401f1
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<title>
Stations Utilization
</title>
<script
src=
"../lib/rsvp.min.js"
type=
"text/javascript"
></script>
<script
src=
"../lib/renderjs.min.js"
type=
"text/javascript"
></script>
<script
src=
"../lib/jquery.flot.js"
></script>
<script
src=
"../lib/jquery.flot.stack.js"
></script>
<script
src=
"document_page_mixin.js"
type=
"text/javascript"
></script>
<script
src=
"station_utilisation_graph.js"
type=
"text/javascript"
></script>
</head>
<body>
<div
class=
"graph_container"
style=
"width: 100%;height:300px"
></div>
</body>
</html>
dream/platform/static/dream/station_utilisation_graph.js
0 → 100644
View file @
a81401f1
/*global console, rJS, RSVP, initDocumentPageMixin, jQuery */
(
function
(
window
,
rJS
,
RSVP
,
initDocumentPageMixin
,
$
)
{
"
use strict
"
;
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
)
{
// 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
{
blockage_ratio
=
obj
.
results
.
blockage_ratio
;
}
}
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
;
}
});
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
,
ticks
:
ticks
},
yaxis
:
{
max
:
100
},
series
:
{
bars
:
{
show
:
true
,
barWidth
:
.
8
,
align
:
"
center
"
},
stack
:
true
}
};
return
[
series
,
options
];
}
var
gadget_klass
=
rJS
(
window
);
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
)
{
gadget
.
props
.
result_list
=
station_utilisation_graph_widget
(
// XXX Hardcoded result
JSON
.
parse
(
simulation_json
)[
0
].
result
);
});
}).
declareMethod
(
"
startService
"
,
function
()
{
// XXX Manually calculate width and height when resizing
$
.
plot
(
this
.
props
.
element
.
querySelector
(
"
.graph_container
"
),
this
.
props
.
result_list
[
0
],
this
.
props
.
result_list
[
1
]);
});
})(
window
,
rJS
,
RSVP
,
initDocumentPageMixin
,
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