diff --git a/kibot/out_kiri.py b/kibot/out_kiri.py
index 4b360622..3fcea66e 100644
--- a/kibot/out_kiri.py
+++ b/kibot/out_kiri.py
@@ -36,16 +36,6 @@ from . import log
logger = log.get_logger()
STASH_MSG = 'KiBot_Changes_Entry'
-TOOLTIP_HTML = '
Commit: {hash}Date: {dt}Author: {author}Description:{desc}
'
-# Icons for modified status
-EMPTY_IMG = ('')
-SCH_IMG = ('')
-PCB_IMG = ('')
-TXT_IMG = ('')
HASH_LOCAL = '_local_'
UNDEF_COLOR = '#DBDBDB'
LAYER_COLORS_HEAD = """/* ==============================
@@ -222,28 +212,39 @@ class KiRiOptions(VariantOptions):
for k, v in rep.items():
ln = ln.replace(f'[{k}]', v)
f.write(ln+'\n')
- if ln.endswith(''):
- self.create_commits(f, commits)
+# if ln.endswith(''):
+# self.create_commits(f, commits)
# elif ln.endswith(''):
# self.create_pages(f)
# elif ln.endswith(''):
# self.create_layers(f)
- def create_commits(self, f, commits):
- template = self.load_html_template('commits', 8)
- for i, c in enumerate(commits):
- hash = c[0][:7]
- dt = c[1].split()[0]
- author = c[2]+' '
- desc = c[3]
- tooltip = TOOLTIP_HTML.format(hash=hash, dt=dt, author=author, desc=desc)
- cls = 'text-warning' if hash == HASH_LOCAL else 'text-info'
- icon_pcb = PCB_IMG if c[0] in self.commits_with_changed_pcb else EMPTY_IMG
- icon_sch = SCH_IMG if c[0] in self.commits_with_changed_sch else EMPTY_IMG
- # TODO What's this? if we only track changes in PCB/Sch this should be empty
- icon_txt = TXT_IMG
- f.write(template.format(i=i+1, hash=hash, tooltip=tooltip, text=c[3], cls=cls, i02='%02d' % (i+1),
- date=dt, user=author, pcb_icon=icon_pcb, sch_icon=icon_sch, txt_icon=icon_txt, hash_label=hash))
+# def create_commits(self, f, commits):
+# template = self.load_html_template('commits', 8)
+# for i, c in enumerate(commits):
+# hash = c[0][:7]
+# dt = c[1].split()[0]
+# author = c[2]+' '
+# desc = c[3]
+# tooltip = TOOLTIP_HTML.format(hash=hash, dt=dt, author=author, desc=desc)
+# cls = 'text-warning' if hash == HASH_LOCAL else 'text-info'
+# icon_pcb = PCB_IMG if c[0] in self.commits_with_changed_pcb else EMPTY_IMG
+# icon_sch = SCH_IMG if c[0] in self.commits_with_changed_sch else EMPTY_IMG
+# # TODO What's this? if we only track changes in PCB/Sch this should be empty
+# icon_txt = TXT_IMG
+# f.write(template.format(i=i+1, hash=hash, tooltip=tooltip, text=c[3], cls=cls, i02='%02d' % (i+1),
+# date=dt, user=author, pcb_icon=icon_pcb, sch_icon=icon_sch, txt_icon=icon_txt, hash_label=hash))
+
+ def save_commits(self, commits):
+ with open(os.path.join(self.cache_dir, 'commits'), 'wt') as f:
+ for c in commits:
+ hash = c[0][:7]
+ dt = c[1].split()[0]
+ author = c[2]
+ desc = c[3]
+ sch_changed = c[0] in self.commits_with_changed_sch
+ pcb_changed = c[0] in self.commits_with_changed_pcb
+ f.write(f'{hash}|{dt}|{author}|{desc}|{sch_changed}|{pcb_changed}\n')
def get_modified_status(self, pcb_file, sch_files):
res = self.run_git(['log', '--pretty=format:%H', '--', pcb_file])
@@ -345,6 +346,7 @@ class KiRiOptions(VariantOptions):
os.remove(self.incl_file)
self.create_kiri_files()
self.create_index(hashes)
+ self.save_commits(hashes)
@output_class
diff --git a/kibot/resources/kiri/kiri.js b/kibot/resources/kiri/kiri.js
index 700a8658..29c3f36d 100644
--- a/kibot/resources/kiri/kiri.js
+++ b/kibot/resources/kiri/kiri.js
@@ -36,6 +36,13 @@ var layers_commit1 = new Set();
var layers_commit2 = new Set();
var current_layers_list = [];
+const SCH_IMG = '';
+const PCB_IMG = '';
+const TXT_IMG = '';
+
// =======================================
// HANDLE SHORTCUTS
// =======================================
@@ -867,6 +874,59 @@ function pad(num, size)
return num;
}
+function load_commits()
+{
+ commits = loadFile("../commits").split("\n").filter((a) => a);
+ console.log(commits);
+ var i = 1;
+ var all_commits_html = "";
+ for (const line of commits)
+ {
+ // Data format: HASH|DATE|AUTHOR|DESCRIPTION|SCH_CHANGED|PCB_CHANGED
+ splitted = line.split("|");
+ var hash = splitted[0];
+ var dt = splitted[1];
+ var author = splitted[2];
+ var desc = splitted[3];
+ var tooltip = `Commit: ${hash}Date: ${dt}Author: ${author}Description:${desc}
`;
+ var sch_changed = splitted[4] == 'True';
+ var pcb_changed = splitted[5] == 'True';
+ var pcb_icon = (pcb_changed ? PCB_IMG : EMPTY_IMG);
+ var sch_icon = (sch_changed ? SCH_IMG : EMPTY_IMG);
+ var txt_icon = TXT_IMG;
+ var i02 = pad(i, 2);
+ var cls = (hash == '_local_' ? 'text-warning' : 'text-info');
+ var commit_html = `
+
+
+
+ `;
+ console.log(commit_html);
+ all_commits_html = all_commits_html + commit_html;
+ i = i+1;
+ }
+ // Update commits list
+ document.getElementById("commits_form").innerHTML = all_commits_html;
+}
+
function update_layers_list(commit1, commit2, selected_layer_idx, selected_layer_id)
{
var used_layers_1;
@@ -1164,7 +1224,7 @@ function get_selected_commits()
}
-// Interpret tooltois as html
+// Interpret tooltips as html
$(document).ready(function()
{
$('[data-toggle="tooltip"]').tooltip({html:true});
@@ -1186,6 +1246,8 @@ $(document).ready(function()
function ready()
{
+ console.log('Starting JS');
+ load_commits();
check_server_status();
select_initial_commits();