diff --git a/GitGrapth/LibGitGraph.ts b/GitGrapth/LibGitGraph.ts
index 36b807b..5688f07 100644
--- a/GitGrapth/LibGitGraph.ts
+++ b/GitGrapth/LibGitGraph.ts
@@ -91,7 +91,10 @@ namespace OS {
set base_dir(v: VFS.BaseFileHandle)
{
this._base_dir = v;
- this.render_next();
+ if(v)
+ {
+ this.render_next();
+ }
}
private gen_color(x:number): string
@@ -206,6 +209,10 @@ namespace OS {
}
private render_next()
{
+ if(this._base_dir == undefined)
+ {
+ return;
+ }
this.load(this.oldest_commit_date)
.then((data: CommitData[]) =>
{
diff --git a/GitGrapth/README.md b/GitGrapth/README.md
index c4f13ef..1e38d6c 100644
--- a/GitGrapth/README.md
+++ b/GitGrapth/README.md
@@ -1,15 +1,17 @@
# LibGitGraph
-This is an example project, generated by AntOS Development Kit
+Git grapth visualization API for AntOS application.
-## Howto
-Use the Antedit command palette to access to the SDK functionalities:
+The visualization can be easily integrated to an AntOS application, example:
-1. Create new project
-2. Init the project from the current folder located in side bar
-3. Build and run the project
-4. Release the project in zip package
+```typescript
+const graph = new API.LibGitGraph({
+ target: this.find("git-graph")
+});
+graph.on_open_diff = (files) => {
+ console.log(files);
+}
+graph.base_dir = "home://workspace/repo-git";
+```
-## Set up build target
-
-Open the `build.json` file from the current project tree and add/remove
-build target entries and jobs. Save the file
\ No newline at end of file
+## Change logs:
+- v0.1.0-b: Initial version
\ No newline at end of file
diff --git a/GitGrapth/build/debug/README.md b/GitGrapth/build/debug/README.md
index c4f13ef..1e38d6c 100644
--- a/GitGrapth/build/debug/README.md
+++ b/GitGrapth/build/debug/README.md
@@ -1,15 +1,17 @@
# LibGitGraph
-This is an example project, generated by AntOS Development Kit
+Git grapth visualization API for AntOS application.
-## Howto
-Use the Antedit command palette to access to the SDK functionalities:
+The visualization can be easily integrated to an AntOS application, example:
-1. Create new project
-2. Init the project from the current folder located in side bar
-3. Build and run the project
-4. Release the project in zip package
+```typescript
+const graph = new API.LibGitGraph({
+ target: this.find("git-graph")
+});
+graph.on_open_diff = (files) => {
+ console.log(files);
+}
+graph.base_dir = "home://workspace/repo-git";
+```
-## Set up build target
-
-Open the `build.json` file from the current project tree and add/remove
-build target entries and jobs. Save the file
\ No newline at end of file
+## Change logs:
+- v0.1.0-b: Initial version
\ No newline at end of file
diff --git a/GitGrapth/build/debug/libgitgraph.js b/GitGrapth/build/debug/libgitgraph.js
index 8035d9f..c7b83f4 100644
--- a/GitGrapth/build/debug/libgitgraph.js
+++ b/GitGrapth/build/debug/libgitgraph.js
@@ -1,498 +1 @@
-
-var OS;
-(function (OS) {
- let API;
- (function (API) {
- ;
- class LibGitGraph {
- constructor(option) {
- this._base_dir = undefined;
- this.lines_data = [];
- this.commits = {};
- this.oldest_commit_date = undefined;
- this.svg_element = undefined;
- this.commits_list_element = undefined;
- this.load_more_el = undefined;
- this.commit_detail_el = undefined;
- this.current_head = undefined;
- this._on_open_diff = undefined;
- this.options = {
- commits_per_page: 100,
- x_offset: 24,
- y_offset: 24,
- target: undefined,
- popup_height: 250
- };
- for (const k in option) {
- this.options[k] = option[k];
- }
- this.current_y_offset = this.options.y_offset;
- this.init_graph();
- }
- set base_dir(v) {
- this._base_dir = v;
- this.render_next();
- }
- gen_color(x) {
- let n = x + 11;
- const rgb = [0, 0, 0];
- for (let i = 0; i < 24; i++) {
- rgb[i % 3] <<= 1;
- rgb[i % 3] |= n & 0x01;
- n >>= 1;
- }
- return '#' + rgb.reduce((a, c) => (c > 0x0f ? c.toString(16) : '0' + c.toString(16)) + a, '');
- }
- meta() {
- return OS.setting.system.packages['GitGraph'];
- }
- call(request) {
- return new Promise(async (ok, reject) => {
- request.args.base_dir = this._base_dir.path;
- let cmd = {
- path: this.meta().path + "/api/api.lua",
- parameters: request
- };
- let data = await API.apigateway(cmd, false);
- if (!data.error) {
- ok(data.result);
- }
- else {
- reject(API.throwe(__("LibGitGrapth server call error: {0}", data.error)));
- }
- });
- }
- load(before) {
- let request = {
- action: 'log',
- args: {
- n_commits: this.options.commits_per_page.toString(),
- before: before ? before : null
- }
- };
- return this.call(request);
- }
- error(e) {
- OS.announcer.oserror(__("GitGraph error: {0}", e.toString()), e);
- }
- set on_open_diff(c) {
- this._on_open_diff = c;
- }
- init_graph() {
- if (!this.options.target) {
- return this.error(API.throwe("Target element is undefined"));
- }
- $(this.options.target)
- .css("overflow-y", "auto")
- .css("overflow-x", "hidden")
- .css("display", "block")
- .css("position", "relative");
- this.svg_element = this.make_svg_el("svg", {
- width: this.options.x_offset,
- height: this.options.y_offset
- });
- $(this.svg_element)
- .css("display", "block")
- .css("position", "absolute")
- .css("left", "0")
- //s.css("z-index", 10)
- .css("top", "0");
- $(this.options.target).empty();
- this.options.target.appendChild(this.svg_element);
- const div = $("
")
- .css("position", "absolute")
- .css("left", "0")
- .css("top", "0")
- .css("width", "100%")
- .css("padding-top", `${this.options.y_offset / 2}px`);
- this.commits_list_element = div[0];
- this.options.target.appendChild(this.commits_list_element);
- const p = $("")
- .css("height", `${this.options.y_offset}px`)
- .css("display", "block")
- .css("padding", "0")
- .css("margin", "0")
- .css("line-height", `${this.options.y_offset}px`)
- .css("vertical-align", "middle");
- p.addClass("git_grapth_load_more");
- p.on("click", (e) => this.render_next());
- p.text(__("More").__());
- this.load_more_el = p[0];
- this.commits_list_element.appendChild(this.load_more_el);
- const popup = $("")
- .css("position", "absolute")
- .css("top", "0")
- .css("height", this.options.popup_height + "px")
- .css("display", "none")
- .css("user-select", "text")
- .addClass("git_grapth_commit_detail");
- this.commit_detail_el = popup[0];
- this.options.target.appendChild(this.commit_detail_el);
- }
- render_next() {
- this.load(this.oldest_commit_date)
- .then((data) => {
- if (this.oldest_commit_date) {
- // remove the first commit as it is already in
- // the graph
- data.shift();
- }
- this.draw_graph(data);
- })
- .catch(e => this.error(e));
- }
- make_svg_el(tag, attrs) {
- const el = document.createElementNS('http://www.w3.org/2000/svg', tag);
- for (var k in attrs)
- el.setAttribute(k, attrs[k]);
- return el;
- }
- max_line_off_x() {
- if (this.lines_data.length == 0)
- return 0;
- return Math.max.apply(Math, this.lines_data.map((o) => o.x_offset));
- }
- update_line_data(commit, y_offset) {
- const parent_commits = commit.hashes.parents.split(" ");
- // get the list of child lines
- const children = this.lines_data.filter((line) => line.next_commit == commit.hashes.commit);
- let merge = {
- src: [],
- dest: undefined
- };
- if (children.length === 0) {
- // add new line
- let line = {
- next_commit: parent_commits[0],
- x_offset: this.max_line_off_x() + this.options.x_offset,
- current_commit: commit.hashes.commit,
- beginning: true,
- y_offset: y_offset,
- color: this.gen_color(this.lines_data.length),
- };
- this.lines_data.push(line);
- merge.dest = line;
- }
- else {
- let min_offset_x = Math.min.apply(Math, children.map((o) => o.x_offset));
- let line = undefined;
- for (let el of children) {
- if (el.x_offset == min_offset_x) {
- line = el;
- line.next_commit = parent_commits[0];
- line.current_commit = commit.hashes.commit;
- line.y_offset = y_offset;
- }
- else {
- this.lines_data.splice(this.lines_data.indexOf(el), 1);
- merge.src.push(el);
- }
- }
- merge.dest = line;
- }
- if (parent_commits.length === 2) {
- let line = undefined;
- line = this.lines_data.filter(l => l.next_commit == parent_commits[1])[0];
- if (!line) {
- // add new line
- line = {
- next_commit: parent_commits[1],
- x_offset: this.max_line_off_x() + this.options.x_offset,
- current_commit: commit.hashes.commit,
- beginning: true,
- y_offset: y_offset + this.options.y_offset,
- color: this.gen_color(this.lines_data.length),
- };
- this.lines_data.push(line);
- }
- else {
- line.y_offset = y_offset + this.options.y_offset;
- }
- merge.src.push(line);
- }
- return merge;
- }
- draw_line(_x1, _y1, _x2, _y2, color, stroke) {
- let line_opt = {
- stroke: color,
- fill: 'none',
- "stroke-width": 1.5
- };
- if (stroke) {
- line_opt['stroke-width'] = stroke;
- }
- if (_x1 == _x2) {
- line_opt.d = `M ${_x1},${_y1} L ${_x2},${_y2}`;
- }
- else {
- let x1 = _x1;
- let y1 = _y1;
- let x2 = _x2;
- let y2 = _y2;
- let dx = Math.abs(x2 - x1);
- let dy = Math.abs(y2 - y1);
- if (_y1 < _y2) {
- x1 = _x2;
- y1 = _y2;
- x2 = _x1;
- y2 = _y1;
- }
- line_opt.d = `M ${x1},${y1} C ${x1},${y1 - dy} ${x2},${y2 + dy} ${x2},${y2}`;
- }
- const line = this.make_svg_el("path", line_opt);
- return line;
- }
- gen_commit_data_header(name, value) {
- const p = $("")
- .css("display", "block");
- p[0].innerHTML = `${name.__()}: ${value}`;
- return p[0];
- }
- open_popup(commit) {
- const el = commit.domel;
- if (!el)
- return;
- $(this.commit_detail_el).empty();
- const position = $(el).position();
- const bbox = this.svg_element.getBBox();
- const off_left = bbox.x + bbox.width + this.options.x_offset / 2;
- const svg = this.make_svg_el("svg", {
- width: off_left - commit.cx + 5,
- height: this.options.y_offset
- });
- $(svg)
- .css("display", "block")
- .css("position", "absolute")
- .css("left", "0")
- .css("top", "-2px");
- svg.appendChild(this.draw_line(0, this.options.y_offset / 2, off_left - commit.cx, this.options.y_offset / 2, commit.color));
- /*
- svg.appendChild(
- this.make_svg_el("circle",{
- cx: off_left-commit.cx - 1,
- cy: this.options.y_offset/2,
- r:4,
- fill: commit.color,
- "stroke-width": 0.0
- })
- );*/
- $(this.commit_detail_el)
- .css("border", "2px solid " + commit.color)
- .css("color", commit.color)
- .append($("")
- .css("position", "absolute")
- .css("height", this.options.y_offset)
- .css("left", commit.cx - off_left)
- .css("padding-left", off_left - commit.cx)
- .append(svg)
- .append($("").text('[X]')
- .css("cursor", "pointer"))
- .addClass("git_grapth_commit_detail_ctrl")
- .on("click", (e) => {
- $(this.commit_detail_el)
- .css("display", "none")
- .empty();
- }));
- const left = $("")
- .css("display", "block")
- .css("overflow-y", "auto")
- .css("overflow-x", "hidden")
- .css("flex", "1")
- .css("border-right", "1px solid " + commit.color)
- .addClass("git_grapth_commit_detail_left");
- const right = $("")
- .css("display", "block")
- .css("overflow-y", "auto")
- .css("overflow-x", "hidden")
- .css("flex", "1")
- .addClass("git_grapth_commit_detail_right");
- // display
- left.append(this.gen_commit_data_header(__("Commit"), commit.hashes.commit));
- left.append(this.gen_commit_data_header(__("Parents"), commit.hashes.parents));
- left.append(this.gen_commit_data_header(__("Author"), `${commit.committer.name} <${commit.committer.email}>`));
- left.append(this.gen_commit_data_header(__("Date"), (new Date(commit.committer.date).toDateString())));
- left.append($("")
- .css("white-space", "pre-wrap")
- .text(commit.message));
- this.commit_detail_el.appendChild(left[0]);
- this.commit_detail_el.appendChild(right[0]);
- this.list_file(commit.hashes.commit)
- .then((files) => {
- const ul = $('');
- $.each(files, (index, value) => {
- const arr = value.split("\t");
- const li = $('');
- const a = $('')
- .css("cursor", "pointer")
- .addClass(`git_graph_file_${arr[0].toLowerCase()}`)
- .on("click", e => {
- if (this._on_open_diff) {
- Promise.all([
- this.get_file(arr[1], `${commit.hashes.commit}^`),
- this.get_file(arr[1], commit.hashes.commit)
- ])
- .then((values) => {
- // create the file
- const files = values.map((content, index) => {
- const file = `mem://${commit.hashes.commit.slice(0, 8)}${index == 0 ? "^" : ""}/${arr[1]}`.asFileHandle();
- file.cache = content;
- file.info.mime = "text/plain";
- return file;
- });
- this._on_open_diff(files);
- })
- .catch((e) => {
- OS.announcer.oserror(__("Unable to fetch diff of {0}: {1}", commit.hashes.commit, e.toString()), e);
- });
- }
- });
- a.text(arr[1]);
- ul.append(li.append(a));
- });
- right.append(ul);
- })
- .catch((e) => OS.announcer.oserror(__("Unable to get commit changes: {0}", e.toString()), e));
- // scroll down if necessary
- $(this.commit_detail_el)
- .css("top", position.top)
- .css("left", off_left)
- .css("display", "flex")
- .css("width", `calc(100% - ${off_left + this.options.x_offset}px)`)
- .css("fflex-direction", "row");
- const delta = this.commit_detail_el.getBoundingClientRect().bottom -
- this.options.target.getBoundingClientRect().bottom;
- if (delta > 0) {
- this.options.target.scrollTop += delta + 10;
- }
- }
- render_commit(commit, color) {
- let current = false;
- const p = $("")
- .css("padding", "0")
- .css("margin", "0")
- .css("display", "block")
- .css("height", `${this.options.y_offset}px`)
- .css("line-height", `${this.options.y_offset}px`)
- .css("color", color)
- .css("vertical-align", "middle")
- .css("white-space", "nowrap")
- .css("overflow", "hidden");
- p.addClass("git_graph_commit_message");
- let html = `${commit.hashes.commit.slice(0, 8)} `;
- commit.branches = [];
- for (const tag of commit.extra.split(",").map(e => e.trim()).filter(e => e != "")) {
- let found = tag.match(/HEAD -> (.*)/i);
- if (found && found.length == 2) {
- html += `${found[1]} `;
- p.addClass("git_graph_commit_current_head");
- current = true;
- commit.branches.push(found[1]);
- this.current_head = commit;
- }
- else if ((found = tag.match(/tag: (.*)/i))) {
- html += `${found[1]} `;
- }
- else {
- html += `${tag} `;
- commit.branches.push(tag);
- }
- }
- html += `${commit.message.split("\n")[0]} `;
- html += `${commit.committer.name} `;
- html += `${new Date(commit.committer.date).toDateString()}`;
- p[0].innerHTML = html;
- p.on("click", (e) => {
- this.open_popup(commit);
- });
- this.commits_list_element.insertBefore(p[0], this.load_more_el);
- commit.domel = p[0];
- return current;
- }
- draw_graph(data) {
- for (const commit of data) {
- this.oldest_commit_date = commit.committer.date;
- if (commit.extra.includes("refs/stash")) {
- continue;
- }
- this.commits[commit.hashes.commit] = commit;
- let merge = this.update_line_data(commit, this.current_y_offset);
- let lines = merge.src;
- // combine the lines
- for (const linedata of lines.filter(o => o.x_offset != merge.dest.x_offset)) {
- this.svg_element.appendChild(this.draw_line(merge.dest.x_offset, merge.dest.y_offset, linedata.x_offset, linedata.y_offset, linedata.color));
- }
- this.lines_data.sort((a, b) => a.x_offset - b.x_offset);
- let x_offset = this.options.x_offset;
- for (const linedata of this.lines_data) {
- if (linedata.beginning && linedata.y_offset > this.current_y_offset) {
- continue;
- }
- linedata.y_offset = this.current_y_offset;
- if (!linedata.beginning) {
- if (linedata.x_offset > x_offset) {
- this.svg_element.appendChild(this.draw_line(linedata.x_offset, linedata.y_offset - this.options.y_offset, linedata.x_offset - this.options.x_offset, linedata.y_offset, linedata.color));
- linedata.x_offset = x_offset;
- }
- else {
- this.svg_element.appendChild(this.draw_line(linedata.x_offset, linedata.y_offset - this.options.y_offset, linedata.x_offset, linedata.y_offset, linedata.color));
- }
- }
- x_offset += this.options.x_offset;
- linedata.beginning = false;
- }
- let options = {
- cx: merge.dest.x_offset,
- cy: merge.dest.y_offset,
- r: 4,
- fill: merge.dest.color,
- stroke: 'black',
- "stroke-width": 0.0
- };
- if (this.render_commit(commit, merge.dest.color)) {
- options.r = options.r * 1.5;
- }
- commit.cx = options.cx;
- commit.color = options.fill;
- const circle = this.make_svg_el("circle", options);
- this.svg_element.appendChild(circle);
- this.current_y_offset += this.options.y_offset;
- }
- const bbox = this.svg_element.getBBox();
- this.svg_element.setAttribute("width", (bbox.x + bbox.width).toString());
- this.svg_element.setAttribute("height", (bbox.y + bbox.height + this.options.y_offset / 2).toString());
- //$(this.commits_list_element).css("left", `-${bbox.x + bbox.width}px`);
- $(".git_graph_commit_message", this.commits_list_element).css("padding-left", `${bbox.x + bbox.width + this.options.x_offset / 2}px`);
- }
- list_file(hash) {
- let request = {
- action: 'list_file',
- args: {
- commit: hash
- }
- };
- return this.call(request);
- }
- get_changes(file, hash) {
- let request = {
- action: 'get_changes',
- args: {
- commit: hash,
- file: file
- }
- };
- return this.call(request);
- }
- get_file(file, hash) {
- let request = {
- action: 'get_file',
- args: {
- commit: hash,
- file: file
- }
- };
- return this.call(request);
- }
- }
- API.LibGitGraph = LibGitGraph;
- })(API = OS.API || (OS.API = {}));
-})(OS || (OS = {}));
+var OS;!function(t){let s;!function(s){s.LibGitGraph=class{constructor(t){this._base_dir=void 0,this.lines_data=[],this.commits={},this.oldest_commit_date=void 0,this.svg_element=void 0,this.commits_list_element=void 0,this.load_more_el=void 0,this.commit_detail_el=void 0,this.current_head=void 0,this._on_open_diff=void 0,this.options={commits_per_page:100,x_offset:24,y_offset:24,target:void 0,popup_height:250};for(const s in t)this.options[s]=t[s];this.current_y_offset=this.options.y_offset,this.init_graph()}set base_dir(t){this._base_dir=t,t&&this.render_next()}gen_color(t){let s=t+11;const e=[0,0,0];for(let t=0;t<24;t++)e[t%3]<<=1,e[t%3]|=1&s,s>>=1;return"#"+e.reduce((t,s)=>(s>15?s.toString(16):"0"+s.toString(16))+t,"")}meta(){return t.setting.system.packages.GitGraph}call(t){return new Promise(async(e,i)=>{t.args.base_dir=this._base_dir.path;let o={path:this.meta().path+"/api/api.lua",parameters:t},a=await s.apigateway(o,!1);a.error?i(s.throwe(__("LibGitGrapth server call error: {0}",a.error))):e(a.result)})}load(t){let s={action:"log",args:{n_commits:this.options.commits_per_page.toString(),before:t||null}};return this.call(s)}error(s){t.announcer.oserror(__("GitGraph error: {0}",s.toString()),s)}set on_open_diff(t){this._on_open_diff=t}init_graph(){if(!this.options.target)return this.error(s.throwe("Target element is undefined"));$(this.options.target).css("overflow-y","auto").css("overflow-x","hidden").css("display","block").css("position","relative"),this.svg_element=this.make_svg_el("svg",{width:this.options.x_offset,height:this.options.y_offset}),$(this.svg_element).css("display","block").css("position","absolute").css("left","0").css("top","0"),$(this.options.target).empty(),this.options.target.appendChild(this.svg_element);const t=$("").css("position","absolute").css("left","0").css("top","0").css("width","100%").css("padding-top",this.options.y_offset/2+"px");this.commits_list_element=t[0],this.options.target.appendChild(this.commits_list_element);const e=$("").css("height",this.options.y_offset+"px").css("display","block").css("padding","0").css("margin","0").css("line-height",this.options.y_offset+"px").css("vertical-align","middle");e.addClass("git_grapth_load_more"),e.on("click",t=>this.render_next()),e.text(__("More").__()),this.load_more_el=e[0],this.commits_list_element.appendChild(this.load_more_el);const i=$("").css("position","absolute").css("top","0").css("height",this.options.popup_height+"px").css("display","none").css("user-select","text").addClass("git_grapth_commit_detail");this.commit_detail_el=i[0],this.options.target.appendChild(this.commit_detail_el)}render_next(){null!=this._base_dir&&this.load(this.oldest_commit_date).then(t=>{this.oldest_commit_date&&t.shift(),this.draw_graph(t)}).catch(t=>this.error(t))}make_svg_el(t,s){const e=document.createElementNS("http://www.w3.org/2000/svg",t);for(var i in s)e.setAttribute(i,s[i]);return e}max_line_off_x(){return 0==this.lines_data.length?0:Math.max.apply(Math,this.lines_data.map(t=>t.x_offset))}update_line_data(t,s){const e=t.hashes.parents.split(" "),i=this.lines_data.filter(s=>s.next_commit==t.hashes.commit);let o={src:[],dest:void 0};if(0===i.length){let i={next_commit:e[0],x_offset:this.max_line_off_x()+this.options.x_offset,current_commit:t.hashes.commit,beginning:!0,y_offset:s,color:this.gen_color(this.lines_data.length)};this.lines_data.push(i),o.dest=i}else{let a=Math.min.apply(Math,i.map(t=>t.x_offset)),n=void 0;for(let _ of i)_.x_offset==a?(n=_,n.next_commit=e[0],n.current_commit=t.hashes.commit,n.y_offset=s):(this.lines_data.splice(this.lines_data.indexOf(_),1),o.src.push(_));o.dest=n}if(2===e.length){let i=void 0;i=this.lines_data.filter(t=>t.next_commit==e[1])[0],i?i.y_offset=s+this.options.y_offset:(i={next_commit:e[1],x_offset:this.max_line_off_x()+this.options.x_offset,current_commit:t.hashes.commit,beginning:!0,y_offset:s+this.options.y_offset,color:this.gen_color(this.lines_data.length)},this.lines_data.push(i)),o.src.push(i)}return o}draw_line(t,s,e,i,o,a){let n={stroke:o,fill:"none","stroke-width":1.5};if(a&&(n["stroke-width"]=a),t==e)n.d=`M ${t},${s} L ${e},${i}`;else{let o=t,a=s,_=e,h=i,l=(Math.abs(_-o),Math.abs(h-a));s").css("display","block");return e[0].innerHTML=`${t.__()}: ${s}`,e[0]}open_popup(s){const e=s.domel;if(!e)return;$(this.commit_detail_el).empty();const i=$(e).position(),o=this.svg_element.getBBox(),a=o.x+o.width+this.options.x_offset/2,n=this.make_svg_el("svg",{width:a-s.cx+5,height:this.options.y_offset});$(n).css("display","block").css("position","absolute").css("left","0").css("top","-2px"),n.appendChild(this.draw_line(0,this.options.y_offset/2,a-s.cx,this.options.y_offset/2,s.color)),$(this.commit_detail_el).css("border","2px solid "+s.color).css("color",s.color).append($("").css("position","absolute").css("height",this.options.y_offset).css("left",s.cx-a).css("padding-left",a-s.cx).append(n).append($("").text("[X]").css("cursor","pointer")).addClass("git_grapth_commit_detail_ctrl").on("click",t=>{$(this.commit_detail_el).css("display","none").empty()}));const _=$("").css("display","block").css("overflow-y","auto").css("overflow-x","hidden").css("flex","1").css("border-right","1px solid "+s.color).addClass("git_grapth_commit_detail_left"),h=$("").css("display","block").css("overflow-y","auto").css("overflow-x","hidden").css("flex","1").addClass("git_grapth_commit_detail_right");_.append(this.gen_commit_data_header(__("Commit"),s.hashes.commit)),_.append(this.gen_commit_data_header(__("Parents"),s.hashes.parents)),_.append(this.gen_commit_data_header(__("Author"),`${s.committer.name} <${s.committer.email}>`)),_.append(this.gen_commit_data_header(__("Date"),new Date(s.committer.date).toDateString())),_.append($("").css("white-space","pre-wrap").text(s.message)),this.commit_detail_el.appendChild(_[0]),this.commit_detail_el.appendChild(h[0]),this.list_file(s.hashes.commit).then(e=>{const i=$("");$.each(e,(e,o)=>{const a=o.split("\t"),n=$(""),_=$("").css("cursor","pointer").addClass("git_graph_file_"+a[0].toLowerCase()).on("click",e=>{this._on_open_diff&&Promise.all([this.get_file(a[1],s.hashes.commit+"^"),this.get_file(a[1],s.hashes.commit)]).then(t=>{const e=t.map((t,e)=>{const i=`mem://${s.hashes.commit.slice(0,8)}${0==e?"^":""}/${a[1]}`.asFileHandle();return i.cache=t,i.info.mime="text/plain",i});this._on_open_diff(e)}).catch(e=>{t.announcer.oserror(__("Unable to fetch diff of {0}: {1}",s.hashes.commit,e.toString()),e)})});_.text(a[1]),i.append(n.append(_))}),h.append(i)}).catch(s=>t.announcer.oserror(__("Unable to get commit changes: {0}",s.toString()),s)),$(this.commit_detail_el).css("top",i.top).css("left",a).css("display","flex").css("width",`calc(100% - ${a+this.options.x_offset}px)`).css("fflex-direction","row");const l=this.commit_detail_el.getBoundingClientRect().bottom-this.options.target.getBoundingClientRect().bottom;l>0&&(this.options.target.scrollTop+=l+10)}render_commit(t,s){let e=!1;const i=$("").css("padding","0").css("margin","0").css("display","block").css("height",this.options.y_offset+"px").css("line-height",this.options.y_offset+"px").css("color",s).css("vertical-align","middle").css("white-space","nowrap").css("overflow","hidden");i.addClass("git_graph_commit_message");let o=`${t.hashes.commit.slice(0,8)} `;t.branches=[];for(const s of t.extra.split(",").map(t=>t.trim()).filter(t=>""!=t)){let a=s.match(/HEAD -> (.*)/i);a&&2==a.length?(o+=`${a[1]} `,i.addClass("git_graph_commit_current_head"),e=!0,t.branches.push(a[1]),this.current_head=t):(a=s.match(/tag: (.*)/i))?o+=`${a[1]} `:(o+=`${s} `,t.branches.push(s))}return o+=`${t.message.split("\n")[0]} `,o+=`${t.committer.name} `,o+=`${new Date(t.committer.date).toDateString()}`,i[0].innerHTML=o,i.on("click",s=>{this.open_popup(t)}),this.commits_list_element.insertBefore(i[0],this.load_more_el),t.domel=i[0],e}draw_graph(t){for(const s of t){if(this.oldest_commit_date=s.committer.date,s.extra.includes("refs/stash"))continue;this.commits[s.hashes.commit]=s;let t=this.update_line_data(s,this.current_y_offset),e=t.src;for(const s of e.filter(s=>s.x_offset!=t.dest.x_offset))this.svg_element.appendChild(this.draw_line(t.dest.x_offset,t.dest.y_offset,s.x_offset,s.y_offset,s.color));this.lines_data.sort((t,s)=>t.x_offset-s.x_offset);let i=this.options.x_offset;for(const t of this.lines_data)t.beginning&&t.y_offset>this.current_y_offset||(t.y_offset=this.current_y_offset,t.beginning||(t.x_offset>i?(this.svg_element.appendChild(this.draw_line(t.x_offset,t.y_offset-this.options.y_offset,t.x_offset-this.options.x_offset,t.y_offset,t.color)),t.x_offset=i):this.svg_element.appendChild(this.draw_line(t.x_offset,t.y_offset-this.options.y_offset,t.x_offset,t.y_offset,t.color))),i+=this.options.x_offset,t.beginning=!1);let o={cx:t.dest.x_offset,cy:t.dest.y_offset,r:4,fill:t.dest.color,stroke:"black","stroke-width":0};this.render_commit(s,t.dest.color)&&(o.r=1.5*o.r),s.cx=o.cx,s.color=o.fill;const a=this.make_svg_el("circle",o);this.svg_element.appendChild(a),this.current_y_offset+=this.options.y_offset}const s=this.svg_element.getBBox();this.svg_element.setAttribute("width",(s.x+s.width).toString()),this.svg_element.setAttribute("height",(s.y+s.height+this.options.y_offset/2).toString()),$(".git_graph_commit_message",this.commits_list_element).css("padding-left",s.x+s.width+this.options.x_offset/2+"px")}list_file(t){let s={action:"list_file",args:{commit:t}};return this.call(s)}get_changes(t,s){let e={action:"get_changes",args:{commit:s,file:t}};return this.call(e)}get_file(t,s){let e={action:"get_file",args:{commit:s,file:t}};return this.call(e)}}}(s=t.API||(t.API={}))}(OS||(OS={}));
\ No newline at end of file
diff --git a/GitGrapth/build/debug/main.css b/GitGrapth/build/debug/main.css
index 268876d..b3586fd 100644
--- a/GitGrapth/build/debug/main.css
+++ b/GitGrapth/build/debug/main.css
@@ -4,6 +4,13 @@ afx-app-window[data-id="GitGraph"] div[data-id="git-graph"]
background-color: bisque;
}
+afx-app-window[data-id="GitGraph"] afx-label[data-id="txt-repo"] i.label-text
+{
+ display: block;
+ text-align: center;
+ font-weight: bold;
+}
+
p.git_graph_commit_message:hover
{
background-color:rgba(39, 39, 39,0.5);
diff --git a/GitGrapth/build/debug/main.js b/GitGrapth/build/debug/main.js
index 6040e7f..ab53767 100644
--- a/GitGrapth/build/debug/main.js
+++ b/GitGrapth/build/debug/main.js
@@ -1,536 +1 @@
-
-
-var OS;
-(function (OS) {
- let API;
- (function (API) {
- })(API = OS.API || (OS.API = {}));
- let application;
- (function (application) {
- /**
- *
- * @class GitGraph
- * @extends {BaseApplication}
- */
- class GitGraph extends application.BaseApplication {
- constructor(args) {
- super("GitGraph", args);
- }
- main() {
- let graph = new API.LibGitGraph({
- target: this.find("git-graph")
- });
- graph.on_open_diff = (files) => {
- console.log(files);
- //(OS.PM.processes.Antedit[0] as any).openDiff(files)
- this._gui.launch("Antedit", [])
- .then((p) => {
- p.observable.one("launched", () => p.openDiff(files));
- });
- };
- graph.base_dir = "home://workspace/antos/".asFileHandle();
- }
- }
- application.GitGraph = GitGraph;
- //GitGraph.dependencies = ["pkg://GitGraph/libgitgraph.js"];
- })(application = OS.application || (OS.application = {}));
-})(OS || (OS = {}));
-
-
-var OS;
-(function (OS) {
- let API;
- (function (API) {
- ;
- class LibGitGraph {
- constructor(option) {
- this._base_dir = undefined;
- this.lines_data = [];
- this.commits = {};
- this.oldest_commit_date = undefined;
- this.svg_element = undefined;
- this.commits_list_element = undefined;
- this.load_more_el = undefined;
- this.commit_detail_el = undefined;
- this.current_head = undefined;
- this._on_open_diff = undefined;
- this.options = {
- commits_per_page: 100,
- x_offset: 24,
- y_offset: 24,
- target: undefined,
- popup_height: 250
- };
- for (const k in option) {
- this.options[k] = option[k];
- }
- this.current_y_offset = this.options.y_offset;
- this.init_graph();
- }
- set base_dir(v) {
- this._base_dir = v;
- this.render_next();
- }
- gen_color(x) {
- let n = x + 11;
- const rgb = [0, 0, 0];
- for (let i = 0; i < 24; i++) {
- rgb[i % 3] <<= 1;
- rgb[i % 3] |= n & 0x01;
- n >>= 1;
- }
- return '#' + rgb.reduce((a, c) => (c > 0x0f ? c.toString(16) : '0' + c.toString(16)) + a, '');
- }
- meta() {
- return OS.setting.system.packages['GitGraph'];
- }
- call(request) {
- return new Promise(async (ok, reject) => {
- request.args.base_dir = this._base_dir.path;
- let cmd = {
- path: this.meta().path + "/api/api.lua",
- parameters: request
- };
- let data = await API.apigateway(cmd, false);
- if (!data.error) {
- ok(data.result);
- }
- else {
- reject(API.throwe(__("LibGitGrapth server call error: {0}", data.error)));
- }
- });
- }
- load(before) {
- let request = {
- action: 'log',
- args: {
- n_commits: this.options.commits_per_page.toString(),
- before: before ? before : null
- }
- };
- return this.call(request);
- }
- error(e) {
- OS.announcer.oserror(__("GitGraph error: {0}", e.toString()), e);
- }
- set on_open_diff(c) {
- this._on_open_diff = c;
- }
- init_graph() {
- if (!this.options.target) {
- return this.error(API.throwe("Target element is undefined"));
- }
- $(this.options.target)
- .css("overflow-y", "auto")
- .css("overflow-x", "hidden")
- .css("display", "block")
- .css("position", "relative");
- this.svg_element = this.make_svg_el("svg", {
- width: this.options.x_offset,
- height: this.options.y_offset
- });
- $(this.svg_element)
- .css("display", "block")
- .css("position", "absolute")
- .css("left", "0")
- //s.css("z-index", 10)
- .css("top", "0");
- $(this.options.target).empty();
- this.options.target.appendChild(this.svg_element);
- const div = $("")
- .css("position", "absolute")
- .css("left", "0")
- .css("top", "0")
- .css("width", "100%")
- .css("padding-top", `${this.options.y_offset / 2}px`);
- this.commits_list_element = div[0];
- this.options.target.appendChild(this.commits_list_element);
- const p = $("")
- .css("height", `${this.options.y_offset}px`)
- .css("display", "block")
- .css("padding", "0")
- .css("margin", "0")
- .css("line-height", `${this.options.y_offset}px`)
- .css("vertical-align", "middle");
- p.addClass("git_grapth_load_more");
- p.on("click", (e) => this.render_next());
- p.text(__("More").__());
- this.load_more_el = p[0];
- this.commits_list_element.appendChild(this.load_more_el);
- const popup = $("")
- .css("position", "absolute")
- .css("top", "0")
- .css("height", this.options.popup_height + "px")
- .css("display", "none")
- .css("user-select", "text")
- .addClass("git_grapth_commit_detail");
- this.commit_detail_el = popup[0];
- this.options.target.appendChild(this.commit_detail_el);
- }
- render_next() {
- this.load(this.oldest_commit_date)
- .then((data) => {
- if (this.oldest_commit_date) {
- // remove the first commit as it is already in
- // the graph
- data.shift();
- }
- this.draw_graph(data);
- })
- .catch(e => this.error(e));
- }
- make_svg_el(tag, attrs) {
- const el = document.createElementNS('http://www.w3.org/2000/svg', tag);
- for (var k in attrs)
- el.setAttribute(k, attrs[k]);
- return el;
- }
- max_line_off_x() {
- if (this.lines_data.length == 0)
- return 0;
- return Math.max.apply(Math, this.lines_data.map((o) => o.x_offset));
- }
- update_line_data(commit, y_offset) {
- const parent_commits = commit.hashes.parents.split(" ");
- // get the list of child lines
- const children = this.lines_data.filter((line) => line.next_commit == commit.hashes.commit);
- let merge = {
- src: [],
- dest: undefined
- };
- if (children.length === 0) {
- // add new line
- let line = {
- next_commit: parent_commits[0],
- x_offset: this.max_line_off_x() + this.options.x_offset,
- current_commit: commit.hashes.commit,
- beginning: true,
- y_offset: y_offset,
- color: this.gen_color(this.lines_data.length),
- };
- this.lines_data.push(line);
- merge.dest = line;
- }
- else {
- let min_offset_x = Math.min.apply(Math, children.map((o) => o.x_offset));
- let line = undefined;
- for (let el of children) {
- if (el.x_offset == min_offset_x) {
- line = el;
- line.next_commit = parent_commits[0];
- line.current_commit = commit.hashes.commit;
- line.y_offset = y_offset;
- }
- else {
- this.lines_data.splice(this.lines_data.indexOf(el), 1);
- merge.src.push(el);
- }
- }
- merge.dest = line;
- }
- if (parent_commits.length === 2) {
- let line = undefined;
- line = this.lines_data.filter(l => l.next_commit == parent_commits[1])[0];
- if (!line) {
- // add new line
- line = {
- next_commit: parent_commits[1],
- x_offset: this.max_line_off_x() + this.options.x_offset,
- current_commit: commit.hashes.commit,
- beginning: true,
- y_offset: y_offset + this.options.y_offset,
- color: this.gen_color(this.lines_data.length),
- };
- this.lines_data.push(line);
- }
- else {
- line.y_offset = y_offset + this.options.y_offset;
- }
- merge.src.push(line);
- }
- return merge;
- }
- draw_line(_x1, _y1, _x2, _y2, color, stroke) {
- let line_opt = {
- stroke: color,
- fill: 'none',
- "stroke-width": 1.5
- };
- if (stroke) {
- line_opt['stroke-width'] = stroke;
- }
- if (_x1 == _x2) {
- line_opt.d = `M ${_x1},${_y1} L ${_x2},${_y2}`;
- }
- else {
- let x1 = _x1;
- let y1 = _y1;
- let x2 = _x2;
- let y2 = _y2;
- let dx = Math.abs(x2 - x1);
- let dy = Math.abs(y2 - y1);
- if (_y1 < _y2) {
- x1 = _x2;
- y1 = _y2;
- x2 = _x1;
- y2 = _y1;
- }
- line_opt.d = `M ${x1},${y1} C ${x1},${y1 - dy} ${x2},${y2 + dy} ${x2},${y2}`;
- }
- const line = this.make_svg_el("path", line_opt);
- return line;
- }
- gen_commit_data_header(name, value) {
- const p = $("")
- .css("display", "block");
- p[0].innerHTML = `${name.__()}: ${value}`;
- return p[0];
- }
- open_popup(commit) {
- const el = commit.domel;
- if (!el)
- return;
- $(this.commit_detail_el).empty();
- const position = $(el).position();
- const bbox = this.svg_element.getBBox();
- const off_left = bbox.x + bbox.width + this.options.x_offset / 2;
- const svg = this.make_svg_el("svg", {
- width: off_left - commit.cx + 5,
- height: this.options.y_offset
- });
- $(svg)
- .css("display", "block")
- .css("position", "absolute")
- .css("left", "0")
- .css("top", "-2px");
- svg.appendChild(this.draw_line(0, this.options.y_offset / 2, off_left - commit.cx, this.options.y_offset / 2, commit.color));
- /*
- svg.appendChild(
- this.make_svg_el("circle",{
- cx: off_left-commit.cx - 1,
- cy: this.options.y_offset/2,
- r:4,
- fill: commit.color,
- "stroke-width": 0.0
- })
- );*/
- $(this.commit_detail_el)
- .css("border", "2px solid " + commit.color)
- .css("color", commit.color)
- .append($("")
- .css("position", "absolute")
- .css("height", this.options.y_offset)
- .css("left", commit.cx - off_left)
- .css("padding-left", off_left - commit.cx)
- .append(svg)
- .append($("").text('[X]')
- .css("cursor", "pointer"))
- .addClass("git_grapth_commit_detail_ctrl")
- .on("click", (e) => {
- $(this.commit_detail_el)
- .css("display", "none")
- .empty();
- }));
- const left = $("")
- .css("display", "block")
- .css("overflow-y", "auto")
- .css("overflow-x", "hidden")
- .css("flex", "1")
- .css("border-right", "1px solid " + commit.color)
- .addClass("git_grapth_commit_detail_left");
- const right = $("")
- .css("display", "block")
- .css("overflow-y", "auto")
- .css("overflow-x", "hidden")
- .css("flex", "1")
- .addClass("git_grapth_commit_detail_right");
- // display
- left.append(this.gen_commit_data_header(__("Commit"), commit.hashes.commit));
- left.append(this.gen_commit_data_header(__("Parents"), commit.hashes.parents));
- left.append(this.gen_commit_data_header(__("Author"), `${commit.committer.name} <${commit.committer.email}>`));
- left.append(this.gen_commit_data_header(__("Date"), (new Date(commit.committer.date).toDateString())));
- left.append($("")
- .css("white-space", "pre-wrap")
- .text(commit.message));
- this.commit_detail_el.appendChild(left[0]);
- this.commit_detail_el.appendChild(right[0]);
- this.list_file(commit.hashes.commit)
- .then((files) => {
- const ul = $('');
- $.each(files, (index, value) => {
- const arr = value.split("\t");
- const li = $('');
- const a = $('')
- .css("cursor", "pointer")
- .addClass(`git_graph_file_${arr[0].toLowerCase()}`)
- .on("click", e => {
- if (this._on_open_diff) {
- Promise.all([
- this.get_file(arr[1], `${commit.hashes.commit}^`),
- this.get_file(arr[1], commit.hashes.commit)
- ])
- .then((values) => {
- // create the file
- const files = values.map((content, index) => {
- const file = `mem://${commit.hashes.commit.slice(0, 8)}${index == 0 ? "^" : ""}/${arr[1]}`.asFileHandle();
- file.cache = content;
- file.info.mime = "text/plain";
- return file;
- });
- this._on_open_diff(files);
- })
- .catch((e) => {
- OS.announcer.oserror(__("Unable to fetch diff of {0}: {1}", commit.hashes.commit, e.toString()), e);
- });
- }
- });
- a.text(arr[1]);
- ul.append(li.append(a));
- });
- right.append(ul);
- })
- .catch((e) => OS.announcer.oserror(__("Unable to get commit changes: {0}", e.toString()), e));
- // scroll down if necessary
- $(this.commit_detail_el)
- .css("top", position.top)
- .css("left", off_left)
- .css("display", "flex")
- .css("width", `calc(100% - ${off_left + this.options.x_offset}px)`)
- .css("fflex-direction", "row");
- const delta = this.commit_detail_el.getBoundingClientRect().bottom -
- this.options.target.getBoundingClientRect().bottom;
- if (delta > 0) {
- this.options.target.scrollTop += delta + 10;
- }
- }
- render_commit(commit, color) {
- let current = false;
- const p = $("")
- .css("padding", "0")
- .css("margin", "0")
- .css("display", "block")
- .css("height", `${this.options.y_offset}px`)
- .css("line-height", `${this.options.y_offset}px`)
- .css("color", color)
- .css("vertical-align", "middle")
- .css("white-space", "nowrap")
- .css("overflow", "hidden");
- p.addClass("git_graph_commit_message");
- let html = `${commit.hashes.commit.slice(0, 8)} `;
- commit.branches = [];
- for (const tag of commit.extra.split(",").map(e => e.trim()).filter(e => e != "")) {
- let found = tag.match(/HEAD -> (.*)/i);
- if (found && found.length == 2) {
- html += `${found[1]} `;
- p.addClass("git_graph_commit_current_head");
- current = true;
- commit.branches.push(found[1]);
- this.current_head = commit;
- }
- else if ((found = tag.match(/tag: (.*)/i))) {
- html += `${found[1]} `;
- }
- else {
- html += `${tag} `;
- commit.branches.push(tag);
- }
- }
- html += `${commit.message.split("\n")[0]} `;
- html += `${commit.committer.name} `;
- html += `${new Date(commit.committer.date).toDateString()}`;
- p[0].innerHTML = html;
- p.on("click", (e) => {
- this.open_popup(commit);
- });
- this.commits_list_element.insertBefore(p[0], this.load_more_el);
- commit.domel = p[0];
- return current;
- }
- draw_graph(data) {
- for (const commit of data) {
- this.oldest_commit_date = commit.committer.date;
- if (commit.extra.includes("refs/stash")) {
- continue;
- }
- this.commits[commit.hashes.commit] = commit;
- let merge = this.update_line_data(commit, this.current_y_offset);
- let lines = merge.src;
- // combine the lines
- for (const linedata of lines.filter(o => o.x_offset != merge.dest.x_offset)) {
- this.svg_element.appendChild(this.draw_line(merge.dest.x_offset, merge.dest.y_offset, linedata.x_offset, linedata.y_offset, linedata.color));
- }
- this.lines_data.sort((a, b) => a.x_offset - b.x_offset);
- let x_offset = this.options.x_offset;
- for (const linedata of this.lines_data) {
- if (linedata.beginning && linedata.y_offset > this.current_y_offset) {
- continue;
- }
- linedata.y_offset = this.current_y_offset;
- if (!linedata.beginning) {
- if (linedata.x_offset > x_offset) {
- this.svg_element.appendChild(this.draw_line(linedata.x_offset, linedata.y_offset - this.options.y_offset, linedata.x_offset - this.options.x_offset, linedata.y_offset, linedata.color));
- linedata.x_offset = x_offset;
- }
- else {
- this.svg_element.appendChild(this.draw_line(linedata.x_offset, linedata.y_offset - this.options.y_offset, linedata.x_offset, linedata.y_offset, linedata.color));
- }
- }
- x_offset += this.options.x_offset;
- linedata.beginning = false;
- }
- let options = {
- cx: merge.dest.x_offset,
- cy: merge.dest.y_offset,
- r: 4,
- fill: merge.dest.color,
- stroke: 'black',
- "stroke-width": 0.0
- };
- if (this.render_commit(commit, merge.dest.color)) {
- options.r = options.r * 1.5;
- }
- commit.cx = options.cx;
- commit.color = options.fill;
- const circle = this.make_svg_el("circle", options);
- this.svg_element.appendChild(circle);
- this.current_y_offset += this.options.y_offset;
- }
- const bbox = this.svg_element.getBBox();
- this.svg_element.setAttribute("width", (bbox.x + bbox.width).toString());
- this.svg_element.setAttribute("height", (bbox.y + bbox.height + this.options.y_offset / 2).toString());
- //$(this.commits_list_element).css("left", `-${bbox.x + bbox.width}px`);
- $(".git_graph_commit_message", this.commits_list_element).css("padding-left", `${bbox.x + bbox.width + this.options.x_offset / 2}px`);
- }
- list_file(hash) {
- let request = {
- action: 'list_file',
- args: {
- commit: hash
- }
- };
- return this.call(request);
- }
- get_changes(file, hash) {
- let request = {
- action: 'get_changes',
- args: {
- commit: hash,
- file: file
- }
- };
- return this.call(request);
- }
- get_file(file, hash) {
- let request = {
- action: 'get_file',
- args: {
- commit: hash,
- file: file
- }
- };
- return this.call(request);
- }
- }
- API.LibGitGraph = LibGitGraph;
- })(API = OS.API || (OS.API = {}));
-})(OS || (OS = {}));
+var OS;!function(t){let i,e;i=t.API||(t.API={}),function(t){class e extends t.BaseApplication{constructor(t){super("GitGraph",t)}main(){const t=new i.LibGitGraph({target:this.find("git-graph")});t.on_open_diff=t=>{this._gui.launch("Antedit",[]).then(i=>{i.observable.one("launched",()=>i.openDiff(t))}).catch(t=>this.error(__("Unable to open diff with Antedit: {0}",t.toString()),t))},this.find("btn-open").onbtclick=i=>{this.openDialog("FileDialog",{title:__("Select a repository"),type:"dir"}).then(i=>{this.find("txt-repo").text=i.file.path,t.base_dir=i.file})}}}t.GitGraph=e,e.dependencies=["pkg://GitGraph/libgitgraph.js"]}(e=t.application||(t.application={}))}(OS||(OS={}));
\ No newline at end of file
diff --git a/GitGrapth/build/debug/package.json b/GitGrapth/build/debug/package.json
index 9be563a..cb74751 100644
--- a/GitGrapth/build/debug/package.json
+++ b/GitGrapth/build/debug/package.json
@@ -4,13 +4,13 @@
"name":"GIT Visualization",
"description":"Git Grapth",
"info":{
- "author": "",
- "email": ""
+ "author": "Dany LE",
+ "email": "contact@iohub.dev"
},
"version":"0.0.1-a",
- "category":"Other",
- "iconclass":"fa fa-adn",
- "mimes":["none"],
+ "category":"Development",
+ "iconclass":"bi bi-git",
+ "mimes":["dir"],
"dependencies":[],
"locale": {}
}
\ No newline at end of file
diff --git a/GitGrapth/build/debug/scheme.html b/GitGrapth/build/debug/scheme.html
index 441a698..a81aee3 100644
--- a/GitGrapth/build/debug/scheme.html
+++ b/GitGrapth/build/debug/scheme.html
@@ -1,8 +1,12 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GitGrapth/build/release/GitGraph.zip b/GitGrapth/build/release/GitGraph.zip
new file mode 100644
index 0000000..47d157e
Binary files /dev/null and b/GitGrapth/build/release/GitGraph.zip differ
diff --git a/GitGrapth/main.css b/GitGrapth/main.css
index 268876d..b3586fd 100644
--- a/GitGrapth/main.css
+++ b/GitGrapth/main.css
@@ -4,6 +4,13 @@ afx-app-window[data-id="GitGraph"] div[data-id="git-graph"]
background-color: bisque;
}
+afx-app-window[data-id="GitGraph"] afx-label[data-id="txt-repo"] i.label-text
+{
+ display: block;
+ text-align: center;
+ font-weight: bold;
+}
+
p.git_graph_commit_message:hover
{
background-color:rgba(39, 39, 39,0.5);
diff --git a/GitGrapth/main.ts b/GitGrapth/main.ts
index 5a850b2..55c9af6 100644
--- a/GitGrapth/main.ts
+++ b/GitGrapth/main.ts
@@ -22,23 +22,31 @@ namespace OS {
super("GitGraph", args);
}
main(): void {
- let graph = new API.LibGitGraph({
+ const graph = new API.LibGitGraph({
target: this.find("git-graph")
});
- graph.on_open_diff = (files) => {
- console.log(files);
- //(OS.PM.processes.Antedit[0] as any).openDiff(files)
-
+ graph.on_open_diff = (files) => {
this._gui.launch("Antedit", [])
.then((p) =>{
p.observable.one("launched",() =>(p as any).openDiff(files));
- });
+ })
+ .catch(e => this.error(__("Unable to open diff with Antedit: {0}", e.toString()),e ));
}
- graph.base_dir = "home://workspace/antos/".asFileHandle();
+ (this.find("btn-open") as GUI.tag.ButtonTag).onbtclick = (e) => {
+ this.openDialog("FileDialog", {
+ title: __("Select a repository"),
+ type: "dir",
+
+ }).then((d) => {
+ (this.find("txt-repo") as GUI.tag.LabelTag).text = d.file.path;
+ graph.base_dir = d.file;
+ });
+ };
+
}
}
- //GitGraph.dependencies = ["pkg://GitGraph/libgitgraph.js"];
+ GitGraph.dependencies = ["pkg://GitGraph/libgitgraph.js"];
}
}
\ No newline at end of file
diff --git a/GitGrapth/package.json b/GitGrapth/package.json
index 9be563a..cb74751 100644
--- a/GitGrapth/package.json
+++ b/GitGrapth/package.json
@@ -4,13 +4,13 @@
"name":"GIT Visualization",
"description":"Git Grapth",
"info":{
- "author": "",
- "email": ""
+ "author": "Dany LE",
+ "email": "contact@iohub.dev"
},
"version":"0.0.1-a",
- "category":"Other",
- "iconclass":"fa fa-adn",
- "mimes":["none"],
+ "category":"Development",
+ "iconclass":"bi bi-git",
+ "mimes":["dir"],
"dependencies":[],
"locale": {}
}
\ No newline at end of file
diff --git a/GitGrapth/scheme.html b/GitGrapth/scheme.html
index 441a698..a81aee3 100644
--- a/GitGrapth/scheme.html
+++ b/GitGrapth/scheme.html
@@ -1,8 +1,12 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/libantosdk/README.md b/libantosdk/README.md
index 04457c7..dacd21a 100644
--- a/libantosdk/README.md
+++ b/libantosdk/README.md
@@ -2,6 +2,7 @@
AntOSDK: development API for AntOS based applications/projects
## Change logs
+- 0.0.14: vfs-rm can be configured to be silent when the target does not exist
- 0.0.13: allow linux-job handle to set defaut pwd if it is not specified in job description
- 0.0.12: TS worker now allows user specific compile options (defined un build file)
- 0.0.11: Update AntOS API v1.2.1
diff --git a/libantosdk/build/debug/README.md b/libantosdk/build/debug/README.md
index 04457c7..dacd21a 100644
--- a/libantosdk/build/debug/README.md
+++ b/libantosdk/build/debug/README.md
@@ -2,6 +2,7 @@
AntOSDK: development API for AntOS based applications/projects
## Change logs
+- 0.0.14: vfs-rm can be configured to be silent when the target does not exist
- 0.0.13: allow linux-job handle to set defaut pwd if it is not specified in job description
- 0.0.12: TS worker now allows user specific compile options (defined un build file)
- 0.0.11: Update AntOS API v1.2.1
diff --git a/libantosdk/build/debug/core/worker.js b/libantosdk/build/debug/core/worker.js
index 6e61252..c1a5820 100644
--- a/libantosdk/build/debug/core/worker.js
+++ b/libantosdk/build/debug/core/worker.js
@@ -446,7 +446,13 @@ class VFSJob extends AntOSDKBaseJob {
case 'rm':
this.delete(this.job.data)
.then(d => this.result(d))
- .catch(e => this.error(e));
+ .catch((e) => {
+ if(this.job.ignore_error)
+ {
+ return this.result(false);
+ }
+ this.error(e);
+ });
break;
case 'mkdir':
this.mkdir(this.job.data)
diff --git a/libantosdk/build/debug/package.json b/libantosdk/build/debug/package.json
index 4453376..6d40a6f 100644
--- a/libantosdk/build/debug/package.json
+++ b/libantosdk/build/debug/package.json
@@ -7,7 +7,7 @@
"author": "Xuan Sang LE",
"email": "mrsang@iohub.dev"
},
- "version": "0.0.13-a",
+ "version": "0.0.14-a",
"category": "Development",
"iconclass": "fa fa-cog",
"mimes": [
diff --git a/libantosdk/build/release/libantosdk.zip b/libantosdk/build/release/libantosdk.zip
index 664ea9b..fdc1dd9 100644
Binary files a/libantosdk/build/release/libantosdk.zip and b/libantosdk/build/release/libantosdk.zip differ
diff --git a/libantosdk/core/worker.js b/libantosdk/core/worker.js
index 6e61252..c1a5820 100644
--- a/libantosdk/core/worker.js
+++ b/libantosdk/core/worker.js
@@ -446,7 +446,13 @@ class VFSJob extends AntOSDKBaseJob {
case 'rm':
this.delete(this.job.data)
.then(d => this.result(d))
- .catch(e => this.error(e));
+ .catch((e) => {
+ if(this.job.ignore_error)
+ {
+ return this.result(false);
+ }
+ this.error(e);
+ });
break;
case 'mkdir':
this.mkdir(this.job.data)
diff --git a/libantosdk/package.json b/libantosdk/package.json
index 4453376..6d40a6f 100644
--- a/libantosdk/package.json
+++ b/libantosdk/package.json
@@ -7,7 +7,7 @@
"author": "Xuan Sang LE",
"email": "mrsang@iohub.dev"
},
- "version": "0.0.13-a",
+ "version": "0.0.14-a",
"category": "Development",
"iconclass": "fa fa-cog",
"mimes": [
diff --git a/packages.json b/packages.json
index 198e0bc..09d5bf3 100644
--- a/packages.json
+++ b/packages.json
@@ -69,16 +69,6 @@
"dependencies": ["Antunnel@0.2.0-b"],
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/AntunnelPlugins/build/release/AntunnelPlugins.zip"
},
- {
- "pkgname": "AntunnelTestClient",
- "name": "AntunnelTestClient",
- "description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/AntunnelTestClient/README.md",
- "category": "Development",
- "author": "Dany LE",
- "version": "0.1.0-a",
- "dependencies": ["Antunnel@0.2.1-b"],
- "download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/AntunnelTestClient/build/release/AntunnelTestClient.zip"
- },
{
"pkgname": "Archive",
"name": "Archive",
@@ -215,7 +205,7 @@
"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/libantosdk/README.md",
"category": "Development",
"author": "Xuan Sang LE",
- "version": "0.0.13-a",
+ "version": "0.0.14-a",
"dependencies": [],
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/libantosdk/build/release/libantosdk.zip"
},