mirror of
https://github.com/Retropex/Ordisrespector-pool-ui.git
synced 2025-05-13 03:30:44 +02:00
ui init
This commit is contained in:
parent
9aafc19923
commit
d9b18b920c
@ -3,7 +3,7 @@
|
|||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"start": "ng serve",
|
"start": "ng serve --proxy-config proxy.config.local.json ",
|
||||||
"build": "ng build",
|
"build": "ng build",
|
||||||
"watch": "ng build --watch --configuration development",
|
"watch": "ng build --watch --configuration development",
|
||||||
"test": "ng test"
|
"test": "ng test"
|
||||||
|
8
proxy.config.local.json
Normal file
8
proxy.config.local.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"/api": {
|
||||||
|
"target": "http://localhost:3334",
|
||||||
|
"secure": false,
|
||||||
|
"changeOrigin": false,
|
||||||
|
"logLevel": "debug"
|
||||||
|
}
|
||||||
|
}
|
@ -1,9 +1,9 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { RouterModule, Routes } from '@angular/router';
|
import { RouterModule, Routes } from '@angular/router';
|
||||||
|
|
||||||
import { DashboardComponent } from './dashboard/dashboard.component';
|
import { DashboardComponent } from './components/dashboard/dashboard.component';
|
||||||
|
import { SplashComponent } from './components/splash/splash.component';
|
||||||
import { AppLayoutComponent } from './layout/app.layout.component';
|
import { AppLayoutComponent } from './layout/app.layout.component';
|
||||||
import { SplashComponent } from './splash/splash.component';
|
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{
|
{
|
||||||
@ -15,7 +15,7 @@ const routes: Routes = [
|
|||||||
component: AppLayoutComponent,
|
component: AppLayoutComponent,
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'dashboard',
|
path: ':address',
|
||||||
component: DashboardComponent
|
component: DashboardComponent
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
import { CommonModule, HashLocationStrategy, LocationStrategy } from '@angular/common';
|
import { CommonModule, HashLocationStrategy, LocationStrategy } from '@angular/common';
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||||
import { BrowserModule } from '@angular/platform-browser';
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
|
|
||||||
import { PrimeNGModule } from '../prime-ng.module';
|
import { PrimeNGModule } from '../prime-ng.module';
|
||||||
import { AppRoutingModule } from './app-routing.module';
|
import { AppRoutingModule } from './app-routing.module';
|
||||||
import { AppComponent } from './app.component';
|
import { AppComponent } from './app.component';
|
||||||
import { DashboardComponent } from './dashboard/dashboard.component';
|
import { DashboardComponent } from './components/dashboard/dashboard.component';
|
||||||
|
import { SplashComponent } from './components/splash/splash.component';
|
||||||
import { AppLayoutModule } from './layout/app.layout.module';
|
import { AppLayoutModule } from './layout/app.layout.module';
|
||||||
import { SplashComponent } from './splash/splash.component';
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
@ -20,7 +21,9 @@ import { SplashComponent } from './splash/splash.component';
|
|||||||
BrowserModule,
|
BrowserModule,
|
||||||
AppRoutingModule,
|
AppRoutingModule,
|
||||||
PrimeNGModule,
|
PrimeNGModule,
|
||||||
AppLayoutModule
|
AppLayoutModule,
|
||||||
|
FormsModule,
|
||||||
|
ReactiveFormsModule
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: LocationStrategy, useClass: HashLocationStrategy },
|
{ provide: LocationStrategy, useClass: HashLocationStrategy },
|
||||||
|
5
src/app/components/dashboard/dashboard.component.html
Normal file
5
src/app/components/dashboard/dashboard.component.html
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<div class="card">
|
||||||
|
<pre>
|
||||||
|
{{clientInfo$ | async | json}}
|
||||||
|
</pre>
|
||||||
|
</div>
|
19
src/app/components/dashboard/dashboard.component.ts
Normal file
19
src/app/components/dashboard/dashboard.component.ts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
|
import { ClientService } from '../../services/client.service';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-dashboard',
|
||||||
|
templateUrl: './dashboard.component.html',
|
||||||
|
styleUrls: ['./dashboard.component.scss']
|
||||||
|
})
|
||||||
|
export class DashboardComponent {
|
||||||
|
|
||||||
|
public clientInfo$: Observable<any>;
|
||||||
|
|
||||||
|
constructor(private clientService: ClientService, private route: ActivatedRoute) {
|
||||||
|
this.clientInfo$ = this.clientService.getClientInfo(this.route.snapshot.params['address']);
|
||||||
|
}
|
||||||
|
}
|
@ -9,9 +9,10 @@
|
|||||||
|
|
||||||
<div class="field mt-8">
|
<div class="field mt-8">
|
||||||
|
|
||||||
<input placeholder="Address" pInputText id="name1" type="text"
|
<input [(ngModel)]="address" placeholder="Address" pInputText id="address" type="text"
|
||||||
class="p-inputtext p-component p-element">
|
class="p-inputtext p-component p-element">
|
||||||
<button class="ml-3" pButton label="My Account" [routerLink]="['app','dashboard']"></button>
|
<button [disabled]="address == null" class="ml-3" pButton label="My Account"
|
||||||
|
[routerLink]="['app',address]"></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
3
src/app/components/splash/splash.component.scss
Normal file
3
src/app/components/splash/splash.component.scss
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#address {
|
||||||
|
min-width: 325px;
|
||||||
|
}
|
@ -7,5 +7,6 @@ import { Component } from '@angular/core';
|
|||||||
})
|
})
|
||||||
export class SplashComponent {
|
export class SplashComponent {
|
||||||
|
|
||||||
|
public address!: string;
|
||||||
constructor() { }
|
constructor() { }
|
||||||
}
|
}
|
@ -1 +0,0 @@
|
|||||||
<p>dashboard works!</p>
|
|
@ -1,10 +0,0 @@
|
|||||||
import { Component } from '@angular/core';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-dashboard',
|
|
||||||
templateUrl: './dashboard.component.html',
|
|
||||||
styleUrls: ['./dashboard.component.scss']
|
|
||||||
})
|
|
||||||
export class DashboardComponent {
|
|
||||||
|
|
||||||
}
|
|
16
src/app/services/client.service.spec.ts
Normal file
16
src/app/services/client.service.spec.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { ClientService } from './client.service';
|
||||||
|
|
||||||
|
describe('ClientService', () => {
|
||||||
|
let service: ClientService;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
TestBed.configureTestingModule({});
|
||||||
|
service = TestBed.inject(ClientService);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should be created', () => {
|
||||||
|
expect(service).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
18
src/app/services/client.service.ts
Normal file
18
src/app/services/client.service.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { HttpClient } from '@angular/common/http';
|
||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
|
||||||
|
import { environment } from '../../environments/environment';
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class ClientService {
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private httpClient: HttpClient
|
||||||
|
) { }
|
||||||
|
|
||||||
|
public getClientInfo(address: string) {
|
||||||
|
return this.httpClient.get(`${environment.API_URL}/api/client/${address}`);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user