[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet-webui] 01/04: -wip namestore page
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet-webui] 01/04: -wip namestore page |
Date: |
Tue, 14 Aug 2018 01:03:09 +0200 |
This is an automated email from the git hooks/post-receive script.
phil pushed a commit to branch master
in repository gnunet-webui.
commit fe7f086b0128b664f6fd24b0a0b4faa75697517b
Author: Phil <address@hidden>
AuthorDate: Thu Jul 26 02:39:52 2018 +0200
-wip namestore page
---
src/app/api.service.ts | 12 +++++++
src/app/gns-record.ts | 30 +++++++++++++++++
.../namestore-page/namestore-page.component.html | 38 ++++++++++++----------
src/app/namestore-page/namestore-page.component.ts | 19 +++++++++--
4 files changed, 80 insertions(+), 19 deletions(-)
diff --git a/src/app/api.service.ts b/src/app/api.service.ts
index 6597514..643f8a3 100644
--- a/src/app/api.service.ts
+++ b/src/app/api.service.ts
@@ -26,6 +26,7 @@ import { HttpClient, HttpHeaders } from
'@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable, of } from 'rxjs';
import { RestAPI } from './rest-api';
+import { GNSRecord } from './gns-record';
import { IdentityAPI } from './identity-api';
import { catchError, map, tap } from 'rxjs/operators';
import { MessagesService } from './messages.service';
@@ -38,6 +39,7 @@ export class ApiService {
private restURL = 'http://localhost:7776/'
private identityURL = this.restURL+'identity';
private gnsURL = this.restURL+'gns';
+ private namestoreURL = this.restURL+'namestore';
constructor(private http: HttpClient,
private messages:MessagesService) { }
@@ -99,6 +101,16 @@ export class ApiService {
);
}
+ addGNSRecord (gns_record: GNSRecord): Observable<any>{
+ this.messages.dismissError();
+ const options = {headers: {'Content-Type': 'application/json'}};
+ return this.http.post(this.namestoreURL, gns_record, options)
+ .pipe(
+ tap(json => this.handleJSON(json)),
+ catchError(this.handleError('searchNameSystem', []))
+ );
+ }
+
/**
diff --git a/src/app/gns-record.ts b/src/app/gns-record.ts
new file mode 100644
index 0000000..3c29ce4
--- /dev/null
+++ b/src/app/gns-record.ts
@@ -0,0 +1,30 @@
+/*
+ This file is part of GNUnet.
+ Copyright (C) 2012-2015 GNUnet e.V.
+
+ GNUnet is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+/**
+ * @author Philippe Buschmann
+ * @file src/app/gns_record.ts
+ * @brief
+ *
+ */
+export class GNSRecord {
+ value: string;
+ type: string;
+ expiration_time: string;
+ flag: number;
+ label: string;
+}
diff --git a/src/app/namestore-page/namestore-page.component.html
b/src/app/namestore-page/namestore-page.component.html
index 3d9bf09..af573ca 100644
--- a/src/app/namestore-page/namestore-page.component.html
+++ b/src/app/namestore-page/namestore-page.component.html
@@ -9,23 +9,23 @@
<div class="o-list__item">
<p class="u-color-grey">Record Type (optional):</p>
<select class="c-input c-input--select u-2/2"
[(ngModel)]="gns_recordtype" name="record_type">
- <option [value]="0">ANY</option>
- <option [value]="65536">PKEY</option>
- <option [value]="65537">NICK</option>
- <option [value]="65538">LEHO</option>
- <option [value]="65539">VPN</option>
- <option [value]="65540">GNS2DNS</option>
- <option [value]="65541">BOX</option>
- <option [value]="65542">PLACE</option>
- <option [value]="65543">PHONE</option>
- <option [value]="65544">ID_ATTR</option>
- <option [value]="65545">ID_TOKEN</option>
- <option [value]="65546">ID_TOKEN_METADATA</option>
- <option [value]="65547">CREDENTIAL</option>
- <option [value]="65548">POLICY</option>
- <option [value]="65549">ATTRIBUTE</option>
- <option [value]="65550">ABE_KEY</option>
- <option [value]="65551">ABE_MASTER</option>
+ <option [value]="'ANY'">Any</option>
+ <option [value]="'PKEY'">Public Key</option>
+ <option [value]="'NICK'">Nickname</option>
+ <option [value]="'LEHO'">Legacy Hostname</option>
+ <option [value]="'VPN'">VPN resolution</option>
+ <option [value]="'GNS2DNS'">GNS 2 DNS</option>
+ <option [value]="'BOX'">Boxed Record</option>
+ <option [value]="'PLACE'">Social Place</option>
+ <option [value]="'PHONE'">Phone (Coversation)</option>
+ <option [value]="'ID_ATTR'">Identity Attribute</option>
+ <option [value]="'ID_TOKEN'">Identity Token</option>
+ <option [value]="'ID_TOKEN_METADATA'">Identity Metadata
(Token)</option>
+ <option [value]="'CREDENTIAL'">Credential</option>
+ <option [value]="'POLICY'">Policy</option>
+ <option [value]="'ATTRIBUTE'">Reverse lookup (Attribute)</option>
+ <option [value]="'ABE_KEY'">ABE Record</option>
+ <option [value]="'ABE_MASTER'">ABE Master Key</option>
</select>
</div>
<div class="o-list__item u-align-bottom">
@@ -33,3 +33,7 @@
</div>
</div>
</div>
+
+<div>
+ <a class="c-button" (click)="onGNSRecordAdd()" >Test GNS_record</a>
+</div>
diff --git a/src/app/namestore-page/namestore-page.component.ts
b/src/app/namestore-page/namestore-page.component.ts
index fc3c501..d135bdc 100644
--- a/src/app/namestore-page/namestore-page.component.ts
+++ b/src/app/namestore-page/namestore-page.component.ts
@@ -24,6 +24,7 @@
import { Component, OnInit } from '@angular/core';
import { ApiService } from '../api.service';
+import { GNSRecord } from '../gns-record';
@Component({
selector: 'app-namestore-page',
@@ -31,10 +32,12 @@ import { ApiService } from '../api.service';
})
export class NamestorePageComponent implements OnInit {
- gns_name:string;
- gns_recordtype:number = 0;
+ gns_name:string = '';
+ gns_recordtype:string = 'ANY';
private gns_response:any =[];
+ gns_record: GNSRecord;
+
private url: string;
constructor(private apiService:ApiService) { }
@@ -51,8 +54,20 @@ export class NamestorePageComponent implements OnInit {
this.apiService.searchNameSystem(this.url).subscribe(data => {
this.gns_response = data;
console.log(data);
+ });
+ }
+ onGNSRecordAdd(){
+ this.gns_record = new GNSRecord();
+ this.gns_record.label = 'test_name';
+ this.gns_record.type = 'PKEY';
+ this.gns_record.expiration_time = 'never';
+ this.gns_record.flag = 0;
+ this.gns_record.value =
'EY1FZ4CNHYXRB4MS1KVB7ZSS0FZ2WBCQBR3J438H6P8EP5BPBJ40';
+ this.apiService.addGNSRecord(this.gns_record).subscribe(data => {
+ console.log(data);
});
+
}
}
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnunet-webui] branch master updated (da35c82 -> 560b397), gnunet, 2018/08/13
- [GNUnet-SVN] [gnunet-webui] 02/04: fix visuals, wip namestore page, gnunet, 2018/08/13
- [GNUnet-SVN] [gnunet-webui] 01/04: -wip namestore page,
gnunet <=
- [GNUnet-SVN] [gnunet-webui] 04/04: finished namestore page, gnunet, 2018/08/13
- [GNUnet-SVN] [gnunet-webui] 03/04: All changes - fixes, features, renames, gnunet, 2018/08/13