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
1560fbb8
Commit
1560fbb8
authored
Jul 01, 2014
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update latest widgets to renderjs widgets
parent
4a2cc112
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
442 additions
and
1 deletion
+442
-1
dream/platform/src2/dream/InputModule_viewAddDocumentDialog.js
.../platform/src2/dream/InputModule_viewAddDocumentDialog.js
+9
-0
dream/platform/src2/dream/Input_viewAvailableCapacitySpreadsheet.html
...rm/src2/dream/Input_viewAvailableCapacitySpreadsheet.html
+23
-0
dream/platform/src2/dream/Input_viewAvailableCapacitySpreadsheet.js
...form/src2/dream/Input_viewAvailableCapacitySpreadsheet.js
+97
-0
dream/platform/src2/dream/Input_viewRequiredCapacitySpreadsheet.html
...orm/src2/dream/Input_viewRequiredCapacitySpreadsheet.html
+23
-0
dream/platform/src2/dream/Input_viewRequiredCapacitySpreadsheet.js
...tform/src2/dream/Input_viewRequiredCapacitySpreadsheet.js
+98
-0
dream/platform/src2/dream/Output_viewCapacityUtilisationGraph.html
...tform/src2/dream/Output_viewCapacityUtilisationGraph.html
+17
-0
dream/platform/src2/dream/Output_viewCapacityUtilisationGraph.js
...latform/src2/dream/Output_viewCapacityUtilisationGraph.js
+121
-0
dream/platform/src2/dream/index.js
dream/platform/src2/dream/index.js
+27
-0
dream/platform/static/dream/InputModule_viewAddDocumentDialog.js
...latform/static/dream/InputModule_viewAddDocumentDialog.js
+3
-1
dream/platform/static/dream/index.js
dream/platform/static/dream/index.js
+24
-0
No files found.
dream/platform/src2/dream/InputModule_viewAddDocumentDialog.js
View file @
1560fbb8
...
...
@@ -75,6 +75,15 @@
"
Machines
"
,
// XXX more generic name ?
"
Start
"
,
"
End
"
]],
capacity_by_project_spreadsheet
:
[[
"
Project Name
"
,
"
Sequence
"
,
"
Capacity Requirements
"
]],
capacity_by_station_spreadsheet
:
[[
"
Day
"
,
"
CS1
"
]]
},
name
=
"
FromScratch
"
;
...
...
dream/platform/src2/dream/Input_viewAvailableCapacitySpreadsheet.html
0 → 100644
View file @
1560fbb8
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<title>
Edit Available Capacity Spreadsheet
</title>
<script
src=
"../<%= copy.rsvp.relative_dest %>"
type=
"text/javascript"
></script>
<script
src=
"../<%= copy.renderjs.relative_dest %>"
type=
"text/javascript"
></script>
<script
src=
"../<%= curl.jquery.relative_dest %>"
type=
"text/javascript"
></script>
<script
src=
"../<%= curl.jquerymobilejs.relative_dest %>"
type=
"text/javascript"
></script>
<script
src=
"mixin_gadget.js"
type=
"text/javascript"
></script>
<script
src=
"Input_viewAvailableCapacitySpreadsheet.js"
type=
"text/javascript"
></script>
</head>
<body>
<div
data-gadget-url=
"../handsontable/index.html"
data-gadget-scope=
"tableeditor"
></div>
<form
class=
"save_form"
>
<button
type=
"submit"
class=
"ui-btn ui-btn-b ui-btn-inline
ui-icon-edit ui-btn-icon-right"
>
Save
</button>
</form>
</body>
</html>
dream/platform/src2/dream/Input_viewAvailableCapacitySpreadsheet.js
0 → 100644
View file @
1560fbb8
/*global rJS, RSVP, initGadgetMixin, loopEventListener */
(
function
(
window
,
rJS
,
RSVP
,
initGadgetMixin
,
loopEventListener
)
{
"
use strict
"
;
function
saveSpreadsheet
(
evt
)
{
var
gadget
=
this
,
editor_data
,
editor_gadget
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
// Prevent double click
evt
.
target
.
getElementsByClassName
(
"
ui-btn
"
)[
0
].
disabled
=
true
;
return
gadget
.
getDeclaredGadget
(
"
tableeditor
"
);
})
.
push
(
function
(
tablegadget
)
{
editor_gadget
=
tablegadget
;
return
editor_gadget
.
getData
();
})
.
push
(
function
(
data
)
{
editor_data
=
data
;
// Always get a fresh version, to prevent deleting spreadsheet & co
return
gadget
.
aq_getAttachment
({
"
_id
"
:
gadget
.
props
.
jio_key
,
"
_attachment
"
:
"
body.json
"
});
})
.
push
(
function
(
body
)
{
var
data
=
JSON
.
parse
(
body
);
data
.
capacity_by_project_spreadsheet
=
JSON
.
parse
(
editor_data
);
return
gadget
.
aq_putAttachment
({
"
_id
"
:
gadget
.
props
.
jio_key
,
"
_attachment
"
:
"
body.json
"
,
"
_data
"
:
JSON
.
stringify
(
data
,
null
,
2
),
"
_mimetype
"
:
"
application/json
"
});
})
.
push
(
function
()
{
evt
.
target
.
getElementsByClassName
(
"
ui-btn
"
)[
0
].
disabled
=
false
;
});
}
function
waitForSave
(
gadget
)
{
return
loopEventListener
(
gadget
.
props
.
element
.
getElementsByClassName
(
"
save_form
"
)[
0
],
'
submit
'
,
false
,
saveSpreadsheet
.
bind
(
gadget
)
);
}
var
gadget_klass
=
rJS
(
window
);
initGadgetMixin
(
gadget_klass
);
gadget_klass
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.
declareAcquiredMethod
(
"
aq_getAttachment
"
,
"
jio_getAttachment
"
)
.
declareAcquiredMethod
(
"
aq_putAttachment
"
,
"
jio_putAttachment
"
)
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.
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
"
:
"
body.json
"
}),
gadget
.
getDeclaredGadget
(
"
tableeditor
"
)
]);
})
.
push
(
function
(
result_list
)
{
return
result_list
[
1
].
render
(
JSON
.
stringify
(
JSON
.
parse
(
result_list
[
0
])
.
capacity_by_project_spreadsheet
)
);
});
})
.
declareMethod
(
"
startService
"
,
function
()
{
var
gadget
=
this
;
return
this
.
getDeclaredGadget
(
"
tableeditor
"
)
.
push
(
function
(
tableeditor
)
{
return
RSVP
.
all
([
tableeditor
.
startService
(),
waitForSave
(
gadget
)
]);
});
});
}(
window
,
rJS
,
RSVP
,
initGadgetMixin
,
loopEventListener
));
dream/platform/src2/dream/Input_viewRequiredCapacitySpreadsheet.html
0 → 100644
View file @
1560fbb8
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<title>
Edit Required Capacity Spreadsheet
</title>
<script
src=
"../<%= copy.rsvp.relative_dest %>"
type=
"text/javascript"
></script>
<script
src=
"../<%= copy.renderjs.relative_dest %>"
type=
"text/javascript"
></script>
<script
src=
"../<%= curl.jquery.relative_dest %>"
type=
"text/javascript"
></script>
<script
src=
"../<%= curl.jquerymobilejs.relative_dest %>"
type=
"text/javascript"
></script>
<script
src=
"mixin_gadget.js"
type=
"text/javascript"
></script>
<script
src=
"Input_viewRequiredCapacitySpreadsheet.js"
type=
"text/javascript"
></script>
</head>
<body>
<div
data-gadget-url=
"../handsontable/index.html"
data-gadget-scope=
"tableeditor"
></div>
<form
class=
"save_form"
>
<button
type=
"submit"
class=
"ui-btn ui-btn-b ui-btn-inline
ui-icon-edit ui-btn-icon-right"
>
Save
</button>
</form>
</body>
</html>
dream/platform/src2/dream/Input_viewRequiredCapacitySpreadsheet.js
0 → 100644
View file @
1560fbb8
/*global rJS, RSVP, initGadgetMixin, loopEventListener */
(
function
(
window
,
rJS
,
RSVP
,
initGadgetMixin
,
loopEventListener
)
{
"
use strict
"
;
function
saveSpreadsheet
(
evt
)
{
var
gadget
=
this
,
editor_data
,
editor_gadget
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
// Prevent double click
evt
.
target
.
getElementsByClassName
(
"
ui-btn
"
)[
0
].
disabled
=
true
;
return
gadget
.
getDeclaredGadget
(
"
tableeditor
"
);
})
.
push
(
function
(
tablegadget
)
{
editor_gadget
=
tablegadget
;
return
editor_gadget
.
getData
();
})
.
push
(
function
(
data
)
{
editor_data
=
data
;
// Always get a fresh version, to prevent deleting spreadsheet & co
return
gadget
.
aq_getAttachment
({
"
_id
"
:
gadget
.
props
.
jio_key
,
"
_attachment
"
:
"
body.json
"
});
})
.
push
(
function
(
body
)
{
var
data
=
JSON
.
parse
(
body
);
data
.
capacity_by_station_spreadsheet
=
JSON
.
parse
(
editor_data
);
return
gadget
.
aq_putAttachment
({
"
_id
"
:
gadget
.
props
.
jio_key
,
"
_attachment
"
:
"
body.json
"
,
"
_data
"
:
JSON
.
stringify
(
data
,
null
,
2
),
"
_mimetype
"
:
"
application/json
"
});
})
.
push
(
function
()
{
evt
.
target
.
getElementsByClassName
(
"
ui-btn
"
)[
0
].
disabled
=
false
;
});
}
function
waitForSave
(
gadget
)
{
return
loopEventListener
(
gadget
.
props
.
element
.
getElementsByClassName
(
"
save_form
"
)[
0
],
'
submit
'
,
false
,
saveSpreadsheet
.
bind
(
gadget
)
);
}
var
gadget_klass
=
rJS
(
window
);
initGadgetMixin
(
gadget_klass
);
gadget_klass
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.
declareAcquiredMethod
(
"
aq_getAttachment
"
,
"
jio_getAttachment
"
)
.
declareAcquiredMethod
(
"
aq_putAttachment
"
,
"
jio_putAttachment
"
)
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.
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
"
:
"
body.json
"
}),
gadget
.
getDeclaredGadget
(
"
tableeditor
"
)
]);
})
.
push
(
function
(
result_list
)
{
return
result_list
[
1
].
render
(
JSON
.
stringify
(
JSON
.
parse
(
result_list
[
0
])
.
capacity_by_station_spreadsheet
),
{
minSpareCols
:
1
}
);
});
})
.
declareMethod
(
"
startService
"
,
function
()
{
var
gadget
=
this
;
return
this
.
getDeclaredGadget
(
"
tableeditor
"
)
.
push
(
function
(
tableeditor
)
{
return
RSVP
.
all
([
tableeditor
.
startService
(),
waitForSave
(
gadget
)
]);
});
});
}(
window
,
rJS
,
RSVP
,
initGadgetMixin
,
loopEventListener
));
dream/platform/src2/dream/Output_viewCapacityUtilisationGraph.html
0 → 100644
View file @
1560fbb8
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<title>
Stations Utilization
</title>
<script
src=
"../<%= copy.rsvp.relative_dest %>"
type=
"text/javascript"
></script>
<script
src=
"../<%= copy.renderjs.relative_dest %>"
type=
"text/javascript"
></script>
<script
src=
"../<%= curl.jquery.relative_dest %>"
type=
"text/javascript"
></script>
<script
src=
"../<%= curl.jqueryflot.relative_dest %>"
></script>
<script
src=
"../<%= curl.jqueryflotstack.relative_dest %>"
></script>
<script
src=
"mixin_gadget.js"
type=
"text/javascript"
></script>
<script
src=
"Output_viewCapacityUtilisationGraph.js"
type=
"text/javascript"
></script>
</head>
<body>
</body>
</html>
dream/platform/src2/dream/Output_viewCapacityUtilisationGraph.js
0 → 100644
View file @
1560fbb8
/*global rJS, jQuery, initGadgetMixin */
/*jslint unparam: true */
(
function
(
window
,
rJS
,
$
,
initGadgetMixin
)
{
"
use strict
"
;
function
capacity_utilisation_graph_widget
(
all_data
)
{
var
available_capacity_by_station
=
{},
station_id
,
series
,
graph_list
=
[],
options
,
capacity_usage_by_station
=
{},
input_data
=
all_data
.
input
,
output_data
=
all_data
.
result
;
// Compute availability by station
$
.
each
(
input_data
.
nodes
,
function
(
idx
,
obj
)
{
var
available_capacity
=
[];
if
(
obj
.
intervalCapacity
!==
undefined
)
{
$
.
each
(
obj
.
intervalCapacity
,
function
(
i
,
capacity
)
{
available_capacity
.
push
([
i
,
capacity
]);
});
available_capacity_by_station
[
obj
.
id
]
=
available_capacity
;
}
});
// Compute used capacity by station
$
.
each
(
output_data
.
elementList
.
sort
(
function
(
a
,
b
)
{
return
a
.
id
<
b
.
id
?
-
1
:
1
;
}
),
function
(
idx
,
obj
)
{
if
(
obj
.
results
!==
undefined
&&
obj
.
results
.
capacityUsed
!==
undefined
)
{
var
capacity_usage
=
[];
$
.
each
(
obj
.
results
.
capacityUsed
,
function
(
i
,
step
)
{
var
period
=
0
,
usage
=
0
;
$
.
each
(
step
,
function
(
k
,
v
)
{
if
(
k
===
'
period
'
)
{
period
=
v
;
}
});
$
.
each
(
step
,
function
(
k
,
v
)
{
if
(
k
!==
'
utilization
'
&&
k
!==
'
period
'
)
{
usage
+=
v
;
}
});
capacity_usage
.
push
([
period
,
usage
]);
});
capacity_usage_by_station
[
obj
.
id
]
=
capacity_usage
;
}
});
for
(
station_id
in
available_capacity_by_station
)
{
if
(
available_capacity_by_station
.
hasOwnProperty
(
station_id
))
{
series
=
[{
label
:
"
Capacity
"
,
data
:
available_capacity_by_station
[
station_id
],
color
:
"
green
"
},
{
label
:
"
Utilisation
"
,
data
:
capacity_usage_by_station
[
station_id
],
color
:
"
red
"
}];
options
=
{
series
:
{
lines
:
{
show
:
true
,
fill
:
true
}
}
};
graph_list
.
push
([
input_data
.
nodes
[
station_id
].
name
||
station_id
,
series
,
options
]);
}
}
return
graph_list
;
}
var
gadget_klass
=
rJS
(
window
);
initGadgetMixin
(
gadget_klass
);
gadget_klass
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.
declareAcquiredMethod
(
"
aq_getAttachment
"
,
"
jio_getAttachment
"
)
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
jio_key
=
options
.
id
,
gadget
=
this
;
gadget
.
props
.
jio_key
=
jio_key
;
gadget
.
props
.
result
=
options
.
result
;
return
gadget
.
aq_getAttachment
({
"
_id
"
:
gadget
.
props
.
jio_key
,
"
_attachment
"
:
"
simulation.json
"
})
.
push
(
function
(
simulation_json
)
{
gadget
.
props
.
result_list
=
capacity_utilisation_graph_widget
(
JSON
.
parse
(
simulation_json
)[
gadget
.
props
.
result
]
);
});
})
.
declareMethod
(
"
startService
"
,
function
()
{
var
element
=
$
(
this
.
props
.
element
),
graph
;
$
.
each
(
this
.
props
.
result_list
,
function
(
idx
,
result
)
{
graph
=
$
(
"
<div class='capacity_graph'
"
+
"
style='width: 70%; height: 250px'></div>
"
);
element
.
append
(
$
(
"
<h2>
"
).
text
(
result
[
0
]),
graph
);
$
.
plot
(
graph
,
result
[
1
],
result
[
2
]);
});
});
}(
window
,
rJS
,
jQuery
,
initGadgetMixin
));
dream/platform/src2/dream/index.js
View file @
1560fbb8
...
...
@@ -51,6 +51,24 @@
.
gui
.
shift_spreadsheet
);
}
},
"
view_available_capacity_spreadsheet
"
:
{
"
gadget
"
:
"
Input_viewAvailableCapacitySpreadsheet
"
,
"
type
"
:
"
object_view
"
,
"
title
"
:
"
Available Capacity Spreadsheet
"
,
"
condition
"
:
function
(
gadget
)
{
return
(
gadget
.
props
.
configuration_dict
[
'
Dream-Configuration
'
]
.
gui
.
capacity_by_project_spreadsheet
);
}
},
"
view_required_capacity_spreadsheet
"
:
{
"
gadget
"
:
"
Input_viewRequiredCapacitySpreadsheet
"
,
"
type
"
:
"
object_view
"
,
"
title
"
:
"
Required Capacity Spreadsheet
"
,
"
condition
"
:
function
(
gadget
)
{
return
(
gadget
.
props
.
configuration_dict
[
'
Dream-Configuration
'
]
.
gui
.
capacity_by_station_spreadsheet
);
}
},
"
view_simu
"
:
{
"
gadget
"
:
"
Input_viewSimulation
"
,
"
type
"
:
"
object_view
"
,
...
...
@@ -77,6 +95,15 @@
.
gui
.
station_utilisation_graph
);
}
},
"
view_capacity_utilization
"
:
{
"
gadget
"
:
"
Output_viewCapacityUtilisationGraph
"
,
"
type
"
:
"
object_view
"
,
"
title
"
:
"
Capacity Utilization
"
,
"
condition
"
:
function
(
gadget
)
{
return
(
gadget
.
props
.
configuration_dict
[
'
Dream-Configuration
'
]
.
gui
.
capacity_utilisation_graph
);
}
},
"
view_queue_stat
"
:
{
"
gadget
"
:
"
Output_viewQueueStatGraph
"
,
"
type
"
:
"
object_view
"
,
...
...
dream/platform/static/dream/InputModule_viewAddDocumentDialog.js
View file @
1560fbb8
...
...
@@ -44,7 +44,9 @@
general
:
{},
wip_part_spreadsheet
:
[
[
"
Order ID
"
,
"
Due Date
"
,
"
Priority
"
,
"
Project Manager
"
,
"
Part
"
,
"
Part Type
"
,
"
Sequence
"
,
"
Processing Times
"
,
"
Prerequisites Parts
"
]
],
shift_spreadsheet
:
[
[
"
Day
"
,
"
Machines
"
,
// XXX more generic name ?
"
Start
"
,
"
End
"
]
]
"
Start
"
,
"
End
"
]
],
capacity_by_project_spreadsheet
:
[
[
"
Project Name
"
,
"
Sequence
"
,
"
Capacity Requirements
"
]
],
capacity_by_station_spreadsheet
:
[
[
"
Day
"
,
"
CS1
"
]
]
},
name
=
"
FromScratch
"
;
return
new
RSVP
.
Queue
().
push
(
function
()
{
return
promiseEventListener
(
gadget
.
props
.
element
.
getElementsByClassName
(
"
new_form
"
)[
0
],
"
submit
"
,
false
);
...
...
dream/platform/static/dream/index.js
View file @
1560fbb8
...
...
@@ -47,6 +47,22 @@
return
gadget
.
props
.
configuration_dict
[
"
Dream-Configuration
"
].
gui
.
shift_spreadsheet
;
}
},
view_available_capacity_spreadsheet
:
{
gadget
:
"
Input_viewAvailableCapacitySpreadsheet
"
,
type
:
"
object_view
"
,
title
:
"
Available Capacity Spreadsheet
"
,
condition
:
function
(
gadget
)
{
return
gadget
.
props
.
configuration_dict
[
"
Dream-Configuration
"
].
gui
.
capacity_by_project_spreadsheet
;
}
},
view_required_capacity_spreadsheet
:
{
gadget
:
"
Input_viewRequiredCapacitySpreadsheet
"
,
type
:
"
object_view
"
,
title
:
"
Required Capacity Spreadsheet
"
,
condition
:
function
(
gadget
)
{
return
gadget
.
props
.
configuration_dict
[
"
Dream-Configuration
"
].
gui
.
capacity_by_station_spreadsheet
;
}
},
view_simu
:
{
gadget
:
"
Input_viewSimulation
"
,
type
:
"
object_view
"
,
...
...
@@ -72,6 +88,14 @@
return
gadget
.
props
.
configuration_dict
[
"
Dream-Configuration
"
].
gui
.
station_utilisation_graph
;
}
},
view_capacity_utilization
:
{
gadget
:
"
Output_viewCapacityUtilisationGraph
"
,
type
:
"
object_view
"
,
title
:
"
Capacity Utilization
"
,
condition
:
function
(
gadget
)
{
return
gadget
.
props
.
configuration_dict
[
"
Dream-Configuration
"
].
gui
.
capacity_utilisation_graph
;
}
},
view_queue_stat
:
{
gadget
:
"
Output_viewQueueStatGraph
"
,
type
:
"
object_view
"
,
...
...
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