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
a16d7ae4
Commit
a16d7ae4
authored
Jan 12, 2015
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stationUtilisationGraph turned more generic. Options provided within the all-inclusive-file
parent
d004a61c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
80 deletions
+59
-80
dream/platform/src/dream/Output_viewStationUtilisationGraph.js
.../platform/src/dream/Output_viewStationUtilisationGraph.js
+59
-80
No files found.
dream/platform/src/dream/Output_viewStationUtilisationGraph.js
View file @
a16d7ae4
...
@@ -3,16 +3,31 @@
...
@@ -3,16 +3,31 @@
(
function
(
window
,
rJS
,
$
,
initGadgetMixin
)
{
(
function
(
window
,
rJS
,
$
,
initGadgetMixin
)
{
"
use strict
"
;
"
use strict
"
;
function
station_utilisation_graph_widget
(
output_data
)
{
function
getRequestedValue
(
object
,
key
)
{
var
blockage_data
=
[],
var
value
=
0.0
;
waiting_data
=
[],
if
(
object
.
results
[
key
]
!==
undefined
)
{
failure_data
=
[],
if
(
object
.
results
[
key
].
avg
!==
undefined
)
{
working_data
=
[],
value
=
object
.
results
[
key
].
avg
;
}
else
{
value
=
object
.
results
[
key
];
}
}
return
value
;
}
function
station_utilisation_graph_widget
(
output_data
,
config
)
{
var
data
=
{},
ticks
=
[],
ticks
=
[],
counter
=
1
,
counter
=
1
,
series
,
key
,
series
=
[],
options
;
options
;
// initialize the data dict holding the properties requested
for
(
key
in
config
)
{
if
(
config
.
hasOwnProperty
(
key
))
{
data
[
key
]
=
[];
}
}
// XXX output is still elementList ???
// XXX output is still elementList ???
$
.
each
(
$
.
each
(
output_data
.
elementList
.
sort
(
output_data
.
elementList
.
sort
(
...
@@ -21,67 +36,32 @@
...
@@ -21,67 +36,32 @@
}
}
),
),
function
(
idx
,
obj
)
{
function
(
idx
,
obj
)
{
// add each object that has a working ratio
var
ctrl_flag
=
false
,
reqKey
,
if
((
obj
.
results
!==
undefined
)
&&
request
,
i
;
(
obj
.
results
.
working_ratio
!==
undefined
))
{
// determine weather the current
/* when there is only one replication, the ratio is given as a float,
// obj has the requested key
otherwise we have a mapping avg, ub lb */
for
(
reqKey
in
config
)
{
var
blockage_ratio
=
0.0
,
if
(
config
.
hasOwnProperty
(
reqKey
))
{
working_ratio
=
0.0
,
if
((
obj
.
results
!==
undefined
)
&&
waiting_ratio
=
0.0
,
(
obj
.
results
[
config
[
reqKey
][
0
]]
!==
undefined
))
{
failure_ratio
=
0.0
;
// control flag, if the results contain
// entities that have working ratios
if
(
obj
.
results
.
blockage_ratio
!==
undefined
)
{
ctrl_flag
=
true
;
if
(
obj
.
results
.
blockage_ratio
.
avg
!==
undefined
)
{
break
;
blockage_ratio
=
obj
.
results
.
blockage_ratio
.
avg
;
}
else
{
blockage_ratio
=
obj
.
results
.
blockage_ratio
;
}
}
}
}
blockage_data
.
push
([
counter
,
blockage_ratio
]);
}
// if the obj contains the requested key
// XXX merge setup & loading ratio in working ratio for now
if
(
ctrl_flag
===
true
)
{
for
(
reqKey
in
config
)
{
if
(
obj
.
results
.
setup_ratio
!==
undefined
)
{
if
(
config
.
hasOwnProperty
(
reqKey
))
{
if
(
obj
.
results
.
setup_ratio
.
avg
!==
undefined
)
{
request
=
0.0
;
working_ratio
+=
obj
.
results
.
setup_ratio
.
avg
;
for
(
i
=
0
;
i
<=
config
[
reqKey
].
length
-
1
;
i
+=
1
)
{
}
else
{
request
+=
getRequestedValue
(
obj
,
config
[
reqKey
][
i
]);
working_ratio
+=
obj
.
results
.
setup_ratio
;
}
}
data
[
reqKey
].
push
([
counter
,
request
]);
}
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
]);
ticks
.
push
([
counter
,
obj
.
id
]);
counter
+=
1
;
counter
+=
1
;
...
@@ -89,19 +69,14 @@
...
@@ -89,19 +69,14 @@
}
}
);
);
series
=
[{
for
(
key
in
data
)
{
label
:
"
Working
"
,
if
(
data
.
hasOwnProperty
(
key
))
{
data
:
working_data
series
.
push
({
},
{
label
:
key
,
label
:
"
Waiting
"
,
data
:
data
[
key
]
data
:
waiting_data
});
},
{
}
label
:
"
Failures
"
,
}
data
:
failure_data
},
{
label
:
"
Blockage
"
,
data
:
blockage_data
}];
options
=
{
options
=
{
xaxis
:
{
xaxis
:
{
...
@@ -114,7 +89,7 @@
...
@@ -114,7 +89,7 @@
series
:
{
series
:
{
bars
:
{
bars
:
{
show
:
true
,
show
:
true
,
barWidth
:
0.
8
,
barWidth
:
0.
7
,
align
:
"
center
"
align
:
"
center
"
},
},
stack
:
true
stack
:
true
...
@@ -145,9 +120,13 @@
...
@@ -145,9 +120,13 @@
"
_attachment
"
:
"
simulation.json
"
"
_attachment
"
:
"
simulation.json
"
})
})
.
push
(
function
(
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
(
gadget
.
props
.
result_list
=
station_utilisation_graph_widget
(
JSON
.
parse
(
simulation_json
)
json_data
.
result
.
result_list
[
gadget
.
props
.
result
],
.
result
.
result_list
[
gadget
.
props
.
result
]
config
);
);
});
});
})
})
...
...
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