diff --git a/.drone.yml b/.drone.yml index f3ec9b2..aacebcf 100644 --- a/.drone.yml +++ b/.drone.yml @@ -65,13 +65,13 @@ steps: settings: registry: registry.frontblock.me insecure: true - repo: registry.frontblock.me/vendor/pluginmanager + repo: registry.frontblock.me/vendor/dashboard tags: ${DRONE_BUILD_CREATED} - name: release container image: plugins/docker settings: - repo: frontblockme/pluginmanager + repo: frontblockme/dashboard tags: ${DRONE_TAG} username: frontblockme password: diff --git a/package-lock.json b/package-lock.json index f1f1d43..b86040d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3858,9 +3858,9 @@ } }, "frontblock-generic": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/frontblock-generic/-/frontblock-generic-0.12.0.tgz", - "integrity": "sha512-yVPnj5AMZb2Baxs2ta/BfPdbN6PbG8RoovBcIARPuE83aknDV61xTMo7TKwxQiJ06tnVR13Ot5UiyjNkfXHObA==", + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/frontblock-generic/-/frontblock-generic-0.15.0.tgz", + "integrity": "sha512-ec5ep0U45+y6e1FXMvxE1RvC78E7xRbUFTwY/9u9prxhQYNe79vu/E0vGCX/PLdbqAmkMfSbIOr1+zCHImoiQQ==", "requires": { "@types/node": "^12.7.1", "bsock": "^0.1.9", diff --git a/package.json b/package.json index b16360e..6b6202e 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "bsock": "^0.1.9", "easy-unzip": "^1.1.0", "express": "^4.16.4", - "frontblock-generic": "^0.12.0", + "frontblock-generic": "^0.15.0", "hdkey": "^1.1.1", "http": "0.0.0", "key-file-storage": "^2.2.4", diff --git a/src/backend/PluginManager/Plugin.ts b/src/backend/PluginManager/Plugin.ts index 4aaa61e..224d070 100644 --- a/src/backend/PluginManager/Plugin.ts +++ b/src/backend/PluginManager/Plugin.ts @@ -1,5 +1,5 @@ import { default as PluginManager } from "./PluginManager"; -import { Plugin } from "frontblock-generic/Plugin"; +import { Plugin, socketioRPC } from "frontblock-generic/Plugin"; import * as Logger from 'log4js'; Logger.configure({ @@ -24,7 +24,7 @@ export default class PluginManagerPlugin extends PluginManager implements Plugin this.loadedPlugins[this.name] = {backend: this, frontend: this.loadFrontend(this.name)} } - exportRPCs(): import("frontblock-generic/Plugin").socketioRPC[] { + exportRPCs(): socketioRPC[] { return [ { name: "getAvailablePluginNames", diff --git a/src/frontend/dashboard/package-lock.json b/src/frontend/dashboard/package-lock.json index c17b0b1..da96387 100644 --- a/src/frontend/dashboard/package-lock.json +++ b/src/frontend/dashboard/package-lock.json @@ -4294,9 +4294,9 @@ } }, "frontblock-generic": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/frontblock-generic/-/frontblock-generic-0.12.0.tgz", - "integrity": "sha512-yVPnj5AMZb2Baxs2ta/BfPdbN6PbG8RoovBcIARPuE83aknDV61xTMo7TKwxQiJ06tnVR13Ot5UiyjNkfXHObA==", + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/frontblock-generic/-/frontblock-generic-0.15.0.tgz", + "integrity": "sha512-ec5ep0U45+y6e1FXMvxE1RvC78E7xRbUFTwY/9u9prxhQYNe79vu/E0vGCX/PLdbqAmkMfSbIOr1+zCHImoiQQ==", "requires": { "@types/node": "^12.7.1", "bsock": "^0.1.9", diff --git a/src/frontend/dashboard/package.json b/src/frontend/dashboard/package.json index e2f26d2..7a529d9 100644 --- a/src/frontend/dashboard/package.json +++ b/src/frontend/dashboard/package.json @@ -23,7 +23,7 @@ "@clr/icons": "^2.1.1", "@clr/ui": "^2.1.1", "@webcomponents/custom-elements": "^1.0.0", - "frontblock-generic": "latest", + "frontblock-generic": "^0.15.0", "key-file-storage": "^2.2.4", "rxjs": "~6.5.2", "systemjs": "^0.21.3", diff --git a/src/frontend/dashboard/src/app/app-routing.module.ts b/src/frontend/dashboard/src/app/app-routing.module.ts index 1580cf6..1fd68e6 100644 --- a/src/frontend/dashboard/src/app/app-routing.module.ts +++ b/src/frontend/dashboard/src/app/app-routing.module.ts @@ -2,9 +2,13 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule, Route } from '@angular/router'; import { HomeComponent } from './home/home.component'; import { ErrorDisplayComponent } from './error-display/error-display.component'; +import { PluginmanagerDevComponent } from './pluginmanager-dev/pluginmanager-dev.component'; const routes: Routes = [{ + path: "dev/pluginmanager", + component: PluginmanagerDevComponent +},{ path: "", component: HomeComponent },{ diff --git a/src/frontend/dashboard/src/app/app.component.html b/src/frontend/dashboard/src/app/app.component.html index 64fcd4d..505b10f 100644 --- a/src/frontend/dashboard/src/app/app.component.html +++ b/src/frontend/dashboard/src/app/app.component.html @@ -1,10 +1,4 @@
-
- -
+
diff --git a/src/frontend/dashboard/src/app/app.module.ts b/src/frontend/dashboard/src/app/app.module.ts index 0889cb3..73652f4 100644 --- a/src/frontend/dashboard/src/app/app.module.ts +++ b/src/frontend/dashboard/src/app/app.module.ts @@ -14,6 +14,8 @@ import { MainComponent } from './main/main.component'; import { DynamicLoaderComponent } from './dynamic-loader/dynamic-loader.component'; import { HomeComponent } from './home/home.component'; import { ErrorDisplayComponent } from './error-display/error-display.component'; +import { PluginmanagerDevComponent } from './pluginmanager-dev/pluginmanager-dev.component'; +import { HeaderBarComponent } from './header-bar/header-bar.component'; export function createCompiler(fn: CompilerFactory): Compiler { return fn.createCompiler(); @@ -28,7 +30,9 @@ const entryComps = [] MainComponent, DynamicLoaderComponent, HomeComponent, - ErrorDisplayComponent + ErrorDisplayComponent, + PluginmanagerDevComponent, + HeaderBarComponent ], imports: [ BrowserModule, diff --git a/src/frontend/dashboard/src/app/dynamic-loader/dynamic-loader.component.ts b/src/frontend/dashboard/src/app/dynamic-loader/dynamic-loader.component.ts index 4669dc1..613bc3e 100644 --- a/src/frontend/dashboard/src/app/dynamic-loader/dynamic-loader.component.ts +++ b/src/frontend/dashboard/src/app/dynamic-loader/dynamic-loader.component.ts @@ -33,7 +33,7 @@ import { AfterViewInit, Component, ViewContainerRef, ViewChild } from '@angular/ import { SidebarComponent } from '../sidebar/sidebar.component'; import { MainComponent } from '../main/main.component'; import { Router } from '@angular/router'; -import { FrontendPlugin } from "frontblock-generic/Plugin" +import { FrontendPlugin, SidebarEntries, SidebarEntry } from "frontblock-generic/Plugin" @Component({ @@ -67,15 +67,37 @@ export class DynamicLoaderComponent implements AfterViewInit { private async installWidget(pluginName:string){ const module: FrontendPlugin = await SystemJS.import("plugins/"+pluginName+".js"); const plugin = new module['PluginModule']() - const entry = plugin.getSidebarEntry() - entry.route = 'page/' + entry.route - this.sidebar.entries.unshift(entry) - + const entry:SidebarEntries | SidebarEntry = plugin.getSidebarEntry() const rc = this.router.config - rc.unshift({ - path: "page", - loadChildren: async () => module['PluginModule'] - }) + + switch (typeof (entry).links) { + case "undefined": + const e:SidebarEntry = entry + e.route = "plugin/" + e.route + + this.sidebar.entries.push(e) + rc.unshift({ + path: "plugin", + loadChildren: async () => module['PluginModule'] + }) + + break; + case "object": + const m:SidebarEntries = entry + + m.links = m.links.map(link => { + return {text: link.text, route: m.text + "/" + link.route } + }) + + this.sidebar.multientires.push(m) + rc.unshift({ + path: m.text, + loadChildren: async () => module['PluginModule'] + }) + + console.log(this.sidebar.multientires) + break; + } this.router.resetConfig(rc) } } \ No newline at end of file diff --git a/src/frontend/dashboard/src/app/header-bar/header-bar.component.html b/src/frontend/dashboard/src/app/header-bar/header-bar.component.html new file mode 100644 index 0000000..6c61fb0 --- /dev/null +++ b/src/frontend/dashboard/src/app/header-bar/header-bar.component.html @@ -0,0 +1,19 @@ +
+
+ Frontblock + +
+ +
+ \ No newline at end of file diff --git a/src/frontend/dashboard/src/app/header-bar/header-bar.component.scss b/src/frontend/dashboard/src/app/header-bar/header-bar.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/frontend/dashboard/src/app/header-bar/header-bar.component.spec.ts b/src/frontend/dashboard/src/app/header-bar/header-bar.component.spec.ts new file mode 100644 index 0000000..dd15fa6 --- /dev/null +++ b/src/frontend/dashboard/src/app/header-bar/header-bar.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { HeaderBarComponent } from './header-bar.component'; + +describe('HeaderBarComponent', () => { + let component: HeaderBarComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ HeaderBarComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(HeaderBarComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/frontend/dashboard/src/app/header-bar/header-bar.component.ts b/src/frontend/dashboard/src/app/header-bar/header-bar.component.ts new file mode 100644 index 0000000..d3310d0 --- /dev/null +++ b/src/frontend/dashboard/src/app/header-bar/header-bar.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'header-bar', + templateUrl: './header-bar.component.html', + styleUrls: ['./header-bar.component.scss'] +}) +export class HeaderBarComponent implements OnInit { + + constructor() { } + + ngOnInit() { + } + +} diff --git a/src/frontend/dashboard/src/app/pluginmanager-dev/pluginmanager-dev.component.html b/src/frontend/dashboard/src/app/pluginmanager-dev/pluginmanager-dev.component.html new file mode 100644 index 0000000..1f5832b --- /dev/null +++ b/src/frontend/dashboard/src/app/pluginmanager-dev/pluginmanager-dev.component.html @@ -0,0 +1 @@ +

pluginmanager-dev works!

diff --git a/src/frontend/dashboard/src/app/pluginmanager-dev/pluginmanager-dev.component.scss b/src/frontend/dashboard/src/app/pluginmanager-dev/pluginmanager-dev.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/frontend/dashboard/src/app/pluginmanager-dev/pluginmanager-dev.component.spec.ts b/src/frontend/dashboard/src/app/pluginmanager-dev/pluginmanager-dev.component.spec.ts new file mode 100644 index 0000000..c8812b6 --- /dev/null +++ b/src/frontend/dashboard/src/app/pluginmanager-dev/pluginmanager-dev.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { PluginmanagerDevComponent } from './pluginmanager-dev.component'; + +describe('PluginmanagerDevComponent', () => { + let component: PluginmanagerDevComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ PluginmanagerDevComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(PluginmanagerDevComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/frontend/dashboard/src/app/pluginmanager-dev/pluginmanager-dev.component.ts b/src/frontend/dashboard/src/app/pluginmanager-dev/pluginmanager-dev.component.ts new file mode 100644 index 0000000..b73a164 --- /dev/null +++ b/src/frontend/dashboard/src/app/pluginmanager-dev/pluginmanager-dev.component.ts @@ -0,0 +1,38 @@ +import { Component, OnInit } from '@angular/core'; +declare const fb +@Component({ + selector: 'pluginmanager', //!!!! + template: ` +
+
+
+
+ DEBUG +
+
+
+ SETUP +
+
+

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

+
+
+ +
+
+
+ ` +}) +export class PluginmanagerDevComponent implements OnInit { + + constructor() { } + + ngOnInit() { } + +} diff --git a/src/frontend/dashboard/src/app/sidebar/sidebar.component.html b/src/frontend/dashboard/src/app/sidebar/sidebar.component.html index 1051f29..8f723f5 100644 --- a/src/frontend/dashboard/src/app/sidebar/sidebar.component.html +++ b/src/frontend/dashboard/src/app/sidebar/sidebar.component.html @@ -1,6 +1,22 @@ + + + {{e.text}} + + + {{l.text}} + + + {{entry.text}} + + + + \ No newline at end of file diff --git a/src/frontend/dashboard/src/app/sidebar/sidebar.component.ts b/src/frontend/dashboard/src/app/sidebar/sidebar.component.ts index b275c75..999d0e1 100644 --- a/src/frontend/dashboard/src/app/sidebar/sidebar.component.ts +++ b/src/frontend/dashboard/src/app/sidebar/sidebar.component.ts @@ -1,4 +1,5 @@ import { Component, OnInit } from '@angular/core'; +import { SidebarEntries, SidebarEntry } from 'frontblock-generic/Plugin'; @Component({ selector: 'app-sidebar', @@ -7,12 +8,25 @@ import { Component, OnInit } from '@angular/core'; }) export class SidebarComponent implements OnInit { - entries:{text:string, icon:string, route:string}[] = [] + entries:SidebarEntry[] = [{ + type: "single", + icon: "wrench", + route: "dev/pluginmanager", + text: "DEV Plugin manager", + }] + + multientires:SidebarEntries[] = [{ + type: "multi", + icon: "times", + text: "HELP", + links: [{ + route: "xd", + text: "XD" + }] + }] constructor() { } ngOnInit() { } - - -} +} \ No newline at end of file diff --git a/src/frontend/widget/widget/a-nested.component.ts b/src/frontend/widget/widget/a-nested.component.ts index 5f4fac6..e8ea730 100644 --- a/src/frontend/widget/widget/a-nested.component.ts +++ b/src/frontend/widget/widget/a-nested.component.ts @@ -1,9 +1,9 @@ import { Component, OnInit } from '@angular/core'; @Component({ - selector: 'exclamations', + selector: 'settings', template: ` - !!! + !!! ` }) export class ANestedComponent implements OnInit { diff --git a/src/frontend/widget/widget/component.ts b/src/frontend/widget/widget/component.ts index b1228ee..566b08c 100644 --- a/src/frontend/widget/widget/component.ts +++ b/src/frontend/widget/widget/component.ts @@ -1,16 +1,29 @@ + import { Component, OnInit } from '@angular/core'; declare const fb @Component({ selector: 'PLUGINMANAGER', //!!!! template: ` -
-
-
- PLUGINMANAGER
${Object.keys(fb.PluginManager).join("
")} -
-
- Hello World -
+
+
+
+
+ Plugin manager +
+
+
+ Block +
+
+ ${Object.keys(fb.PluginManager).join("
")} + +
+
+ +
` diff --git a/src/frontend/widget/widget/module.ts b/src/frontend/widget/widget/module.ts index 990f177..f846938 100644 --- a/src/frontend/widget/widget/module.ts +++ b/src/frontend/widget/widget/module.ts @@ -3,10 +3,10 @@ import { CommonModule } from '@angular/common'; import { PluginComponent } from './component'; import { ANestedComponent } from './a-nested.component'; import { RouterModule } from '@angular/router'; -import { FrontendPlugin, SidebarEntry } from 'frontblock-generic/Plugin'; +import { FrontendPlugin, SidebarEntries } from 'frontblock-generic/Plugin'; @NgModule({ - imports: [CommonModule, RouterModule.forChild([{path: "pluginmanager", component: PluginComponent}])], + imports: [CommonModule, RouterModule.forChild([{path: "debug", component: PluginComponent}])], exports: [RouterModule], declarations: [ PluginComponent, @@ -19,7 +19,15 @@ import { FrontendPlugin, SidebarEntry } from 'frontblock-generic/Plugin'; }] }) export class PluginModule implements FrontendPlugin{ - getSidebarEntry(): SidebarEntry { - return {icon: 'check', text: 'Plugin manager', route: 'pluginmanager'} + getSidebarEntry(): SidebarEntries { + return { + icon: 'cog', + text: 'pluginmanager', + type: "multi", + links: [{ + route: 'debug', + text: 'DEBUG' + }] + } } }