GPClient: minor fix on dialog
All checks were successful
gitea-sync/antosdk-apps/pipeline/head This commit looks good

This commit is contained in:
DanyLE 2023-07-18 19:16:14 +02:00
parent 675f245b3f
commit d9726d6041
6 changed files with 11 additions and 7 deletions

View File

@ -3,6 +3,10 @@
"targets": {
"init": {
"jobs": [
{
"name": "vfs-rm_no_error",
"data": ["build/debug","build/release"]
},
{
"name": "vfs-mkdir",
"data": [

View File

@ -1 +1 @@
(function(){var t,e,i;(t=class t extends this.OS.GUI.BasicDialog{constructor(){super("ClientDialog",t.scheme)}main(){var t,e,i,n;if(super.main(),i=$(this.scheme).find("input[type=text]"),this.data)for(e=0,n=i.length;e<n;e++)t=i[e],this.data[t.name]&&(t.value=this.data[t.name]);return this.find("btncancel").onbtclick=()=>this.quit(),this.find("btnok").onbtclick=e=>{var n,a,s;for(n={},a=0,s=i.length;a<s;a++){if(""===(t=i[a]).value)return this.notify(__("Please enter all the fields"));n[t.name]=t.value}return this.handle&&this.handle(n),this.quit()}}}).scheme='<afx-app-window width=\'400\' height=\'300\'>\n <afx-vbox padding="5">\n <afx-label data-height="25" text = "__(Client name)"></afx-label>\n <input type="text" name="text" data-height="30" ></input>\n <div data-height="5"></div>\n <afx-label data-height="25" text = "__(URL)"></afx-label>\n <input type="text" name="url" data-height="30" ></input>\n <div></div>\n <div data-height="35" style="text-align: right;">\n <afx-button data-id="btnok" text="__(Ok)"></afx-button>\n <afx-button data-id="btncancel" text="__(Cancel)"></afx-button>\n </div>\n </afx-vbox>\n</afx-app-window>',(e=class e extends this.OS.GUI.BasicDialog{constructor(){super("ClientListDialog",e.scheme)}refresh_list(){return this.clist.data=this.parent.setting.clients.map(t=>({text:t.text,url:t.url}))}main(){return super.main(),this.clist=this.find("client-list"),this.clist.buttons=[{text:"",iconclass:"fa fa-plus-circle",onbtclick:e=>this.openDialog(new t,{title:__("Add new client")}).then(t=>(console.log(t),this.parent.setting.clients.push(t),this.clist.data=this.parent.setting.clients.map(t=>({text:t.text,url:t.url}))))},{text:"",iconclass:"fa fa-minus-circle",onbtclick:t=>{var e,i;if(i=this.clist.selectedItem,e=this.clist.selected,i)return this.ask({text:__("Do you realy want to delete: `{0}`",i.data.text)}).then(t=>{if(t)return this.parent.setting.clients.splice(e,1),this.refresh_list()})}},{text:"",iconclass:"fa fa-pencil-square-o",onbtclick:e=>{var i;if(i=this.clist.selectedItem)return this.openDialog(new t,{title:__("Add new client"),text:i.data.text,url:i.data.url}).then(t=>{if(t)return i.data.text=t.text,i.data.url=t.url,this.refresh_list()})}}],this.find("btnswitch").onbtclick=t=>{var e;if(e=this.clist.selectedItem)return this.parent.setting.curl=e.data.url,this.parent.setting.cname=e.data.text,this.parent.switchClient(),this.quit()},this.refresh_list()}}).scheme='<afx-app-window width=\'400\' height=\'300\'>\n <afx-vbox padding="5">\n <afx-list-view data-id="client-list"></afx-list-view>\n <div data-height="35" style="text-align: right;">\n <afx-button text="__(Switch client)" data-id="btnswitch"></afx-button>\n <div>\n </afx-vbox>\n</afx-app-window>',(i=class extends this.OS.application.BaseApplication{constructor(t){super("GPClient",t)}main(){return this.setting.clients||(this.setting.clients=[]),this.container=this.find("container"),this.bindKey("CTRL-M",()=>this.openDialog(new e,{title:__("Client Manager")})),this.switchClient()}switchClient(){return this.setting.curl?(this.container.src=this.setting.curl,this.scheme.apptitle=this.setting.cname):this.notify(__("No client selected, manager client in menu Options > Client manager"))}menu(){return[{text:"__(Options)",nodes:[{text:"__(Client manager)",shortcut:"C-M"}],onchildselect:t=>this.openDialog(new e,{title:__("Client Manager")})}]}}).singleton=!0,this.OS.register("GPClient",i)}).call(this);
(function(){var t,e,i;(t=class t extends this.OS.GUI.BasicDialog{constructor(){super("ClientDialog",t.scheme)}main(){var t,e,i,n;if(super.main(),e=$(this.scheme).find("input[type=text]"),this.data)for(i=0,n=e.length;i<n;i++)t=e[i],this.data[t.name]&&(t.value=this.data[t.name]);return this.find("btncancel").onbtclick=()=>this.quit(),this.find("btnok").onbtclick=i=>{var n,s,a;for(n={},s=0,a=e.length;s<a;s++){if(""===(t=e[s]).value)return this.notify(__("Please enter all the fields"));n[t.name]=t.value}return this.handle&&this.handle(n),this.quit()}}}).scheme='<afx-app-window width=\'400\' height=\'300\'>\n <afx-vbox padding="5">\n <afx-label data-height="25" text = "__(Client name)"></afx-label>\n <input type="text" name="text" data-height="30" ></input>\n <div data-height="5"></div>\n <afx-label data-height="25" text = "__(URL)"></afx-label>\n <input type="text" name="url" data-height="30" ></input>\n <div></div>\n <div data-height="35" style="text-align: right;">\n <afx-button data-id="btnok" text="__(Ok)"></afx-button>\n <afx-button data-id="btncancel" text="__(Cancel)"></afx-button>\n </div>\n </afx-vbox>\n</afx-app-window>',(e=class e extends this.OS.GUI.BasicDialog{constructor(){super("ClientListDialog",e.scheme)}refresh_list(){return this.clist.data=this.parent.setting.clients.map(t=>({text:t.text,url:t.url}))}main(){return super.main(),this.clist=this.find("client-list"),this.clist.buttons=[{text:"",iconclass:"fa fa-plus-circle",onbtclick:e=>this.openDialog(new t,{title:__("Add new client")}).then(t=>(console.log(t),this.parent.setting.clients.push(t),this.clist.data=this.parent.setting.clients.map((t,e)=>({text:t.text,url:t.url}))))},{text:"",iconclass:"fa fa-minus-circle",onbtclick:t=>{var e,i;if(i=this.clist.selectedItem,e=this.clist.selected,i)return this.ask({text:__("Do you realy want to delete: `{0}`",i.data.text)}).then(t=>{if(t)return this.parent.setting.clients.splice(e,1),this.refresh_list()})}},{text:"",iconclass:"fa fa-pencil-square-o",onbtclick:e=>{var i,n;if(n=this.clist.selectedItem,i=this.clist.selected,n)return this.openDialog(new t,{title:__("Edit client"),text:n.data.text,url:n.data.url}).then(t=>{if(t)return this.parent.setting.clients[i].text=t.text,this.parent.setting.clients[i].url=t.url,this.refresh_list()})}}],this.find("btnswitch").onbtclick=t=>{var e;if(e=this.clist.selectedItem)return this.parent.setting.curl=e.data.url,this.parent.setting.cname=e.data.text,this.parent.switchClient(),this.quit()},this.refresh_list()}}).scheme='<afx-app-window width=\'400\' height=\'300\'>\n <afx-vbox padding="5">\n <afx-list-view data-id="client-list"></afx-list-view>\n <div data-height="35" style="text-align: right;">\n <afx-button text="__(Switch client)" data-id="btnswitch"></afx-button>\n <div>\n </afx-vbox>\n</afx-app-window>',(i=class extends this.OS.application.BaseApplication{constructor(t){super("GPClient",t)}main(){return this.setting.clients||(this.setting.clients=[]),this.container=this.find("container"),this.bindKey("CTRL-M",()=>this.openDialog(new e,{title:__("Client Manager")})),this.switchClient()}switchClient(){return this.setting.curl?(this.container.src=this.setting.curl,this.scheme.apptitle=this.setting.cname):this.notify(__("No client selected, manager client in menu Options > Client manager"))}menu(){return[{text:"__(Options)",nodes:[{text:"__(Client manager)",shortcut:"C-M"}],onchildselect:t=>this.openDialog(new e,{title:__("Client Manager")})}]}}).singleton=!0,this.OS.register("GPClient",i)}).call(this);

Binary file not shown.

View File

@ -65,7 +65,7 @@ class ClientListDialog extends this.OS.GUI.BasicDialog
.then (data) =>
console.log(data)
@parent.setting.clients.push(data)
@clist.data = @parent.setting.clients.map (e) =>
@clist.data = @parent.setting.clients.map (e,i) =>
{
text: e.text,
url: e.url
@ -90,17 +90,17 @@ class ClientListDialog extends this.OS.GUI.BasicDialog
iconclass: "fa fa-pencil-square-o",
onbtclick: (e) =>
item = @clist.selectedItem
index = @clist.selected
return unless item
@openDialog(new ClientDialog(), {
title: __("Add new client"),
title: __("Edit client"),
text: item.data.text,
url: item.data.url
})
.then (data) =>
#console.log(data)
return unless data
item.data.text = data.text
item.data.url = data.url
@parent.setting.clients[index].text = data.text
@parent.setting.clients[index].url = data.url
@refresh_list()
}
]

Binary file not shown.

File diff suppressed because one or more lines are too long