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
193da8aa
Commit
193da8aa
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
Publish build version.
parent
68409d9f
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
246 additions
and
2 deletions
+246
-2
dream/platform/static/dream/document_page_mixin.js
dream/platform/static/dream/document_page_mixin.js
+4
-1
dream/platform/static/dream/edit_table.js
dream/platform/static/dream/edit_table.js
+1
-1
dream/platform/static/dream/index.js
dream/platform/static/dream/index.js
+1
-0
dream/platform/static/dream/job_gantt.html
dream/platform/static/dream/job_gantt.html
+19
-0
dream/platform/static/dream/job_gantt.js
dream/platform/static/dream/job_gantt.js
+207
-0
dream/platform/static/dream/station_utilisation_graph.html
dream/platform/static/dream/station_utilisation_graph.html
+1
-0
dream/platform/static/lib/dhtmlxgantt.css
dream/platform/static/lib/dhtmlxgantt.css
+5
-0
dream/platform/static/lib/dhtmlxgantt.js
dream/platform/static/lib/dhtmlxgantt.js
+8
-0
No files found.
dream/platform/static/dream/document_page_mixin.js
View file @
193da8aa
...
...
@@ -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
(
"
exit_stat
"
,
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
(
"
job_gantt
"
,
key
),
gadget
.
whoWantToDisplayThisDocumentPage
(
"
debug_json
"
,
key
)
]);
}).
push
(
function
(
result_list
)
{
return
[
{
link
:
result_list
[
0
],
...
...
@@ -28,6 +28,9 @@
title
:
"
Exit Statistics
"
},
{
link
:
result_list
[
6
],
title
:
"
Job Gantt
"
},
{
link
:
result_list
[
7
],
title
:
"
Debug JSON
"
}
];
});
...
...
dream/platform/static/dream/edit_table.js
View file @
193da8aa
...
...
@@ -18,7 +18,7 @@
_attachment
:
"
body.json
"
}),
gadget
.
getDeclaredGadget
(
"
tableeditor
"
)
]);
}).
push
(
function
(
result_list
)
{
return
result_list
[
1
].
render
(
JSON
.
stringify
(
JSON
.
parse
(
result_list
[
0
]).
shif
t_spreadsheet
));
return
result_list
[
1
].
render
(
JSON
.
stringify
(
JSON
.
parse
(
result_list
[
0
]).
wip_par
t_spreadsheet
));
});
}).
declareMethod
(
"
startService
"
,
function
()
{
return
this
.
getDeclaredGadget
(
"
tableeditor
"
).
push
(
function
(
tableeditor
)
{
...
...
dream/platform/static/dream/index.js
View file @
193da8aa
...
...
@@ -93,6 +93,7 @@
}
}).
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
,
page_gadget
,
element
=
gadget
.
props
.
element
.
getElementsByClassName
(
"
gadget_container
"
)[
0
];
options
.
configuration_dict
=
gadget
.
props
.
configuration_dict
;
if
(
options
.
page
===
undefined
)
{
// Redirect to the about page
return
gadget
.
aq_pleasePublishMyState
({
...
...
dream/platform/static/dream/job_gantt.html
0 → 100644
View file @
193da8aa
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<title>
Job 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=
"document_page_mixin.js"
type=
"text/javascript"
></script>
<script
src=
"job_gantt.js"
type=
"text/javascript"
></script>
</head>
<body>
<div
class=
"gant_container"
style=
"height: 800px;"
></div>
</body>
</html>
dream/platform/static/dream/job_gantt.js
0 → 100644
View file @
193da8aa
/*global console, rJS, RSVP, initDocumentPageMixin, jQuery, gantt */
/*jslint nomen: true */
(
function
(
window
,
rJS
,
RSVP
,
initDocumentPageMixin
,
$
,
gantt
)
{
"
use strict
"
;
gantt
.
templates
.
task_class
=
function
(
start
,
end
,
obj
)
{
return
obj
.
parent
?
"
sub_task
"
:
""
;
};
function
job_gantt_widget
(
all_data
)
{
var
now
=
new
Date
(),
start_date
,
gantt_data
=
{
data
:
[
{
id
:
"
by_order
"
,
text
:
"
By Order
"
,
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
:
[]
},
input_data
=
all_data
.
input
,
output_data
=
all_data
.
result
;
// temporary hack
now
.
setHours
(
0
);
now
.
setMinutes
(
0
);
now
.
setSeconds
(
0
);
start_date
=
input_data
.
general
.
currentDate
;
if
(
start_date
!==
undefined
&&
start_date
!==
""
)
{
start_date
=
new
Date
(
start_date
);
}
else
{
start_date
=
new
Date
(
now
.
getTime
());
}
function
isVisibleStation
(
station
)
{
// we should be able to define in the backend which
// station is visible
return
input_data
.
nodes
[
station
].
_class
!==
"
Dream.QueueManagedJob
"
&&
input_data
.
nodes
[
station
].
_class
!==
"
Dream.OperatorManagedJob
"
&&
input_data
.
nodes
[
station
].
_class
!==
"
Dream.ExitJobShop
"
;
}
$
.
each
(
output_data
.
elementList
.
sort
(
function
(
a
,
b
)
{
return
a
.
id
<
b
.
id
?
-
1
:
1
;
}),
function
(
idx
,
obj
)
{
var
input_job
=
null
,
input_order
=
null
,
i
,
j
,
node
,
node_key
,
order
,
component
,
duration
,
seen_parts
=
{};
if
(
obj
.
_class
===
"
Dream.Job
"
)
{
// find the corresponding input
// find the input order and order component for this job
for
(
node_key
in
input_data
.
nodes
)
{
if
(
input_data
.
nodes
.
hasOwnProperty
(
node_key
))
{
node
=
input_data
.
nodes
[
node_key
];
if
(
node
.
wip
)
{
for
(
i
=
0
;
i
<
node
.
wip
.
length
;
i
+=
1
)
{
order
=
node
.
wip
[
i
];
if
(
order
.
id
===
obj
.
id
)
{
input_job
=
input_order
=
order
;
}
if
(
input_job
===
null
)
{
for
(
j
=
0
;
j
<
order
.
componentsList
.
length
;
j
+=
1
)
{
component
=
order
.
componentsList
[
j
];
if
(
component
.
id
===
obj
.
id
)
{
input_order
=
order
;
input_job
=
component
;
}
}
}
}
}
}
}
duration
=
0
;
if
(
input_job
===
input_order
)
{
// if we are on the order definition
gantt_data
.
data
.
push
({
id
:
input_order
.
id
,
text
:
input_order
.
name
,
project
:
1
,
open
:
false
,
parent
:
"
by_order
"
});
}
seen_parts
=
{};
$
.
each
(
obj
.
results
.
schedule
,
function
(
i
,
schedule
)
{
var
entrance_date
,
task_start_date
,
job_full_id
;
// Filter intermediate steps in part job shop
if
(
isVisibleStation
(
schedule
.
stationId
))
{
entrance_date
=
new
Date
(
start_date
.
getTime
());
entrance_date
.
setTime
(
entrance_date
.
getTime
()
+
schedule
.
entranceTime
*
1
e3
*
3600
);
if
(
obj
.
results
.
schedule
[
i
+
1
])
{
duration
=
obj
.
results
.
schedule
[
i
+
1
].
entranceTime
-
schedule
.
entranceTime
;
}
else
{
duration
=
obj
.
results
.
completionTime
-
schedule
.
entranceTime
;
}
if
(
duration
>
0
)
{
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
*
3600
);
job_full_id
=
input_job
.
id
+
"
.
"
+
input_order
.
id
;
if
(
seen_parts
[
job_full_id
]
===
undefined
)
{
gantt_data
.
data
.
push
({
id
:
job_full_id
,
text
:
input_job
.
name
,
parent
:
input_order
.
id
});
seen_parts
[
job_full_id
]
=
1
;
}
gantt_data
.
data
.
push
({
id
:
input_order
.
id
+
"
.
"
+
idx
+
"
_
"
+
i
,
text
:
schedule
.
stationId
,
start_date
:
task_start_date
,
duration
:
duration
,
parent
:
job_full_id
});
gantt_data
.
data
.
push
({
id
:
"
job.
"
+
obj
.
id
+
"
.
"
+
idx
+
"
_
"
+
i
,
text
:
input_order
.
name
+
"
-
"
+
input_job
.
name
,
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
;
});
return
gantt_data
;
}
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
=
job_gantt_widget
(
// XXX Hardcoded result
JSON
.
parse
(
simulation_json
)[
0
]);
});
}).
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
*
60
*
1
e3
,
//date_grid: "%H:%i",
date_scale
:
"
%M/%d
"
,
step
:
1
,
subscales
:
[
{
unit
:
"
hour
"
,
step
:
4
,
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
,
initDocumentPageMixin
,
jQuery
,
gantt
);
\ No newline at end of file
dream/platform/static/dream/station_utilisation_graph.html
View file @
193da8aa
...
...
@@ -6,6 +6,7 @@
<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.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>
...
...
dream/platform/static/lib/dhtmlxgantt.css
0 → 100644
View file @
193da8aa
This diff is collapsed.
Click to expand it.
dream/platform/static/lib/dhtmlxgantt.js
0 → 100644
View file @
193da8aa
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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