removed folder dashboard
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
# Editor configuration, see https://editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
max_line_length = off
|
||||
trim_trailing_whitespace = false
|
||||
@@ -1,46 +0,0 @@
|
||||
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
||||
|
||||
# compiled output
|
||||
/dist
|
||||
/tmp
|
||||
/out-tsc
|
||||
# Only exists if Bazel was run
|
||||
/bazel-out
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
|
||||
# profiling files
|
||||
chrome-profiler-events.json
|
||||
speed-measure-plugin.json
|
||||
|
||||
# IDEs and editors
|
||||
/.idea
|
||||
.project
|
||||
.classpath
|
||||
.c9/
|
||||
*.launch
|
||||
.settings/
|
||||
*.sublime-workspace
|
||||
|
||||
# IDE - VSCode
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
.history/*
|
||||
|
||||
# misc
|
||||
/.sass-cache
|
||||
/connect.lock
|
||||
/coverage
|
||||
/libpeerconnection.log
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
testem.log
|
||||
/typings
|
||||
|
||||
# System Files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
@@ -1,27 +0,0 @@
|
||||
# Dashboard
|
||||
|
||||
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.1.0.
|
||||
|
||||
## Development server
|
||||
|
||||
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
|
||||
|
||||
## Code scaffolding
|
||||
|
||||
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
|
||||
|
||||
## Build
|
||||
|
||||
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
|
||||
|
||||
## Running unit tests
|
||||
|
||||
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
||||
|
||||
## Running end-to-end tests
|
||||
|
||||
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
|
||||
|
||||
## Further help
|
||||
|
||||
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
|
||||
@@ -1,130 +0,0 @@
|
||||
{
|
||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||
"version": 1,
|
||||
"newProjectRoot": "projects",
|
||||
"projects": {
|
||||
"dashboard": {
|
||||
"projectType": "application",
|
||||
"schematics": {
|
||||
"@schematics/angular:component": {
|
||||
"style": "scss"
|
||||
}
|
||||
},
|
||||
"root": "",
|
||||
"sourceRoot": "src",
|
||||
"prefix": "app",
|
||||
"architect": {
|
||||
"build": {
|
||||
"builder": "@angular-devkit/build-angular:browser",
|
||||
"options": {
|
||||
"outputPath": "dist/dashboard",
|
||||
"index": "src/index.html",
|
||||
"main": "src/main.ts",
|
||||
"polyfills": "src/polyfills.ts",
|
||||
"tsConfig": "tsconfig.app.json",
|
||||
"aot": false,
|
||||
"assets": [
|
||||
"src/favicon.ico",
|
||||
"src/assets"
|
||||
],
|
||||
"styles": [
|
||||
"src/styles.scss",
|
||||
"node_modules/@clr/icons/clr-icons.min.css",
|
||||
"node_modules/@clr/ui/clr-ui-dark.min.css"
|
||||
],
|
||||
"scripts": [
|
||||
"node_modules/systemjs/dist/system.js",
|
||||
"node_modules/@webcomponents/custom-elements/custom-elements.min.js",
|
||||
"node_modules/@clr/icons/clr-icons.min.js"
|
||||
]
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"fileReplacements": [
|
||||
{
|
||||
"replace": "src/environments/environment.ts",
|
||||
"with": "src/environments/environment.prod.ts"
|
||||
}
|
||||
],
|
||||
"optimization": true,
|
||||
"outputHashing": "all",
|
||||
"sourceMap": false,
|
||||
"extractCss": true,
|
||||
"namedChunks": false,
|
||||
"aot": false,
|
||||
"extractLicenses": true,
|
||||
"vendorChunk": false,
|
||||
"buildOptimizer": true,
|
||||
"budgets": [
|
||||
{
|
||||
"type": "initial",
|
||||
"maximumWarning": "2mb",
|
||||
"maximumError": "5mb"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"serve": {
|
||||
"builder": "@angular-devkit/build-angular:dev-server",
|
||||
"options": {
|
||||
"browserTarget": "dashboard:build"
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"browserTarget": "dashboard:build:production"
|
||||
}
|
||||
}
|
||||
},
|
||||
"extract-i18n": {
|
||||
"builder": "@angular-devkit/build-angular:extract-i18n",
|
||||
"options": {
|
||||
"browserTarget": "dashboard:build"
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"builder": "@angular-devkit/build-angular:karma",
|
||||
"options": {
|
||||
"main": "src/test.ts",
|
||||
"polyfills": "src/polyfills.ts",
|
||||
"tsConfig": "tsconfig.spec.json",
|
||||
"karmaConfig": "karma.conf.js",
|
||||
"assets": [
|
||||
"src/favicon.ico",
|
||||
"src/assets"
|
||||
],
|
||||
"styles": [
|
||||
"src/styles.scss"
|
||||
],
|
||||
"scripts": []
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"builder": "@angular-devkit/build-angular:tslint",
|
||||
"options": {
|
||||
"tsConfig": [
|
||||
"tsconfig.app.json",
|
||||
"tsconfig.spec.json",
|
||||
"e2e/tsconfig.json"
|
||||
],
|
||||
"exclude": [
|
||||
"**/node_modules/**"
|
||||
]
|
||||
}
|
||||
},
|
||||
"e2e": {
|
||||
"builder": "@angular-devkit/build-angular:protractor",
|
||||
"options": {
|
||||
"protractorConfig": "e2e/protractor.conf.js",
|
||||
"devServerTarget": "dashboard:serve"
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"devServerTarget": "dashboard:serve:production"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}},
|
||||
"defaultProject": "dashboard"
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
|
||||
# For additional information regarding the format and rule options, please see:
|
||||
# https://github.com/browserslist/browserslist#queries
|
||||
|
||||
# You can see what browsers were selected by your queries by running:
|
||||
# npx browserslist
|
||||
|
||||
> 0.5%
|
||||
last 2 versions
|
||||
Firefox ESR
|
||||
not dead
|
||||
not IE 9-11 # For IE 9-11 support, remove 'not'.
|
||||
@@ -1,32 +0,0 @@
|
||||
// @ts-check
|
||||
// Protractor configuration file, see link for more information
|
||||
// https://github.com/angular/protractor/blob/master/lib/config.ts
|
||||
|
||||
const { SpecReporter } = require('jasmine-spec-reporter');
|
||||
|
||||
/**
|
||||
* @type { import("protractor").Config }
|
||||
*/
|
||||
exports.config = {
|
||||
allScriptsTimeout: 11000,
|
||||
specs: [
|
||||
'./src/**/*.e2e-spec.ts'
|
||||
],
|
||||
capabilities: {
|
||||
'browserName': 'chrome'
|
||||
},
|
||||
directConnect: true,
|
||||
baseUrl: 'http://localhost:4200/',
|
||||
framework: 'jasmine',
|
||||
jasmineNodeOpts: {
|
||||
showColors: true,
|
||||
defaultTimeoutInterval: 30000,
|
||||
print: function() {}
|
||||
},
|
||||
onPrepare() {
|
||||
require('ts-node').register({
|
||||
project: require('path').join(__dirname, './tsconfig.json')
|
||||
});
|
||||
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
|
||||
}
|
||||
};
|
||||
@@ -1,23 +0,0 @@
|
||||
import { AppPage } from './app.po';
|
||||
import { browser, logging } from 'protractor';
|
||||
|
||||
describe('workspace-project App', () => {
|
||||
let page: AppPage;
|
||||
|
||||
beforeEach(() => {
|
||||
page = new AppPage();
|
||||
});
|
||||
|
||||
it('should display welcome message', () => {
|
||||
page.navigateTo();
|
||||
expect(page.getTitleText()).toEqual('Welcome to dashboard!');
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
// Assert that there are no errors emitted from the browser
|
||||
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
|
||||
expect(logs).not.toContain(jasmine.objectContaining({
|
||||
level: logging.Level.SEVERE,
|
||||
} as logging.Entry));
|
||||
});
|
||||
});
|
||||
@@ -1,11 +0,0 @@
|
||||
import { browser, by, element } from 'protractor';
|
||||
|
||||
export class AppPage {
|
||||
navigateTo() {
|
||||
return browser.get(browser.baseUrl) as Promise<any>;
|
||||
}
|
||||
|
||||
getTitleText() {
|
||||
return element(by.css('app-root h1')).getText() as Promise<string>;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../out-tsc/e2e",
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"types": [
|
||||
"jasmine",
|
||||
"jasminewd2",
|
||||
"node"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
// Karma configuration file, see link for more information
|
||||
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
||||
|
||||
module.exports = function (config) {
|
||||
config.set({
|
||||
basePath: '',
|
||||
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
||||
plugins: [
|
||||
require('karma-jasmine'),
|
||||
require('karma-chrome-launcher'),
|
||||
require('karma-jasmine-html-reporter'),
|
||||
require('karma-coverage-istanbul-reporter'),
|
||||
require('@angular-devkit/build-angular/plugins/karma')
|
||||
],
|
||||
client: {
|
||||
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
||||
},
|
||||
coverageIstanbulReporter: {
|
||||
dir: require('path').join(__dirname, './coverage/dashboard'),
|
||||
reports: ['html', 'lcovonly', 'text-summary'],
|
||||
fixWebpackSourcePaths: true
|
||||
},
|
||||
reporters: ['progress', 'kjhtml'],
|
||||
port: 9876,
|
||||
colors: true,
|
||||
logLevel: config.LOG_INFO,
|
||||
autoWatch: true,
|
||||
browsers: ['Chrome'],
|
||||
singleRun: false,
|
||||
restartOnFileChange: true
|
||||
});
|
||||
};
|
||||
Generated
-11797
File diff suppressed because it is too large
Load Diff
@@ -1,62 +0,0 @@
|
||||
{
|
||||
"name": "dashboard",
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve --aot=false --optimization=false --proxy-config proxy.conf.json",
|
||||
"build": "ng build --prod --aot=false --optimization=false --build-optimizer=false",
|
||||
"test": "ng test",
|
||||
"lint": "ng lint",
|
||||
"e2e": "ng e2e",
|
||||
"update-frontblock": "rm -rf node_modules/frontblock*; npm install"
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@angular/animations": "~8.2.1",
|
||||
"@angular/common": "~8.2.1",
|
||||
"@angular/compiler": "~8.2.1",
|
||||
"@angular/core": "~8.2.1",
|
||||
"@angular/forms": "~8.2.1",
|
||||
"@angular/platform-browser": "~8.2.1",
|
||||
"@angular/platform-browser-dynamic": "~8.2.1",
|
||||
"@angular/router": "~8.2.1",
|
||||
"@clr/angular": "^2.1.1",
|
||||
"@clr/icons": "^2.1.1",
|
||||
"@clr/ui": "^2.1.1",
|
||||
"@webcomponents/custom-elements": "^1.0.0",
|
||||
"btc-hdkey": "0.0.17",
|
||||
"coinselect": "^3.1.11",
|
||||
"frontblock": "latest",
|
||||
"frontblock-generic": "^0.22.0",
|
||||
"key-file-storage": "^2.2.4",
|
||||
"node-fetch": "^2.6.0",
|
||||
"rxjs": "~6.5.2",
|
||||
"stream": "0.0.2",
|
||||
"systemjs": "^0.21.3",
|
||||
"tslib": "^1.9.0",
|
||||
"uuid": "^3.3.2",
|
||||
"zone.js": "~0.10.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular-devkit/build-angular": "~0.802.1",
|
||||
"@angular/cli": "^8.2.1",
|
||||
"@angular/compiler-cli": "~8.2.1",
|
||||
"@angular/language-service": "~8.2.1",
|
||||
"@types/jasmine": "~3.4.0",
|
||||
"@types/jasminewd2": "~2.0.3",
|
||||
"@types/node": "^12.7.1",
|
||||
"@types/systemjs": "^0.20.6",
|
||||
"codelyzer": "^5.0.0",
|
||||
"jasmine-core": "~3.4.0",
|
||||
"jasmine-spec-reporter": "~4.2.1",
|
||||
"karma": "~4.2.0",
|
||||
"karma-chrome-launcher": "~3.0.0",
|
||||
"karma-coverage-istanbul-reporter": "~2.1.0",
|
||||
"karma-jasmine": "~2.0.1",
|
||||
"karma-jasmine-html-reporter": "^1.4.0",
|
||||
"protractor": "~5.4.0",
|
||||
"ts-node": "~8.3.0",
|
||||
"tslint": "~5.18.0",
|
||||
"typescript": "~3.5.3"
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"/widgets-repo/*": {
|
||||
"target": "http://localhost:4201",
|
||||
"secure": false,
|
||||
"pathRewrite": {
|
||||
"^/widgets-repo": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
import { Component, OnInit, isDevMode } from '@angular/core';
|
||||
import { SubscriptionResponse, parseResponse, SuccessResponse, Coin } from 'frontblock-generic/Types.js';
|
||||
import { default as uuid } from 'uuid/v4'
|
||||
|
||||
declare const fb
|
||||
|
||||
@Component({
|
||||
selector: 'consumers',
|
||||
template: `
|
||||
<div class="clr-row">
|
||||
<div class="card clr-col-12 clr-col-sm-12 clr-col-md-12 clr-col-lg-auto clr-col-xl-auto">
|
||||
<div class="card-header">
|
||||
Consumers
|
||||
</div>
|
||||
<clr-alert *ngFor="let entry of alerts" [clrAlertType]="entry.severity">
|
||||
<clr-alert-item>
|
||||
<span class="alert-text">
|
||||
{{entry.message}}
|
||||
</span>
|
||||
</clr-alert-item>
|
||||
</clr-alert>
|
||||
|
||||
<div *ngIf="loading" class="card-block">
|
||||
<span class="spinner spinner-inline"></span>
|
||||
</div>
|
||||
<div *ngIf="entries.length !== 0 && !loading" class="card-block limit-height">
|
||||
<div class="card-text limit-height">
|
||||
<clr-datagrid>
|
||||
<clr-dg-column>UUID</clr-dg-column>
|
||||
<clr-dg-column>Subscription UUID</clr-dg-column>
|
||||
<clr-dg-column>Expiry</clr-dg-column>
|
||||
<clr-dg-column>Creation</clr-dg-column>
|
||||
|
||||
<clr-dg-row *clrDgItems="let line of entries">
|
||||
<clr-dg-cell>{{line.uid}}</clr-dg-cell>
|
||||
<clr-dg-cell>{{line.message}}</clr-dg-cell>
|
||||
<clr-dg-cell>{{line.expiry | date}}</clr-dg-cell>
|
||||
<clr-dg-cell>{{line.created | date}}</clr-dg-cell>
|
||||
|
||||
<clr-dg-row-detail *clrIfExpanded>
|
||||
<button class="btn btn-icon btn-danger-outline" (click)="quit(line.uid)"><clr-icon shape="times"></clr-icon> Quit</button>
|
||||
</clr-dg-row-detail>
|
||||
</clr-dg-row>
|
||||
<clr-dg-footer>
|
||||
<clr-dg-pagination #pagination [clrDgPageSize]="10">
|
||||
<clr-dg-page-size [clrPageSizeOptions]="[10,20,50,100]">Users per page</clr-dg-page-size>
|
||||
{{pagination.firstItem + 1}} - {{pagination.lastItem + 1}}
|
||||
of {{pagination.totalItems}} users
|
||||
</clr-dg-pagination>
|
||||
</clr-dg-footer>
|
||||
</clr-datagrid>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<button *ngIf="!loading" class="btn btn-sm btn-link" (click)="load()">{{actionName}}</button>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
export class ApiclientConsumptionComponent implements OnInit {
|
||||
loading: boolean = false
|
||||
actionName: string = "load"
|
||||
entries: SubscriptionResponse[] = []
|
||||
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)
|
||||
const res = parseResponse(r)
|
||||
if (res instanceof SuccessResponse) {
|
||||
this.alerts.push({ severity: "success", message: "Quit consuming " + uid })
|
||||
this.load()
|
||||
} else {
|
||||
this.alerts.push({ severity: "danger", message: "Error " + res.message })
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,132 +0,0 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FrontblockApiConf } from 'frontblock';
|
||||
import { isDevMode } from '@angular/core';
|
||||
|
||||
declare const fb
|
||||
|
||||
@Component({
|
||||
selector: 'settings',
|
||||
template: `
|
||||
<div class="clr-row">
|
||||
<div class="card clr-col-12 clr-col-sm-12 clr-col-md-12 clr-col-lg-auto clr-col-xl-auto">
|
||||
<div class="card-header">
|
||||
Settings
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-text">
|
||||
<form clrForm clrLayout="horizontal">
|
||||
<div class="clr-row clr-form-control ng-star-inserted">
|
||||
<label class="clr-col-12 clr-col-md-4 clr-control-label">testnet</label>
|
||||
<div class="clr-col-12 clr-col-md-8">
|
||||
<input type="checkbox" [(ngModel)]="testnet" (change)="updateTestnet($event)" name="testnetToggle" clrToggle />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<clr-input-container *ngIf="!testnet">
|
||||
<label class="clr-col-12 clr-col-md-4">API key</label>
|
||||
<input class="clr-col-12 clr-col-md-8" clrInput type="text" name="apiKey" required />
|
||||
</clr-input-container>
|
||||
|
||||
<clr-input-container *ngIf="advanced" class="clr-row">
|
||||
<label class="clr-col-12 clr-col-md-4">API address</label>
|
||||
<input class="clr-col-12 clr-col-md-8" type="text" [(ngModel)]="data.apiHost" (change)="updatePort($event)" clrInput name="apiHost" required />
|
||||
<clr-control-error>This field is required!</clr-control-error>
|
||||
</clr-input-container>
|
||||
|
||||
<div class="clr-row clr-form-control ng-star-inserted" *ngIf="advanced">
|
||||
<label class="clr-col-12 clr-col-md-4 clr-control-label">Use TLS</label>
|
||||
<div class="clr-col-12 clr-col-md-8">
|
||||
<input [(ngModel)]="data.tls" type="checkbox" clrCheckbox value="tls" name="options" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<clr-input-container class="clr-row" *ngIf="advanced">
|
||||
<label class="clr-col-12 clr-col-md-4">Port</label>
|
||||
<input class="clr-col-12 clr-col-md-8" [(ngModel)]="data.apiPort" clrInput type="number" name="lastName" required />
|
||||
<clr-control-error>Valid range 1024 - 65536
|
||||
</clr-control-error>
|
||||
</clr-input-container>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<button *ngIf="!saving" class="btn btn-success-outline" (click)="save()">
|
||||
<span>Save</span>
|
||||
</button>
|
||||
|
||||
<button *ngIf="saving" class="btn btn-disabled" (click)="save()" disabled>
|
||||
<span class="spinner spinner-inline"></span>
|
||||
</button>
|
||||
<button *ngIf="!advanced" class="btn btn-sm btn-link" (click)="setAdvanced()">Advanced</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
export class ApiclientFormComponent implements OnInit {
|
||||
testnet: boolean = true
|
||||
saving: boolean = false
|
||||
advanced: boolean = false
|
||||
data: FrontblockApiConf = {
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
import { Component, OnInit, isDevMode } from '@angular/core';
|
||||
import { SubscriptionResponse, SuccessResponse, parseResponse, Coin } from 'frontblock-generic/Types.js';
|
||||
import { default as uuid } from 'uuid/v4'
|
||||
declare const fb
|
||||
|
||||
@Component({
|
||||
selector: 'subscriptions',
|
||||
template: `
|
||||
<div class="clr-row">
|
||||
<div class="card clr-col-12 clr-col-sm-12 clr-col-md-12 clr-col-lg-12 clr-col-xl-12">
|
||||
<div class="card-header">
|
||||
Subscriptions
|
||||
</div>
|
||||
<clr-alert *ngFor="let entry of alerts" [clrAlertType]="entry.severity">
|
||||
<clr-alert-item>
|
||||
<span class="alert-text">
|
||||
{{entry.message}}
|
||||
</span>
|
||||
</clr-alert-item>
|
||||
</clr-alert>
|
||||
|
||||
<div *ngIf="loading" class="card-block">
|
||||
<span class="spinner spinner-inline"></span>
|
||||
</div>
|
||||
<div *ngIf="entries.length !== 0 && !loading" class="card-block">
|
||||
<div class="card-text">
|
||||
<clr-datagrid>
|
||||
<clr-dg-column>UUID</clr-dg-column>
|
||||
<!--
|
||||
<clr-dg-column>Currency</clr-dg-column>
|
||||
<clr-dg-column>Address</clr-dg-column>
|
||||
<clr-dg-column>Memo</clr-dg-column>
|
||||
<clr-dg-column>Expiry</clr-dg-column>
|
||||
<clr-dg-column>Creation</clr-dg-column>
|
||||
-->
|
||||
|
||||
<clr-dg-row *clrDgItems="let line of entries">
|
||||
<clr-dg-cell>{{line.uid}}</clr-dg-cell>
|
||||
<!--
|
||||
<clr-dg-cell>{{line.currency}}</clr-dg-cell>
|
||||
<clr-dg-cell>{{line.address}}</clr-dg-cell>
|
||||
<clr-dg-cell>{{line.memo}}</clr-dg-cell>
|
||||
<clr-dg-cell>{{line.expiry | date}}</clr-dg-cell>
|
||||
<clr-dg-cell>{{line.created | date}}</clr-dg-cell>
|
||||
-->
|
||||
|
||||
<clr-dg-row-detail *clrIfExpanded>
|
||||
<button class="btn btn-icon btn-danger-outline" (click)="quit(line.uid)"><clr-icon shape="times"></clr-icon> Unsubscribe</button>
|
||||
</clr-dg-row-detail>
|
||||
</clr-dg-row>
|
||||
<clr-dg-footer>
|
||||
<clr-dg-pagination #pagination [clrDgPageSize]="10">
|
||||
<clr-dg-page-size [clrPageSizeOptions]="[10,20,50,100]">Users per page</clr-dg-page-size>
|
||||
{{pagination.firstItem + 1}} - {{pagination.lastItem + 1}}
|
||||
of {{pagination.totalItems}} users
|
||||
</clr-dg-pagination>
|
||||
</clr-dg-footer>
|
||||
</clr-datagrid>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<button *ngIf="!loading" class="btn btn-sm btn-link" (click)="load()">{{actionName}}</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
export class ApiclientSubscriptionComponent implements OnInit {
|
||||
loading: boolean = false
|
||||
actionName: string = "load"
|
||||
entries: (SubscriptionResponse )[] = []
|
||||
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)
|
||||
const res = parseResponse(r)
|
||||
if (res instanceof SuccessResponse) {
|
||||
this.alerts.push({ severity: "success", message: "Stopped subscription " + uid })
|
||||
this.load()
|
||||
} else {
|
||||
this.alerts.push({ severity: "danger", message: "Error " + res.message })
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
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, SidebarEntries } from 'frontblock-generic/Plugin';
|
||||
import { ClarityModule } from '@clr/angular';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
FormsModule,
|
||||
ClarityModule,
|
||||
|
||||
CommonModule,
|
||||
RouterModule.forChild([
|
||||
{path: "settings", component: ApiclientFormComponent},
|
||||
{path: "subscriptions", component: ApiclientSubscriptionComponent},
|
||||
{path: "consumers", component: ApiclientConsumptionComponent},
|
||||
]),
|
||||
],
|
||||
exports: [RouterModule],
|
||||
declarations: [
|
||||
ApiclientFormComponent,
|
||||
ApiclientConsumptionComponent,
|
||||
ApiclientSubscriptionComponent
|
||||
]
|
||||
})
|
||||
export class PluginModule implements FrontendPlugin{
|
||||
getSidebarEntry(): SidebarEntries {
|
||||
return {
|
||||
icon: "key",
|
||||
parentRoute: "apiclient",
|
||||
text: "Api client",
|
||||
links: [{
|
||||
route: "settings",
|
||||
text: "Settings"
|
||||
},{
|
||||
route: "consumers",
|
||||
text: "Consumers"
|
||||
},{
|
||||
route: "subscriptions",
|
||||
text: "Subscriptions"
|
||||
},]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { SidebarEntry } from 'frontblock-generic/Plugin';
|
||||
declare const fb
|
||||
@Component({
|
||||
selector: 'debug', //!!!!
|
||||
template: `
|
||||
<div class="clr-row">
|
||||
<div class="clr-col">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
DEBUG
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-title">
|
||||
SETUP
|
||||
</div>
|
||||
<div class="card-text">
|
||||
<p>
|
||||
Press this button to install all plugins.
|
||||
<br>
|
||||
Once the installation is done the page will refresh automatically
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<button class="btn btn-warning-outline" onclick="setup()">SETUP</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
export class PluginmanagerDEBUG implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() { }
|
||||
|
||||
}
|
||||
|
||||
export const sidebarEntry: SidebarEntry = {
|
||||
icon: "wrench",
|
||||
route: "dev/pluginmanager",
|
||||
text: "DEV Plugin manager",
|
||||
}
|
||||
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import { PluginmanagerDEBUG } from './debug.component';
|
||||
import { PluginsComponent } from './plugins.component';
|
||||
|
||||
import { FrontendPlugin, SidebarEntries } from 'frontblock-generic/Plugin';
|
||||
import { ClarityModule } from '@clr/angular';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
FormsModule,
|
||||
ClarityModule,
|
||||
|
||||
CommonModule,
|
||||
RouterModule.forChild([
|
||||
{path: "debug", component: PluginmanagerDEBUG},
|
||||
{path: "plugins", component: PluginsComponent}
|
||||
]),
|
||||
],
|
||||
exports: [RouterModule],
|
||||
declarations: [
|
||||
PluginmanagerDEBUG,
|
||||
PluginsComponent
|
||||
]
|
||||
})
|
||||
export class PluginModule implements FrontendPlugin{
|
||||
getSidebarEntry(): SidebarEntries {
|
||||
return {
|
||||
icon: "plugin",
|
||||
text: "Plugin manager",
|
||||
parentRoute: "pluginmanager",
|
||||
links: [{
|
||||
route: "debug",
|
||||
text: "DEBUG"
|
||||
},{
|
||||
route: "plugins",
|
||||
text: "Plugins"
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,156 +0,0 @@
|
||||
import { Component, OnInit, isDevMode } from '@angular/core';
|
||||
declare const fb
|
||||
@Component({
|
||||
selector: 'plugins', //!!!!
|
||||
template: `
|
||||
<clr-modal [(clrModalOpen)]="updatepending">
|
||||
<h3 class="modal-title">Confirm installation</h3>
|
||||
<div class="modal-body">
|
||||
<p>{{updateCandidate}} But not much to say...</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-icon btn-success" (click)="download(updateCandidate)"><clr-icon shape="check"></clr-icon></button>
|
||||
<button class="btn btn-icon btn-danger" (click)="cancelModal()"><clr-icon shape="times"></clr-icon></button>
|
||||
</div>
|
||||
</clr-modal>
|
||||
|
||||
<div class="clr-row">
|
||||
<div class="card clr-col-12 clr-col-sm-12 clr-col-md-12 clr-col-lg-12 clr-col-xl-12">
|
||||
<div class="card-header">
|
||||
Plugins
|
||||
</div>
|
||||
<clr-alert *ngFor="let entry of alerts" [clrAlertType]="line.severity">
|
||||
<clr-alert-item>
|
||||
<span class="alert-text">
|
||||
{{line.message}}
|
||||
</span>
|
||||
</clr-alert-item>
|
||||
</clr-alert>
|
||||
|
||||
<div *ngIf="loading" class="card-block">
|
||||
<span class="spinner spinner-inline"></span>
|
||||
</div>
|
||||
<div *ngIf="plugins.length !== 0 && !loading" class="card-block">
|
||||
<div class="card-text">
|
||||
<clr-datagrid>
|
||||
<clr-dg-column>Name</clr-dg-column>
|
||||
<clr-dg-column>Available</clr-dg-column>
|
||||
<clr-dg-column>Installed</clr-dg-column>
|
||||
<clr-dg-column>Status</clr-dg-column>
|
||||
|
||||
<clr-dg-row *clrDgItems="let line of plugins">
|
||||
<clr-dg-cell>{{line.name}}</clr-dg-cell>
|
||||
<clr-dg-cell>
|
||||
<span *ngIf="line.installed != line.available" class="label info">{{line.available}}</span>
|
||||
<span *ngIf="line.installed == line.available">{{line.available}}</span>
|
||||
</clr-dg-cell>
|
||||
<clr-dg-cell>{{line.installed}}</clr-dg-cell>
|
||||
<clr-dg-cell>{{line.status}}</clr-dg-cell>
|
||||
|
||||
<clr-dg-row-detail *clrIfExpanded>
|
||||
<button *ngIf="line.status === 'Stopped'" class="btn btn-icon btn-success-outline" (click)="start(line.name)"><clr-icon shape="play"></clr-icon></button>
|
||||
<button *ngIf="line.status === 'Running'" class="btn btn-icon btn-warning-outline" (click)="stop(line.name)"><clr-icon shape="pause"></clr-icon></button>
|
||||
<button *ngIf="line.status === 'Stopped'" class="btn btn-icon btn-danger-outline" (click)="delete(line.name)"><clr-icon shape="trash"></clr-icon></button>
|
||||
<button *ngIf="line.status === 'Available'" class="btn btn-icon btn-info-outline" (click)="showConfirmation(line.name)"><clr-icon shape="download"></clr-icon></button>
|
||||
<button *ngIf="line.available !== line.installed && line.status === 'Stopped'" class="btn btn-icon btn-outline " (click)="showConfirmation(line.name)">
|
||||
<clr-icon shape="sync"></clr-icon>
|
||||
</button>
|
||||
</clr-dg-row-detail>
|
||||
</clr-dg-row>
|
||||
<clr-dg-footer>
|
||||
<clr-dg-pagination #pagination [clrDgPageSize]="10">
|
||||
<clr-dg-page-size [clrPageSizeOptions]="[10,20,50,100]">per page</clr-dg-page-size>
|
||||
{{pagination.firstItem + 1}} - {{pagination.lastItem + 1}}
|
||||
of {{pagination.totalItems}}
|
||||
</clr-dg-pagination>
|
||||
</clr-dg-footer>
|
||||
</clr-datagrid>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<button *ngIf="!reloading" class="btn btn-sm btn-link" (click)="reload()">Check</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
export class PluginsComponent implements OnInit {
|
||||
plugins = [{
|
||||
name: "test",
|
||||
available: "0.0.1",
|
||||
installed: "0.0.1",
|
||||
status: "Running"
|
||||
}, {
|
||||
name: "test II: Return of test",
|
||||
available: "0.0.1",
|
||||
installed: "0.0.1",
|
||||
status: "Stopped"
|
||||
}, {
|
||||
name: "test 3",
|
||||
available: "0.0.2",
|
||||
installed: "",
|
||||
status: "Available"
|
||||
}, {
|
||||
name: "test IV: minor bump",
|
||||
available: "0.9.27",
|
||||
installed: "0.0.11",
|
||||
status: "Stopped"
|
||||
},]
|
||||
|
||||
reloading = false
|
||||
updatepending = false
|
||||
updateCandidate = ""
|
||||
|
||||
constructor() { }
|
||||
|
||||
start(name) {
|
||||
this.plugins.find((el) => el.name === name).status = "Running"
|
||||
}
|
||||
|
||||
stop(name) {
|
||||
this.plugins.find((el) => el.name === name).status = "Stopped"
|
||||
}
|
||||
|
||||
delete(name) {
|
||||
let plugin = this.plugins.find((el) => el.name === name)
|
||||
plugin.status = "Available"
|
||||
plugin.installed = ""
|
||||
}
|
||||
|
||||
showConfirmation(name) {
|
||||
this.updateCandidate = name
|
||||
this.updatepending = !this.updatepending
|
||||
}
|
||||
|
||||
download(name) {
|
||||
let plugin = this.plugins.find((el) => el.name === name)
|
||||
plugin.status = "Stopped"
|
||||
plugin.installed = plugin.available
|
||||
this.updatepending = !this.updatepending
|
||||
}
|
||||
|
||||
cancelModal() {
|
||||
this.updateCandidate = ""
|
||||
this.updatepending = !this.updatepending
|
||||
}
|
||||
|
||||
async reload(){
|
||||
this.reloading = true
|
||||
if(isDevMode()){
|
||||
await new Promise((resolve, reject) => {
|
||||
setTimeout(resolve, 1000)
|
||||
})
|
||||
this.plugins = this.plugins.map(plugin => {
|
||||
const parts = plugin.available.split('.')
|
||||
plugin.available = parts[0]+"."+parts[1]+"."+(parseInt(parts[2])+1)
|
||||
return plugin
|
||||
})
|
||||
this.reloading = false
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit() { }
|
||||
|
||||
}
|
||||
|
||||
@@ -1,174 +0,0 @@
|
||||
|
||||
|
||||
import { Component, OnInit, isDevMode } from '@angular/core';
|
||||
import { PluginsComponent } from './btc.component';
|
||||
import { ClrDatagridStringFilterInterface, ClrDatagridNumericFilterInterface, ClrDropdownModule } from '@clr/angular';
|
||||
declare const fb
|
||||
@Component({
|
||||
selector: 'address-viewer', //!!!!
|
||||
template: `
|
||||
<div class="clr-row">
|
||||
<div *ngIf="regularAddresses.length != 0" class="clr-col-12 clr-col-sm-12 clr-col-md-12 clr-col-lg-12 clr-col-xl-6">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
Addresses
|
||||
</div>
|
||||
<clr-alert *ngFor="let entry of alerts" [clrAlertType]="line.severity">
|
||||
<clr-alert-item>
|
||||
<span class="alert-text">
|
||||
{{line.message}}
|
||||
</span>
|
||||
</clr-alert-item>
|
||||
</clr-alert>
|
||||
|
||||
<clr-datagrid class="datagrid-compact ">
|
||||
<clr-dg-column>Address</clr-dg-column>
|
||||
<clr-dg-column>
|
||||
Balance
|
||||
</clr-dg-column>
|
||||
<clr-dg-column>
|
||||
Pending
|
||||
</clr-dg-column>
|
||||
<clr-dg-column>
|
||||
Estimate total
|
||||
<clr-dg-numeric-filter [clrDgNumericFilter]="otherBalanceFilter" [clrFilterValue]="[0, null]"></clr-dg-numeric-filter>
|
||||
</clr-dg-column>
|
||||
|
||||
<clr-dg-row *clrDgItems="let line of regularAddresses">
|
||||
<clr-dg-cell class="monospace" style="word-break: break-all">{{line.address}}</clr-dg-cell>
|
||||
<clr-dg-cell class="monospace">{{line.confirmed.balance | number: '1.8-18'}}</clr-dg-cell>
|
||||
<clr-dg-cell class="monospace">
|
||||
<span *ngIf="line.unconfirmed.balance != 0">
|
||||
{{line.unconfirmed.balance | number: '1.8-18'}}
|
||||
</span>
|
||||
</clr-dg-cell>
|
||||
<clr-dg-cell class="monospace">{{line.total.balance | number: '1.8-18'}}</clr-dg-cell>
|
||||
|
||||
<clr-dg-row-detail *clrIfExpanded >
|
||||
<div class="clr-row">
|
||||
<div class="clr-col-3">
|
||||
<button class="btn btn-info-outline" (click)="parent.addrExplorer(line.address)">Explorer</button>
|
||||
</div>
|
||||
|
||||
<div *ngIf="parent.keys[line.address] != null" class="clr-col-9" style="word-break:break-all">
|
||||
<h6 style="margin-top: 0">Derivation </h6>
|
||||
{{parent.keys[line.address].derivation}}
|
||||
<h6> Public key </h6>
|
||||
{{parent.keys[line.address].publicExtendedKey}}
|
||||
<h6> Private key </h6>
|
||||
{{parent.keys[line.address].privateExtendedKey}}
|
||||
</div>
|
||||
</div>
|
||||
</clr-dg-row-detail>
|
||||
</clr-dg-row>
|
||||
|
||||
<clr-dg-footer>
|
||||
<clr-dg-pagination #pagination2 [clrDgPageSize]="10">
|
||||
<clr-dg-page-size [clrPageSizeOptions]="[5,10,20,50,100]">per page</clr-dg-page-size>
|
||||
{{pagination2.firstItem + 1}} - {{pagination2.lastItem + 1}}
|
||||
of {{pagination2.totalItems}}
|
||||
</clr-dg-pagination>
|
||||
</clr-dg-footer>
|
||||
</clr-datagrid>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="changeAddresses.length != 0" class="clr-col-12 clr-col-sm-12 clr-col-md-12 clr-col-lg-12 clr-col-xl-6">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
Change Addresses
|
||||
</div>
|
||||
<clr-alert *ngFor="let entry of alerts" [clrAlertType]="line.severity">
|
||||
<clr-alert-item>
|
||||
<span class="alert-text">
|
||||
{{line.message}}
|
||||
</span>
|
||||
</clr-alert-item>
|
||||
</clr-alert>
|
||||
|
||||
<clr-datagrid class="datagrid-compact">
|
||||
<clr-dg-column>Address</clr-dg-column>
|
||||
<clr-dg-column>
|
||||
Balance
|
||||
</clr-dg-column>
|
||||
<clr-dg-column>
|
||||
Pending
|
||||
</clr-dg-column>
|
||||
<clr-dg-column>
|
||||
Estimate total
|
||||
<clr-dg-numeric-filter [clrDgNumericFilter]="balanceFilter" [clrFilterValue]="[0.00000001, null]"></clr-dg-numeric-filter>
|
||||
</clr-dg-column>
|
||||
|
||||
<clr-dg-row *clrDgItems="let line of changeAddresses">
|
||||
<clr-dg-cell class="monospace" style="word-break: break-all">{{line.address}}</clr-dg-cell>
|
||||
<clr-dg-cell class="monospace">{{line.confirmed.balance | number: '1.8-18'}}</clr-dg-cell>
|
||||
<clr-dg-cell class="monospace">
|
||||
<span *ngIf="line.unconfirmed.balance != 0">
|
||||
{{line.unconfirmed.balance | number: '1.8-18'}}
|
||||
</span>
|
||||
</clr-dg-cell>
|
||||
<clr-dg-cell class="monospace">{{line.total.balance | number: '1.8-18'}}</clr-dg-cell>
|
||||
|
||||
<clr-dg-row-detail *clrIfExpanded >
|
||||
<div class="clr-row">
|
||||
<div class="clr-col-3">
|
||||
<button class="btn btn-info-outline" (click)="parent.addrExplorer(line.address)">Explorer</button>
|
||||
<p>
|
||||
</div>
|
||||
|
||||
<div *ngIf="parent.keys[line.address] != null" class="clr-col-9" style="word-break:break-all">
|
||||
<h6 style="margin-top: 0">Derivation </h6>
|
||||
{{parent.keys[line.address].derivation}}
|
||||
<h6> Public key </h6>
|
||||
{{parent.keys[line.address].publicExtendedKey}}
|
||||
<h6> Private key </h6>
|
||||
{{parent.keys[line.address].privateExtendedKey}}
|
||||
</div>
|
||||
</div>
|
||||
</clr-dg-row-detail>
|
||||
</clr-dg-row>
|
||||
|
||||
<clr-dg-footer>
|
||||
<clr-dg-pagination #pagination [clrDgPageSize]="10">
|
||||
<clr-dg-page-size [clrPageSizeOptions]="[5,10,20,50,100]">per page</clr-dg-page-size>
|
||||
{{pagination.firstItem + 1}} - {{pagination.lastItem + 1}}
|
||||
of {{pagination.totalItems}}
|
||||
</clr-dg-pagination>
|
||||
</clr-dg-footer>
|
||||
</clr-datagrid>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
export class AddressViewerComponent implements OnInit{
|
||||
balanceFilter = new BalanceFilter()
|
||||
otherBalanceFilter = new BalanceFilter()
|
||||
regularAddresses = []
|
||||
changeAddresses = []
|
||||
keys = {}
|
||||
parent:PluginsComponent
|
||||
ngOnInit() { }
|
||||
|
||||
setParent(parent:PluginsComponent){
|
||||
this.parent = parent
|
||||
}
|
||||
|
||||
setRegularAddresses(addresses){
|
||||
this.regularAddresses = addresses
|
||||
}
|
||||
|
||||
setChangeAddresses(addresses){
|
||||
this.changeAddresses = addresses
|
||||
}
|
||||
}
|
||||
|
||||
class BalanceFilter implements ClrDatagridNumericFilterInterface<any>{
|
||||
accepts(item: any, low: number, high: number): boolean {
|
||||
high = parseFloat(""+high)
|
||||
low = parseFloat(""+low)
|
||||
const balance = (parseFloat(item.unconfirmed.balance) + parseFloat(item.confirmed.balance))
|
||||
return (Number.isNaN(low) || balance >= low)
|
||||
&& (Number.isNaN(high) || balance <= high)
|
||||
}
|
||||
}
|
||||
@@ -1,566 +0,0 @@
|
||||
import { Component, OnInit, isDevMode, ViewChild, AfterViewInit } from '@angular/core';
|
||||
import { WalletGeneratorComponent } from './wallet-generator.component';
|
||||
import { WalletPickerComponent } from './wallet-picker.component';
|
||||
import { HDKey } from "btc-hdkey"
|
||||
import { AddressViewerComponent } from './address-viewer.component';
|
||||
const fetch = require("node-fetch")
|
||||
const coinselect = require('coinselect/accumulative')
|
||||
import { TransactionBuilder, Signer } from 'bitcoinjs-lib'
|
||||
import { networks } from 'bitcoinjs-lib'
|
||||
let feeRate = 55 // satoshis per byte
|
||||
|
||||
const hdkey = new HDKey()
|
||||
declare const fb
|
||||
@Component({
|
||||
selector: 'plugins', //!!!!
|
||||
template: `
|
||||
|
||||
<wallet-generator></wallet-generator>
|
||||
|
||||
<!-- loading -->
|
||||
<clr-modal [clrModalSize]="'md'" [(clrModalOpen)]="loading">
|
||||
|
||||
<div class="modal-body ">
|
||||
<span class="spinner spinner-inverse spinner-md">
|
||||
Loading...
|
||||
</span>
|
||||
<h3>Checking addresses</h3> <br>
|
||||
Checking the first {{loadingN*115}} addresses. <br>
|
||||
Found addresses containing balance: {{regaddresses.length + changeaddresses.length}}
|
||||
</div>
|
||||
</clr-modal>
|
||||
<!-- / loading -->
|
||||
|
||||
<!-- row 0 -->
|
||||
<div *ngIf="mode.net == 'testnet'" class="clr-all-12">
|
||||
<div class="card">
|
||||
|
||||
<div class="card-header">
|
||||
Faucet
|
||||
</div>
|
||||
<div class="card-block" >
|
||||
<button class="btn btn-icon btn-info-outline" onclick="window.open('https://testnet-faucet.mempool.co/', '_blank')"><clr-icon shape="fuel"></clr-icon></button>
|
||||
<button class="btn btn-icon btn-info-outline" onclick="window.open('https://bitcoinfaucet.uo1.net/', '_blank')"><clr-icon shape="fuel"></clr-icon></button>
|
||||
<button class="btn btn-icon btn-info-outline" onclick="window.open('https://coinfaucet.eu/en/btc-testnet/', '_blank')"><clr-icon shape="fuel"></clr-icon></button>
|
||||
<button class="btn btn-icon btn-success-outline" onclick="window.open('https://www.google.com/search?q=btc+testnet+faucet&oq=btc+testnet+faucet', '_blank')"><clr-icon shape="plus"></clr-icon> more</button>
|
||||
</div>
|
||||
<div class="card-footer" >
|
||||
Get free test-BTC
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- row 1 -->
|
||||
<div class="clr-all-12">
|
||||
|
||||
<!-- wallet picker + send box + balance box -->
|
||||
<div class="clr-row">
|
||||
|
||||
<!-- left column -->
|
||||
<div class="clr-col-12 clr-col-sm-12 clr-col-md-12 clr-col-lg-5 clr-col-xl-5">
|
||||
|
||||
<!-- Wallet picker -->
|
||||
<div class="clr-row">
|
||||
<walletpicker class="clr-all-12"></walletpicker>
|
||||
</div>
|
||||
<!-- /Wallet picker -->
|
||||
|
||||
<!-- Send box -->
|
||||
<div *ngIf="mode.type=='private'" class="clr-row">
|
||||
|
||||
<div class="clr-all-12">
|
||||
<div class="card">
|
||||
|
||||
<div class="card-header">
|
||||
Send
|
||||
</div>
|
||||
<clr-alert *ngFor="let error of errors" [clrAlertType]="'danger'">
|
||||
<clr-alert-item>
|
||||
<span class="alert-text">
|
||||
{{error}}
|
||||
</span>
|
||||
</clr-alert-item>
|
||||
</clr-alert>
|
||||
<clr-alert *ngFor="let success of successes" [clrAlertType]="'success'">
|
||||
<clr-alert-item>
|
||||
<span class="alert-text">
|
||||
{{success}}
|
||||
</span>
|
||||
</clr-alert-item>
|
||||
</clr-alert>
|
||||
<div class="card-block" >
|
||||
|
||||
<div class="clr-row" style="padding-left:12px; padding-right:12px">
|
||||
<input [(ngModel)]="sendTo" type="text" placeholder="To address" class="clr-input clr-col-12" />
|
||||
<input [(ngModel)]="sendAmount" type="text" min="0" placeholder="Amount" class="clr-input clr-col-12" style="margin-top:12px; margin-borrom:12px" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer" >
|
||||
<button class="btn btn-success-outline" (click)="createAndSendTx(sendTo, sendAmount)">send</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- /Send Box -->
|
||||
|
||||
</div>
|
||||
<!-- /left column -->
|
||||
|
||||
<!-- right column -->
|
||||
<div class="clr-col-12 clr-col-sm-12 clr-col-md-12 clr-col-lg-7 clr-col-xl-7" >
|
||||
|
||||
<!-- Balance box -->
|
||||
<div *ngIf="rootkey.publicExtendedKey != ''" class="card">
|
||||
<div class="card-header" style="word-break: break-all">
|
||||
<span *ngIf="mode.net=='testnet'" class="label label-danger">Testnet</span>{{rootkey.publicExtendedKey}}
|
||||
</div>
|
||||
<clr-alert *ngFor="let entry of alerts" [clrAlertType]="line.severity">
|
||||
<clr-alert-item>
|
||||
<span class="alert-text">
|
||||
{{line.message}}
|
||||
</span>
|
||||
</clr-alert-item>
|
||||
</clr-alert>
|
||||
|
||||
<div class="card-block">
|
||||
<h3 style="margin-top:12px">{{balanceDisplay.total | number: '1.8-18'}} BTC </h3>
|
||||
<p class="monospace">
|
||||
<span *ngIf="balanceDisplay.unconfirmed < 0"> </span>{{balanceDisplay.confirmed | number: '1.18'}} BTC confirmed<br />
|
||||
{{balanceDisplay.unconfirmed | number: '1.18'}} BTC pending
|
||||
</p>
|
||||
<p *ngIf="mode.type=='private'">
|
||||
<clr-icon shape="key"></clr-icon> Private key available
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="card-footer" >
|
||||
<button class="btn btn-icon" (click)="reload()"> <clr-icon shape="refresh"></clr-icon> Reload </button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Balance box-->
|
||||
|
||||
</div>
|
||||
<!-- right column -->
|
||||
|
||||
</div>
|
||||
<!-- /row wallet picker + send box + balance box -->
|
||||
|
||||
<div class="clr-all-12" style="padding-left:0px; padding-right: 0px">
|
||||
<address-viewer></address-viewer>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /row 1 -->
|
||||
`
|
||||
})
|
||||
export class PluginsComponent implements AfterViewInit {
|
||||
errors:string[] = []
|
||||
successes:string[] = []
|
||||
wallets:WalletStore = {}
|
||||
txToSend:any
|
||||
rootkey:bip32Keypair = {publicExtendedKey: "",privateExtendedKey: ""}
|
||||
keys:KeyStore = {}
|
||||
regaddresses:AddressLine[] = []
|
||||
changeaddresses:AddressLine[] = []
|
||||
balanceDisplay = {
|
||||
confirmed: 0,
|
||||
total: 0,
|
||||
unconfirmed: 0
|
||||
}
|
||||
mode : {
|
||||
type:keyType,
|
||||
net:networkType
|
||||
} = {
|
||||
net: "testnet",
|
||||
type: "public"
|
||||
}
|
||||
sendTo:string
|
||||
sendAmount:number
|
||||
loading = false
|
||||
loadingN = 1
|
||||
|
||||
@ViewChild(AddressViewerComponent, {static: false})
|
||||
AddressViewerComponent:AddressViewerComponent
|
||||
|
||||
@ViewChild(WalletGeneratorComponent, {static: false})
|
||||
WalletGeneratorComponent:WalletGeneratorComponent
|
||||
|
||||
@ViewChild(WalletPickerComponent, {static: false})
|
||||
WalletPickerComponent:WalletPickerComponent
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
this.WalletGeneratorComponent.setParent(this)
|
||||
this.WalletPickerComponent.setParent(this)
|
||||
this.AddressViewerComponent.setParent(this)
|
||||
|
||||
window['btc'] = this
|
||||
|
||||
this.loadKey("tprv8cXm1S7PGS2fHuLjZajuDZZsvxerzv4zZJJAhkLAWZzwz5rE7efHm31xsqpzfoGMHBNC8bkRcsjiMdmkSuNn5C1qNqk7rrk1pCuhk4HfVak")
|
||||
}
|
||||
|
||||
addWallet(wallet){
|
||||
/* store somewhere */
|
||||
|
||||
this.wallets[wallet.name] = wallet
|
||||
this.WalletPickerComponent.setWallets(this.wallets)
|
||||
|
||||
}
|
||||
|
||||
showWizard(){
|
||||
this.WalletGeneratorComponent.open()
|
||||
}
|
||||
|
||||
loadKey(key:string){
|
||||
this.wallets = {}
|
||||
this.txToSend = null
|
||||
this.sendTo = ""
|
||||
this.regaddresses = []
|
||||
|
||||
const t = hdkey.checkHDKey(key)
|
||||
if(t){
|
||||
console.log(t)
|
||||
this.mode = t
|
||||
}
|
||||
|
||||
this.rootkey = hdkey.HDKeyFromExtendedKey(key)
|
||||
this.reload()
|
||||
}
|
||||
|
||||
async reload():Promise<void>{
|
||||
this.loading = true
|
||||
this.loadingN = 1
|
||||
this.keys = {}
|
||||
this.balanceDisplay.total = 0
|
||||
this.balanceDisplay.unconfirmed = 0
|
||||
this.balanceDisplay.confirmed = 0
|
||||
await this.refresh()
|
||||
this.loading = false
|
||||
}
|
||||
|
||||
async refresh():Promise<void>{
|
||||
let p1 = this.updateChange()
|
||||
let p2 = this.updateBalance()
|
||||
|
||||
let balances:GrandTotal[] = await Promise.all([p1,p2])
|
||||
balances.forEach(balance => {
|
||||
this.balanceDisplay.confirmed += balance.confirmed
|
||||
this.balanceDisplay.total += balance.total
|
||||
this.balanceDisplay.unconfirmed += balance.unconfirmed
|
||||
})
|
||||
|
||||
this.AddressViewerComponent.setChangeAddresses(this.changeaddresses)
|
||||
this.AddressViewerComponent.setRegularAddresses(this.regaddresses)
|
||||
}
|
||||
|
||||
getAddresses(rootAddr: string, n = 10, skip = 0, changeAddresses = false): string[] | null{
|
||||
let addresses: string[] = []
|
||||
for(let i = skip; i < skip+n; i++){
|
||||
let addr
|
||||
if(changeAddresses){
|
||||
addr = hdkey.deriveAddress(rootAddr, i, 'm/1/')
|
||||
}else{
|
||||
addr = hdkey.deriveAddress(rootAddr, i)
|
||||
}
|
||||
if(!addr){
|
||||
return
|
||||
}
|
||||
addresses.push(addr)
|
||||
}
|
||||
return addresses
|
||||
}
|
||||
|
||||
async fetchAddresses(addresses:string[], network:networkType): Promise<{success:boolean, address?:any, addresses?:any}>{
|
||||
let lookupstr = addresses.join(',')
|
||||
try{
|
||||
let r = await fetch(api[network]+'/address/'+lookupstr, {
|
||||
'method':'GET',
|
||||
'mode':'cors',
|
||||
'data': {limit: 200}
|
||||
})
|
||||
if(r.status !== 200){
|
||||
return {success: false}
|
||||
}
|
||||
|
||||
let json = (await r).json()
|
||||
return json
|
||||
}catch(e){
|
||||
return {success: false}
|
||||
}
|
||||
}
|
||||
|
||||
async getAddressInfos(rootAddr: string, n = 10, skip = 0, changeAddresses = false): Promise<any>{
|
||||
const t = hdkey.checkHDKey(rootAddr)
|
||||
if(!t){
|
||||
return false
|
||||
}
|
||||
const addresses = this.getAddresses(rootAddr, n, skip, changeAddresses)
|
||||
return await this.fetchAddresses(addresses, t.net)
|
||||
|
||||
}
|
||||
|
||||
async getTxs(address: string, type:networkType){
|
||||
try{
|
||||
let r = await fetch(api[type]+'/address/'+address, {
|
||||
'method':'GET',
|
||||
'mode':'cors'
|
||||
})
|
||||
if(r.status !== 200){
|
||||
return {success: false}
|
||||
}
|
||||
|
||||
return (await r).json()
|
||||
}catch(e){
|
||||
console.warn ("getTxs", e)
|
||||
}
|
||||
}
|
||||
|
||||
async getUnspentTxs(addresses:string[], type:networkType):Promise<any>{
|
||||
let lookupstr = addresses.join(',')
|
||||
|
||||
try{
|
||||
let r = await fetch(api[type]+'/address/'+lookupstr+'/unspent', {
|
||||
'method':'GET',
|
||||
'mode':'cors'
|
||||
})
|
||||
if(r.status !== 200){
|
||||
return {success: false}
|
||||
}
|
||||
|
||||
return (await r).json()
|
||||
}catch(e){
|
||||
console.warn ("getUnspentTxs", e)
|
||||
return {success: false}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
getKeyForAddress(keyName){
|
||||
return this.keys[keyName]
|
||||
}
|
||||
|
||||
calculateTotal(addresses:AddressLine[]):GrandTotal{
|
||||
const resMap: any = addresses.reduce((o1, o2)=>{o1[o2.address] = o2; return o1}, {})
|
||||
const total: any = Object.values(resMap).reduce((accum:GrandTotal, obj:AddressLine) => {
|
||||
accum.confirmed += parseFloat(<any>obj.confirmed.balance)
|
||||
accum.unconfirmed += parseFloat(<any>obj.unconfirmed.balance)
|
||||
accum.total += parseFloat(<any>obj.confirmed.balance) + parseFloat(<any>obj.unconfirmed.balance)
|
||||
return accum
|
||||
},{
|
||||
confirmed: 0,
|
||||
unconfirmed: 0,
|
||||
total: 0
|
||||
})
|
||||
|
||||
return total
|
||||
}
|
||||
|
||||
async updateBalance():Promise<GrandTotal>{
|
||||
let n = 1
|
||||
let res: { success: boolean; addresses: any; address: any; }
|
||||
this.regaddresses = []
|
||||
while(true){
|
||||
this.loadingN = n
|
||||
try{
|
||||
res = await this.getAddressInfos(this.rootkey.publicExtendedKey, 115*n, 115*(n-1))
|
||||
}catch(e){
|
||||
break
|
||||
}
|
||||
if(res.success === true){
|
||||
if('addresses' in res){ // multiple
|
||||
this.regaddresses = [...this.regaddresses, ...res.addresses]
|
||||
}
|
||||
if('address' in res){
|
||||
this.regaddresses.push(res.address)
|
||||
}
|
||||
n++
|
||||
}else{
|
||||
console.warn(`This error is a result of a failed fetch request.
|
||||
These are always shown by the browser and cannot be hidden (a design decision)
|
||||
They are completely safe and mean no more addresses were found`)
|
||||
console.log('No more balance found after attempting ', 115*n, 'addresses')
|
||||
if(this.mode.type == "private"){
|
||||
for(let i = 0; i < 115*n+1; i++){
|
||||
const keyN = hdkey.deriveKey(this.rootkey.privateExtendedKey, i)
|
||||
const addrN = hdkey.addressFromHDKey(keyN._publicKey, this.mode.net)
|
||||
keyN.derivation = i
|
||||
this.keys[addrN] = keyN
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
//add an extra empty address at the end
|
||||
const extraAddr = hdkey.deriveAddress(this.rootkey.publicExtendedKey, this.regaddresses.length)
|
||||
this.regaddresses.push({
|
||||
address: <string>extraAddr,
|
||||
confirmed: {balance: 0},
|
||||
unconfirmed: {balance: 0},
|
||||
total: {balance: 0},
|
||||
})
|
||||
|
||||
return this.calculateTotal(this.regaddresses)
|
||||
}
|
||||
|
||||
async updateChange():Promise<GrandTotal>{
|
||||
let n = 1
|
||||
this.changeaddresses = []
|
||||
while(true){
|
||||
let res
|
||||
try{
|
||||
res = await this.getAddressInfos(this.rootkey.publicExtendedKey, 115*n, 115*(n-1), true)
|
||||
}catch(e){
|
||||
break
|
||||
}
|
||||
if(res.success === true){
|
||||
if('addresses' in res){ // multiple
|
||||
this.changeaddresses = [...this.changeaddresses, ...res.addresses]
|
||||
}
|
||||
if('address' in res){
|
||||
this.changeaddresses.push(res.address)
|
||||
}
|
||||
n++
|
||||
}else{
|
||||
console.warn(`This error is a result of a failed fetch request.
|
||||
These are always shown by the browser and cannot be hidden (a design decision)
|
||||
They are completely safe and mean no more addresses were found`)
|
||||
console.log('No more change balance found after attempting ', 115*n, 'addresses')
|
||||
if(this.mode.type == "private"){
|
||||
//make keypairs for addresses
|
||||
for(let i = 0; i < 115*n; i++){
|
||||
const keyN = hdkey.deriveKey(this.rootkey.privateExtendedKey, i, 'm/1/')
|
||||
const addrN = hdkey.addressFromHDKey(keyN._publicKey, this.mode.net)
|
||||
keyN.derivation = i
|
||||
this.keys[addrN] = keyN
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return this.calculateTotal(this.changeaddresses)
|
||||
}
|
||||
|
||||
async createAndSendTx(target:string, value:number){
|
||||
|
||||
if(target == null || typeof target !== 'string' || target === '' || value == null || value <= 0 ){
|
||||
this.errors.push('Bad inputs. Expected bitcoin address and number')
|
||||
return
|
||||
}
|
||||
|
||||
if(value > this.balanceDisplay.confirmed){
|
||||
this.errors.push('Insufficient funds')
|
||||
return
|
||||
}
|
||||
|
||||
let addresses: string[] = [...this.regaddresses.map(a => a.address), ...this.changeaddresses.map(a => a.address)]
|
||||
const txs = await this.getUnspentTxs(addresses, this.mode.net)
|
||||
|
||||
if(txs == null || txs.success !== true || txs.unspent.length === 0){
|
||||
this.errors.push('No UTXOs found')
|
||||
return
|
||||
}
|
||||
|
||||
const utxos = txs.unspent.map(t => {
|
||||
return {
|
||||
address: t.addresses[0],
|
||||
txId: t.txid,
|
||||
vout: t.n,
|
||||
value: t.value * 100000000
|
||||
}
|
||||
})
|
||||
|
||||
let { inputs, outputs, fee } = coinselect(utxos, [{address: target, value: value*100000000}], feeRate)
|
||||
|
||||
// .inputs and .outputs will be undefined if no solution was found
|
||||
if (!inputs || !outputs){
|
||||
this.errors.push('Could not build a valid transaction')
|
||||
return
|
||||
}
|
||||
|
||||
const txb = new TransactionBuilder(networks[this.mode.net])
|
||||
|
||||
|
||||
txb.setVersion(1)
|
||||
inputs.forEach((input) => {
|
||||
txb.addInput(input.txId, input.vout)
|
||||
})
|
||||
outputs.forEach((output) => {
|
||||
if (!output.address) {
|
||||
output.address = hdkey.deriveAddress(this.rootkey.publicExtendedKey, this.changeaddresses.length, 'm/1/')
|
||||
}
|
||||
txb.addOutput(output.address, output.value)
|
||||
})
|
||||
inputs.forEach((input, i) => {
|
||||
txb.sign(i, <Signer>this.keys[input.address])
|
||||
})
|
||||
|
||||
this.txToSend = txb.build()
|
||||
|
||||
this.sendTx()
|
||||
}
|
||||
|
||||
private async sendTx(){
|
||||
if(this.txToSend == null){
|
||||
this.errors.push('No transaction to send!')
|
||||
return
|
||||
}
|
||||
|
||||
let url = api[this.mode.net]+"/pushtx"
|
||||
let r
|
||||
try{
|
||||
r = await fetch(url, {
|
||||
'method':'POST',
|
||||
'body': JSON.stringify({'hex': this.txToSend.toHex()})
|
||||
})
|
||||
}catch(e){
|
||||
console.warn("sendTx", e)
|
||||
return
|
||||
}
|
||||
this.txToSend = null
|
||||
if(r.status === 200){
|
||||
this.errors = []
|
||||
this.successes.push("Sent "+this.sendAmount+" to "+this.sendTo)
|
||||
this.reload()
|
||||
}else{
|
||||
this.errors.push('The API '+url+' returned a non-200 error code '+r.status+' '+r.statusText)
|
||||
}
|
||||
}
|
||||
|
||||
addrExplorer(address){
|
||||
const url = this.mode.net === 'testnet'?'https://live.blockcypher.com/btc-testnet/address/':'https://live.blockcypher.com/btc/address/'
|
||||
window.open(url+address, '_blank')
|
||||
}
|
||||
}
|
||||
|
||||
export type KeyStore = {[keyname in string]: bip32Keypair & Signer}
|
||||
|
||||
export type AddressLine = {
|
||||
address: string,
|
||||
confirmed: {balance: number},
|
||||
unconfirmed: {balance: number},
|
||||
total: {balance: number},
|
||||
}
|
||||
|
||||
type networkType = 'testnet' | 'mainnet'
|
||||
type keyType = 'public' | 'private'
|
||||
type WalletStore = {
|
||||
[address in string]:{
|
||||
key:string
|
||||
name:string
|
||||
}
|
||||
}
|
||||
type GrandTotal = {
|
||||
confirmed: number,
|
||||
unconfirmed: number,
|
||||
total: number
|
||||
}
|
||||
type bip32Keypair = { publicExtendedKey: string, privateExtendedKey: string }
|
||||
|
||||
const api = {
|
||||
testnet: 'https://testnet-api.smartbit.com.au/v1/blockchain',
|
||||
mainnet: 'https://api.smartbit.com.au/v1/blockchain'
|
||||
}
|
||||
@@ -1,266 +0,0 @@
|
||||
import { Component, OnInit, isDevMode, ViewChild } from '@angular/core';
|
||||
import { ClrWizard } from '@clr/angular';
|
||||
import { HDKey } from "btc-hdkey"
|
||||
import { PluginsComponent } from './btc.component';
|
||||
|
||||
declare const fb
|
||||
@Component({
|
||||
selector: 'wallet-generator', //!!!!
|
||||
template: `
|
||||
<clr-wizard #wizard [(clrWizardOpen)]="mdOpen" [clrWizardForceForwardNavigation]="true" clrWizardSize="lg">
|
||||
<clr-wizard-title>Bitcoin wallet generator and importer</clr-wizard-title>
|
||||
|
||||
<clr-wizard-button [type]="'cancel'">Cancel</clr-wizard-button>
|
||||
<clr-wizard-button [type]="'previous'">Back</clr-wizard-button>
|
||||
<clr-wizard-button [type]="'next'">Next</clr-wizard-button>
|
||||
<clr-wizard-button [type]="'finish'">Finish</clr-wizard-button>
|
||||
|
||||
<clr-wizard-page (clrWizardPageCustomButton)="doCustomClick($event)">
|
||||
<ng-template clrPageTitle>Menemonic/BIP39 (optional)</ng-template>
|
||||
<ng-template clrPageNavTitle>
|
||||
Menemonic/BIP39
|
||||
</ng-template>
|
||||
<p>
|
||||
A menemonic is a collection of words that is supposed to be easier to remember than a complex seed. It may be used to reconstruct the private key.
|
||||
</p>
|
||||
<p>
|
||||
Enter your menemonic below or generate a new one.
|
||||
</p>
|
||||
<textarea [(ngModel)]="menemonic" class="clr-textarea" style="margin-top: 24px; width: 100%; height: 200px">{{menemonic}}</textarea>
|
||||
<div class="clr-row">
|
||||
<clr-checkbox-wrapper class="clr-col">
|
||||
<input type="checkbox" clrCheckbox value="testnet" name="testnet1" [(ngModel)]="testnet" />
|
||||
<label>testnet</label>
|
||||
</clr-checkbox-wrapper>
|
||||
<button class="btn btn-outline-success clr-col" (click)="generateMenemonic()">{{"Generate"}}</button>
|
||||
</div>
|
||||
<ng-template clrPageButtons>
|
||||
<clr-wizard-button [type]="'cancel'">Cancel</clr-wizard-button>
|
||||
<clr-wizard-button [type]="'menemonic-next'">{{menemonic.length==0?"Skip":"Next"}}</clr-wizard-button>
|
||||
</ng-template>
|
||||
</clr-wizard-page>
|
||||
|
||||
<clr-wizard-page (clrWizardPageCustomButton)="doCustomClick($event)">
|
||||
<ng-template clrPageTitle>Seed phrase (optional)</ng-template>
|
||||
<ng-template clrPageNavTitle>
|
||||
Seed phrase
|
||||
</ng-template>
|
||||
<p>
|
||||
If you entered a menemonic in the previous step, a seed was generated from it.
|
||||
</p>
|
||||
<p>
|
||||
If you would like to use your own seed enter it below. Use something sufficiently hard to guess.
|
||||
</p>
|
||||
<textarea class="clr-textarea" (ngModelChange)="updateSeed()" [(ngModel)]="seed" style="margin-top: 24px; width: 100%; height: 200px">{{seed}}</textarea>
|
||||
<clr-checkbox-wrapper>
|
||||
<input type="checkbox" clrCheckbox value="testnet" name="testnet2" [(ngModel)]="testnet" />
|
||||
<label>testnet</label>
|
||||
</clr-checkbox-wrapper>
|
||||
<ng-template clrPageButtons>
|
||||
<clr-wizard-button [type]="'cancel'">Cancel</clr-wizard-button>
|
||||
<clr-wizard-button [type]="'back'">Back</clr-wizard-button>
|
||||
<clr-wizard-button [type]="'seed-next'">{{seed.length==0?"Skip":"Next"}}</clr-wizard-button>
|
||||
</ng-template>
|
||||
</clr-wizard-page>
|
||||
|
||||
<clr-wizard-page [clrWizardPageNextDisabled]="keyInvalid" (clrWizardPageCustomButton)="doCustomClick($event)">
|
||||
<ng-template clrPageTitle>Extended Key/BIP32</ng-template>
|
||||
<p>
|
||||
Accepts keys in the xpub and xprv (BIP32) format
|
||||
</p>
|
||||
<textarea [(ngModel)]="key" (ngModelChange)="updateKey()"class="clr-textarea" style="margin-top: 24px; width: 100%; height: 200px"></textarea>
|
||||
</clr-wizard-page>
|
||||
|
||||
<clr-wizard-page class="break-word" (clrWizardPageCustomButton)="doCustomClick($event)">
|
||||
<ng-template clrPageTitle>Confirm</ng-template>
|
||||
|
||||
<div class="alert alert-danger" role="alert">
|
||||
<div class="alert-items">
|
||||
<div class="alert-item static">
|
||||
<div class="alert-icon-wrapper">
|
||||
<clr-icon class="alert-icon" shape="exclamation-circle"></clr-icon>
|
||||
</div>
|
||||
<span class="alert-text">
|
||||
Do not give any of this information to other people! Even your public key holds the power to correlate all your addresses back to you!
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="keypair.privateExtendedKey != null && keypair.privateExtendedKey.length != 0" class="alert alert-warning" role="alert">
|
||||
<div class="alert-items">
|
||||
<div class="alert-item static">
|
||||
<div class="alert-icon-wrapper">
|
||||
<clr-icon class="alert-icon" shape="exclamation-circle"></clr-icon>
|
||||
</div>
|
||||
<span class="alert-text">
|
||||
WARNING: A private key is not required for operating frontblock
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="keypair.privateExtendedKey != null && keypair.privateExtendedKey.length != 0" class="alert alert-info" role="alert">
|
||||
<div class="alert-items">
|
||||
<div class="alert-item static">
|
||||
<div class="alert-icon-wrapper">
|
||||
<clr-icon class="alert-icon" shape="exclamation-circle"></clr-icon>
|
||||
</div>
|
||||
<span class="alert-text">
|
||||
HINT: You can exclusively store the public key by going back one step and importing the xpub you just created
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="left">Type</th>
|
||||
<th class="left">Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngIf="menemonic.length != 0">
|
||||
<td class="left"> menemonic</td>
|
||||
<td class="left">{{menemonic}}</td>
|
||||
</tr>
|
||||
<tr *ngIf="seed.length != 0">
|
||||
<td class="left"> seed</td>
|
||||
<textarea rows="3" class="clr-textarea left" [ngModel]="seed" style="width: 100%"></textarea>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="left"> xpub</td>
|
||||
<textarea rows="3" class="clr-textarea left" [ngModel]="keypair.publicExtendedKey" style="width: 100%"></textarea>
|
||||
</tr>
|
||||
<tr *ngIf="keypair.privateExtendedKey != null && keypair.privateExtendedKey.length != 0">
|
||||
<td class="left"> xprv</td>
|
||||
<textarea rows="3" class="clr-textarea left" [ngModel]="keypair.privateExtendedKey" style="width: 100%"></textarea>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<clr-checkbox-wrapper>
|
||||
<input type="checkbox" clrCheckbox value="option1" name="options" />
|
||||
<label>I understand this is important</label>
|
||||
</clr-checkbox-wrapper>
|
||||
<ng-template clrPageButtons>
|
||||
<clr-wizard-button [type]="'cancel'">Cancel</clr-wizard-button>
|
||||
<clr-wizard-button [type]="'back'">Back</clr-wizard-button>
|
||||
<clr-wizard-button class="btn btn-success" [type]="'myfinish'">Finish</clr-wizard-button>
|
||||
</ng-template>
|
||||
</clr-wizard-page>
|
||||
</clr-wizard>
|
||||
|
||||
`
|
||||
})
|
||||
export class WalletGeneratorComponent implements OnInit {
|
||||
@ViewChild("wizard", {static: false}) wizard: ClrWizard;
|
||||
key:string = ""
|
||||
keyInvalid = true
|
||||
accept = false
|
||||
seed:string = ""
|
||||
mdOpen: boolean = false
|
||||
checkKey: boolean = true
|
||||
menemonic:string = ""
|
||||
keypair: any = {}
|
||||
testnet: boolean = false
|
||||
profileName
|
||||
private hdKey = new HDKey()
|
||||
private parent:PluginsComponent
|
||||
|
||||
ngOnInit() { }
|
||||
|
||||
open(){
|
||||
this.key = ""
|
||||
this.keyInvalid = true
|
||||
this.seed = ""
|
||||
this.checkKey = true
|
||||
this.menemonic = ""
|
||||
this.keypair = {}
|
||||
this.testnet = false
|
||||
this.wizard.reset()
|
||||
this.mdOpen = true
|
||||
}
|
||||
|
||||
setParent(parent:PluginsComponent){
|
||||
this.parent = parent
|
||||
}
|
||||
|
||||
async generateMenemonic(){
|
||||
this.menemonic = this.hdKey.randomMenemonic()
|
||||
}
|
||||
|
||||
async seedFromMenemonic(){
|
||||
try{
|
||||
this.seed = this.hdKey.seedFromMenemonic(this.menemonic)
|
||||
}catch(e){
|
||||
/* invalid menemonic */
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
|
||||
async accountFromSeed(){
|
||||
this.keypair = this.hdKey.deriveAccount(this.seed, this.testnet?"testnet":"mainnet", 0)
|
||||
console.log(this.keypair)
|
||||
this.key = this.keypair.privateExtendedKey != null?this.keypair.privateExtendedKey:this.keypair.publicExtendedKey
|
||||
this.keyInvalid = false
|
||||
}
|
||||
|
||||
async importKey(){
|
||||
this.hdKey.HDKeyFromExtendedKey(this.key)
|
||||
}
|
||||
|
||||
checkBip32(){
|
||||
return this.hdKey.checkHDKey(this.keypair.privateExtendedKey != null?this.keypair.privateExtendedKey:this.keypair.publicExtendedKey)
|
||||
}
|
||||
|
||||
finish(){
|
||||
this.parent.addWallet({
|
||||
name: this.key.substr(4,15),
|
||||
key: this.key
|
||||
})
|
||||
}
|
||||
|
||||
public doCustomClick(buttonType: string): void {
|
||||
if ("menemonic-next" === buttonType) {
|
||||
if(this.menemonic.length != 0){
|
||||
this.seedFromMenemonic()
|
||||
}
|
||||
this.wizard.next();
|
||||
}
|
||||
|
||||
if ("myfinish" === buttonType) {
|
||||
this.finish()
|
||||
this.wizard.close()
|
||||
}
|
||||
|
||||
if ("seed-next" === buttonType) {
|
||||
if(this.seed.length != 0){
|
||||
this.accountFromSeed()
|
||||
}
|
||||
this.wizard.next();
|
||||
}
|
||||
|
||||
if ("back" === buttonType) {
|
||||
this.wizard.previous();
|
||||
}
|
||||
}
|
||||
|
||||
updateSeed(){
|
||||
this.menemonic = ""
|
||||
}
|
||||
|
||||
updateKey(){
|
||||
this.keyInvalid = true
|
||||
this.menemonic = ""
|
||||
this.seed = ""
|
||||
let key
|
||||
try{
|
||||
key = this.hdKey.HDKeyFromExtendedKey(this.key)
|
||||
}catch(e){
|
||||
/* invalid key */
|
||||
console.log("bad key")
|
||||
}
|
||||
if(key){
|
||||
this.keypair = key
|
||||
this.keyInvalid = false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
|
||||
|
||||
import { Component, OnInit, isDevMode } from '@angular/core';
|
||||
import { PluginsComponent } from './btc.component';
|
||||
declare const fb
|
||||
@Component({
|
||||
selector: 'walletpicker', //!!!!
|
||||
|
||||
template: `
|
||||
<div class="card" style="overflow:hidden; padding-bottom:12px">
|
||||
<div class="card-header">
|
||||
Wallets
|
||||
</div>
|
||||
<clr-alert *ngFor="let entry of alerts" [clrAlertType]="line.severity">
|
||||
<clr-alert-item>
|
||||
<span class="alert-text">
|
||||
{{line.message}}
|
||||
</span>
|
||||
</clr-alert-item>
|
||||
</clr-alert>
|
||||
|
||||
<clr-tree-node style="margin-top:12px; margin-bottom:12px">
|
||||
<a style="cursor:pointer" (click)="parent.showWizard()"><clr-icon shape="download" class="is-solid"></clr-icon> New / Import</a>
|
||||
</clr-tree-node>
|
||||
<clr-tree-node *ngFor="let line of wallets">
|
||||
<a style="cursor:pointer" (click)="parent.loadKey(line.key)">
|
||||
<clr-icon *ngIf="line.key.startsWith('xpub') || line.key.startsWith('tpub')" shape="lock" class="is-solid"></clr-icon>
|
||||
<clr-icon *ngIf="line.key.startsWith('xprv') || line.key.startsWith('tprv')" shape="key" class="is-solid"></clr-icon>
|
||||
{{line.name}}
|
||||
</a>
|
||||
</clr-tree-node>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
export class WalletPickerComponent implements OnInit {
|
||||
private parent:PluginsComponent
|
||||
wallets = []
|
||||
|
||||
setWallets(wallets){
|
||||
this.wallets = Object.values(wallets)
|
||||
}
|
||||
|
||||
setParent(parent:PluginsComponent){
|
||||
this.parent = parent
|
||||
}
|
||||
|
||||
ngOnInit() { }
|
||||
|
||||
}
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import { PluginsComponent } from './btc/btc.component';
|
||||
import { WalletPickerComponent } from './btc/wallet-picker.component';
|
||||
import { AddressViewerComponent } from './btc/address-viewer.component';
|
||||
|
||||
import { FrontendPlugin, SidebarEntries } from 'frontblock-generic/Plugin';
|
||||
import { ClarityModule } from '@clr/angular';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { WalletGeneratorComponent } from './btc/wallet-generator.component';
|
||||
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
FormsModule,
|
||||
ClarityModule,
|
||||
|
||||
CommonModule,
|
||||
RouterModule.forChild([
|
||||
{path: "btc", component: PluginsComponent},
|
||||
]),
|
||||
],
|
||||
exports: [RouterModule],
|
||||
declarations: [
|
||||
PluginsComponent,
|
||||
WalletPickerComponent,
|
||||
AddressViewerComponent,
|
||||
WalletGeneratorComponent
|
||||
]
|
||||
})
|
||||
export class PluginModule implements FrontendPlugin{
|
||||
getSidebarEntry(): SidebarEntries {
|
||||
return {
|
||||
icon: "wallet",
|
||||
text: "Wallets",
|
||||
parentRoute: "wallet",
|
||||
links: [{
|
||||
route: "btc",
|
||||
text: "BTC Wallet"
|
||||
},{
|
||||
route: "ltc",
|
||||
text: "LTC Wallet"
|
||||
},{
|
||||
route: "eth",
|
||||
text: "ETH Wallet"
|
||||
},{
|
||||
route: "xrp",
|
||||
text: "XRP Wallet"
|
||||
},{
|
||||
route: "xlm",
|
||||
text: "XLM Wallet"
|
||||
},{
|
||||
route: "settings",
|
||||
text: "Settings"
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
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 { environment } from 'src/environments/environment';
|
||||
|
||||
const routes: Routes = [{
|
||||
path: "",
|
||||
component: HomeComponent
|
||||
},{
|
||||
path: "**",
|
||||
component: ErrorDisplayComponent
|
||||
}];
|
||||
|
||||
export function getRoutes(){
|
||||
return routes
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forRoot(routes)],
|
||||
exports: [RouterModule],
|
||||
})
|
||||
export class AppRoutingModule {
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
<clr-main-container >
|
||||
<header-bar></header-bar>
|
||||
<subnav></subnav>
|
||||
<dynamic-loader style="height: 100%;"></dynamic-loader>
|
||||
</clr-main-container>
|
||||
@@ -1,35 +0,0 @@
|
||||
import { TestBed, async } from '@angular/core/testing';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { AppComponent } from './app.component';
|
||||
|
||||
describe('AppComponent', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
RouterTestingModule
|
||||
],
|
||||
declarations: [
|
||||
AppComponent
|
||||
],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
it('should create the app', () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.debugElement.componentInstance;
|
||||
expect(app).toBeTruthy();
|
||||
});
|
||||
|
||||
it(`should have as title 'dashboard'`, () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.debugElement.componentInstance;
|
||||
expect(app.title).toEqual('dashboard');
|
||||
});
|
||||
|
||||
it('should render title in a h1 tag', () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
fixture.detectChanges();
|
||||
const compiled = fixture.debugElement.nativeElement;
|
||||
expect(compiled.querySelector('h1').textContent).toContain('Welcome to dashboard!');
|
||||
});
|
||||
});
|
||||
@@ -1,32 +0,0 @@
|
||||
import { Component, ChangeDetectorRef, NgZone, ViewChild, OnInit, AfterContentInit, isDevMode } from '@angular/core';
|
||||
import { SidebarComponent } from './sidebar/sidebar.component';
|
||||
import { SidebarEntryService } from './sidebar-entry-service.service';
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
templateUrl: './app.component.html',
|
||||
styleUrls: ['./app.component.scss']
|
||||
})
|
||||
export class AppComponent implements AfterContentInit {
|
||||
title = 'dashboard';
|
||||
|
||||
@ViewChild(SidebarComponent, {static: false})
|
||||
sidebar: SidebarComponent
|
||||
|
||||
constructor(private zone:NgZone, private sidebarService: SidebarEntryService){
|
||||
window["refresh"] = setInterval(() => zone.run(()=>{ /*this triggers an angular reload*/}), 200)
|
||||
if(isDevMode()){
|
||||
require("../assets/FrontblockLib")
|
||||
}
|
||||
}
|
||||
|
||||
ngAfterContentInit(){
|
||||
const _this = this;
|
||||
(function awaitSidebar(){
|
||||
if(_this.sidebar != null){
|
||||
_this.sidebarService.setSidebar(_this.sidebar)
|
||||
return
|
||||
}
|
||||
setTimeout(awaitSidebar,25)
|
||||
})()
|
||||
}
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { AppRoutingModule } from './app-routing.module';
|
||||
|
||||
import { ClarityModule } from '@clr/angular';
|
||||
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import { COMPILER_OPTIONS, CompilerFactory, Compiler } from '@angular/core';
|
||||
import { JitCompilerFactory } from '@angular/platform-browser-dynamic';
|
||||
|
||||
import { AppComponent } from './app.component';
|
||||
import { SidebarComponent } from './sidebar/sidebar.component';
|
||||
import { MainComponent } from './content-area/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 { HeaderBarComponent } from './header-bar/header-bar.component';
|
||||
import { SubnavComponent } from './subnav/subnav.component';
|
||||
|
||||
import { environment } from 'src/environments/environment';
|
||||
|
||||
export function createCompiler(fn: CompilerFactory): Compiler {
|
||||
return fn.createCompiler();
|
||||
}
|
||||
|
||||
const declarations = [
|
||||
AppComponent,
|
||||
|
||||
SidebarComponent,
|
||||
MainComponent,
|
||||
DynamicLoaderComponent,
|
||||
HomeComponent,
|
||||
HeaderBarComponent,
|
||||
ErrorDisplayComponent,
|
||||
SubnavComponent,
|
||||
]
|
||||
|
||||
@NgModule({
|
||||
declarations: declarations,
|
||||
imports: [
|
||||
FormsModule,
|
||||
BrowserModule,
|
||||
BrowserAnimationsModule,
|
||||
ClarityModule,
|
||||
AppRoutingModule,
|
||||
],
|
||||
entryComponents: [],
|
||||
providers: [
|
||||
{
|
||||
provide: COMPILER_OPTIONS,
|
||||
useValue: {},
|
||||
multi: true
|
||||
},
|
||||
{
|
||||
provide: CompilerFactory,
|
||||
useClass: JitCompilerFactory,
|
||||
deps: [COMPILER_OPTIONS]
|
||||
},
|
||||
{
|
||||
provide: Compiler,
|
||||
useFactory: createCompiler,
|
||||
deps: [CompilerFactory]
|
||||
}
|
||||
],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
export class AppModule{
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
<div class="content-area" style="max-height: 100%">
|
||||
<router-outlet class="clr-all-12" ></router-outlet>
|
||||
</div>
|
||||
@@ -1,25 +0,0 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { MainComponent } from './main.component';
|
||||
|
||||
describe('MainComponent', () => {
|
||||
let component: MainComponent;
|
||||
let fixture: ComponentFixture<MainComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ MainComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(MainComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,17 +0,0 @@
|
||||
import { Component, OnInit, ViewContainerRef, ViewChild } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'content-area',
|
||||
templateUrl: './main.component.html',
|
||||
styleUrls: ['./main.component.scss']
|
||||
})
|
||||
export class MainComponent implements OnInit {
|
||||
|
||||
@ViewChild('content', { read: ViewContainerRef, static: false })
|
||||
content: ViewContainerRef;
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
<div class="content-container" style="height: 100%;">
|
||||
<sidebar></sidebar>
|
||||
<content-area style="height: 100%; width: 100%"></content-area>
|
||||
</div>
|
||||
@@ -1,3 +0,0 @@
|
||||
.heightmax{
|
||||
height: 100%!important;
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DynamicLoaderComponent } from './dynamic-loader.component';
|
||||
|
||||
describe('DynamicLoaderComponent', () => {
|
||||
let component: DynamicLoaderComponent;
|
||||
let fixture: ComponentFixture<DynamicLoaderComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ DynamicLoaderComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(DynamicLoaderComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,115 +0,0 @@
|
||||
/**
|
||||
* Set existing vendor modules into SystemJS registry.
|
||||
* This way SystemJS won't make HTTP requests to fetch imported modules
|
||||
* needed by the dynamicaly loaded Widgets.
|
||||
*/
|
||||
import { System } from 'systemjs';
|
||||
declare const SystemJS: System;
|
||||
|
||||
import * as angularRouter from '@angular/router';
|
||||
import * as angularCore from '@angular/core';
|
||||
import * as angularCommon from '@angular/common';
|
||||
import * as angularCommonHttp from '@angular/common/http';
|
||||
import * as angularForms from '@angular/forms';
|
||||
import * as angularAnimations from '@angular/animations';
|
||||
import * as angularAnimationsBrowser from '@angular/animations/browser'
|
||||
import * as angularPlatformBrowser from '@angular/platform-browser';
|
||||
import * as angularPlatformBrowserDynamic from '@angular/platform-browser-dynamic';
|
||||
import * as clarityModule from '@clr/angular';
|
||||
import * as frontblockGenericTypes from 'frontblock-generic/Types.js'
|
||||
import * as browserAnimationsModule from "@angular/platform-browser/animations";
|
||||
|
||||
SystemJS.set('@clr/angular', SystemJS.newModule(clarityModule));
|
||||
SystemJS.set('@angular/router', SystemJS.newModule(angularRouter));
|
||||
SystemJS.set('@angular/core', SystemJS.newModule(angularCore));
|
||||
SystemJS.set('@angular/common', SystemJS.newModule(angularCommon));
|
||||
SystemJS.set('@angular/common/http', SystemJS.newModule(angularCommonHttp));
|
||||
SystemJS.set('@angular/forms', SystemJS.newModule(angularForms));
|
||||
SystemJS.set('@angular/animations', SystemJS.newModule(angularAnimations));
|
||||
SystemJS.set('@angular/animations/browser', SystemJS.newModule(angularAnimationsBrowser));
|
||||
SystemJS.set('@angular/platform-browser', SystemJS.newModule(angularPlatformBrowser));
|
||||
SystemJS.set('@angular/platform-browser/animations', SystemJS.newModule(browserAnimationsModule));
|
||||
SystemJS.set('@angular/platform-browser-dynamic', SystemJS.newModule(angularPlatformBrowserDynamic));
|
||||
SystemJS.set('frontblock-generic/Types', SystemJS.newModule(frontblockGenericTypes));
|
||||
|
||||
SystemJS.config({ meta: { '*': { authorization: true } } });
|
||||
/** --------- */
|
||||
|
||||
import { AfterViewInit, Component, ViewChild } from '@angular/core';
|
||||
import { SidebarComponent } from '../sidebar/sidebar.component';
|
||||
import { Router } from '@angular/router';
|
||||
import { FrontendPlugin, SidebarEntries, SidebarEntry } from "frontblock-generic/Plugin"
|
||||
import { environment } from "../../environments/environment"
|
||||
|
||||
const fb = environment.production ? window["fb"] : {
|
||||
PluginManager: {
|
||||
getLoadedPluginNames: () => ["ApiClient", "PluginManager", "Wallet"]
|
||||
}
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'dynamic-loader',
|
||||
templateUrl: './dynamic-loader.component.html',
|
||||
styleUrls: ['./dynamic-loader.component.scss']
|
||||
})
|
||||
export class DynamicLoaderComponent implements AfterViewInit {
|
||||
@ViewChild(SidebarComponent, {static:false})
|
||||
private sidebar:SidebarComponent
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
) {
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.loadWidgets()
|
||||
}
|
||||
|
||||
private async loadWidgets() {
|
||||
while (!fb.PluginManager) {
|
||||
await new Promise((resolve) => setTimeout(resolve, 50))
|
||||
}
|
||||
const pluginNames = await fb.PluginManager.getLoadedPluginNames()
|
||||
pluginNames.forEach(element => this.installWidget(element));
|
||||
}
|
||||
|
||||
private async installWidget(pluginName: string) {
|
||||
let module: FrontendPlugin
|
||||
if (environment.production)
|
||||
module = await SystemJS.import("plugins/" + pluginName + ".js");
|
||||
else
|
||||
module = await import("../" + pluginName + "/module")
|
||||
|
||||
const plugin = new module['PluginModule']()
|
||||
const entry: SidebarEntries | SidebarEntry = plugin.getSidebarEntry()
|
||||
const rc = this.router.config
|
||||
|
||||
switch (typeof (<any>entry).links) {
|
||||
case "undefined":
|
||||
const e: SidebarEntry = <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 = <SidebarEntries>entry
|
||||
|
||||
m.links = m.links.map(link => {
|
||||
return { text: link.text, route: m.parentRoute + "/" + link.route }
|
||||
})
|
||||
|
||||
this.sidebar.multientires.push(m)
|
||||
rc.unshift({
|
||||
path: m.parentRoute,
|
||||
loadChildren: async () => module['PluginModule']
|
||||
})
|
||||
break;
|
||||
}
|
||||
this.router.resetConfig(rc)
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'exclamations',
|
||||
template: `
|
||||
<span style="color: blue">!!!</span>
|
||||
`
|
||||
})
|
||||
export class ANestedComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() { }
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
<p>Oops that didn't work!</p>
|
||||
@@ -1,25 +0,0 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ErrorDisplayComponent } from './error-display.component';
|
||||
|
||||
describe('ErrorDisplayComponent', () => {
|
||||
let component: ErrorDisplayComponent;
|
||||
let fixture: ComponentFixture<ErrorDisplayComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ErrorDisplayComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ErrorDisplayComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,15 +0,0 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-error-display',
|
||||
templateUrl: './error-display.component.html',
|
||||
styleUrls: ['./error-display.component.scss'],
|
||||
})
|
||||
export class ErrorDisplayComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { ErrorDisplayComponent } from './error-display.component';
|
||||
import { ANestedComponent } from './a-nested.component';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
|
||||
@NgModule({
|
||||
imports: [CommonModule, RouterModule.forChild([{path: "helloWorld", component: ErrorDisplayComponent}])],
|
||||
exports: [RouterModule],
|
||||
declarations: [
|
||||
ErrorDisplayComponent,
|
||||
ANestedComponent
|
||||
],
|
||||
entryComponents: [ErrorDisplayComponent],
|
||||
providers: [{
|
||||
provide: 'provider',
|
||||
useValue: ErrorDisplayComponent
|
||||
}],
|
||||
|
||||
})
|
||||
export class PluginModule { }
|
||||
@@ -1,12 +0,0 @@
|
||||
<clr-header class="header header-1">
|
||||
<div class="branding">
|
||||
<span class="title">Frontblock</span>
|
||||
|
||||
</div>
|
||||
<div class="header-actions">
|
||||
<a class="nav-link nav-icon-text">
|
||||
<clr-icon shape="bug"></clr-icon>
|
||||
<span class="nav-text">ALPHA {{devmode}}</span>
|
||||
</a>
|
||||
</div>
|
||||
</clr-header>
|
||||
@@ -1,25 +0,0 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { HeaderBarComponent } from './header-bar.component';
|
||||
|
||||
describe('HeaderBarComponent', () => {
|
||||
let component: HeaderBarComponent;
|
||||
let fixture: ComponentFixture<HeaderBarComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ HeaderBarComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(HeaderBarComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,15 +0,0 @@
|
||||
import { Component, OnInit, isDevMode } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'header-bar',
|
||||
templateUrl: './header-bar.component.html',
|
||||
styleUrls: ['./header-bar.component.scss']
|
||||
})
|
||||
export class HeaderBarComponent implements OnInit {
|
||||
devmode = isDevMode()?"{ ng-DEV }":""
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
<p>home works!</p>
|
||||
@@ -1,25 +0,0 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { HomeComponent } from './home.component';
|
||||
|
||||
describe('HomeComponent', () => {
|
||||
let component: HomeComponent;
|
||||
let fixture: ComponentFixture<HomeComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ HomeComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(HomeComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,15 +0,0 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-home',
|
||||
templateUrl: './home.component.html',
|
||||
styleUrls: ['./home.component.scss']
|
||||
})
|
||||
export class HomeComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { SidebarComponent } from './sidebar/sidebar.component';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class SidebarEntryService {
|
||||
|
||||
private sidebar:SidebarComponent
|
||||
|
||||
constructor() { }
|
||||
|
||||
setSidebar(sidebar){
|
||||
this.sidebar = sidebar
|
||||
}
|
||||
|
||||
getSidebar():SidebarComponent{
|
||||
return this.sidebar
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<clr-vertical-nav [clr-nav-level]="1" class="nav-trigger--bottom" style="height: 100%;" [clrVerticalNavCollapsible]="true" [(clrVerticalNavCollapsed)]="collapsed" >
|
||||
<clr-vertical-nav-group *ngFor="let e of multientires" routerLinkActive="active">
|
||||
<clr-icon [attr.shape]="e.icon" clrVerticalNavIcon></clr-icon>
|
||||
{{e.text}}
|
||||
<clr-vertical-nav-group-children>
|
||||
<a clrVerticalNavLink
|
||||
*ngFor="let l of e.links"
|
||||
[routerLink]="l.route"
|
||||
routerLinkActive="active">
|
||||
{{l.text}}
|
||||
</a>
|
||||
</clr-vertical-nav-group-children>
|
||||
</clr-vertical-nav-group>
|
||||
|
||||
<a *ngFor="let entry of entries" clrVerticalNavLink routerLinkActive="active" [routerLink]="entry.route">
|
||||
<clr-icon [attr.shape]="entry.icon" clrVerticalNavIcon></clr-icon>
|
||||
{{entry.text}}
|
||||
</a>
|
||||
</clr-vertical-nav>
|
||||
@@ -1,25 +0,0 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { SidebarComponent } from './sidebar.component';
|
||||
|
||||
describe('SidebarComponent', () => {
|
||||
let component: SidebarComponent;
|
||||
let fixture: ComponentFixture<SidebarComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ SidebarComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(SidebarComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,24 +0,0 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { SidebarEntries, SidebarEntry } from 'frontblock-generic/Plugin';
|
||||
import { environment } from 'src/environments/environment';
|
||||
|
||||
@Component({
|
||||
selector: 'sidebar',
|
||||
templateUrl: './sidebar.component.html',
|
||||
styleUrls: ['./sidebar.component.scss']
|
||||
})
|
||||
export class SidebarComponent implements OnInit {
|
||||
|
||||
collapsed = true
|
||||
|
||||
entries:SidebarEntry[] = [
|
||||
]
|
||||
|
||||
multientires:SidebarEntries[] = [
|
||||
]
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
<nav class="subnav">
|
||||
<ul class="nav">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" href="#">Dashboard</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
@@ -1,25 +0,0 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { SubnavComponent } from './subnav.component';
|
||||
|
||||
describe('SubnavComponent', () => {
|
||||
let component: SubnavComponent;
|
||||
let fixture: ComponentFixture<SubnavComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ SubnavComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(SubnavComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,15 +0,0 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'subnav',
|
||||
templateUrl: './subnav.component.html',
|
||||
styleUrls: ['./subnav.component.scss']
|
||||
})
|
||||
export class SubnavComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
./FrontblockLib.js
|
||||
File diff suppressed because one or more lines are too long
@@ -1,3 +0,0 @@
|
||||
export const environment = {
|
||||
production: true
|
||||
};
|
||||
@@ -1,16 +0,0 @@
|
||||
// This file can be replaced during build by using the `fileReplacements` array.
|
||||
// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
|
||||
// The list of file replacements can be found in `angular.json`.
|
||||
|
||||
export const environment = {
|
||||
production: false
|
||||
};
|
||||
|
||||
/*
|
||||
* For easier debugging in development mode, you can import the following file
|
||||
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
|
||||
*
|
||||
* This import should be commented out in production mode because it will have a negative impact
|
||||
* on performance if an error is thrown.
|
||||
*/
|
||||
// import 'zone.js/dist/zone-error'; // Included with Angular CLI.
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 5.3 KiB |
@@ -1,15 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<script src="FrontblockLib.js"></script>
|
||||
<meta charset="utf-8">
|
||||
<title>Dashboard</title>
|
||||
<base href="/">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||
</head>
|
||||
<body>
|
||||
<app-root></app-root>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,12 +0,0 @@
|
||||
import { enableProdMode } from '@angular/core';
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
|
||||
import { AppModule } from './app/app.module';
|
||||
import { environment } from './environments/environment';
|
||||
|
||||
if (environment.production) {
|
||||
enableProdMode();
|
||||
}
|
||||
|
||||
platformBrowserDynamic().bootstrapModule(AppModule)
|
||||
.catch(err => console.error(err));
|
||||
@@ -1,67 +0,0 @@
|
||||
/**
|
||||
* This file includes polyfills needed by Angular and is loaded before the app.
|
||||
* You can add your own extra polyfills to this file.
|
||||
*
|
||||
* This file is divided into 2 sections:
|
||||
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
|
||||
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
|
||||
* file.
|
||||
*
|
||||
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
|
||||
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
|
||||
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
|
||||
*
|
||||
* Learn more in https://angular.io/guide/browser-support
|
||||
*/
|
||||
|
||||
/***************************************************************************************************
|
||||
* BROWSER POLYFILLS
|
||||
*/
|
||||
|
||||
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
|
||||
// import 'classlist.js'; // Run `npm install --save classlist.js`.
|
||||
|
||||
/**
|
||||
* Web Animations `@angular/platform-browser/animations`
|
||||
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
|
||||
* Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
|
||||
*/
|
||||
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
|
||||
|
||||
/**
|
||||
* By default, zone.js will patch all possible macroTask and DomEvents
|
||||
* user can disable parts of macroTask/DomEvents patch by setting following flags
|
||||
* because those flags need to be set before `zone.js` being loaded, and webpack
|
||||
* will put import in the top of bundle, so user need to create a separate file
|
||||
* in this directory (for example: zone-flags.ts), and put the following flags
|
||||
* into that file, and then add the following code before importing zone.js.
|
||||
* import './zone-flags.ts';
|
||||
*
|
||||
* The flags allowed in zone-flags.ts are listed here.
|
||||
*
|
||||
* The following flags will work for all browsers.
|
||||
*
|
||||
* (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
|
||||
* (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
|
||||
* (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
|
||||
*
|
||||
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
|
||||
* with the following flag, it will bypass `zone.js` patch for IE/Edge
|
||||
*
|
||||
* (window as any).__Zone_enable_cross_context_check = true;
|
||||
*
|
||||
*/
|
||||
|
||||
/***************************************************************************************************
|
||||
* Zone JS is required by default for Angular itself.
|
||||
*/
|
||||
import 'zone.js/dist/zone'; // Included with Angular CLI.
|
||||
|
||||
|
||||
/***************************************************************************************************
|
||||
* APPLICATION IMPORTS
|
||||
*/
|
||||
// Add global to window, assigning the value of window itself.
|
||||
(window as any).global = window;
|
||||
global.Buffer = global.Buffer || require('buffer').Buffer;
|
||||
global.process = global.process || require('process')
|
||||
@@ -1,52 +0,0 @@
|
||||
/* You can add global styles to this file, and also import other style files */
|
||||
@import "../node_modules/@clr/ui/src/utils/components.clarity";
|
||||
|
||||
.heightmax{
|
||||
height: 100%
|
||||
}
|
||||
.break-word {
|
||||
word-wrap: break-word;
|
||||
}
|
||||
.monospace {
|
||||
font-family: monospace;
|
||||
font-size: 90%
|
||||
}
|
||||
*::-webkit-scrollbar-track
|
||||
{
|
||||
box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
|
||||
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
|
||||
background-color: rgba(0,0,0,0);
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
*::-webkit-scrollbar
|
||||
{
|
||||
width: 7px;
|
||||
background-color: rgba(0,0,0,0);
|
||||
}
|
||||
|
||||
*::-webkit-scrollbar-thumb
|
||||
{
|
||||
border-radius: 7px;
|
||||
background-color: #0079B8;
|
||||
}
|
||||
|
||||
.clr-all-12{
|
||||
@extend .clr-col-12, .clr-col-sm-12, .clr-col-md-12, .clr-col-lg-12, .clr-col-xl-12
|
||||
}
|
||||
|
||||
.clr-all-4{
|
||||
@extend .clr-col-4, .clr-col-sm-4, .clr-col-md-4, .clr-col-lg-4, .clr-col-xl-4
|
||||
}
|
||||
|
||||
.clr-all-6{
|
||||
@extend .clr-col-6, .clr-col-sm-6, .clr-col-md-6, .clr-col-lg-6, .clr-col-xl-6
|
||||
}
|
||||
|
||||
.clr-all-3{
|
||||
@extend .clr-col-3, .clr-col-sm-3, .clr-col-md-3, .clr-col-lg-3, .clr-col-xl-3
|
||||
}
|
||||
|
||||
.clr-all-2{
|
||||
@extend .clr-col-2, .clr-col-sm-2, .clr-col-md-2, .clr-col-lg-2, .clr-col-xl-2
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
||||
|
||||
import 'zone.js/dist/zone-testing';
|
||||
import { getTestBed } from '@angular/core/testing';
|
||||
import {
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting
|
||||
} from '@angular/platform-browser-dynamic/testing';
|
||||
|
||||
declare const require: any;
|
||||
|
||||
// First, initialize the Angular testing environment.
|
||||
getTestBed().initTestEnvironment(
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting()
|
||||
);
|
||||
// Then we find all the tests.
|
||||
const context = require.context('./', true, /\.spec\.ts$/);
|
||||
// And load the modules.
|
||||
context.keys().map(context);
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./out-tsc/app",
|
||||
"types": ["node"]
|
||||
},
|
||||
"include": [
|
||||
"src/**/*.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"src/test.ts",
|
||||
"src/**/*.spec.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"compileOnSave": false,
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"outDir": "./dist/out-tsc",
|
||||
"sourceMap": true,
|
||||
"declaration": false,
|
||||
"downlevelIteration": true,
|
||||
"experimentalDecorators": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"importHelpers": true,
|
||||
"target": "es2015",
|
||||
"typeRoots": [
|
||||
"node_modules/@types"
|
||||
],
|
||||
"lib": [
|
||||
"es2018",
|
||||
"dom"
|
||||
]
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"fullTemplateTypeCheck": true,
|
||||
"strictInjectionParameters": true
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./out-tsc/spec",
|
||||
"types": [
|
||||
"jasmine",
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"src/test.ts",
|
||||
"src/polyfills.ts"
|
||||
],
|
||||
"include": [
|
||||
"src/**/*.spec.ts",
|
||||
"src/**/*.d.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
{
|
||||
"extends": "tslint:recommended",
|
||||
"rules": {
|
||||
"array-type": false,
|
||||
"arrow-parens": false,
|
||||
"deprecation": {
|
||||
"severity": "warning"
|
||||
},
|
||||
"component-class-suffix": true,
|
||||
"contextual-lifecycle": true,
|
||||
"directive-class-suffix": true,
|
||||
"directive-selector": [
|
||||
true,
|
||||
"attribute",
|
||||
"app",
|
||||
"camelCase"
|
||||
],
|
||||
"component-selector": [
|
||||
true,
|
||||
"element",
|
||||
"app",
|
||||
"kebab-case"
|
||||
],
|
||||
"import-blacklist": [
|
||||
true,
|
||||
"rxjs/Rx"
|
||||
],
|
||||
"interface-name": false,
|
||||
"max-classes-per-file": false,
|
||||
"max-line-length": [
|
||||
true,
|
||||
140
|
||||
],
|
||||
"member-access": false,
|
||||
"member-ordering": [
|
||||
true,
|
||||
{
|
||||
"order": [
|
||||
"static-field",
|
||||
"instance-field",
|
||||
"static-method",
|
||||
"instance-method"
|
||||
]
|
||||
}
|
||||
],
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-console": [
|
||||
true,
|
||||
"debug",
|
||||
"info",
|
||||
"time",
|
||||
"timeEnd",
|
||||
"trace"
|
||||
],
|
||||
"no-empty": false,
|
||||
"no-inferrable-types": [
|
||||
true,
|
||||
"ignore-params"
|
||||
],
|
||||
"no-non-null-assertion": true,
|
||||
"no-redundant-jsdoc": true,
|
||||
"no-switch-case-fall-through": true,
|
||||
"no-use-before-declare": true,
|
||||
"no-var-requires": false,
|
||||
"object-literal-key-quotes": [
|
||||
true,
|
||||
"as-needed"
|
||||
],
|
||||
"object-literal-sort-keys": false,
|
||||
"ordered-imports": false,
|
||||
"quotemark": [
|
||||
true,
|
||||
"single"
|
||||
],
|
||||
"trailing-comma": false,
|
||||
"no-conflicting-lifecycle": true,
|
||||
"no-host-metadata-property": true,
|
||||
"no-input-rename": true,
|
||||
"no-inputs-metadata-property": true,
|
||||
"no-output-native": true,
|
||||
"no-output-on-prefix": true,
|
||||
"no-output-rename": true,
|
||||
"no-outputs-metadata-property": true,
|
||||
"template-banana-in-box": true,
|
||||
"template-no-negated-async": true,
|
||||
"use-lifecycle-interface": true,
|
||||
"use-pipe-transform-interface": true
|
||||
},
|
||||
"rulesDirectory": [
|
||||
"codelyzer"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user