Create navbar and sidebar for view page
This commit is contained in:
parent
7494ca72ab
commit
706bb17055
@ -14,7 +14,7 @@ export class SendDataService {
|
|||||||
formData.append('file', file, file.name);
|
formData.append('file', file, file.name);
|
||||||
|
|
||||||
return this.http.post<File>(
|
return this.http.post<File>(
|
||||||
'http://127.0.0.1:8000/prototype/form',
|
'http://127.0.0.1:8000/prototype/form/',
|
||||||
formData,
|
formData,
|
||||||
requestOptions
|
requestOptions
|
||||||
);
|
);
|
||||||
|
@ -2,10 +2,16 @@ import { BrowserModule } from '@angular/platform-browser';
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { HttpClientModule } from '@angular/common/http';
|
import { HttpClientModule } from '@angular/common/http';
|
||||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
import { NbThemeModule } from '@nebular/theme';
|
|
||||||
import { AppRoutingModule } from './app-routing.module';
|
import { AppRoutingModule } from './app-routing.module';
|
||||||
import { AppComponent } from './app.component';
|
import { AppComponent } from './app.component';
|
||||||
|
|
||||||
import { NbEvaIconsModule } from '@nebular/eva-icons';
|
import { NbEvaIconsModule } from '@nebular/eva-icons';
|
||||||
|
import {
|
||||||
|
NbThemeModule,
|
||||||
|
NbSidebarModule,
|
||||||
|
NbSidebarService,
|
||||||
|
} from '@nebular/theme';
|
||||||
|
|
||||||
import { FrontPageModule } from './front-page/front-page.module';
|
import { FrontPageModule } from './front-page/front-page.module';
|
||||||
import { SharedDataService } from './_services/shared-data.service';
|
import { SharedDataService } from './_services/shared-data.service';
|
||||||
@ -18,10 +24,11 @@ import { SharedDataService } from './_services/shared-data.service';
|
|||||||
AppRoutingModule,
|
AppRoutingModule,
|
||||||
HttpClientModule,
|
HttpClientModule,
|
||||||
NbThemeModule.forRoot(),
|
NbThemeModule.forRoot(),
|
||||||
|
NbSidebarModule.forRoot(),
|
||||||
NbEvaIconsModule,
|
NbEvaIconsModule,
|
||||||
FrontPageModule,
|
FrontPageModule,
|
||||||
],
|
],
|
||||||
bootstrap: [AppComponent],
|
bootstrap: [AppComponent],
|
||||||
providers: [SharedDataService],
|
providers: [SharedDataService, NbSidebarService],
|
||||||
})
|
})
|
||||||
export class AppModule {}
|
export class AppModule {}
|
||||||
|
@ -37,7 +37,9 @@ export class FrontPageComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sendFile(event: any): void {
|
sendFile(event: any): void {
|
||||||
this.sharedDataService.setData('Dupa');
|
this.sendDataService.postFile(this.file).subscribe((res: any) => {
|
||||||
|
this.sharedDataService.setData(res);
|
||||||
|
});
|
||||||
this.router.navigate(['/view']);
|
this.router.navigate(['/view']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1 +1,13 @@
|
|||||||
|
<nb-layout>
|
||||||
|
<nb-layout-header>
|
||||||
|
<div class="actions-container">
|
||||||
|
<nb-actions>
|
||||||
|
<nb-action icon="menu" (click)="toggleSidebar()"></nb-action>
|
||||||
|
</nb-actions>
|
||||||
|
<nb-actions>
|
||||||
|
<nb-action icon="power" title="Wyloguj">Wyloguj</nb-action>
|
||||||
|
</nb-actions>
|
||||||
|
</div>
|
||||||
|
</nb-layout-header>
|
||||||
|
<nb-sidebar tag="main"></nb-sidebar>
|
||||||
|
</nb-layout>
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
.actions-container {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-flow: row;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
@ -1,6 +1,9 @@
|
|||||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||||
import { SharedDataService } from '../_services/shared-data.service';
|
import { SharedDataService } from '../_services/shared-data.service';
|
||||||
|
|
||||||
|
import { NbSidebarService } from '@nebular/theme';
|
||||||
|
import { Subscription } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-main-view',
|
selector: 'app-main-view',
|
||||||
templateUrl: './main-view.component.html',
|
templateUrl: './main-view.component.html',
|
||||||
@ -8,14 +11,24 @@ import { SharedDataService } from '../_services/shared-data.service';
|
|||||||
})
|
})
|
||||||
export class MainViewComponent implements OnInit, OnDestroy {
|
export class MainViewComponent implements OnInit, OnDestroy {
|
||||||
public data: any;
|
public data: any;
|
||||||
|
private dataSub: Subscription;
|
||||||
|
|
||||||
constructor(private sharedDataService: SharedDataService) {}
|
constructor(
|
||||||
|
private sharedDataService: SharedDataService,
|
||||||
|
private sidebarService: NbSidebarService
|
||||||
|
) {}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.sharedDataService.getData().subscribe((res) => {
|
this.dataSub = this.sharedDataService.getData().subscribe((res) => {
|
||||||
this.data = res;
|
this.data = res;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {}
|
ngOnDestroy(): void {
|
||||||
|
this.dataSub.unsubscribe();
|
||||||
|
}
|
||||||
|
|
||||||
|
toggleSidebar() {
|
||||||
|
this.sidebarService.toggle(true, 'main');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,23 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
|
|
||||||
import { MainViewComponent } from './main-view.component';
|
import { MainViewComponent } from './main-view.component';
|
||||||
import { MainViewRoutingModule } from './main-view-routing.module';
|
import { MainViewRoutingModule } from './main-view-routing.module';
|
||||||
|
|
||||||
|
import {
|
||||||
|
NbLayoutModule,
|
||||||
|
NbActionsModule,
|
||||||
|
NbSidebarModule,
|
||||||
|
} from '@nebular/theme';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [MainViewComponent],
|
declarations: [MainViewComponent],
|
||||||
imports: [CommonModule, MainViewRoutingModule],
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
MainViewRoutingModule,
|
||||||
|
NbLayoutModule,
|
||||||
|
NbActionsModule,
|
||||||
|
NbSidebarModule,
|
||||||
|
],
|
||||||
})
|
})
|
||||||
export class MainViewModule {}
|
export class MainViewModule {}
|
||||||
|
Loading…
Reference in New Issue
Block a user