mirror of
https://github.com/lxsang/antos-frontend.git
synced 2025-07-13 21:24:22 +02:00
Improvement antos API + bugs fixed
This commit is contained in:
@ -85,7 +85,11 @@ namespace OS {
|
||||
protected logger() {
|
||||
if(!this.app.setting.showBottomBar)
|
||||
{
|
||||
this.app.showBottomBar(true);
|
||||
this.app.showOutput(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.app.showOutput(false);
|
||||
}
|
||||
return this.app.logger;
|
||||
}
|
||||
|
@ -86,6 +86,31 @@ namespace OS {
|
||||
.catch((e) => this.logger().error(__("Unable to read meta-data: {0}", e.stack)));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @memberof ExtensionMaker
|
||||
*/
|
||||
installFromURL(): void
|
||||
{
|
||||
this.logger().clear();
|
||||
this.app
|
||||
.openDialog("PromptDialog", {
|
||||
title: __("Enter URI"),
|
||||
label: __("Please enter extension URI:")
|
||||
})
|
||||
.then(async (v) => {
|
||||
if(!v) return;
|
||||
try {
|
||||
await this.installZip(v);
|
||||
this.logger().info(__("Extension installed"));
|
||||
return this.app.loadExtensionMetaData();
|
||||
} catch (e) {
|
||||
return this.app.error(__("Unable to install extension: {0}", v));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
/**
|
||||
*
|
||||
*
|
||||
@ -295,6 +320,10 @@ namespace OS {
|
||||
if (this.app.extensions[meta.meta.name]) {
|
||||
this.app.extensions[meta.meta.name].text = meta.meta.text;
|
||||
this.app.extensions[meta.meta.name].nodes = [];
|
||||
if(this.app.extensions[meta.meta.name].ext && this.app.extensions[meta.meta.name].ext.cleanup)
|
||||
{
|
||||
this.app.extensions[meta.meta.name].ext.cleanup();
|
||||
}
|
||||
this.app.extensions[meta.meta.name].ext = new App.extensions[meta.meta.name](this.app);
|
||||
for (v of meta.meta.actions) {
|
||||
this.app.extensions[meta.meta.name].addAction(v);
|
||||
|
@ -40,8 +40,12 @@
|
||||
"name": "release"
|
||||
},
|
||||
{
|
||||
"text": "__(Install extension)",
|
||||
"text": "__(Install extension from file)",
|
||||
"name": "install"
|
||||
},
|
||||
{
|
||||
"text": "__(Install extension from URL)",
|
||||
"name": "installFromURL"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -448,6 +448,11 @@ namespace OS {
|
||||
this.trigger("resize");
|
||||
}
|
||||
|
||||
showOutput(toggle:boolean = false): void {
|
||||
if(toggle)
|
||||
this.showBottomBar(true);
|
||||
this.bottombar.selectedIndex = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply [[showBottomBar]] from user setting value
|
||||
@ -936,6 +941,14 @@ namespace OS {
|
||||
let v: GenericObject<any>;
|
||||
const dirties = this.eum.dirties();
|
||||
if (dirties.length === 0) {
|
||||
// cleanup all extension
|
||||
for(let k in this.extensions)
|
||||
{
|
||||
if(this.extensions[k].ext && this.extensions[k].ext.cleanup)
|
||||
{
|
||||
this.extensions[k].ext.cleanup();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
evt.preventDefault();
|
||||
|
@ -7,4 +7,7 @@ class App.extensions.{0} extends App.BaseExtension
|
||||
super app
|
||||
|
||||
test: () ->
|
||||
@notify "Test action is invoked"
|
||||
@notify "Test action is invoked"
|
||||
|
||||
cleanup: () ->
|
||||
# clean up the extension on application exit
|
Reference in New Issue
Block a user