aboutsummaryrefslogtreecommitdiff
path: root/src/app/gns-page
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/gns-page')
-rw-r--r--src/app/gns-page/gns-page.component.html47
-rw-r--r--src/app/gns-page/gns-page.component.spec.ts25
-rw-r--r--src/app/gns-page/gns-page.component.ts57
3 files changed, 129 insertions, 0 deletions
diff --git a/src/app/gns-page/gns-page.component.html b/src/app/gns-page/gns-page.component.html
new file mode 100644
index 0000000..47e5102
--- /dev/null
+++ b/src/app/gns-page/gns-page.component.html
@@ -0,0 +1,47 @@
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.spec.ts b/src/app/gns-page/gns-page.component.spec.ts
new file mode 100644
index 0000000..c76f655
--- /dev/null
+++ b/src/app/gns-page/gns-page.component.spec.ts
@@ -0,0 +1,25 @@
1import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2
3import { GnsPageComponent } from './gns-page.component';
4
5describe('GnsPageComponent', () => {
6 let component: GnsPageComponent;
7 let fixture: ComponentFixture<GnsPageComponent>;
8
9 beforeEach(async(() => {
10 TestBed.configureTestingModule({
11 declarations: [ GnsPageComponent ]
12 })
13 .compileComponents();
14 }));
15
16 beforeEach(() => {
17 fixture = TestBed.createComponent(GnsPageComponent);
18 component = fixture.componentInstance;
19 fixture.detectChanges();
20 });
21
22 it('should create', () => {
23 expect(component).toBeTruthy();
24 });
25});
diff --git a/src/app/gns-page/gns-page.component.ts b/src/app/gns-page/gns-page.component.ts
new file mode 100644
index 0000000..ea25fc5
--- /dev/null
+++ b/src/app/gns-page/gns-page.component.ts
@@ -0,0 +1,57 @@
1import { Component, OnInit } from '@angular/core';
2import { ApiService } from '../api.service';
3
4@Component({
5 selector: 'gns-page',
6 templateUrl: './gns-page.component.html'
7})
8export class GnsPageComponent implements OnInit {
9
10 private gns_name:string;
11 private gns_recordtype:number = 0;
12 private gns_options:number = 0;
13 private gns_zonekey:string = '';
14 private display_ego: boolean = true;
15 private display_zonekey: boolean = true;
16 private gns_ego:string = '';
17 private gns_response:any =[];
18
19 private url: string;
20
21 constructor(private apiService:ApiService) { }
22
23 ngOnInit() {
24 }
25
26 onSearch(){
27 this.url = '?name='+this.gns_name;
28 if(this.gns_recordtype != null && this.gns_recordtype != ''){
29 this.url += '&record_type='+this.gns_recordtype;
30 }
31 if(this.gns_options != null && this.gns_options != ''){
32 this.url += '&options='+this.gns_options;
33 }
34 if(this.gns_zonekey != null && this.gns_zonekey != ''){
35 this.url += '&pkey='+this.gns_zonekey;
36 }
37 if(this.gns_ego != null && this.gns_ego != ''){
38 this.url += '&ego='+this.gns_ego;
39 }
40 console.log(this.url);
41 this.apiService.searchNameSystem(this.url).subscribe(data => {
42 this.gns_response = data;
43 });
44 }
45
46 toggleEgo(){
47 if(this.gns_zonekey == ''){ this.display_ego = true; }
48 else { this.display_ego = false; }
49 }
50
51 toggleZonekey(){
52 if(this.gns_ego == ''){ this.display_zonekey = true; }
53 else { this.display_zonekey = false; }
54 }
55
56
57}