aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
Diffstat (limited to 'src/app')
-rw-r--r--src/app/api.service.ts14
-rw-r--r--src/app/app-routing.module.ts25
-rw-r--r--src/app/app.component.html90
-rw-r--r--src/app/app.component.ts29
-rw-r--r--src/app/app.module.ts10
-rw-r--r--src/app/create-identity/create-identity.component.html7
-rw-r--r--src/app/create-identity/create-identity.component.ts8
-rw-r--r--src/app/error-page/error-page.component.html3
-rw-r--r--src/app/error-page/error-page.component.spec.ts (renamed from src/app/gns-page/gns-page.component.spec.ts)18
-rw-r--r--src/app/error-page/error-page.component.ts38
-rw-r--r--src/app/gns-page/gns-page.component.html47
-rw-r--r--src/app/gns-page/gns-page.component.ts81
-rw-r--r--src/app/identity-page/identity-page.component.html73
-rw-r--r--src/app/identity-page/identity-page.component.ts20
-rw-r--r--src/app/main-page/main-page.component.html15
-rw-r--r--src/app/namestore-page/namestore-page.component.html38
-rw-r--r--src/app/namestore-page/namestore-page.component.ts26
-rw-r--r--src/app/rest-api.ts4
-rw-r--r--src/app/rest-apis/rest-apis.component.html14
-rw-r--r--src/app/rest-apis/rest-apis.component.ts15
20 files changed, 286 insertions, 289 deletions
diff --git a/src/app/api.service.ts b/src/app/api.service.ts
index a70eee1..b659198 100644
--- a/src/app/api.service.ts
+++ b/src/app/api.service.ts
@@ -11,14 +11,14 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */ 17 */
18/** 18/**
19 * @author Philippe Buschmann 19 * @author Philippe Buschmann
20 * @file src/app/api.service.ts 20 * @file src/app/api.service.ts
21 * @brief 21 * @brief
22 * 22 *
23 */ 23 */
24 24
@@ -34,12 +34,6 @@ import { MessagesService } from './messages.service';
34 providedIn: 'root' 34 providedIn: 'root'
35}) 35})
36export class ApiService { 36export class ApiService {
37 apis: RestAPI[] = [
38 {name: 'Identity API', desc: 'This is the identity API', link: 'identity'},
39 {name: 'GNS API', desc: 'This is the gns API', link: 'gns'},
40 {name: 'Namestore API', desc: 'This is the namestore API', link: 'namestore'},
41 {name: 'Peerstore API', desc: 'This is the peerstore API', link: 'peerstore'},
42 ];
43 37
44 private restURL = 'http://localhost:7776/' 38 private restURL = 'http://localhost:7776/'
45 private identityURL = this.restURL+'identity'; 39 private identityURL = this.restURL+'identity';
@@ -48,10 +42,6 @@ export class ApiService {
48 constructor(private http: HttpClient, 42 constructor(private http: HttpClient,
49 private messages:MessagesService) { } 43 private messages:MessagesService) { }
50 44
51 getAPIs(): Observable<RestAPI[]> {
52 return of(this.apis);
53 }
54
55 getIdentities (): Observable<IdentityAPI[]>{ 45 getIdentities (): Observable<IdentityAPI[]>{
56 return this.http.get<IdentityAPI[]>(this.identityURL) 46 return this.http.get<IdentityAPI[]>(this.identityURL)
57 .pipe( 47 .pipe(
diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts
index 7943788..e8e156d 100644
--- a/src/app/app-routing.module.ts
+++ b/src/app/app-routing.module.ts
@@ -11,35 +11,38 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */ 17 */
18/** 18/**
19 * @author Philippe Buschmann 19 * @author Philippe Buschmann
20 * @file src/app/app-routing.module.ts 20 * @file src/app/app-routing.module.ts
21 * @brief 21 * @brief
22 * 22 *
23 */ 23 */
24 24
25import { NgModule } from '@angular/core'; 25import { NgModule } from '@angular/core';
26import { RouterModule, Routes } from '@angular/router'; 26import { RouterModule, Routes, Router, ActivatedRoute, NavigationEnd } from '@angular/router';
27
28import { filter } from 'rxjs/operators';
27 29
28import { RestApisComponent } from './rest-apis/rest-apis.component'; 30import { RestApisComponent } from './rest-apis/rest-apis.component';
29import { MainPageComponent } from './main-page/main-page.component'; 31import { MainPageComponent } from './main-page/main-page.component';
30import { IdentityPageComponent } from './identity-page/identity-page.component'; 32import { IdentityPageComponent } from './identity-page/identity-page.component';
31import { GnsPageComponent } from './gns-page/gns-page.component';
32import { PeerstorePageComponent } from './peerstore-page/peerstore-page.component'; 33import { PeerstorePageComponent } from './peerstore-page/peerstore-page.component';
33import { NamestorePageComponent } from './namestore-page/namestore-page.component'; 34import { NamestorePageComponent } from './namestore-page/namestore-page.component';
35import { ErrorPageComponent } from './error-page/error-page.component';
34 36
37import { MessagesService } from './messages.service';
35 38
36const routes: Routes = [ 39const routes: Routes = [
37 { path: '', component: MainPageComponent }, 40 { path: '', component: MainPageComponent },
38 { path: 'apis', component: RestApisComponent }, 41 { path: 'apis', component: RestApisComponent },
39 { path: 'identity', component: IdentityPageComponent }, 42 { path: 'identity', component: IdentityPageComponent },
40 { path: 'gns', component: GnsPageComponent },
41 { path: 'peerstore', component: PeerstorePageComponent }, 43 { path: 'peerstore', component: PeerstorePageComponent },
42 { path: 'namestore', component: NamestorePageComponent } 44 { path: 'namestore', component: NamestorePageComponent },
45 { path: '**', component: ErrorPageComponent }
43]; 46];
44 47
45@NgModule({ 48@NgModule({
@@ -47,4 +50,14 @@ const routes: Routes = [
47 exports: [ RouterModule ] 50 exports: [ RouterModule ]
48}) 51})
49export class AppRoutingModule { 52export class AppRoutingModule {
53 constructor(private router: Router,
54 private messages: MessagesService) {
55 router.events.pipe(filter(event => event instanceof NavigationEnd))
56 .subscribe((route: ActivatedRoute) => {
57 this.messages.dismissError();
58 this.messages.dismissSuccess();
59 this.messages.dismissWarning();
60 this.messages.dismissInformation();
61 });
62 }
50} 63}
diff --git a/src/app/app.component.html b/src/app/app.component.html
index 7f098f2..a4a6a27 100644
--- a/src/app/app.component.html
+++ b/src/app/app.component.html
@@ -1,33 +1,27 @@
1<!--The content below is only a placeholder and can be replaced.--> 1<!--The content below is only a placeholder and can be replaced.-->
2<header class="c-header u-p-x2"> 2<header class="c-header u-p-x2">
3 <div class="o-container o-container--size-small"> 3 <div class="o-container o-container--size-small">
4 <div class="o-media o-media--middle"> 4 <div class="o-media o-media--middle">
5 <div class="o-media__fixed"> 5 <div class="o-media__fixed">
6 <img src="svg/logo.svg"> GNUnet API 6 <img class="u-align-middle" src="https://gnunet.org/sites/default/files/transparent_0_0.png" width="40px">
7 </div> 7 &nbsp;<span class="o-type-22 u-align-middle">GNUnet Web UI</span>
8 <div class="o-media__fluid u-text-right"> 8 </div>
9 <nav> 9 <div class="o-media__fluid u-text-right">
10 <ul class="o-list o-list--inline o-list--gutter-x4"> 10 <nav>
11 <li class="o-list__item"> 11 <ul class="o-list o-list--inline o-list--gutter-x4">
12 <a routerLink="/" class="c-link">Main Page</a> 12 <li class="o-list__item" *ngFor="let item of this.menu">
13 </li> 13 <div *ngIf="item.id === active" class="u-p-x1 u-bgcolor-primary u-color-contrary">
14 <li class="o-list__item"> 14 <a routerLink="{{item.link}}" class="c-link">{{item.name}}</a>
15 <a routerLink="identity" class="c-link">Identity</a> 15 </div>
16 </li> 16 <div *ngIf="item.id !== active" class="u-p-x1">
17 <li class="o-list__item"> 17 <a routerLink="{{item.link}}" class="c-link">{{item.name}}</a>
18 <a routerLink="gns" class="c-link">GNS</a> 18 </div>
19 </li> 19 </li>
20 <li class="o-list__item"> 20 </ul>
21 <a routerLink="namestore" class="c-link">Namestore</a> 21 </nav>
22 </li> 22 </div>
23 <li class="o-list__item"> 23 </div>
24 <a routerLink="peerstore" class="c-link">Peerstore</a> 24 </div>
25 </li>
26 </ul>
27 </nav>
28 </div>
29 </div>
30 </div>
31</header> 25</header>
32 26
33<main class="u-mv-x2 o-container"> 27<main class="u-mv-x2 o-container">
@@ -35,22 +29,24 @@
35 <router-outlet></router-outlet> 29 <router-outlet></router-outlet>
36</main> 30</main>
37 31
38<footer class="c-footer u-p-x2"> 32<div class="c-footer-fixed"><div>
39 <div class="o-container o-container--size-small"> 33
40 <div class="o-media o-media--middle"> 34 <footer class="c-footer u-p-x2">
41 <div class="o-media__fixed"> 35 <div class="o-container o-container--size-small">
42 <ul class="o-list o-list--inline o-list--gutter-x4"> 36 <div class="o-media o-media--middle">
43 <li class="o-list__item"> 37 <div class="o-media__fixed">
44 <a routerLink="/" class="c-link">Impressum</a> 38 <ul class="o-list o-list--inline o-list--gutter-x4">
45 </li> 39 <li class="o-list__item">
46 <li class="o-list__item"> 40 <a routerLink="/" class="c-link">Impressum</a>
47 <a routerLink="/" class="c-link">Documentation</a> 41 </li>
48 </li> 42 <li class="o-list__item">
49 </ul> 43 <a routerLink="/" class="c-link">Documentation</a>
50 </div> 44 </li>
51 <div class="o-media__fluid u-text-right"> 45 </ul>
52 Copyright things 46 </div>
53 </div> 47 <div class="o-media__fluid u-text-right">
54 </div> 48 Placeholder
55 </div> 49 </div>
56</footer> 50 </div>
51 </div>
52 </footer>
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index cb12491..5ee4946 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -23,14 +23,37 @@
23 */ 23 */
24 24
25import { Component } from '@angular/core'; 25import { Component } from '@angular/core';
26import { Router, ActivatedRoute, NavigationEnd } from '@angular/router';
27
28
29import { filter } from 'rxjs/operators';
26 30
27@Component({ 31@Component({
28 selector: 'app-root', 32 selector: 'app-root',
29 templateUrl: './app.component.html', 33 templateUrl: './app.component.html'
30 //styleUrls: ['./../scss/main.scss']
31}) 34})
32 35
33 36
34export class AppComponent { 37export class AppComponent {
35 title = ''; 38
39 private active: number = 0;
40
41 menu : any[] = [
42 {id:0, name: 'Main', link: ''},
43 {id:1, name: 'Identities', link: 'identity'},
44 {id:2, name: 'Names', link: 'namestore'},
45 {id:3, name: 'Peers', link: 'peerstore'},
46 ];
47
48 constructor(private router: Router) {
49 router.events.pipe(filter(event => event instanceof NavigationEnd))
50 .subscribe((route: ActivatedRoute) => {
51 let index = this.menu.find(x => {
52 let url = '/'+x.link;
53 return url == route.url+'';
54 });
55 this.active = this.menu.indexOf(index);
56 });
57 }
58
36} 59}
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index edec9cc..e88a0d6 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -11,14 +11,14 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */ 17 */
18/** 18/**
19 * @author Philippe Buschmann 19 * @author Philippe Buschmann
20 * @file src/app/app.module.ts 20 * @file src/app/app.module.ts
21 * @brief 21 * @brief
22 * 22 *
23 */ 23 */
24 24
@@ -35,9 +35,9 @@ import { IdentityPageComponent } from './identity-page/identity-page.component';
35import { CreateIdentityComponent } from './create-identity/create-identity.component'; 35import { CreateIdentityComponent } from './create-identity/create-identity.component';
36import { MyFilterPipe } from './filter.pipe'; 36import { MyFilterPipe } from './filter.pipe';
37import { ErrorMessageComponent } from './error-message/error-message.component'; 37import { ErrorMessageComponent } from './error-message/error-message.component';
38import { GnsPageComponent } from './gns-page/gns-page.component';
39import { NamestorePageComponent } from './namestore-page/namestore-page.component'; 38import { NamestorePageComponent } from './namestore-page/namestore-page.component';
40import { PeerstorePageComponent } from './peerstore-page/peerstore-page.component'; 39import { PeerstorePageComponent } from './peerstore-page/peerstore-page.component';
40import { ErrorPageComponent } from './error-page/error-page.component';
41 41
42@NgModule({ 42@NgModule({
43 declarations: [ 43 declarations: [
@@ -48,9 +48,9 @@ import { PeerstorePageComponent } from './peerstore-page/peerstore-page.componen
48 CreateIdentityComponent, 48 CreateIdentityComponent,
49 MyFilterPipe, 49 MyFilterPipe,
50 ErrorMessageComponent, 50 ErrorMessageComponent,
51 GnsPageComponent,
52 NamestorePageComponent, 51 NamestorePageComponent,
53 PeerstorePageComponent 52 PeerstorePageComponent,
53 ErrorPageComponent
54 ], 54 ],
55 imports: [ 55 imports: [
56 BrowserModule, 56 BrowserModule,
diff --git a/src/app/create-identity/create-identity.component.html b/src/app/create-identity/create-identity.component.html
index d2e27fe..e1bfa3d 100644
--- a/src/app/create-identity/create-identity.component.html
+++ b/src/app/create-identity/create-identity.component.html
@@ -1,7 +1,8 @@
1<div class="c-card u-p-x3"> 1<div class="c-card c-card--no-padding u-p-x3">
2 <div class="o-type-20 u-pb-x1" >Create new identity</div> 2 <h1 class="o-type-22 u-pb-x1 u-color-primary-light" >Create new identity</h1>
3 <div class="o-list o-list--inline"> 3 <div class="o-list o-list--inline">
4 <input [(ngModel)]="this.input_text" type="text" class="o-list__item c-input" placeholder="Identity Name"/> 4 <p class="u-color-grey">Identity Name:</p>
5 <input [(ngModel)]="this.input_text" type="text" class="o-list__item c-input" placeholder="e.g. Testname, ..."/>
5 <a class="o-list__item c-button" (click)="onClick()"><i class="fa fa-plus"></i></a> 6 <a class="o-list__item c-button" (click)="onClick()"><i class="fa fa-plus"></i></a>
6 <div *ngIf="!is_free" class="o-list__item c-spinner"></div> 7 <div *ngIf="!is_free" class="o-list__item c-spinner"></div>
7 </div> 8 </div>
diff --git a/src/app/create-identity/create-identity.component.ts b/src/app/create-identity/create-identity.component.ts
index c71239a..61224a0 100644
--- a/src/app/create-identity/create-identity.component.ts
+++ b/src/app/create-identity/create-identity.component.ts
@@ -11,14 +11,14 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */ 17 */
18/** 18/**
19 * @author Philippe Buschmann 19 * @author Philippe Buschmann
20 * @file src/app/create-identity/create-identity.component.ts 20 * @file src/app/create-identity/create-identity.component.ts
21 * @brief 21 * @brief
22 * 22 *
23 */ 23 */
24 24
@@ -34,9 +34,9 @@ import { MessagesService } from '../messages.service';
34}) 34})
35export class CreateIdentityComponent implements OnInit { 35export class CreateIdentityComponent implements OnInit {
36 36
37 private input_text: string = ''; 37 input_text: string = '';
38 private json: any = {'name':''}; 38 private json: any = {'name':''};
39 private is_free:boolean = true; 39 is_free:boolean = true;
40 40
41 constructor(private apiService: ApiService, 41 constructor(private apiService: ApiService,
42 private message: MessagesService, 42 private message: MessagesService,
diff --git a/src/app/error-page/error-page.component.html b/src/app/error-page/error-page.component.html
new file mode 100644
index 0000000..a433358
--- /dev/null
+++ b/src/app/error-page/error-page.component.html
@@ -0,0 +1,3 @@
1<h1 class="u-color-primary o-type-80 u-m-x7">404 Not Found</h1>
2<p class="o-type-28 u-m-x7">This page is currently not available.</p>
3<a class="o-type-28 u-m-x7" routerLink="/">Return to Main Page</a>
diff --git a/src/app/gns-page/gns-page.component.spec.ts b/src/app/error-page/error-page.component.spec.ts
index 48c9d8e..057ee70 100644
--- a/src/app/gns-page/gns-page.component.spec.ts
+++ b/src/app/error-page/error-page.component.spec.ts
@@ -11,34 +11,34 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */ 17 */
18/** 18/**
19 * @author Philippe Buschmann 19 * @author Philippe Buschmann
20 * @file src/app/gns-page/gns-page.component.spec.ts 20 * @file src/app/error-page/error-page.component.spec.ts
21 * @brief 21 * @brief
22 * 22 *
23 */ 23 */
24 24
25import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 25import { async, ComponentFixture, TestBed } from '@angular/core/testing';
26 26
27import { GnsPageComponent } from './gns-page.component'; 27import { ErrorPageComponent } from './error-page.component';
28 28
29describe('GnsPageComponent', () => { 29describe('ErrorPageComponent', () => {
30 let component: GnsPageComponent; 30 let component: ErrorPageComponent;
31 let fixture: ComponentFixture<GnsPageComponent>; 31 let fixture: ComponentFixture<ErrorPageComponent>;
32 32
33 beforeEach(async(() => { 33 beforeEach(async(() => {
34 TestBed.configureTestingModule({ 34 TestBed.configureTestingModule({
35 declarations: [ GnsPageComponent ] 35 declarations: [ ErrorPageComponent ]
36 }) 36 })
37 .compileComponents(); 37 .compileComponents();
38 })); 38 }));
39 39
40 beforeEach(() => { 40 beforeEach(() => {
41 fixture = TestBed.createComponent(GnsPageComponent); 41 fixture = TestBed.createComponent(ErrorPageComponent);
42 component = fixture.componentInstance; 42 component = fixture.componentInstance;
43 fixture.detectChanges(); 43 fixture.detectChanges();
44 }); 44 });
diff --git a/src/app/error-page/error-page.component.ts b/src/app/error-page/error-page.component.ts
new file mode 100644
index 0000000..92cb9b5
--- /dev/null
+++ b/src/app/error-page/error-page.component.ts
@@ -0,0 +1,38 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2012-2015 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18/**
19 * @author Philippe Buschmann
20 * @file src/app/error-page/error-page.component.ts
21 * @brief
22 *
23 */
24
25 import { Component, OnInit } from '@angular/core';
26
27@Component({
28 selector: 'app-error-page',
29 templateUrl: './error-page.component.html'
30})
31export class ErrorPageComponent implements OnInit {
32
33 constructor() { }
34
35 ngOnInit() {
36 }
37
38}
diff --git a/src/app/gns-page/gns-page.component.html b/src/app/gns-page/gns-page.component.html
deleted file mode 100644
index 47e5102..0000000
--- a/src/app/gns-page/gns-page.component.html
+++ /dev/null
@@ -1,47 +0,0 @@
1<div class="o-grid">
2 <div class="o-grid__col u-1/3">
3 <div class="c-card u-p-x3 u-mr-x2">
4 <div class="o-type-20 u-pb-x1" >Search for namesystem</div>
5 <div class="">
6 Name:<br>
7 <input class="c-input u-2/2" placeholder="Name" [(ngModel)]="gns_name" /><br><br>
8 Record Type (optional):<br>
9 <select class="c-input c-input--select u-2/2" [(ngModel)]="gns_recordtype" name="record_type">
10 <option [value]="0">ANY</option>
11 <option [value]="65536">PKEY</option>
12 <option [value]="65537">NICK</option>
13 <option [value]="65538">LEHO</option>
14 <option [value]="65539">VPN</option>
15 <option [value]="65540">GNS2DNS</option>
16 <option [value]="65541">BOX</option>
17 <option [value]="65542">PLACE</option>
18 <option [value]="65543">PHONE</option>
19 <option [value]="65544">ID_ATTR</option>
20 <option [value]="65545">ID_TOKEN</option>
21 <option [value]="65546">ID_TOKEN_METADATA</option>
22 <option [value]="65547">CREDENTIAL</option>
23 <option [value]="65548">POLICY</option>
24 <option [value]="65549">ATTRIBUTE</option>
25 <option [value]="65550">ABE_KEY</option>
26 <option [value]="65551">ABE_MASTER</option>
27 </select><br><br>
28 Search in:<br>
29 <div class="">
30 <input type="radio" name="options" [(ngModel)]="gns_options" [value]="0"> local namestore, then DHT<br>
31 <input type="radio" name="options" [(ngModel)]="gns_options" [value]="1"> local namestore only<br>
32 <input type="radio" name="options" [(ngModel)]="gns_options" [value]="2"> local namestore only for rightmost label, for others in DHT
33 </div><br>
34 Zone key (optional):<br>
35 <input *ngIf="display_zonekey" class="c-input u-2/2" placeholder="Zone Key" [(ngModel)]="gns_zonekey" (input)="toggleEgo()"/><br><br>
36 <div *ngIf="display_ego">Ego identifier (optional):<br>
37 <input class="c-input u-2/2" placeholder="Ego" [(ngModel)]="gns_ego" (input)="toggleZonekey()" /><br></div>
38 <div class="u-text-right"><a class="c-button u-mt-x2" (click)="onSearch()">Search</a></div>
39 </div>
40 </div>
41 </div>
42 <div class="o-grid__col u-2/3">
43 <div class="c-card u-p-x3">
44 {{gns_response}}
45 </div>
46 </div>
47</div>
diff --git a/src/app/gns-page/gns-page.component.ts b/src/app/gns-page/gns-page.component.ts
deleted file mode 100644
index 8147dcf..0000000
--- a/src/app/gns-page/gns-page.component.ts
+++ /dev/null
@@ -1,81 +0,0 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2012-2015 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18/**
19 * @author Philippe Buschmann
20 * @file src/app/gns-page/gns-page.component.ts
21 * @brief
22 *
23 */
24
25import { Component, OnInit } from '@angular/core';
26import { ApiService } from '../api.service';
27
28@Component({
29 selector: 'gns-page',
30 templateUrl: './gns-page.component.html'
31})
32export class GnsPageComponent implements OnInit {
33
34 private gns_name:string;
35 private gns_recordtype:number = 0;
36 private gns_options:number = 0;
37 private gns_zonekey:string = '';
38 private display_ego: boolean = true;
39 private display_zonekey: boolean = true;
40 private gns_ego:string = '';
41 private gns_response:any =[];
42
43 private url: string;
44
45 constructor(private apiService:ApiService) { }
46
47 ngOnInit() {
48 }
49
50 onSearch(){
51 this.url = '?name='+this.gns_name;
52 if(this.gns_recordtype != null){
53 this.url += '&record_type='+this.gns_recordtype;
54 }
55 if(this.gns_options != null){
56 this.url += '&options='+this.gns_options;
57 }
58 if(this.gns_zonekey != null && this.gns_zonekey != ''){
59 this.url += '&pkey='+this.gns_zonekey;
60 }
61 if(this.gns_ego != null && this.gns_ego != ''){
62 this.url += '&ego='+this.gns_ego;
63 }
64 console.log(this.url);
65 this.apiService.searchNameSystem(this.url).subscribe(data => {
66 this.gns_response = data;
67 });
68 }
69
70 toggleEgo(){
71 if(this.gns_zonekey == ''){ this.display_ego = true; }
72 else { this.display_ego = false; }
73 }
74
75 toggleZonekey(){
76 if(this.gns_ego == ''){ this.display_zonekey = true; }
77 else { this.display_zonekey = false; }
78 }
79
80
81}
diff --git a/src/app/identity-page/identity-page.component.html b/src/app/identity-page/identity-page.component.html
index 4eeb8da..fe72dc1 100644
--- a/src/app/identity-page/identity-page.component.html
+++ b/src/app/identity-page/identity-page.component.html
@@ -1,51 +1,38 @@
1<div *ngIf="is_displayed"> 1<div *ngIf="is_displayed">
2<div class="o-grid"> 2 <div class="o-grid">
3 <div class="o-grid__col u-1/2"> 3 <create-identity-component class="o-grid__col u-1/2"></create-identity-component>
4 <create-identity-component></create-identity-component> 4 <div class="o-grid__col u-1/2">
5 </div> 5 <div class="c-card c-card--no-padding u-p-x3">
6 <div class="o-grid__col u-1/2"> 6 <h1 class="o-type-22 u-pb-x1 u-color-primary-light" >Search</h1>
7 <div class="c-card c-card--no-padding u-p-x3"> 7 <div class="">
8 <div class="o-type-20 u-pb-x1" >Search</div> 8 <p class="u-color-grey">Search Input:</p>
9 <div class=""> 9 <input #myInput class="c-input u-2/2" placeholder="e.g. Name, ID, ..." [(ngModel)]="name" (input)="filterItem(myInput.value)"/>
10 <input #myInput class="c-input u-2/2" placeholder="Search" [(ngModel)]="name" (input)="filterItem(myInput.value)"/> 10 </div>
11 </div> 11 </div>
12 </div> 12 </div>
13 </div> 13 </div>
14</div>
15
16<div class="c-card u-mt-x2">
17 <table class=" u-2/2 c-table">
18 <tr>
19 <th class="u-text-center">Type</th>
20 <th>Name</th>
21 <th>ID</th>
22 <th class="u-text-center">Rename</th>
23 <th class="u-text-center">Delete</th>
24 </tr>
25 <tr *ngIf="request">
26 <td class="u-text-center"><div class="c-spinner"></div></td>
27 <td class="u-text-center"><div class="c-spinner"></div></td>
28 <td class="u-text-center"><div class="c-spinner"></div></td>
29 <td class="u-text-center"><div class="c-spinner"></div></td>
30 <td class="u-text-center"><div class="c-spinner"></div></td>
31 </tr>
32 <tr *ngFor="let identity of filteredItems">
33 <td class="u-text-center"><span class="fa fa-user o-type-20" *ngIf="identity.type == 'ego'"></span></td>
34 <td>
35 <span class="">{{identity.name}}</span>
36 </td>
37 <td>{{identity.id}}</td>
38 <td class="u-text-center"><a class="c-button c-button--rename" (click)="onClickRename(identity)"><i class="fa fa-pencil"></i></a></td>
39 <td class="u-text-center"><a class="c-button c-button--danger" (click)="onClickDelete(identity)"><i class="fa fa-trash"></i></a></td>
40 </tr>
41 </table>
42</div>
43</div>
44 14
15 <div *ngIf="request" class="u-text-center u-m-x3">
16 <div class="c-spinner"></div>
17 </div>
18 <div class="u-mv-x1" *ngFor="let identity of filteredItems">
19 <div class="c-card c-card--no-padding u-p-x1">
20 <div class="o-grid">
21 <div class="o-grid__col u-1/12"><div class="c-circle" [ngStyle]="{'background-color': returnHSL(identity.id)}">{{identity.name | slice:0:1 | uppercase}}</div></div>
22 <div class="o-grid__col u-9/12">
23 <p class="u-color-grey">Public Key: <span class="">{{identity.id}}</span></p>
24 <span class="o-type-20">{{identity.name}}</span>
25 </div>
26 <div class="o-grid__col u-1/12"><p class="u-color-grey">Rename</p><a class="c-button c-button--rename" (click)="onClickRename(identity)"><i class="fa fa-pencil"></i></a></div>
27 <div class="o-grid__col u-1/12"><p class="u-color-grey">Delete</p><a class="c-button c-button--danger" (click)="onClickDelete(identity)"><i class="fa fa-trash"></i></a></div>
28 </div>
29 </div>
30 </div>
31 </div>
45 32
46<div class="c-card u-p-x3 u-mt-x2" *ngIf="this.rename"> 33<div class="c-card u-p-x3 u-mt-x2" *ngIf="this.rename">
47 <div class="o-type-20 u-pb-x1" >Rename</div> 34 <h1 class="o-type-22 u-pb-x1 u-color-primary-light" >Rename</h1>
48 <div class="u-color-grey">ID: <span>{{changeIdentity.id}}</span></div> 35 <div class="u-color-grey">Public Key: <span>{{changeIdentity.id}}</span></div>
49 <div> 36 <div>
50 <span class="u-mr-x2"><span class="u-mr-x3">Name: </span><input class="c-input" placeholder="Change Name" [(ngModel)]="changeIdentity.name"/></span> 37 <span class="u-mr-x2"><span class="u-mr-x3">Name: </span><input class="c-input" placeholder="Change Name" [(ngModel)]="changeIdentity.name"/></span>
51 <a class="c-button" (click)="onRename(changeIdentity)">Rename</a> 38 <a class="c-button" (click)="onRename(changeIdentity)">Rename</a>
@@ -54,8 +41,8 @@
54</div> 41</div>
55 42
56<div class="c-card u-p-x3 u-mt-x2" *ngIf="this.delete"> 43<div class="c-card u-p-x3 u-mt-x2" *ngIf="this.delete">
57 <div class="o-type-20 u-pb-x1" >Rename</div> 44 <h1 class="o-type-22 u-pb-x1 u-color-primary-light" >Delete</h1>
58 <div >ID: <span>{{changeIdentity.id}}</span></div> 45 <div >Public Key: <span>{{changeIdentity.id}}</span></div>
59 <div >Name: <span>{{changeIdentity.name}}</span></div> 46 <div >Name: <span>{{changeIdentity.name}}</span></div>
60 <div> 47 <div>
61 <a class="c-button" (click)="onDelete(changeIdentity.id)">Delete</a> 48 <a class="c-button" (click)="onDelete(changeIdentity.id)">Delete</a>
diff --git a/src/app/identity-page/identity-page.component.ts b/src/app/identity-page/identity-page.component.ts
index b193d5e..f347f44 100644
--- a/src/app/identity-page/identity-page.component.ts
+++ b/src/app/identity-page/identity-page.component.ts
@@ -11,14 +11,14 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */ 17 */
18/** 18/**
19 * @author Philippe Buschmann 19 * @author Philippe Buschmann
20 * @file src/app/identity-page/identity-page.component.ts 20 * @file src/app/identity-page/identity-page.component.ts
21 * @brief 21 * @brief
22 * 22 *
23 */ 23 */
24 24
@@ -112,4 +112,20 @@ export class IdentityPageComponent implements OnInit {
112 }); 112 });
113 } 113 }
114 114
115 intFromHash(str:string): number{
116 let hash: number = 0;
117 for (var i = 0; i < str.length; i++) {
118 hash = str.charCodeAt(i) + ((hash << 5)-hash);
119 hash = hash & hash;
120 }
121 return (Math.abs(hash)/4294967295);
122 }
123
124 returnHSL(id:string): string{
125 return "hsl(" + 360 * this.intFromHash(id) + ',' +
126 (90 + 70 * this.intFromHash(id)) + '%,' +
127 (85 + 10 * this.intFromHash(id)) + '%)';
128 }
129
130
115} 131}
diff --git a/src/app/main-page/main-page.component.html b/src/app/main-page/main-page.component.html
index e7cd074..cd09fb7 100644
--- a/src/app/main-page/main-page.component.html
+++ b/src/app/main-page/main-page.component.html
@@ -1,11 +1,12 @@
1<div class="c-card"> 1<div class="">
2 <h1 class="u-text-center u-pb-x3 o-type-35"> 2 <h1 class="u-color-primary u-pv-x3 o-type-50">
3 GNUnet Web User Interface 3 GNUnet Web User Interface
4 </h1> 4 </h1>
5 <p> 5 <p class="u-pb-x2 o-type-28">
6 Lorem ipsum dolor sit amet consectetur adipiscing elit sed, diam dictum inceptos nostra mus enim id scelerisque, nam congue ligula penatibus dui arcu cubilia. Placerat dapibus felis euismod ligula pellentesque facilisi magna eu curae ridiculus arcu venenatis, ad justo auctor mollis faucibus viverra odio netus lectus risus vitae. Quisque morbi dapibus mollis ut cursus leo nascetur vitae aliquet venenatis per sociosqu, vivamus pulvinar risus nunc libero feugiat auctor gravida commodo proin. 6 Welcome to the GNUnet Web User Interface!<br>
7 7 </p>
8 Luctus magnis mi odio cursus ut pharetra pretium congue mattis, sagittis taciti iaculis mollis gravida fringilla facilisi faucibus, tincidunt consequat eu fusce arcu potenti proin sapien. Taciti sem placerat fringilla a fusce pretium nunc praesent habitant, sociosqu maecenas conubia mollis aliquam aliquet curae ad, mauris arcu urna pellentesque laoreet inceptos suscipit nullam. Curabitur molestie class gravida donec nisl cum urna integer, sodales etiam placerat vivamus scelerisque sollicitudin. 8 <p class="u-pb-x2 o-type-28">
9 This is an alternative to the graphical interface <span class="c-markdown">gnunet-gtk</span> and the command line tools.
9 </p> 10 </p>
10</div> 11</div>
11<app-rest-apis class="u-text-center"></app-rest-apis> 12<app-rest-apis></app-rest-apis>
diff --git a/src/app/namestore-page/namestore-page.component.html b/src/app/namestore-page/namestore-page.component.html
index f235c16..3d9bf09 100644
--- a/src/app/namestore-page/namestore-page.component.html
+++ b/src/app/namestore-page/namestore-page.component.html
@@ -1,3 +1,35 @@
1<p> 1
2 namestore-page works! 2<div class="c-card u-p-x3">
3</p> 3 <h1 class="o-type-22 u-pb-x1 u-color-primary-light" >Search Namesystem</h1>
4 <div class="o-list o-list--inline">
5 <div class="o-list__item">
6 <p class="u-color-grey">Name:</p>
7 <input class="c-input u-2/2" placeholder="Name" [(ngModel)]="gns_name" />
8 </div>
9 <div class="o-list__item">
10 <p class="u-color-grey">Record Type (optional):</p>
11 <select class="c-input c-input--select u-2/2" [(ngModel)]="gns_recordtype" name="record_type">
12 <option [value]="0">ANY</option>
13 <option [value]="65536">PKEY</option>
14 <option [value]="65537">NICK</option>
15 <option [value]="65538">LEHO</option>
16 <option [value]="65539">VPN</option>
17 <option [value]="65540">GNS2DNS</option>
18 <option [value]="65541">BOX</option>
19 <option [value]="65542">PLACE</option>
20 <option [value]="65543">PHONE</option>
21 <option [value]="65544">ID_ATTR</option>
22 <option [value]="65545">ID_TOKEN</option>
23 <option [value]="65546">ID_TOKEN_METADATA</option>
24 <option [value]="65547">CREDENTIAL</option>
25 <option [value]="65548">POLICY</option>
26 <option [value]="65549">ATTRIBUTE</option>
27 <option [value]="65550">ABE_KEY</option>
28 <option [value]="65551">ABE_MASTER</option>
29 </select>
30 </div>
31 <div class="o-list__item u-align-bottom">
32 <div class="u-text-right"><a class="c-button u-mt-x2" (click)="onSearch()">Search</a></div>
33 </div>
34 </div>
35</div>
diff --git a/src/app/namestore-page/namestore-page.component.ts b/src/app/namestore-page/namestore-page.component.ts
index 0369542..fc3c501 100644
--- a/src/app/namestore-page/namestore-page.component.ts
+++ b/src/app/namestore-page/namestore-page.component.ts
@@ -11,18 +11,19 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */ 17 */
18/** 18/**
19 * @author Philippe Buschmann 19 * @author Philippe Buschmann
20 * @file src/app/namestore-page/namestore-page.component.ts 20 * @file src/app/namestore-page/namestore-page.component.ts
21 * @brief 21 * @brief
22 * 22 *
23 */ 23 */
24 24
25import { Component, OnInit } from '@angular/core'; 25import { Component, OnInit } from '@angular/core';
26import { ApiService } from '../api.service';
26 27
27@Component({ 28@Component({
28 selector: 'app-namestore-page', 29 selector: 'app-namestore-page',
@@ -30,9 +31,28 @@ import { Component, OnInit } from '@angular/core';
30}) 31})
31export class NamestorePageComponent implements OnInit { 32export class NamestorePageComponent implements OnInit {
32 33
33 constructor() { } 34 gns_name:string;
35 gns_recordtype:number = 0;
36 private gns_response:any =[];
37
38 private url: string;
39
40 constructor(private apiService:ApiService) { }
34 41
35 ngOnInit() { 42 ngOnInit() {
36 } 43 }
37 44
45 onSearch(){
46 this.url = '?name='+this.gns_name;
47 if(this.gns_recordtype != null){
48 this.url += '&record_type='+this.gns_recordtype;
49 }
50 console.log(this.url);
51 this.apiService.searchNameSystem(this.url).subscribe(data => {
52 this.gns_response = data;
53 console.log(data);
54
55 });
56 }
57
38} 58}
diff --git a/src/app/rest-api.ts b/src/app/rest-api.ts
index e401986..8d5c30b 100644
--- a/src/app/rest-api.ts
+++ b/src/app/rest-api.ts
@@ -11,14 +11,14 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */ 17 */
18/** 18/**
19 * @author Philippe Buschmann 19 * @author Philippe Buschmann
20 * @file src/app/rest-api.ts 20 * @file src/app/rest-api.ts
21 * @brief 21 * @brief
22 * 22 *
23 */ 23 */
24 24
diff --git a/src/app/rest-apis/rest-apis.component.html b/src/app/rest-apis/rest-apis.component.html
index 6081599..e9c99e5 100644
--- a/src/app/rest-apis/rest-apis.component.html
+++ b/src/app/rest-apis/rest-apis.component.html
@@ -1,9 +1,15 @@
1<div class="o-grid u-pt-x2 "> 1<div class="o-grid u-pt-x2 ">
2 <div class="o-grid__col u-1/4" *ngFor="let api of apis"> 2 <div class="o-grid__col o-grid--gutter-x2 u-mv-x1 u-1/1" *ngFor="let api of apis">
3 <div class="c-card"> 3 <div routerLink="{{api.link}}" class="c-card c-card--clickable">
4 <h1 class="o-type-28">{{api.name}}</h1> 4 <h1 class="u-color-primary-light o-type-28">{{api.name}}</h1>
5 <br> 5 <br>
6 {{api.desc}} ...<a routerLink="{{api.link}}">Read more</a> 6 <div class="o-media">
7 <div class="o-media__fluid u-align-middle">
8 <p class=" o-type-20">{{api.desc}}</p>
9 </div>
10 <div class="o-media__fixed u-text-right u-align-middle">
11 </div>
12 </div>
7 </div> 13 </div>
8 </div> 14 </div>
9 </div> 15 </div>
diff --git a/src/app/rest-apis/rest-apis.component.ts b/src/app/rest-apis/rest-apis.component.ts
index 8c95b23..72ff3bf 100644
--- a/src/app/rest-apis/rest-apis.component.ts
+++ b/src/app/rest-apis/rest-apis.component.ts
@@ -11,14 +11,14 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */ 17 */
18/** 18/**
19 * @author Philippe Buschmann 19 * @author Philippe Buschmann
20 * @file src/app/rest-apis/rest-apis.component.ts 20 * @file src/app/rest-apis/rest-apis.component.ts
21 * @brief 21 * @brief
22 * 22 *
23 */ 23 */
24 24
@@ -31,16 +31,15 @@ import { ApiService } from '../api.service';
31}) 31})
32export class RestApisComponent implements OnInit { 32export class RestApisComponent implements OnInit {
33 33
34 apis: RestAPI[]; 34 apis: RestAPI[] = [
35 {name: 'Manage Identities', desc: 'Create new identities, edit their names and delete them!', link: 'identity'},
36 {name: 'Maintain Names', desc: 'Do things!', link: 'namestore'},
37 {name: 'Handle Peers', desc: 'Do things!', link: 'peerstore'},
38 ];
35 39
36 constructor(private apiService: ApiService) { } 40 constructor(private apiService: ApiService) { }
37 41
38 getAPIs(): void {
39 this.apiService.getAPIs().subscribe(apis => this.apis = apis);
40 }
41
42 ngOnInit() { 42 ngOnInit() {
43 this.getAPIs();
44 } 43 }
45 44
46} 45}