mirror of
https://github.com/antos-rde/antosdk-apps.git
synced 2024-12-25 03:38:21 +01:00
rename IOClient to GPClient
This commit is contained in:
parent
de8c3fccc9
commit
2462e97e81
5
GPClient/assets/scheme.html
Normal file
5
GPClient/assets/scheme.html
Normal file
@ -0,0 +1,5 @@
|
||||
<afx-app-window apptitle="__(Unknow client)" width="700" height="500" data-id="GPClient">
|
||||
<afx-hbox >
|
||||
<iframe frameborder="0" data-id="container" src=""></iframe>
|
||||
</afx-hbox>
|
||||
</afx-app-window>
|
214
GPClient/build/debug/main.js
Normal file
214
GPClient/build/debug/main.js
Normal file
@ -0,0 +1,214 @@
|
||||
(function() {
|
||||
var ClientDialog, ClientListDialog, GPClient;
|
||||
|
||||
ClientDialog = class ClientDialog extends this.OS.GUI.BasicDialog {
|
||||
constructor() {
|
||||
super("ClientDialog", ClientDialog.scheme);
|
||||
}
|
||||
|
||||
main() {
|
||||
var el, i, inputs, len;
|
||||
super.main();
|
||||
inputs = $(this.scheme).find("input[type=text]");
|
||||
if (this.data) {
|
||||
for (i = 0, len = inputs.length; i < len; i++) {
|
||||
el = inputs[i];
|
||||
if (this.data[el.name]) {
|
||||
el.value = this.data[el.name];
|
||||
}
|
||||
}
|
||||
}
|
||||
this.find("btncancel").onbtclick = () => {
|
||||
return this.quit();
|
||||
};
|
||||
return this.find("btnok").onbtclick = (e) => {
|
||||
var data, j, len1;
|
||||
data = {};
|
||||
for (j = 0, len1 = inputs.length; j < len1; j++) {
|
||||
el = inputs[j];
|
||||
if (el.value === "") {
|
||||
return this.notify(__("Please enter all the fields"));
|
||||
}
|
||||
data[el.name] = el.value;
|
||||
}
|
||||
if (this.handle) {
|
||||
this.handle(data);
|
||||
}
|
||||
return this.quit();
|
||||
};
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
ClientDialog.scheme = `<afx-app-window width='300' height='160'>
|
||||
<afx-hbox>
|
||||
<div data-width="5"></div>
|
||||
<afx-vbox>
|
||||
<div data-height="5"></div>
|
||||
<afx-label data-height="25" text = "__(Client name)"></afx-label>
|
||||
<input type="text" name="text" data-height="25" />
|
||||
<div data-height="5"></div>
|
||||
<afx-label data-height="25" text = "__(URL)"></afx-label>
|
||||
<input type="text" name="url" data-height="25" />
|
||||
<div data-height="30" style="text-align: right;">
|
||||
<afx-button data-id="btnok" text="__(Ok)"></afx-button>
|
||||
<afx-button data-id="btncancel" text="__(Cancel)"></afx-button>
|
||||
</div>
|
||||
</afx-vbox>
|
||||
<div data-width="5"></div>
|
||||
</afx-hbox>
|
||||
</afx-app-window>`;
|
||||
|
||||
|
||||
ClientListDialog = class ClientListDialog extends this.OS.GUI.BasicDialog {
|
||||
constructor() {
|
||||
super("ClientListDialog", ClientListDialog.scheme);
|
||||
}
|
||||
|
||||
main() {
|
||||
super.main();
|
||||
this.clist = this.find("client-list");
|
||||
this.clist.buttons = [
|
||||
{
|
||||
text: "",
|
||||
iconclass: "fa fa-plus-circle",
|
||||
onbtclick: (e) => {
|
||||
return this.openDialog(new ClientDialog(),
|
||||
{
|
||||
title: __("Add new client")
|
||||
}).then((data) => {
|
||||
//console.log(data)
|
||||
this.parent.setting.clients.push(data);
|
||||
return this.clist.data = this.parent.setting.clients;
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
text: "",
|
||||
iconclass: "fa fa-minus-circle",
|
||||
onbtclick: (e) => {
|
||||
var index,
|
||||
item;
|
||||
item = this.clist.selectedItem;
|
||||
index = this.clist.selected;
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
return this.ask({
|
||||
text: __("Do you realy want to delete: `{0}`",
|
||||
item.data.text)
|
||||
}).then((d) => {
|
||||
if (!d) {
|
||||
return;
|
||||
}
|
||||
this.parent.setting.clients.splice(index,
|
||||
1);
|
||||
return this.clist.data = this.parent.setting.clients;
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
text: "",
|
||||
iconclass: "fa fa-pencil-square-o",
|
||||
onbtclick: (e) => {
|
||||
var item;
|
||||
item = this.clist.selectedItem;
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
return this.openDialog(new ClientDialog(),
|
||||
{
|
||||
title: __("Add new client"),
|
||||
text: item.data.text,
|
||||
url: item.data.url
|
||||
}).then((data) => {
|
||||
//console.log(data)
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
item.data.text = data.text;
|
||||
item.data.url = data.url;
|
||||
return this.clist.data = this.parent.setting.clients;
|
||||
});
|
||||
}
|
||||
}
|
||||
];
|
||||
this.find("btnswitch").onbtclick = (e) => {
|
||||
var item;
|
||||
item = this.clist.selectedItem;
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
this.parent.setting.curl = item.data.url;
|
||||
this.parent.setting.cname = item.data.text;
|
||||
this.parent.switchClient();
|
||||
return this.quit();
|
||||
};
|
||||
return this.clist.data = this.parent.setting.clients;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
ClientListDialog.scheme = `<afx-app-window width='200' height='200'>
|
||||
<afx-vbox>
|
||||
<afx-list-view data-id="client-list"></afx-list-view>
|
||||
<div data-height="30" style="text-align: right;">
|
||||
<afx-button text="__(Switch client)" data-id="btnswitch"></afx-button>
|
||||
<div>
|
||||
</afx-vbox>
|
||||
</afx-app-window>`;
|
||||
|
||||
GPClient = class GPClient extends this.OS.application.BaseApplication {
|
||||
constructor(args) {
|
||||
super("GPClient", args);
|
||||
}
|
||||
|
||||
main() {
|
||||
if (!this.setting.clients) {
|
||||
this.setting.clients = [];
|
||||
}
|
||||
this.container = this.find("container");
|
||||
this.bindKey("CTRL-M", () => {
|
||||
return this.openDialog(new ClientListDialog(), {
|
||||
title: __("Client Manager")
|
||||
});
|
||||
});
|
||||
return this.switchClient();
|
||||
}
|
||||
|
||||
switchClient() {
|
||||
if (this.setting.curl) {
|
||||
this.container.src = this.setting.curl;
|
||||
return this.scheme.apptitle = this.setting.cname;
|
||||
} else {
|
||||
return this.notify(__("No client selected, manager client in menu Options > Client manager"));
|
||||
}
|
||||
}
|
||||
|
||||
menu() {
|
||||
return [
|
||||
{
|
||||
text: "__(Options)",
|
||||
nodes: [
|
||||
{
|
||||
text: "__(Client manager)",
|
||||
shortcut: "C-M"
|
||||
}
|
||||
],
|
||||
onchildselect: (e) => {
|
||||
return this.openDialog(new ClientListDialog(),
|
||||
{
|
||||
title: __("Client Manager")
|
||||
});
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
GPClient.singleton = true;
|
||||
|
||||
this.OS.register("GPClient", GPClient);
|
||||
|
||||
}).call(this);
|
16
GPClient/build/debug/package.json
Normal file
16
GPClient/build/debug/package.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"pkgname": "GPClient",
|
||||
"app":"GPClient",
|
||||
"name":"Generic Purpose client",
|
||||
"description":"Generic Purpose client",
|
||||
"info":{
|
||||
"author": "Xuan Sang LE",
|
||||
"email": "mrsang@iohub.dev"
|
||||
},
|
||||
"version":"0.1.0-a",
|
||||
"category":"Internet",
|
||||
"iconclass":"fa fa-globe",
|
||||
"mimes":["none"],
|
||||
"dependencies":[],
|
||||
"locale": {}
|
||||
}
|
5
GPClient/build/debug/scheme.html
Normal file
5
GPClient/build/debug/scheme.html
Normal file
@ -0,0 +1,5 @@
|
||||
<afx-app-window apptitle="__(Unknow client)" width="700" height="500" data-id="GPClient">
|
||||
<afx-hbox >
|
||||
<iframe frameborder="0" data-id="container" src=""></iframe>
|
||||
</afx-hbox>
|
||||
</afx-app-window>
|
155
GPClient/coffees/main.coffee
Normal file
155
GPClient/coffees/main.coffee
Normal file
@ -0,0 +1,155 @@
|
||||
class ClientDialog extends this.OS.GUI.BasicDialog
|
||||
constructor: () ->
|
||||
super "ClientDialog", ClientDialog.scheme
|
||||
|
||||
main: () ->
|
||||
super.main()
|
||||
|
||||
inputs = $(@scheme).find("input[type=text]")
|
||||
|
||||
if @data
|
||||
for el in inputs
|
||||
el.value = @data[el.name] if @data[el.name]
|
||||
|
||||
@find("btncancel").onbtclick = () => @quit()
|
||||
|
||||
@find("btnok").onbtclick = (e) =>
|
||||
data = {}
|
||||
for el in inputs
|
||||
return @notify __("Please enter all the fields") if el.value is ""
|
||||
data[el.name] = el.value
|
||||
|
||||
@handle data if @handle
|
||||
@quit()
|
||||
|
||||
ClientDialog.scheme = """
|
||||
<afx-app-window width='300' height='160'>
|
||||
<afx-hbox>
|
||||
<div data-width="5"></div>
|
||||
<afx-vbox>
|
||||
<div data-height="5"></div>
|
||||
<afx-label data-height="25" text = "__(Client name)"></afx-label>
|
||||
<input type="text" name="text" data-height="25" />
|
||||
<div data-height="5"></div>
|
||||
<afx-label data-height="25" text = "__(URL)"></afx-label>
|
||||
<input type="text" name="url" data-height="25" />
|
||||
<div data-height="30" style="text-align: right;">
|
||||
<afx-button data-id="btnok" text="__(Ok)"></afx-button>
|
||||
<afx-button data-id="btncancel" text="__(Cancel)"></afx-button>
|
||||
</div>
|
||||
</afx-vbox>
|
||||
<div data-width="5"></div>
|
||||
</afx-hbox>
|
||||
</afx-app-window>
|
||||
"""
|
||||
#
|
||||
|
||||
class ClientListDialog extends this.OS.GUI.BasicDialog
|
||||
constructor: () ->
|
||||
super "ClientListDialog", ClientListDialog.scheme
|
||||
|
||||
main: () ->
|
||||
super.main()
|
||||
@clist = @find("client-list")
|
||||
@clist.buttons = [
|
||||
{
|
||||
text: "",
|
||||
iconclass: "fa fa-plus-circle",
|
||||
onbtclick: (e) =>
|
||||
@openDialog(new ClientDialog(), {
|
||||
title: __("Add new client")
|
||||
})
|
||||
.then (data) =>
|
||||
#console.log(data)
|
||||
@parent.setting.clients.push(data)
|
||||
@clist.data = @parent.setting.clients
|
||||
|
||||
},
|
||||
{
|
||||
text: "",
|
||||
iconclass: "fa fa-minus-circle",
|
||||
onbtclick: (e) =>
|
||||
item = @clist.selectedItem
|
||||
index = @clist.selected
|
||||
return unless item
|
||||
@ask({ text:__("Do you realy want to delete: `{0}`", item.data.text)})
|
||||
.then (d) =>
|
||||
return unless d
|
||||
@parent.setting.clients.splice(index,1)
|
||||
@clist.data = @parent.setting.clients
|
||||
},
|
||||
{
|
||||
text: "",
|
||||
iconclass: "fa fa-pencil-square-o",
|
||||
onbtclick: (e) =>
|
||||
item = @clist.selectedItem
|
||||
return unless item
|
||||
@openDialog(new ClientDialog(), {
|
||||
title: __("Add new 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
|
||||
@clist.data = @parent.setting.clients
|
||||
}
|
||||
]
|
||||
@find("btnswitch").onbtclick = (e) =>
|
||||
item = @clist.selectedItem
|
||||
return unless item
|
||||
@parent.setting.curl = item.data.url
|
||||
@parent.setting.cname = item.data.text
|
||||
@parent.switchClient()
|
||||
@quit()
|
||||
@clist.data = @parent.setting.clients
|
||||
|
||||
ClientListDialog.scheme = """
|
||||
<afx-app-window width='200' height='200'>
|
||||
<afx-vbox>
|
||||
<afx-list-view data-id="client-list"></afx-list-view>
|
||||
<div data-height="30" style="text-align: right;">
|
||||
<afx-button text="__(Switch client)" data-id="btnswitch"></afx-button>
|
||||
<div>
|
||||
</afx-vbox>
|
||||
</afx-app-window>
|
||||
"""
|
||||
class GPClient extends this.OS.application.BaseApplication
|
||||
constructor: ( args ) ->
|
||||
super "GPClient", args
|
||||
|
||||
main: () ->
|
||||
@setting.clients = [] unless @setting.clients
|
||||
@container = @find("container")
|
||||
@bindKey "CTRL-M", () =>
|
||||
@openDialog new ClientListDialog(), {
|
||||
title: __("Client Manager")
|
||||
}
|
||||
@switchClient()
|
||||
|
||||
switchClient: () ->
|
||||
if @setting.curl
|
||||
@container.src = @setting.curl
|
||||
@scheme.apptitle = @setting.cname
|
||||
else
|
||||
@notify __("No client selected, manager client in menu Options > Client manager")
|
||||
|
||||
menu: () ->
|
||||
[
|
||||
{
|
||||
text: "__(Options)",
|
||||
nodes: [
|
||||
{ text: "__(Client manager)", shortcut: "C-M"}
|
||||
],
|
||||
onchildselect: (e) =>
|
||||
@openDialog new ClientListDialog(), {
|
||||
title: __("Client Manager")
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
GPClient.singleton = true
|
||||
|
||||
this.OS.register "GPClient", GPClient
|
16
GPClient/package.json
Normal file
16
GPClient/package.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"pkgname": "GPClient",
|
||||
"app":"GPClient",
|
||||
"name":"Generic Purpose client",
|
||||
"description":"Generic Purpose client",
|
||||
"info":{
|
||||
"author": "Xuan Sang LE",
|
||||
"email": "mrsang@iohub.dev"
|
||||
},
|
||||
"version":"0.1.0-a",
|
||||
"category":"Internet",
|
||||
"iconclass":"fa fa-globe",
|
||||
"mimes":["none"],
|
||||
"dependencies":[],
|
||||
"locale": {}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "IOMail",
|
||||
"name": "GPClient",
|
||||
"css": [],
|
||||
"javascripts": [],
|
||||
"coffees": ["coffees/main.coffee"],
|
@ -1,5 +0,0 @@
|
||||
<afx-app-window apptitle="__(IOHub mail client)" width="700" height="500" data-id="IOMail">
|
||||
<afx-hbox >
|
||||
<iframe src="https://mail.iohub.dev"></iframe>
|
||||
</afx-hbox>
|
||||
</afx-app-window>
|
@ -1 +0,0 @@
|
||||
(function(){var i;(i=class extends this.OS.application.BaseApplication{constructor(i){super("IOMail",i)}main(){}}).singleton=!0,this.OS.register("IOMail",i)}).call(this);
|
@ -1,16 +0,0 @@
|
||||
{
|
||||
"pkgname": "IOMail",
|
||||
"app":"IOMail",
|
||||
"name":"IOHub mail",
|
||||
"description":"IOHub mail",
|
||||
"info":{
|
||||
"author": "",
|
||||
"email": ""
|
||||
},
|
||||
"version":"0.1.0-a",
|
||||
"category":"Other",
|
||||
"iconclass":"fa fa-envelope",
|
||||
"mimes":["none"],
|
||||
"dependencies":[],
|
||||
"locale": {}
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<afx-app-window apptitle="__(IOHub mail client)" width="700" height="500" data-id="IOMail">
|
||||
<afx-hbox >
|
||||
<iframe src="https://mail.iohub.dev"></iframe>
|
||||
</afx-hbox>
|
||||
</afx-app-window>
|
@ -1,9 +0,0 @@
|
||||
class IOMail extends this.OS.application.BaseApplication
|
||||
constructor: ( args ) ->
|
||||
super "IOMail", args
|
||||
|
||||
main: () ->
|
||||
|
||||
IOMail.singleton = true
|
||||
|
||||
this.OS.register "IOMail", IOMail
|
@ -1,16 +0,0 @@
|
||||
{
|
||||
"pkgname": "IOMail",
|
||||
"app":"IOMail",
|
||||
"name":"IOHub mail",
|
||||
"description":"IOHub mail",
|
||||
"info":{
|
||||
"author": "",
|
||||
"email": ""
|
||||
},
|
||||
"version":"0.1.0-a",
|
||||
"category":"Other",
|
||||
"iconclass":"fa fa-envelope",
|
||||
"mimes":["none"],
|
||||
"dependencies":[],
|
||||
"locale": {}
|
||||
}
|
Loading…
Reference in New Issue
Block a user