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
31a781d1
Commit
31a781d1
authored
Jan 16, 2015
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
static files of platform updated after introduction of new gadget
parent
7fa6792d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
231 additions
and
7 deletions
+231
-7
dream/platform/static/dream/Output_viewGantt.html
dream/platform/static/dream/Output_viewGantt.html
+19
-0
dream/platform/static/dream/Output_viewGantt.js
dream/platform/static/dream/Output_viewGantt.js
+196
-0
dream/platform/static/dream/Output_viewGraph.js
dream/platform/static/dream/Output_viewGraph.js
+16
-7
No files found.
dream/platform/static/dream/Output_viewGantt.html
0 → 100644
View file @
31a781d1
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<title>
Gantt
</title>
<link
rel=
"stylesheet"
href=
"../lib/dhtmlxgantt.css"
>
<script
src=
"../lib/rsvp.min.js"
type=
"text/javascript"
></script>
<script
src=
"../lib/renderjs.min.js"
type=
"text/javascript"
></script>
<script
src=
"../lib/jquery.js"
type=
"text/javascript"
></script>
<script
src=
"../lib/dhtmlxgantt.js"
type=
"text/javascript"
></script>
<script
src=
"mixin_gadget.js"
type=
"text/javascript"
></script>
<script
src=
"Output_viewGantt.js"
type=
"text/javascript"
></script>
</head>
<body>
<div
class=
"gant_container"
style=
"height: 800px;"
></div>
</body>
</html>
dream/platform/static/dream/Output_viewGantt.js
0 → 100644
View file @
31a781d1
/*global rJS, RSVP, jQuery, gantt,
initGadgetMixin, console */
/*jslint nomen: true, unparam: true */
(
function
(
window
,
rJS
,
RSVP
,
$
,
gantt
,
initGadgetMixin
)
{
"
use strict
"
;
gantt
.
templates
.
task_class
=
function
(
start
,
end
,
obj
)
{
return
obj
.
parent
?
"
sub_task
"
:
""
;
};
function
gantt_widget
(
all_data
,
gadget
)
{
// XXX: use dhx_gantt zoom level feature (
// http://dhtmlx.com/docs/products/dhtmlxGantt/02_features.html )
var
now
=
new
Date
(),
start_date
=
all_data
.
general
.
currentDate
,
input_data
=
all_data
.
input
,
graph_data
=
all_data
.
graph
,
output_data
=
all_data
.
result
.
result_list
[
gadget
.
props
.
result
],
config
=
all_data
.
application_configuration
.
output
[
gadget
.
props
.
action
].
configuration
,
gantt_data
;
// temporary hack
now
.
setHours
(
0
);
now
.
setMinutes
(
0
);
now
.
setSeconds
(
0
);
if
(
start_date
!==
undefined
&&
start_date
!==
""
)
{
start_date
=
new
Date
(
start_date
);
}
else
{
start_date
=
new
Date
(
now
.
getTime
());
}
gantt_data
=
{
data
:
[
{
id
:
"
by_operator
"
,
text
:
"
By Operator
"
,
start_date
:
start_date
,
duration
:
0
,
project
:
1
,
open
:
true
},
{
id
:
"
by_station
"
,
text
:
"
By Station
"
,
start_date
:
start_date
,
duration
:
0
,
project
:
1
,
open
:
true
}
],
link
:
[]
};
console
.
log
(
"
gantt gadget method
"
);
console
.
log
(
config
);
console
.
log
(
input_data
);
console
.
log
(
graph_data
);
console
.
log
(
output_data
);
function
isVisibleStation
(
station
)
{
var
i
;
// we should be able to define in the backend which
// station is visible
for
(
i
=
0
;
i
<=
output_data
.
elementList
.
length
-
1
;
i
+=
1
)
{
if
(
output_data
.
elementList
[
i
].
id
===
station
)
{
return
output_data
.
elementList
[
i
].
family
!==
"
Buffer
"
&&
output_data
.
elementList
[
i
].
family
!==
"
Exit
"
&&
output_data
.
elementList
[
i
].
family
!==
"
Operator
"
&&
output_data
.
elementList
[
i
].
family
!==
"
Entry
"
;
}
}
}
$
.
each
(
output_data
.
elementList
.
sort
(
function
(
a
,
b
)
{
return
a
.
id
<
b
.
id
?
-
1
:
1
;
}),
function
(
idx
,
obj
)
{
var
duration
=
0
;
if
(
obj
.
family
===
"
Operator
"
)
{
gantt_data
.
data
.
push
({
id
:
obj
.
id
,
text
:
obj
.
id
,
project
:
1
,
open
:
false
,
parent
:
"
by_operator
"
});
console
.
log
(
"
operator
"
);
console
.
log
(
obj
.
id
);
if
(
obj
.
results
.
schedule
)
{
$
.
each
(
obj
.
results
.
schedule
,
function
(
i
,
schedule
)
{
var
task_start_date
;
// Filter intermediate steps in part job shop
if
(
isVisibleStation
(
schedule
.
stationId
))
{
if
(
schedule
.
exitTime
)
{
duration
=
24
*
(
schedule
.
exitTime
-
schedule
.
entranceTime
);
}
else
{
if
(
obj
.
results
.
schedule
[
i
+
1
])
{
duration
=
obj
.
results
.
schedule
[
i
+
1
].
entranceTime
-
schedule
.
entranceTime
;
}
else
{
// XXX completion time not provided
duration
=
obj
.
results
.
completionTime
-
schedule
.
entranceTime
;
}
}
if
(
duration
>
0
)
{
console
.
log
(
"
..
"
);
console
.
log
(
"
step
"
);
console
.
log
(
i
);
console
.
log
(
"
duration
"
);
console
.
log
(
duration
);
task_start_date
=
new
Date
(
start_date
.
getTime
());
// for simulation time unit as days
// task_start_date.setDate(task_start_date.getDate() +
// schedule['entranceTime']);
// for simulation time unit as days hours
task_start_date
.
setTime
(
task_start_date
.
getTime
()
+
schedule
.
entranceTime
*
1
e3
*
60
);
console
.
log
(
"
start date
"
);
console
.
log
(
task_start_date
);
console
.
log
(
schedule
.
entranceTime
);
console
.
log
(
schedule
.
entranceTime
*
1
e3
*
60
);
gantt_data
.
data
.
push
({
id
:
obj
.
id
+
"
.
"
+
schedule
.
stationId
+
"
.
"
+
i
,
text
:
schedule
.
stationId
,
start_date
:
task_start_date
,
duration
:
duration
,
parent
:
obj
.
id
});
gantt_data
.
data
.
push
({
id
:
"
operator.
"
+
obj
.
id
+
"
.
"
+
idx
+
"
_
"
+
i
,
text
:
obj
.
id
+
"
-
"
+
schedule
.
stationId
,
start_date
:
task_start_date
,
duration
:
duration
,
parent
:
schedule
.
stationId
,
by_station
:
1
});
}
}
});
}
}
else
{
if
(
isVisibleStation
(
obj
.
id
))
{
gantt_data
.
data
.
push
({
id
:
obj
.
id
,
text
:
obj
.
id
,
project
:
1
,
open
:
false
,
parent
:
"
by_station
"
});
}
}
});
// gantt_output_height = 35 * (gantt_data.data.length + 1) + 1;
gantt_data
.
data
.
sort
(
function
(
a
,
b
)
{
// sort gantt data in a chronological order
var
result
;
if
(
a
.
start_date
===
undefined
&&
b
.
start_date
!==
undefined
)
{
result
=
1
;
}
else
if
(
a
.
start_date
!==
undefined
&&
b
.
start_date
===
undefined
)
{
result
=
-
1
;
}
else
if
(
a
.
start_date
===
undefined
&&
b
.
start_date
===
undefined
)
{
result
=
0
;
}
else
if
(
a
.
start_date
>
b
.
start_date
)
{
result
=
1
;
}
else
if
(
a
.
start_date
<
b
.
start_date
)
{
result
=
-
1
;
}
else
{
result
=
0
;
}
return
result
;
});
console
.
log
(
"
Returning the Gantt Data
"
);
console
.
log
(
gantt_data
);
return
gantt_data
;
}
var
gadget_klass
=
rJS
(
window
);
initGadgetMixin
(
gadget_klass
);
gadget_klass
.
declareAcquiredMethod
(
"
aq_getAttachment
"
,
"
jio_getAttachment
"
).
declareMethod
(
"
render
"
,
function
(
options
)
{
var
jio_key
=
options
.
id
,
gadget
=
this
;
gadget
.
props
.
jio_key
=
jio_key
;
gadget
.
props
.
result
=
options
.
result
;
gadget
.
props
.
action
=
options
.
action
;
return
gadget
.
aq_getAttachment
({
_id
:
gadget
.
props
.
jio_key
,
_attachment
:
"
simulation.json
"
}).
push
(
function
(
simulation_json
)
{
var
json_data
=
JSON
.
parse
(
simulation_json
);
gadget
.
props
.
result
=
gantt_widget
(
json_data
,
gadget
);
});
}).
declareMethod
(
"
startService
"
,
function
()
{
$
(
this
.
props
.
element
).
find
(
"
.gant_container
"
).
dhx_gantt
({
data
:
this
.
props
.
result
,
readonly
:
true
,
/* for days has simulation time unit
scale_unit: 'day',
step: 7
*/
// for hours has simulation time unit
scale_unit
:
"
day
"
,
duration_unit
:
60
*
1
e3
,
// date_grid: "%H:%i",
date_scale
:
"
%M/%d
"
,
step
:
1
,
subscales
:
[
{
unit
:
"
hour
"
,
step
:
1
,
date
:
"
%H:%i
"
}
]
});
return
new
RSVP
.
Queue
().
push
(
function
()
{
// Infinite wait, until cancelled
return
new
RSVP
.
defer
().
promise
;
}).
push
(
undefined
,
function
(
error
)
{
gantt
.
clearAll
();
throw
error
;
});
});
})(
window
,
rJS
,
RSVP
,
jQuery
,
gantt
,
initGadgetMixin
);
\ No newline at end of file
dream/platform/static/dream/Output_viewGraph.js
View file @
31a781d1
...
...
@@ -17,12 +17,16 @@
/* FIXME: does not support more than one replic (Buffer family).
* + see george email to integrate without the need of an EG
*/
var
conf_data
=
config
.
data
,
ticks
=
[],
counter
=
1
,
series
=
[],
options
=
{};
var
conf_data
=
config
.
data
,
ticks
=
[],
counter
=
1
,
series
=
[],
options
=
{},
key
,
data
=
{};
for
(
key
in
conf_data
)
{
if
(
conf_data
.
hasOwnProperty
(
key
))
{
data
[
key
]
=
[];
}
}
$
.
each
(
output_data
.
elementList
.
sort
(
function
(
a
,
b
)
{
return
a
.
id
<
b
.
id
?
-
1
:
1
;
}),
function
(
idx
,
obj
)
{
var
reqKey
,
// ctrl_flag = false,
request
,
i
;
var
reqKey
,
request
,
i
;
// if the obj is of the requested family
if
(
obj
.
family
===
config
.
family
)
{
if
(
config
.
plot
===
"
bars
"
)
{
...
...
@@ -32,10 +36,7 @@
for
(
i
=
0
;
i
<=
conf_data
[
reqKey
].
length
-
1
;
i
+=
1
)
{
request
+=
getRequestedValue
(
obj
,
conf_data
[
reqKey
][
i
]);
}
series
.
push
({
label
:
reqKey
,
data
:
[
[
counter
,
request
]
]
});
data
[
reqKey
].
push
([
counter
,
request
]);
}
}
ticks
.
push
([
counter
,
obj
.
id
]);
...
...
@@ -49,6 +50,14 @@
}
});
if
(
config
.
plot
===
"
bars
"
)
{
for
(
key
in
data
)
{
if
(
data
.
hasOwnProperty
(
key
))
{
series
.
push
({
label
:
key
,
data
:
data
[
key
]
});
}
}
options
=
{
xaxis
:
{
minTickSize
:
1
,
...
...
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