diff options
author | 2017-08-04 11:39:32 +1000 | |
---|---|---|
committer | 2017-08-04 11:42:23 +1000 | |
commit | 00f6156cbbadfc01dcd2a7e91d26d55fa210dfab (patch) | |
tree | c8b7b3756c4a0d1bf64a78356bb438221fffdceb /scripts/minimaws/lib/wsgiserve.py | |
parent | 0fbad045de7da6883d1930f81e895f59dc49c0b4 (diff) |
minimaws: show compatible slots for devices [Vas Crabb]
(nw) Identify Donkey Kong Junior (Japan set F-1) [Corrado Comaselli]
Diffstat (limited to 'scripts/minimaws/lib/wsgiserve.py')
-rw-r--r-- | scripts/minimaws/lib/wsgiserve.py | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/scripts/minimaws/lib/wsgiserve.py b/scripts/minimaws/lib/wsgiserve.py index fe96a60f4f4..1743178dbb7 100644 --- a/scripts/minimaws/lib/wsgiserve.py +++ b/scripts/minimaws/lib/wsgiserve.py @@ -211,6 +211,7 @@ class MachineHandler(QueryPageHandler): yield htmltmpl.MACHINE_SLOTS_PLACEHOLDER.substitute( machine=self.js_escape(self.shortname)).encode('utf=8') + # list devices referenced by this system/device first = True for name, desc, src in self.dbcurs.get_devices_referenced(id): if first: @@ -224,8 +225,32 @@ class MachineHandler(QueryPageHandler): first = False yield self.machine_row(name, desc, src) if not first: - yield ' </tbody>\n</table>\n<script>make_table_sortable(document.getElementById("tbl-dev-refs"));</script>\n'.encode('utf-8') + yield htmltmpl.SORTABLE_TABLE_EPILOGUE.substitute(id='tbl-dev-refs').encode('utf-8') + # list slots where this device is an option + first = True + for name, desc, slot, opt, src in self.dbcurs.get_compatible_slots(id): + if (first): + yield \ + '<h2>Compatible Slots</h2>\n' \ + '<table id="tbl-comp-slots">\n' \ + ' <thead>\n' \ + ' <tr><th>Short name</th><th>Description</th><th>Slot</th><th>Choice</th><th>Source file</th></tr>\n' \ + ' </thead>\n' \ + ' <tbody>\n'.encode('utf-8') + first = False + yield htmltmpl.COMPATIBLE_SLOT_ROW.substitute( + machinehref=self.machine_href(name), + sourcehref=self.sourcefile_href(src), + shortname=cgi.escape(name), + description=cgi.escape(desc), + sourcefile=cgi.escape(src), + slot=cgi.escape(slot), + slotoption=cgi.escape(opt)).encode('utf-8') + if not first: + yield htmltmpl.SORTABLE_TABLE_EPILOGUE.substitute(id='tbl-comp-slots').encode('utf-8') + + # list systems/devices that reference this device first = True for name, desc, src in self.dbcurs.get_device_references(id): if first: @@ -239,7 +264,7 @@ class MachineHandler(QueryPageHandler): first = False yield self.machine_row(name, desc, src) if not first: - yield ' </tbody>\n</table>\n<script>make_table_sortable(document.getElementById("tbl-ref-by"));</script>\n'.encode('utf-8') + yield htmltmpl.SORTABLE_TABLE_EPILOGUE.substitute(id='tbl-ref-by').encode('utf-8') yield '</html>\n'.encode('utf-8') |