diff options
-rw-r--r-- | src/app/api.service.spec.ts | 15 | ||||
-rw-r--r-- | src/app/api.service.ts | 20 | ||||
-rw-r--r-- | src/app/app-routing.module.spec.ts | 13 | ||||
-rw-r--r-- | src/app/app-routing.module.ts | 16 | ||||
-rw-r--r-- | src/app/app.component.html | 32 | ||||
-rw-r--r-- | src/app/app.component.ts | 2 | ||||
-rw-r--r-- | src/app/app.module.ts | 12 | ||||
-rw-r--r-- | src/app/rest-api.ts | 5 | ||||
-rw-r--r-- | src/app/rest-apis/rest-apis.component.html | 3 | ||||
-rw-r--r-- | src/app/rest-apis/rest-apis.component.scss | 0 | ||||
-rw-r--r-- | src/app/rest-apis/rest-apis.component.spec.ts | 25 | ||||
-rw-r--r-- | src/app/rest-apis/rest-apis.component.ts | 24 |
12 files changed, 150 insertions, 17 deletions
diff --git a/src/app/api.service.spec.ts b/src/app/api.service.spec.ts new file mode 100644 index 0000000..65b6c71 --- /dev/null +++ b/src/app/api.service.spec.ts | |||
@@ -0,0 +1,15 @@ | |||
1 | import { TestBed, inject } from '@angular/core/testing'; | ||
2 | |||
3 | import { ApiService } from './api.service'; | ||
4 | |||
5 | describe('ApiService', () => { | ||
6 | beforeEach(() => { | ||
7 | TestBed.configureTestingModule({ | ||
8 | providers: [ApiService] | ||
9 | }); | ||
10 | }); | ||
11 | |||
12 | it('should be created', inject([ApiService], (service: ApiService) => { | ||
13 | expect(service).toBeTruthy(); | ||
14 | })); | ||
15 | }); | ||
diff --git a/src/app/api.service.ts b/src/app/api.service.ts new file mode 100644 index 0000000..aaf0162 --- /dev/null +++ b/src/app/api.service.ts | |||
@@ -0,0 +1,20 @@ | |||
1 | import { Injectable } from '@angular/core'; | ||
2 | import { Observable, of } from 'rxjs'; | ||
3 | import { RestAPI } from './rest-api'; | ||
4 | |||
5 | @Injectable({ | ||
6 | providedIn: 'root' | ||
7 | }) | ||
8 | export class ApiService { | ||
9 | apis: RestAPI[] = [ | ||
10 | {name: 'Rest API 1', desc: 'What it does', link: '#'}, | ||
11 | {name: 'Rest API 1', desc: 'What it does', link: '#'}, | ||
12 | {name: 'Rest API 1', desc: 'What it does', link: '#'} | ||
13 | ]; | ||
14 | |||
15 | constructor() { } | ||
16 | |||
17 | getAPIs(): Observable<RestAPI[]> { | ||
18 | return of(this.apis); | ||
19 | } | ||
20 | } | ||
diff --git a/src/app/app-routing.module.spec.ts b/src/app/app-routing.module.spec.ts new file mode 100644 index 0000000..d68ef06 --- /dev/null +++ b/src/app/app-routing.module.spec.ts | |||
@@ -0,0 +1,13 @@ | |||
1 | import { AppRoutingModule } from './app-routing.module'; | ||
2 | |||
3 | describe('AppRoutingModule', () => { | ||
4 | let appRoutingModule: AppRoutingModule; | ||
5 | |||
6 | beforeEach(() => { | ||
7 | appRoutingModule = new AppRoutingModule(); | ||
8 | }); | ||
9 | |||
10 | it('should create an instance', () => { | ||
11 | expect(appRoutingModule).toBeTruthy(); | ||
12 | }); | ||
13 | }); | ||
diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts new file mode 100644 index 0000000..2c25096 --- /dev/null +++ b/src/app/app-routing.module.ts | |||
@@ -0,0 +1,16 @@ | |||
1 | import { NgModule } from '@angular/core'; | ||
2 | import { RouterModule, Routes } from '@angular/router'; | ||
3 | |||
4 | import { RestApisComponent } from './rest-apis/rest-apis.component'; | ||
5 | |||
6 | |||
7 | const routes: Routes = [ | ||
8 | { path: 'apis', component: RestApisComponent } | ||
9 | ]; | ||
10 | |||
11 | @NgModule({ | ||
12 | imports: [ RouterModule.forRoot(routes) ], | ||
13 | exports: [ RouterModule ] | ||
14 | }) | ||
15 | export class AppRoutingModule { | ||
16 | } | ||
diff --git a/src/app/app.component.html b/src/app/app.component.html index fa2706a..566c30f 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html | |||
@@ -1,20 +1,24 @@ | |||
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 | <div style="text-align:center"> | 2 | <div style="text-align:center"> |
3 | <h1> | 3 | <h1> |
4 | Welcome to {{ title }}! | 4 | {{ title }} |
5 | </h1> | 5 | </h1> |
6 | <img width="300" alt="Angular Logo" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg=="> | 6 | <app-rest-apis></app-rest-apis> |
7 | <router-outlet></router-outlet> | ||
7 | </div> | 8 | </div> |
8 | <h2>Here are some links to help you start: </h2> | 9 | <div class="o-container u-bgcolor-grey-light"> |
9 | <ul> | 10 | <div class="o-grid o-grid--gutter-x4"> |
10 | <li> | 11 | <div class="o-grid__col u-1/2@sm u-bgcolor-white"> |
11 | <h2><a target="_blank" rel="noopener" href="https://angular.io/tutorial">Tour of Heroes</a></h2> | 12 | Test |
12 | </li> | 13 | </div> |
13 | <li> | 14 | <div class="o-grid__col u-1/2@sm u-bgcolor-white"> |
14 | <h2><a target="_blank" rel="noopener" href="https://github.com/angular/angular-cli/wiki">CLI Documentation</a></h2> | 15 | Test |
15 | </li> | 16 | </div> |
16 | <li> | 17 | </div> |
17 | <h2><a target="_blank" rel="noopener" href="https://blog.angular.io/">Angular blog</a></h2> | 18 | <h2 class="">Here are some links to help you start: </h2> |
18 | </li> | 19 | <ul class="o-list"> |
20 | <li class="o-list__item"><a target="_blank" rel="noopener" href="https://angular.io/tutorial">Tour of Heroes</a></li> | ||
21 | <li class="o-list__item"><a target="_blank" rel="noopener" href="https://github.com/angular/angular-cli/wiki">CLI Documentation</a></li> | ||
22 | <li class="o-list__item"><a target="_blank" rel="noopener" href="https://blog.angular.io/">Angular blog</a></li> | ||
19 | </ul> | 23 | </ul> |
20 | 24 | </div> | |
diff --git a/src/app/app.component.ts b/src/app/app.component.ts index bff8c82..4bba0e2 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts | |||
@@ -6,5 +6,5 @@ import { Component } from '@angular/core'; | |||
6 | styleUrls: ['./../scss/main.scss'] | 6 | styleUrls: ['./../scss/main.scss'] |
7 | }) | 7 | }) |
8 | export class AppComponent { | 8 | export class AppComponent { |
9 | title = 'app'; | 9 | title = 'GNUnet Web User Interface'; |
10 | } | 10 | } |
diff --git a/src/app/app.module.ts b/src/app/app.module.ts index f657163..cb9bb62 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts | |||
@@ -1,14 +1,22 @@ | |||
1 | import { BrowserModule } from '@angular/platform-browser'; | 1 | import { BrowserModule } from '@angular/platform-browser'; |
2 | import { NgModule } from '@angular/core'; | 2 | import { NgModule } from '@angular/core'; |
3 | import { FormsModule } from '@angular/forms'; | ||
3 | 4 | ||
4 | import { AppComponent } from './app.component'; | 5 | import { AppComponent } from './app.component'; |
6 | import { HeroesComponent } from './heroes/heroes.component'; | ||
7 | import { RestApisComponent } from './rest-apis/rest-apis.component'; | ||
8 | import { AppRoutingModule } from './/app-routing.module'; | ||
5 | 9 | ||
6 | @NgModule({ | 10 | @NgModule({ |
7 | declarations: [ | 11 | declarations: [ |
8 | AppComponent | 12 | AppComponent, |
13 | HeroesComponent, | ||
14 | RestApisComponent | ||
9 | ], | 15 | ], |
10 | imports: [ | 16 | imports: [ |
11 | BrowserModule | 17 | BrowserModule, |
18 | FormsModule, | ||
19 | AppRoutingModule | ||
12 | ], | 20 | ], |
13 | providers: [], | 21 | providers: [], |
14 | bootstrap: [AppComponent] | 22 | bootstrap: [AppComponent] |
diff --git a/src/app/rest-api.ts b/src/app/rest-api.ts new file mode 100644 index 0000000..b4fa409 --- /dev/null +++ b/src/app/rest-api.ts | |||
@@ -0,0 +1,5 @@ | |||
1 | export class RestAPI { | ||
2 | name: string; | ||
3 | desc: string; | ||
4 | link: string; | ||
5 | } | ||
diff --git a/src/app/rest-apis/rest-apis.component.html b/src/app/rest-apis/rest-apis.component.html new file mode 100644 index 0000000..5e0e14a --- /dev/null +++ b/src/app/rest-apis/rest-apis.component.html | |||
@@ -0,0 +1,3 @@ | |||
1 | <div *ngFor="let api of apis"> | ||
2 | {{api.name}}{{api.desc}}<a href="{{api.link}}">Link</a> | ||
3 | </div> | ||
diff --git a/src/app/rest-apis/rest-apis.component.scss b/src/app/rest-apis/rest-apis.component.scss new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/app/rest-apis/rest-apis.component.scss | |||
diff --git a/src/app/rest-apis/rest-apis.component.spec.ts b/src/app/rest-apis/rest-apis.component.spec.ts new file mode 100644 index 0000000..7ed2d82 --- /dev/null +++ b/src/app/rest-apis/rest-apis.component.spec.ts | |||
@@ -0,0 +1,25 @@ | |||
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
2 | |||
3 | import { RestApisComponent } from './rest-apis.component'; | ||
4 | |||
5 | describe('RestApisComponent', () => { | ||
6 | let component: RestApisComponent; | ||
7 | let fixture: ComponentFixture<RestApisComponent>; | ||
8 | |||
9 | beforeEach(async(() => { | ||
10 | TestBed.configureTestingModule({ | ||
11 | declarations: [ RestApisComponent ] | ||
12 | }) | ||
13 | .compileComponents(); | ||
14 | })); | ||
15 | |||
16 | beforeEach(() => { | ||
17 | fixture = TestBed.createComponent(RestApisComponent); | ||
18 | component = fixture.componentInstance; | ||
19 | fixture.detectChanges(); | ||
20 | }); | ||
21 | |||
22 | it('should create', () => { | ||
23 | expect(component).toBeTruthy(); | ||
24 | }); | ||
25 | }); | ||
diff --git a/src/app/rest-apis/rest-apis.component.ts b/src/app/rest-apis/rest-apis.component.ts new file mode 100644 index 0000000..c8fc017 --- /dev/null +++ b/src/app/rest-apis/rest-apis.component.ts | |||
@@ -0,0 +1,24 @@ | |||
1 | import { Component, OnInit } from '@angular/core'; | ||
2 | import { RestAPI } from '../rest-api'; | ||
3 | import { ApiService } from '../api.service'; | ||
4 | |||
5 | @Component({ | ||
6 | selector: 'app-rest-apis', | ||
7 | templateUrl: './rest-apis.component.html', | ||
8 | styleUrls: ['./rest-apis.component.scss'] | ||
9 | }) | ||
10 | export class RestApisComponent implements OnInit { | ||
11 | |||
12 | apis: RestAPI[]; | ||
13 | |||
14 | constructor(private apiService: ApiService) { } | ||
15 | |||
16 | getAPIs(): void { | ||
17 | this.apiService.getAPIs().subscribe(apis => this.apis = apis); | ||
18 | } | ||
19 | |||
20 | ngOnInit() { | ||
21 | this.getAPIs(); | ||
22 | } | ||
23 | |||
24 | } | ||