1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: Apache-2.0
6 from html import escape
11 from typing import ItemsView
13 class ReportTemplate(object):
14 """Base class for HTML reports produced by Arvados reporting tools.
16 Used by crunchstat-summary and cluster-activity.
24 font-family: "Roboto", "Helvetica", "Arial", sans-serif;
26 color: rgba(0, 0, 0, 0.87);
31 box-shadow: 0px 1px 5px 0px rgba(0,0,0,0.2),0px 2px 2px 0px rgba(0,0,0,0.14),0px 3px 1px -2px rgba(0,0,0,0.12);
36 padding: 2px 16px 8px 16px;
47 border-top: 1px solid rgba(224, 224, 224, 1);
51 border-top: 1px solid rgba(224, 224, 224, 1);
59 def __init__(self, label):
63 def cardlist(self, items):
64 if not isinstance(items, list):
73 </div>""".format(i) for i in items)
76 return '''<!doctype html>
79 <title>{label}</title>
100 '''.format(label=escape(self.label),
103 header=self.headHTML(),
104 cards=self.cardlist(self.cards))
113 """Return extra HTML text to include in HEAD."""