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
dbf9df3d
Commit
dbf9df3d
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
2e13a9e9
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
147 additions
and
1 deletion
+147
-1
dream/platform/static/dream/document_page_mixin.js
dream/platform/static/dream/document_page_mixin.js
+4
-1
dream/platform/static/dream/job_schedule_spreadsheet.html
dream/platform/static/dream/job_schedule_spreadsheet.html
+18
-0
dream/platform/static/dream/job_schedule_spreadsheet.js
dream/platform/static/dream/job_schedule_spreadsheet.js
+116
-0
dream/platform/static/lib/moment.js
dream/platform/static/lib/moment.js
+9
-0
No files found.
dream/platform/static/dream/document_page_mixin.js
View file @
dbf9df3d
...
...
@@ -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
(
"
job_gantt
"
,
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
(
"
job_schedule_spreadsheet
"
,
key
),
gadget
.
whoWantToDisplayThisDocumentPage
(
"
debug_json
"
,
key
)
]);
}).
push
(
function
(
result_list
)
{
return
[
{
link
:
result_list
[
0
],
...
...
@@ -31,6 +31,9 @@
title
:
"
Job Gantt
"
},
{
link
:
result_list
[
7
],
title
:
"
Job Schedule
"
},
{
link
:
result_list
[
8
],
title
:
"
Debug JSON
"
}
];
});
...
...
dream/platform/static/dream/job_schedule_spreadsheet.html
0 → 100644
View file @
dbf9df3d
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<title>
Job Schedule
</title>
<script
src=
"../lib/rsvp.min.js"
type=
"text/javascript"
></script>
<script
src=
"../lib/renderjs.min.js"
type=
"text/javascript"
></script>
<script
src=
"../lib/moment.js"
type=
"text/javascript"
></script>
<script
src=
"document_page_mixin.js"
type=
"text/javascript"
></script>
<script
src=
"job_schedule_spreadsheet.js"
type=
"text/javascript"
></script>
</head>
<body>
<div
data-gadget-url=
"../handsontable/index.html"
data-gadget-scope=
"tableeditor"
></div>
</body>
</html>
dream/platform/static/dream/job_schedule_spreadsheet.js
0 → 100644
View file @
dbf9df3d
/*global console, rJS, RSVP, initDocumentPageMixin, moment */
/*jslint nomen: true */
(
function
(
window
,
rJS
,
RSVP
,
initDocumentPageMixin
,
moment
)
{
"
use strict
"
;
function
job_schedule_spreadsheet_widget
(
all_data
)
{
var
now
=
new
Date
(),
input_data
=
all_data
.
input
,
output_data
=
all_data
.
result
,
spreadsheet_data
=
[],
spreadsheet_header
=
[
[
"
Jobs
"
,
"
ID
"
,
"
Project Manager
"
,
"
Due Date
"
,
"
Priority
"
,
"
Entrance Time
"
,
"
Processing Time
"
,
"
Station ID
"
,
"
Step No.
"
]
],
simulation_start_date
=
new
Date
(
input_data
.
general
.
currentDate
||
now
.
getTime
()),
i
,
j
,
k
,
obj
,
node
,
component
,
order
,
node_id
,
due_date
,
entrance_date
,
duration
,
schedule
,
input_job
=
null
,
input_order
=
null
;
// XXX why ?
now
.
setHours
(
0
);
now
.
setMinutes
(
0
);
now
.
setSeconds
(
0
);
// XXX: time unit for later
// or an utility function to map sim time to real time & vice
// versa.
for
(
i
=
0
;
i
<
output_data
.
elementList
.
length
;
i
+=
1
)
{
obj
=
output_data
.
elementList
[
i
];
if
(
obj
.
_class
===
"
Dream.Job
"
)
{
input_job
=
null
;
input_order
=
null
;
// find the input order and order component for this job
for
(
node_id
in
input_data
.
nodes
)
{
if
(
input_data
.
nodes
.
hasOwnProperty
(
node_id
))
{
node
=
input_data
.
nodes
[
node_id
];
if
(
node
.
wip
)
{
for
(
j
=
0
;
j
<
node
.
wip
.
length
;
j
+=
1
)
{
order
=
node
.
wip
[
j
];
if
(
order
.
id
===
obj
.
id
)
{
input_job
=
input_order
=
order
;
}
if
(
input_job
===
null
)
{
for
(
k
=
0
;
k
<
order
.
componentsList
.
length
;
k
+=
1
)
{
component
=
order
.
componentsList
[
k
];
if
(
component
.
id
===
obj
.
id
)
{
input_order
=
order
;
input_job
=
component
;
}
}
}
}
}
}
}
due_date
=
new
Date
(
simulation_start_date
.
getTime
()
+
input_order
.
dueDate
*
1
e3
*
3600
);
for
(
j
=
0
;
j
<
obj
.
results
.
schedule
.
length
;
j
+=
1
)
{
schedule
=
obj
.
results
.
schedule
[
j
];
entrance_date
=
new
Date
(
simulation_start_date
.
getTime
()
+
// XXX: time unit
schedule
.
entranceTime
*
1
e3
*
3600
);
duration
=
0
;
// Duration is calculated by difference of entranceTime of this
// step and entranceTime of the next step, or completionTime when
// this is the last step
if
(
j
+
1
===
obj
.
results
.
schedule
.
length
)
{
duration
=
obj
.
results
.
completionTime
-
schedule
.
entranceTime
;
}
else
{
duration
=
obj
.
results
.
schedule
[
j
+
1
].
entranceTime
-
schedule
.
entranceTime
;
}
spreadsheet_data
.
push
([
// XXX this label is incorrect for design step, during design
// phase we still have an order and not an order component.
input_order
.
name
+
"
-
"
+
input_job
.
name
,
obj
.
id
,
input_order
.
manager
,
moment
(
due_date
).
format
(
"
YYYY/MM/DD
"
),
input_order
.
priority
,
moment
(
entrance_date
).
format
(
"
MMM/DD HH:mm
"
),
duration
,
schedule
.
stationId
,
j
]);
}
}
}
if
(
spreadsheet_data
.
length
>
1
)
{
// Sort the spreadsheet data to an order convenient for end users
// XXX: search for a default cmp in javascript
spreadsheet_data
.
sort
(
function
(
a
,
b
)
{
var
result
=
0
,
order_id_a
,
order_id_b
,
entrance_a
,
entrance_b
;
order_id_a
=
a
[
0
].
split
(
"
-
"
)[
0
];
order_id_b
=
b
[
0
].
split
(
"
-
"
)[
0
];
if
(
order_id_a
!==
order_id_b
)
{
if
(
order_id_a
>
order_id_b
)
{
result
=
1
;
}
else
{
result
=
-
1
;
}
}
else
{
entrance_a
=
a
[
4
];
entrance_b
=
b
[
4
];
if
(
entrance_a
>
entrance_b
)
{
result
=
1
;
}
else
if
(
entrance_a
<
entrance_b
)
{
result
=
-
1
;
}
else
{
result
=
0
;
}
}
return
result
;
});
}
return
spreadsheet_header
.
concat
(
spreadsheet_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
new
RSVP
.
Queue
().
push
(
function
()
{
return
RSVP
.
all
([
gadget
.
aq_getAttachment
({
_id
:
jio_key
,
_attachment
:
"
simulation.json
"
}),
gadget
.
getDeclaredGadget
(
"
tableeditor
"
)
]);
}).
push
(
function
(
result_list
)
{
// XXX Hardcoded result
return
result_list
[
1
].
render
(
JSON
.
stringify
(
job_schedule_spreadsheet_widget
(
JSON
.
parse
(
result_list
[
0
])[
0
])));
});
}).
declareMethod
(
"
startService
"
,
function
()
{
return
this
.
getDeclaredGadget
(
"
tableeditor
"
).
push
(
function
(
tableeditor
)
{
return
tableeditor
.
startService
();
});
});
})(
window
,
rJS
,
RSVP
,
initDocumentPageMixin
,
moment
);
\ No newline at end of file
dream/platform/static/lib/moment.js
0 → 100644
View file @
dbf9df3d
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