Commit 86dc804b authored by Romain Courteaud's avatar Romain Courteaud Committed by Jérome Perrin

Add condition to display a tab.

parent 7cc01a8b
......@@ -3,12 +3,12 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Edit table</title>
<title>Edit Wip Part Spreadsheet</title>
<script src="../<%= copy.rsvp.relative_dest %>" type="text/javascript"></script>
<script src="../<%= copy.renderjs.relative_dest %>" type="text/javascript"></script>
<script src="mixin_gadget.js" type="text/javascript"></script>
<script src="Input_viewTable.js" type="text/javascript"></script>
<script src="Input_viewShiftSpreadsheet.js" type="text/javascript"></script>
</head>
<body>
<div data-gadget-url="../handsontable/index.html"
......
/*global console, rJS, RSVP, initGadgetMixin */
(function (window, rJS, RSVP, initGadgetMixin) {
"use strict";
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;
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]).shift_spreadsheet)
);
});
})
.declareMethod("startService", function () {
return this.getDeclaredGadget("tableeditor")
.push(function (tableeditor) {
return tableeditor.startService();
});
});
}(window, rJS, RSVP, initGadgetMixin));
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Edit Wip Part Spreadsheet</title>
<script src="../<%= copy.rsvp.relative_dest %>" type="text/javascript"></script>
<script src="../<%= copy.renderjs.relative_dest %>" type="text/javascript"></script>
<script src="mixin_gadget.js" type="text/javascript"></script>
<script src="Input_viewWipPartSpreadsheet.js" type="text/javascript"></script>
</head>
<body>
<div data-gadget-url="../handsontable/index.html"
data-gadget-scope="tableeditor"></div>
</body>
</html>
......@@ -33,10 +33,23 @@
"type": "object_view",
"title": "Production Line"
},
"view_table": {
"gadget": "Input_viewTable",
"view_wip_part_spreadsheet": {
"gadget": "Input_viewWipPartSpreadsheet",
"type": "object_view",
"title": "Edit table"
"title": "WIP Part Spreadsheet",
"condition": function (gadget) {
return (gadget.props.configuration_dict['Dream-Configuration']
.gui.wip_part_spreadsheet);
}
},
"view_shift_spreadsheet": {
"gadget": "Input_viewShiftSpreadsheet",
"type": "object_view",
"title": "Shift Spreadsheet",
"condition": function (gadget) {
return (gadget.props.configuration_dict['Dream-Configuration']
.gui.shift_spreadsheet);
}
},
"view_simu": {
"gadget": "Input_viewSimulation",
......@@ -58,32 +71,56 @@
"view": {
"gadget": "Output_viewStationUtilisationGraph",
"type": "object_view",
"title": "Stations Utilization"
"title": "Stations Utilization",
"condition": function (gadget) {
return (gadget.props.configuration_dict['Dream-Configuration']
.gui.station_utilisation_graph);
}
},
"view_queue_stat": {
"gadget": "Output_viewQueueStatGraph",
"type": "object_view",
"title": "Queues Statistics"
"title": "Queues Statistics",
"condition": function (gadget) {
return (gadget.props.configuration_dict['Dream-Configuration']
.gui.queue_stat);
}
},
"view_exit_stat": {
"gadget": "Output_viewExitStatistics",
"type": "object_view",
"title": "Exit Statistics"
"title": "Exit Statistics",
"condition": function (gadget) {
return (gadget.props.configuration_dict['Dream-Configuration']
.gui.exit_stat);
}
},
"view_gantt": {
"gadget": "Output_viewJobGantt",
"type": "object_view",
"title": "Job Gantt"
"title": "Job Gantt",
"condition": function (gadget) {
return (gadget.props.configuration_dict['Dream-Configuration']
.gui.job_gantt);
}
},
"view_schedule": {
"gadget": "Output_viewJobScheduleSpreadsheet",
"type": "object_view",
"title": "Job Schedule"
"title": "Job Schedule",
"condition": function (gadget) {
return (gadget.props.configuration_dict['Dream-Configuration']
.gui.job_schedule_spreadsheet);
}
},
"view_debug": {
"gadget": "Output_viewDebugJson",
"type": "object_view",
"title": "Debug JSON"
"title": "Debug JSON",
"condition": function (gadget) {
return (gadget.props.configuration_dict['Dream-Configuration']
.gui.debug_json);
}
}
}
},
......@@ -196,10 +233,13 @@
if (portal_types[portal_type].hasOwnProperty(key2)) {
action = portal_types[portal_type][key2];
if (action.type === "object_view") {
url_list.push(
calculateTabHTML(gadget, options, key2, action.title,
(key2 === options.action))
);
if ((action.condition === undefined) ||
(action.condition(gadget))) {
url_list.push(
calculateTabHTML(gadget, options, key2, action.title,
(key2 === options.action))
);
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment