GitGraph: support open git repo with openwith dialog

This commit is contained in:
lxsang
2022-07-05 22:45:28 +02:00
parent eb7162b901
commit cb76136de3
18 changed files with 28 additions and 414 deletions

View File

@ -107,7 +107,7 @@ namespace OS {
}
private gen_color(x:number): string
{
let n = x + 11;
let n = x + 10;
const rgb = [0, 0, 0];
for (let i = 0; i < 24; i++) {
rgb[i%3] <<= 1;

View File

@ -14,6 +14,7 @@ graph.base_dir = "home://workspace/repo-git";
```
## Change logs:
- v0.1.3-b: Support open Git repo with open with dialog
- v0.1.2-b: fix init bug
- v0.1.1-b: add class to container element
- v0.1.0-b: Initial version

View File

@ -14,6 +14,7 @@ graph.base_dir = "home://workspace/repo-git";
```
## Change logs:
- v0.1.3-b: Support open Git repo with open with dialog
- v0.1.2-b: fix init bug
- v0.1.1-b: add class to container element
- v0.1.0-b: Initial version

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
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={}));
var OS;!function(t){let i,e;i=t.API||(t.API={}),function(t){class e extends t.BaseApplication{constructor(t){super("GitGraph",t),t&&t[0]&&(this.curr_repo=t[0].path.asFileHandle(),"file"===t[0].type&&(this.curr_repo=this.curr_repo.parent()))}main(){this.graph=new i.LibGitGraph({target:this.find("git-graph")}),this.graph.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=t=>{this.openDialog("FileDialog",{title:__("Select a repository"),type:"dir"}).then(t=>{this.setRepo(t.file)})},this.setRepo(this.curr_repo)}setRepo(t){t&&(this.find("txt-repo").text=t.path,this.curr_repo=t,this.graph.base_dir=t)}}t.GitGraph=e,e.dependencies=["pkg://GitGraph/libgitgraph.js"]}(e=t.application||(t.application={}))}(OS||(OS={}));

View File

@ -7,7 +7,7 @@
"author": "Dany LE",
"email": "contact@iohub.dev"
},
"version":"0.1.2-a",
"version":"0.1.3-b",
"category":"Development",
"iconclass":"bi bi-git",
"mimes":["dir"],

Binary file not shown.

View File

@ -18,14 +18,22 @@ namespace OS {
* @extends {BaseApplication}
*/
export class GitGraph extends BaseApplication {
private graph: API.LibGitGraph;
private curr_repo: API.VFS.BaseFileHandle;
constructor(args: AppArgumentsType[]) {
super("GitGraph", args);
if(args && args[0])
{
this.curr_repo = args[0].path.asFileHandle();
if(args[0].type === "file")
this.curr_repo = this.curr_repo.parent();
}
}
main(): void {
const graph = new API.LibGitGraph({
this.graph = new API.LibGitGraph({
target: this.find("git-graph")
});
graph.on_open_diff = (files) => {
this.graph.on_open_diff = (files) => {
this._gui.launch("Antedit", [])
.then((p) =>{
p.observable.one("launched",() =>(p as any).openDiff(files));
@ -39,11 +47,18 @@ namespace OS {
type: "dir",
}).then((d) => {
(this.find("txt-repo") as GUI.tag.LabelTag).text = d.file.path;
graph.base_dir = d.file;
this.setRepo(d.file);
});
};
this.setRepo(this.curr_repo);
}
private setRepo(d:API.VFS.BaseFileHandle): void
{
if(!d) return;
(this.find("txt-repo") as GUI.tag.LabelTag).text = d.path;
this.curr_repo = d;
this.graph.base_dir = d;
}
}

View File

@ -7,7 +7,7 @@
"author": "Dany LE",
"email": "contact@iohub.dev"
},
"version":"0.1.2-a",
"version":"0.1.3-b",
"category":"Development",
"iconclass":"bi bi-git",
"mimes":["dir"],