working on frontend

This commit is contained in:
peter
2019-08-11 22:12:55 +02:00
parent 817c319b0a
commit 842ab3ffcf
10 changed files with 105 additions and 77 deletions
+3 -3
View File
@@ -3858,9 +3858,9 @@
} }
}, },
"frontblock-generic": { "frontblock-generic": {
"version": "0.17.0", "version": "0.20.0",
"resolved": "https://registry.npmjs.org/frontblock-generic/-/frontblock-generic-0.17.0.tgz", "resolved": "https://registry.npmjs.org/frontblock-generic/-/frontblock-generic-0.20.0.tgz",
"integrity": "sha512-5l5w5gnn5RpwzLmI4icdQI/yueoQQDhbH56pRsfVV+opNMRa8cvW9DJ3FXo0CgZ5BEKA6EHqF4iDIFsgYyPPpA==", "integrity": "sha512-QYXKpDmznkWM4UuNlZg+QcOwcwjVi8IRvlOv+Shm6n2qmU7WMliB0HMfRjw8JNKi8aC3EYx1YpgvXmY9tdN4QQ==",
"requires": { "requires": {
"@types/node": "^12.7.1", "@types/node": "^12.7.1",
"bsock": "^0.1.9", "bsock": "^0.1.9",
+1 -1
View File
@@ -33,7 +33,7 @@
"bsock": "^0.1.9", "bsock": "^0.1.9",
"easy-unzip": "^1.1.0", "easy-unzip": "^1.1.0",
"express": "^4.16.4", "express": "^4.16.4",
"frontblock-generic": "^0.17.0", "frontblock-generic": "^0.20.0",
"hdkey": "^1.1.1", "hdkey": "^1.1.1",
"http": "0.0.0", "http": "0.0.0",
"key-file-storage": "^2.2.4", "key-file-storage": "^2.2.4",
+1 -7
View File
@@ -24,7 +24,7 @@ export default class PluginManagerPlugin extends PluginManager implements Plugin
this.loadedPlugins[this.name] = {backend: this, frontend: this.loadFrontend(this.name)} this.loadedPlugins[this.name] = {backend: this, frontend: this.loadFrontend(this.name)}
} }
exportRPCs(): socketioRPC[] { exportExtraRPCs(): socketioRPC[] {
return [ return [
{ {
name: "getAvailablePluginNames", name: "getAvailablePluginNames",
@@ -66,12 +66,6 @@ export default class PluginManagerPlugin extends PluginManager implements Plugin
visibility: "private", visibility: "private",
rpc: async(pluginName:string) => { return this.unloadPlugin(pluginName) }, rpc: async(pluginName:string) => { return this.unloadPlugin(pluginName) },
type: 'call' type: 'call'
},
{
name: "updateConfig",
visibility: "private",
rpc: async(conf) => { return this.updateConfig(conf) },
type: 'call'
},{ },{
name: "extractPlugin", name: "extractPlugin",
visibility: "private", visibility: "private",
+4 -4
View File
@@ -7,7 +7,7 @@ import path = require('path')
import unzip = require('unzip') import unzip = require('unzip')
import easyunzip = require('easy-unzip') import easyunzip = require('easy-unzip')
import { Plugin, ConfigLoader } from 'frontblock-generic/Plugin'; import { Plugin, ConfigLoader, PluginConfigLoader } from 'frontblock-generic/Plugin';
import { SemVer, parse } from "semver"; import { SemVer, parse } from "semver";
import { once } from 'events'; import { once } from 'events';
@@ -39,7 +39,7 @@ export type PluginManagerConfig = {
installDir:string installDir:string
} }
export default class PluginManager extends ConfigLoader<PluginManagerConfig&PluginVersioning>{ export default abstract class PluginManager extends PluginConfigLoader<PluginManagerConfig&PluginVersioning>{
private cacheDir: string private cacheDir: string
protected loadedPlugins: PluginMap = {} protected loadedPlugins: PluginMap = {}
@@ -152,7 +152,7 @@ export default class PluginManager extends ConfigLoader<PluginManagerConfig&Plug
this.conf[pluginName] = {} this.conf[pluginName] = {}
} }
this.conf[pluginName]!["cached"] = version this.conf[pluginName]!["cached"] = version
this.updateConfig(this.conf) this.setConfig(this.conf)
} catch (error) { } catch (error) {
@@ -172,7 +172,7 @@ export default class PluginManager extends ConfigLoader<PluginManagerConfig&Plug
this.conf[pluginName] = {} this.conf[pluginName] = {}
} }
this.conf[pluginName]!["installed"] = this.conf[pluginName]!["cached"] this.conf[pluginName]!["installed"] = this.conf[pluginName]!["cached"]
this.updateConfig(this.conf) this.setConfig(this.conf)
} }
public async installPlugin(pluginName: string) { public async installPlugin(pluginName: string) {
+3 -3
View File
@@ -4294,9 +4294,9 @@
} }
}, },
"frontblock-generic": { "frontblock-generic": {
"version": "0.17.0", "version": "0.20.0",
"resolved": "https://registry.npmjs.org/frontblock-generic/-/frontblock-generic-0.17.0.tgz", "resolved": "https://registry.npmjs.org/frontblock-generic/-/frontblock-generic-0.20.0.tgz",
"integrity": "sha512-5l5w5gnn5RpwzLmI4icdQI/yueoQQDhbH56pRsfVV+opNMRa8cvW9DJ3FXo0CgZ5BEKA6EHqF4iDIFsgYyPPpA==", "integrity": "sha512-QYXKpDmznkWM4UuNlZg+QcOwcwjVi8IRvlOv+Shm6n2qmU7WMliB0HMfRjw8JNKi8aC3EYx1YpgvXmY9tdN4QQ==",
"requires": { "requires": {
"@types/node": "^12.7.1", "@types/node": "^12.7.1",
"bsock": "^0.1.9", "bsock": "^0.1.9",
+1 -1
View File
@@ -23,7 +23,7 @@
"@clr/icons": "^2.1.1", "@clr/icons": "^2.1.1",
"@clr/ui": "^2.1.1", "@clr/ui": "^2.1.1",
"@webcomponents/custom-elements": "^1.0.0", "@webcomponents/custom-elements": "^1.0.0",
"frontblock-generic": "^0.17.0", "frontblock-generic": "^0.20.0",
"key-file-storage": "^2.2.4", "key-file-storage": "^2.2.4",
"rxjs": "~6.5.2", "rxjs": "~6.5.2",
"systemjs": "^0.21.3", "systemjs": "^0.21.3",
@@ -1,26 +1,12 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { SidebarEntry } from 'frontblock-generic/Plugin';
declare const fb declare const fb
@Component({ @Component({
selector: 'apiclient', //!!!! selector: 'apiclient', //!!!!
template: ` template: `
<div class="clr-row"> <div class="clr-row">
<div class="clr-col"> <div class="clr-col">
<div class="card"> <settings></settings>
<div class="card-header">
Configuration
</div>
<div class="card-block">
<div class="card-title">
Settings
</div>
<div class="card-text">
<settings></settings>
</div>
</div>
<div class="card-footer">
<button class="btn btn-success" onclick="">Save</button>
</div>
</div>
</div> </div>
</div> </div>
` `
@@ -32,3 +18,9 @@ export class ApiclientDevComponent implements OnInit {
ngOnInit() { } ngOnInit() { }
} }
export const sidebarEntry:SidebarEntry = {
icon: "wrench",
route: "dev/apiclient",
text: "DEV ApiClient",
}
@@ -3,50 +3,85 @@ import { Component, OnInit } from '@angular/core';
@Component({ @Component({
selector: 'settings', selector: 'settings',
template: ` template: `
<form clrForm clrLayout="vertical"> <div class="card">
<div class="card-header">
Configuration
</div>
<div class="card-block">
<div class="card-title">
Settings
</div>
<div class="card-text">
<form clrForm clrLayout="vertical">
<clr-input-container>
<label>testnet</label>
<clr-control-error>We need your first name for legal compliance</clr-control-error>
</clr-input-container>
<input type="checkbox" [(ngModel)]="testnet" (change)="updateTestnet($event)" name="testnetToggle" clrToggle />
<clr-input-container> <clr-input-container *ngIf="!testnet">
<label>API key</label> <label>API key</label>
<input clrInput type="text" name="apikey" required /> <input clrInput type="text" name="apikey" required />
<clr-control-error>We need your first name for legal compliance</clr-control-error> <clr-control-error>We need your first name for legal compliance</clr-control-error>
</clr-input-container> </clr-input-container>
<clr-select-container> <clr-input-container *ngIf="advanced">
<label>API address</label> <label>API address</label>
<select [(ngModel)]="data.address" (change)="updatePort($event)" clrSelect name="apihost" required> <input type="text" [(ngModel)]="data.apihost" (change)="updatePort($event)" clrInput name="apihost" required />
<option value="api.testnet.frontblock.me">api.testnet.frontblock.me</option> <clr-control-error>This field is required!</clr-control-error>
<option value="api.frontblock.me">api.frontblock.me</option> </clr-input-container>
</select>
<clr-control-error>This field is required!</clr-control-error>
</clr-select-container>
<clr-checkbox-wrapper> <clr-checkbox-wrapper *ngIf="advanced" >
<input [(ngModel)]="data.tls" type="checkbox" clrCheckbox value="tls" name="options" /> <input [(ngModel)]="data.tls" type="checkbox" clrCheckbox value="tls" name="options" />
<label>Use TLS</label> <label>Use TLS</label>
</clr-checkbox-wrapper> </clr-checkbox-wrapper>
<clr-input-container> <clr-input-container *ngIf="advanced">
<label>Port</label> <label>Port</label>
<input [(ngModel)]="data.port" clrInput type="number" name="lastName" required /> <input [(ngModel)]="data.port" clrInput type="number" name="lastName" required />
<clr-control-error>Valid range 1024 - 65536 <clr-control-error>Valid range 1024 - 65536
</clr-control-error> </clr-control-error>
</clr-input-container> </clr-input-container>
</form> </form>
</div>
</div>
<div class="card-footer">
<button class="btn btn-success" ngClick="">Save</button>
<button *ngIf="!advanced" class="btn btn-sm btn-link" (click)="setAdvanced()">Advanced</button>
</div>
</div>
` `
}) })
export class ApiclientFormComponent implements OnInit { export class ApiclientFormComponent implements OnInit {
testnet:boolean = true
data:any = {} advanced:boolean = false
data:any = {
apihost: "api.testnet.frontblock.me",
port: "10001"
}
constructor() { } constructor() { }
ngOnInit() { } ngOnInit() { }
setAdvanced(){ this.advanced = true }
updateTestnet(){
if(this.testnet){
this.data.apihost = "api.testnet.frontblock.me"
this.data.port = 10001
}else{
this.data.apihost = "api.frontblock.me"
this.data.port = 10000
}
}
updatePort(obj){ updatePort(obj){
console.log(obj, this.data) switch (this.data.apihost) {
switch (this.data.address) {
case "api.testnet.frontblock.me": case "api.testnet.frontblock.me":
this.data.port = 10001 this.data.port = 10001
break; break;
@@ -1,4 +1,5 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { SidebarEntry } from 'frontblock-generic/Plugin';
declare const fb declare const fb
@Component({ @Component({
selector: 'pluginmanager', //!!!! selector: 'pluginmanager', //!!!!
@@ -36,3 +37,11 @@ export class PluginmanagerDevComponent implements OnInit {
ngOnInit() { } ngOnInit() { }
} }
export const sidebarEntry: SidebarEntry = {
icon: "wrench",
route: "dev/pluginmanager",
text: "DEV Plugin manager",
}
@@ -1,5 +1,8 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { SidebarEntries, SidebarEntry } from 'frontblock-generic/Plugin'; import { SidebarEntries, SidebarEntry } from 'frontblock-generic/Plugin';
import { sidebarEntry as apiclient } from "../apiclient-dev/apiclient-dev.component"
import { sidebarEntry as pluginmanager } from "../pluginmanager-dev/pluginmanager-dev.component"
@Component({ @Component({
selector: 'app-sidebar', selector: 'app-sidebar',
@@ -8,15 +11,10 @@ import { SidebarEntries, SidebarEntry } from 'frontblock-generic/Plugin';
}) })
export class SidebarComponent implements OnInit { export class SidebarComponent implements OnInit {
entries:SidebarEntry[] = [{ entries:SidebarEntry[] = [
icon: "wrench", pluginmanager,
route: "dev/pluginmanager", apiclient
text: "DEV Plugin manager", ]
},{
icon: "wrench",
route: "dev/apiclient",
text: "DEV ApiClient",
}]
multientires:SidebarEntries[] = [{ multientires:SidebarEntries[] = [{
icon: "times", icon: "times",