diff --git a/src/frontend/widget/widget/a-nested.component.ts b/src/frontend/widget/widget/a-nested.component.ts deleted file mode 100644 index 4634db3..0000000 --- a/src/frontend/widget/widget/a-nested.component.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Component, OnInit } from '@angular/core'; - -@Component({ - selector: 'settings', - template: ` - !!! - ` -}) -export class ANestedComponent implements OnInit { - - constructor() { } - - ngOnInit() { } - -} \ No newline at end of file diff --git a/src/frontend/widget/widget/apiclient-consumptions.component.ts b/src/frontend/widget/widget/apiclient-consumptions.component.ts deleted file mode 100644 index 7d6068f..0000000 --- a/src/frontend/widget/widget/apiclient-consumptions.component.ts +++ /dev/null @@ -1,89 +0,0 @@ -import { Component, OnInit } from '@angular/core'; - - -declare const fb - -@Component({ - selector: 'consumptions', - template: ` -
-
- Consumptions -
- - - - {{entry.message}} - - - - -
- -
-
-
- - - - - - - - - - - - - - - - - -
UUIDExpiryCreation
{{line.uid}}{{line.expiry}}{{line.created}}
-
-
- -
- ` -}) -export class ApiclientConsumptionComponent implements OnInit { - loading:boolean = false - actionName:string = "load" - entries:any[] = [{ - uid: "1231", - message: "", - result: "Success" - }] - alerts: { - severity: "danger" | "warning" | "success" - message: string - }[] = [] - - constructor() { } - - ngOnInit() { } - - async load(){ - this.loading = true - this.entries = await fb.ApiClient.getConsumptions() - if(this.entries.length === 0){ - this.alerts.push({ severity: "warning", message: "0 results were returned"}) - } - this.loading = false - this.actionName = "refresh" - } - - async quit(uid:string){ - const r = await fb.ApiClient.quit(uid) - if(r.uid != null){ - this.alerts.push({ severity: "success", message: "Quit consuming "+uid}) - this.load() - }else{ - this.alerts.push({ severity: "danger", message: "Error "+r.message}) - } - } -} diff --git a/src/frontend/widget/widget/apiclient-settings-form.component.ts b/src/frontend/widget/widget/apiclient-settings-form.component.ts deleted file mode 100644 index 7b01a81..0000000 --- a/src/frontend/widget/widget/apiclient-settings-form.component.ts +++ /dev/null @@ -1,129 +0,0 @@ -import { Component, OnInit } from '@angular/core'; - -declare const fb - -@Component({ - selector: 'settings', - template: ` -
-
- Settings -
-
-
-
- - - We need your first name for legal compliance - - - - - - - We need your first name for legal compliance - - - - - - This field is required! - - - - - - - - - - - Valid range 1024 - 65536 - - - - -
-
-
- -
- ` -}) -export class ApiclientFormComponent implements OnInit { - testnet:boolean = true - saving:boolean = false - advanced:boolean = false - data = { - apiHost: "api.testnet.frontblock.me", - apiPort: 10001, - tls: false, - apiKey: "" - } - - constructor() { } - - ngOnInit() { } - - setAdvanced(){ this.advanced = true } - - checkData():boolean{ - return ( - typeof this.data.apiPort === "number" && - typeof this.data.apiHost === "string" && - typeof this.data.tls === "boolean" && - typeof this.data.apiKey === "string" - ) - } - - updateTestnet(){ - if(this.testnet){ - this.data.apiHost = "api.testnet.frontblock.me" - this.data.apiPort = 10001 - }else{ - this.data.apiHost = "api.frontblock.me" - this.data.apiPort = 10000 - } - } - - updatePort(obj){ - switch (this.data.apiHost) { - case "api.testnet.frontblock.me": - this.data.apiPort = 10001 - break; - case "api.frontblock.me": - this.data.apiPort = 10000 - break; - - default: - console.warn("A non-standard api host was chosen: "+this.data.apiPort) - break; - } - console.log(this.data) - } - - async save(){ - this.saving = true; - if(typeof this.data.apiPort === "string") - this.data.apiPort = parseInt(this.data.apiPort) - - if(this.checkData()){ - const conf = await fb.ApiClient.setConfig(this.data) - console.log(conf) - }else{ - //show error in gui - console.error("bad data :(") - } - this.saving = false - } -} diff --git a/src/frontend/widget/widget/apiclient-subscriptions.component.ts b/src/frontend/widget/widget/apiclient-subscriptions.component.ts deleted file mode 100644 index a8cedf4..0000000 --- a/src/frontend/widget/widget/apiclient-subscriptions.component.ts +++ /dev/null @@ -1,86 +0,0 @@ -import { Component, OnInit } from '@angular/core'; - -declare const fb - -@Component({ - selector: 'subscriptions', - template: ` -
-
- Subscriptions -
- - - - - {{entry.message}} - - - - -
- -
-
-
- - - - - - - - - - - - - - - - - -
UUIDExpiryCreation
{{line.uid}}{{line.expiry}}{{line.created}}
-
-
- -
- ` -}) -export class ApiclientSubscriptionComponent implements OnInit { - loading:boolean = false - actionName:string = "load" - entries:any[] = [] - alerts: { - severity: "danger" | "warning" | "success" - message: string - }[] = [] - - constructor() { } - - ngOnInit() { } - - async load(){ - this.loading = true - this.entries = await fb.ApiClient.getSubscriptions() - if(this.entries.length === 0){ - this.alerts.push({ severity: "warning", message: "0 results were returned"}) - } - this.loading = false - this.actionName = "refresh" - } - - async quit(uid:string){ - const r = await fb.ApiClient.unsubscribe(uid) - if(r.uid != null){ - this.alerts.push({ severity: "success", message: "Stopped subscription "+uid}) - this.load() - }else{ - this.alerts.push({ severity: "danger", message: "Error "+r.message}) - } - } - -} diff --git a/src/frontend/widget/widget/component.ts b/src/frontend/widget/widget/component.ts index 28102b9..34b0a95 100644 --- a/src/frontend/widget/widget/component.ts +++ b/src/frontend/widget/widget/component.ts @@ -1,20 +1,31 @@ import { Component, OnInit } from '@angular/core'; +import { SidebarEntry } from 'frontblock-generic/Plugin'; +declare const fb @Component({ - selector: 'apiclient', //!!!! + selector: 'pluginmanager', //!!!! template: ` -
-
- -
-
- -
-
-
-
- +
+
+ DEBUG +
+
+
+ SETUP +
+
+

+ Press this button to install all plugins. +
+ Once the installation is done the page will refresh automatically +

+
+
+ +
` @@ -26,3 +37,11 @@ export class PluginComponent implements OnInit { ngOnInit() { } } + +export const sidebarEntry: SidebarEntry = { + icon: "wrench", + route: "dev/pluginmanager", + text: "DEV Plugin manager", +} + + diff --git a/src/frontend/widget/widget/module.ts b/src/frontend/widget/widget/module.ts index ee2dc80..06d35ae 100644 --- a/src/frontend/widget/widget/module.ts +++ b/src/frontend/widget/widget/module.ts @@ -2,24 +2,19 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { PluginComponent } from './component'; import { RouterModule } from '@angular/router'; -import { ApiclientFormComponent } from './apiclient-settings-form.component'; -import { ApiclientConsumptionComponent } from './apiclient-consumptions.component'; -import { ApiclientSubscriptionComponent } from './apiclient-subscriptions.component'; -import { FrontendPlugin, SidebarEntry } from 'frontblock-generic/Plugin'; -import { ANestedComponent } from './a-nested.component'; +import { FrontendPlugin, SidebarEntry, SidebarEntries } from 'frontblock-generic/Plugin'; @NgModule({ imports: [ CommonModule, - RouterModule.forChild([{path: "pluginmanager", component: PluginComponent}]), + RouterModule.forChild([ + {path: "debug", component: PluginComponent} + ]), ], exports: [RouterModule], declarations: [ PluginComponent, // ANestedComponent, - ApiclientFormComponent, - ApiclientConsumptionComponent, - ApiclientSubscriptionComponent ], entryComponents: [PluginComponent], providers: [{ @@ -28,11 +23,15 @@ import { ANestedComponent } from './a-nested.component'; }] }) export class PluginModule implements FrontendPlugin{ - getSidebarEntry(): SidebarEntry { + getSidebarEntry(): SidebarEntries { return { icon: "wrench", - route: "pluginmanager", + parentRoute: "pluginmanager", text: "Plugin manager", + links: [{ + route: "debug", + text: "DEBUG" + }] } } }