From 0562110e003c7db39382d790866bb5565604c8ea Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 26 Feb 2019 17:13:11 +0900 Subject: html: status based summary status based summary is easy to see Signed-off-by: Kuninori Morimoto --- scripts/html.py | 77 ++++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 63 insertions(+), 14 deletions(-) (limited to 'scripts/html.py') diff --git a/scripts/html.py b/scripts/html.py index 094a59b..cdc77c9 100755 --- a/scripts/html.py +++ b/scripts/html.py @@ -161,23 +161,22 @@ class periject_html(base.base): #-------------------- # summary #-------------------- - def __summary(self, title, dir, files): - # ------- - # summary - # ------- - # - # ------- - html("h2").print(title) + def ___summary(self, status, dir, files): + + if (not len(files)): + return + + html("h3").print(html("a", {"target":"summary", + "href":self.relpath("html/{}.html".format(status), dir)}).text(status)) + with html("table", {"border":"1"}): with html("tr"): html("th").print("file") - html("th").print("status") html("th").print("assignee") html("th").print("title") for file in files: v = view.viewer([file]) v.set_data(file) - f = os.path.basename(file) subbody = html("a", {"target":"subbody"}) summary = html("a", {"target":"summary"}) @@ -185,16 +184,56 @@ class periject_html(base.base): subbody.option({"href":self.relpath_y2h(file, dir)}) html("td").print(subbody.text(os.path.basename(file).replace(".yaml", ""))) - status = v.get_data("status") - summary.option({"href":self.relpath("html/{}.html".format(status), dir)}) - html("td").print(summary.text(status)) - assignee = v.get_data("assignee") summary.option({"href":self.relpath("html/{}.html".format(assignee), dir)}) html("td").print(summary.text(assignee)) html("td").print(v.get_data("title")) + #-------------------- + # summary + #-------------------- + def __summary(self, title, dir, files): + # ------- + # summary + # ------- + # + # ------- + if (title): + html("h2").print(title) + + new = [] + active = [] + blocked = [] + paused = [] + done = [] + abandoned = [] + + for file in files: + v = view.viewer([file]) + v.set_data(file) + + status = v.get_data("status") + if (status == "New"): + new.append(file) + elif (status == "Active"): + active.append(file) + elif (status == "Blocked"): + blocked.append(file) + elif (status == "Paused"): + paused.append(file) + elif (status == "Done"): + done.append(file) + else: + abandoned.append(file) + + self.___summary("New", dir, new) + self.___summary("Active", dir, active) + self.___summary("Blocked", dir, blocked) + self.___summary("Paused", dir, paused) + self.___summary("Done", dir, done) + self.___summary("Abandoned", dir, abandoned) + #-------------------- # summary #-------------------- @@ -460,6 +499,16 @@ class periject_html(base.base): with html("body"): self.__summary(mem, "{}/html".format(self.top()), argv) + #-------------------- + # status + #-------------------- + def status(self, argv): + + argv.pop(0) + + with html("body"): + self.__summary(None, "{}/html".format(self.top()), argv) + #-------------------- # bsp #-------------------- @@ -531,7 +580,7 @@ class periject_html(base.base): self.member(sys.argv) elif (cmd == "status"): # ./script/find.py -s Active | xargs ./script/html.py status Active - self.member(sys.argv) + self.status(sys.argv) elif (cmd == "bsp"): # ./script/html.py bsp xxx.yaml xxx.yaml ... self.bsp(sys.argv) -- cgit v1.2.3