[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet-webui] 02/05: -wip Service feature
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet-webui] 02/05: -wip Service feature |
Date: |
Sat, 09 Jun 2018 12:17:28 +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 57efd4f24d238ca649ef25e9922b7f64fa4cc417
Author: Phil <address@hidden>
AuthorDate: Tue May 15 22:03:04 2018 +0200
-wip Service feature
---
src/app/api.service.spec.ts | 15 +++++++++++++
src/app/api.service.ts | 20 +++++++++++++++++
src/app/app-routing.module.spec.ts | 13 +++++++++++
src/app/app-routing.module.ts | 16 ++++++++++++++
src/app/app.component.html | 32 +++++++++++++++------------
src/app/app.component.ts | 2 +-
src/app/app.module.ts | 12 ++++++++--
src/app/rest-api.ts | 5 +++++
src/app/rest-apis/rest-apis.component.html | 3 +++
src/app/rest-apis/rest-apis.component.scss | 0
src/app/rest-apis/rest-apis.component.spec.ts | 25 +++++++++++++++++++++
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 @@
+import { TestBed, inject } from '@angular/core/testing';
+
+import { ApiService } from './api.service';
+
+describe('ApiService', () => {
+ beforeEach(() => {
+ TestBed.configureTestingModule({
+ providers: [ApiService]
+ });
+ });
+
+ it('should be created', inject([ApiService], (service: ApiService) => {
+ expect(service).toBeTruthy();
+ }));
+});
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 @@
+import { Injectable } from '@angular/core';
+import { Observable, of } from 'rxjs';
+import { RestAPI } from './rest-api';
+
address@hidden({
+ providedIn: 'root'
+})
+export class ApiService {
+ apis: RestAPI[] = [
+ {name: 'Rest API 1', desc: 'What it does', link: '#'},
+ {name: 'Rest API 1', desc: 'What it does', link: '#'},
+ {name: 'Rest API 1', desc: 'What it does', link: '#'}
+ ];
+
+ constructor() { }
+
+ getAPIs(): Observable<RestAPI[]> {
+ return of(this.apis);
+ }
+}
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 @@
+import { AppRoutingModule } from './app-routing.module';
+
+describe('AppRoutingModule', () => {
+ let appRoutingModule: AppRoutingModule;
+
+ beforeEach(() => {
+ appRoutingModule = new AppRoutingModule();
+ });
+
+ it('should create an instance', () => {
+ expect(appRoutingModule).toBeTruthy();
+ });
+});
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 @@
+import { NgModule } from '@angular/core';
+import { RouterModule, Routes } from '@angular/router';
+
+import { RestApisComponent } from './rest-apis/rest-apis.component';
+
+
+const routes: Routes = [
+ { path: 'apis', component: RestApisComponent }
+];
+
address@hidden({
+ imports: [ RouterModule.forRoot(routes) ],
+ exports: [ RouterModule ]
+})
+export class AppRoutingModule {
+}
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 @@
<!--The content below is only a placeholder and can be replaced.-->
<div style="text-align:center">
<h1>
- Welcome to {{ title }}!
+ {{ title }}
</h1>
- <img width="300" alt="Angular Logo"
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTg
[...]
+ <app-rest-apis></app-rest-apis>
+ <router-outlet></router-outlet>
</div>
-<h2>Here are some links to help you start: </h2>
-<ul>
- <li>
- <h2><a target="_blank" rel="noopener"
href="https://angular.io/tutorial">Tour of Heroes</a></h2>
- </li>
- <li>
- <h2><a target="_blank" rel="noopener"
href="https://github.com/angular/angular-cli/wiki">CLI Documentation</a></h2>
- </li>
- <li>
- <h2><a target="_blank" rel="noopener"
href="https://blog.angular.io/">Angular blog</a></h2>
- </li>
+<div class="o-container u-bgcolor-grey-light">
+ <div class="o-grid o-grid--gutter-x4">
+ <div class="o-grid__col u-1/address@hidden u-bgcolor-white">
+ Test
+ </div>
+ <div class="o-grid__col u-1/address@hidden u-bgcolor-white">
+ Test
+ </div>
+ </div>
+<h2 class="">Here are some links to help you start: </h2>
+<ul class="o-list">
+ <li class="o-list__item"><a target="_blank" rel="noopener"
href="https://angular.io/tutorial">Tour of Heroes</a></li>
+ <li class="o-list__item"><a target="_blank" rel="noopener"
href="https://github.com/angular/angular-cli/wiki">CLI Documentation</a></li>
+ <li class="o-list__item"><a target="_blank" rel="noopener"
href="https://blog.angular.io/">Angular blog</a></li>
</ul>
-
+</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';
styleUrls: ['./../scss/main.scss']
})
export class AppComponent {
- title = 'app';
+ title = 'GNUnet Web User Interface';
}
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 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
+import { FormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
+import { HeroesComponent } from './heroes/heroes.component';
+import { RestApisComponent } from './rest-apis/rest-apis.component';
+import { AppRoutingModule } from './/app-routing.module';
@NgModule({
declarations: [
- AppComponent
+ AppComponent,
+ HeroesComponent,
+ RestApisComponent
],
imports: [
- BrowserModule
+ BrowserModule,
+ FormsModule,
+ AppRoutingModule
],
providers: [],
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 @@
+export class RestAPI {
+ name: string;
+ desc: string;
+ link: string;
+}
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 @@
+<div *ngFor="let api of apis">
+ {{api.name}}{{api.desc}}<a href="{{api.link}}">Link</a>
+</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
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 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { RestApisComponent } from './rest-apis.component';
+
+describe('RestApisComponent', () => {
+ let component: RestApisComponent;
+ let fixture: ComponentFixture<RestApisComponent>;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ RestApisComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(RestApisComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
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 @@
+import { Component, OnInit } from '@angular/core';
+import { RestAPI } from '../rest-api';
+import { ApiService } from '../api.service';
+
address@hidden({
+ selector: 'app-rest-apis',
+ templateUrl: './rest-apis.component.html',
+ styleUrls: ['./rest-apis.component.scss']
+})
+export class RestApisComponent implements OnInit {
+
+ apis: RestAPI[];
+
+ constructor(private apiService: ApiService) { }
+
+ getAPIs(): void {
+ this.apiService.getAPIs().subscribe(apis => this.apis = apis);
+ }
+
+ ngOnInit() {
+ this.getAPIs();
+ }
+
+}
--
To stop receiving notification emails like this one, please contact
address@hidden