routing #2
This commit is contained in:
16
WEB/src/app/songs/modules/edit/edit-routing.module.ts
Normal file
16
WEB/src/app/songs/modules/edit/edit-routing.module.ts
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import {NgModule} from '@angular/core';
|
||||||
|
import {RouterModule, Routes} from '@angular/router';
|
||||||
|
import {SongEditComponent} from './song-edit/song-edit.component';
|
||||||
|
|
||||||
|
const routes: Routes = [{
|
||||||
|
path: '',
|
||||||
|
pathMatch: 'full',
|
||||||
|
component: SongEditComponent
|
||||||
|
}];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [RouterModule.forChild(routes)],
|
||||||
|
exports: [RouterModule]
|
||||||
|
})
|
||||||
|
export class EditRoutingModule {
|
||||||
|
}
|
||||||
44
WEB/src/app/songs/modules/edit/edit.module.ts
Normal file
44
WEB/src/app/songs/modules/edit/edit.module.ts
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
import {NgModule} from '@angular/core';
|
||||||
|
import {CommonModule} from '@angular/common';
|
||||||
|
|
||||||
|
import {EditRoutingModule} from './edit-routing.module';
|
||||||
|
import {SongFormModule} from '../widget-modules/song-form/song-form.module';
|
||||||
|
import {SongEditComponent} from './song-edit/song-edit.component';
|
||||||
|
import {FontAwesomeModule} from '@fortawesome/angular-fontawesome';
|
||||||
|
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
||||||
|
import {FileUploadModule} from 'ng2-file-upload';
|
||||||
|
import {
|
||||||
|
MatButtonModule,
|
||||||
|
MatCardModule,
|
||||||
|
MatChipsModule,
|
||||||
|
MatInputModule,
|
||||||
|
MatSelectModule,
|
||||||
|
MatTableModule,
|
||||||
|
MatTooltipModule
|
||||||
|
} from '@angular/material';
|
||||||
|
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
SongEditComponent
|
||||||
|
],
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
EditRoutingModule,
|
||||||
|
SongFormModule,
|
||||||
|
FontAwesomeModule,
|
||||||
|
FormsModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
FileUploadModule,
|
||||||
|
|
||||||
|
MatCardModule,
|
||||||
|
MatChipsModule,
|
||||||
|
MatSelectModule,
|
||||||
|
MatInputModule,
|
||||||
|
MatTableModule,
|
||||||
|
MatButtonModule,
|
||||||
|
MatTooltipModule
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class EditModule {
|
||||||
|
}
|
||||||
16
WEB/src/app/songs/modules/new/new-routing.module.ts
Normal file
16
WEB/src/app/songs/modules/new/new-routing.module.ts
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import {NgModule} from '@angular/core';
|
||||||
|
import {RouterModule, Routes} from '@angular/router';
|
||||||
|
import {SongNewComponent} from './song-new/song-new.component';
|
||||||
|
|
||||||
|
const routes: Routes = [{
|
||||||
|
path: '',
|
||||||
|
pathMatch: 'full',
|
||||||
|
component: SongNewComponent
|
||||||
|
}];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [RouterModule.forChild(routes)],
|
||||||
|
exports: [RouterModule]
|
||||||
|
})
|
||||||
|
export class NewRoutingModule {
|
||||||
|
}
|
||||||
43
WEB/src/app/songs/modules/new/new.module.ts
Normal file
43
WEB/src/app/songs/modules/new/new.module.ts
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
import {NgModule} from '@angular/core';
|
||||||
|
import {CommonModule} from '@angular/common';
|
||||||
|
|
||||||
|
import {NewRoutingModule} from './new-routing.module';
|
||||||
|
import {SongFormModule} from '../widget-modules/song-form/song-form.module';
|
||||||
|
import {SongNewComponent} from './song-new/song-new.component';
|
||||||
|
import {FontAwesomeModule} from '@fortawesome/angular-fontawesome';
|
||||||
|
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
||||||
|
import {FileUploadModule} from 'ng2-file-upload';
|
||||||
|
import {
|
||||||
|
MatButtonModule,
|
||||||
|
MatCardModule,
|
||||||
|
MatChipsModule,
|
||||||
|
MatInputModule,
|
||||||
|
MatSelectModule,
|
||||||
|
MatTableModule,
|
||||||
|
MatTooltipModule
|
||||||
|
} from '@angular/material';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
SongNewComponent
|
||||||
|
],
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
NewRoutingModule,
|
||||||
|
SongFormModule,
|
||||||
|
FontAwesomeModule,
|
||||||
|
FormsModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
FileUploadModule,
|
||||||
|
|
||||||
|
MatCardModule,
|
||||||
|
MatChipsModule,
|
||||||
|
MatSelectModule,
|
||||||
|
MatInputModule,
|
||||||
|
MatTableModule,
|
||||||
|
MatButtonModule,
|
||||||
|
MatTooltipModule
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class NewModule {
|
||||||
|
}
|
||||||
16
WEB/src/app/songs/modules/read/read-routing.module.ts
Normal file
16
WEB/src/app/songs/modules/read/read-routing.module.ts
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import {NgModule} from '@angular/core';
|
||||||
|
import {RouterModule, Routes} from '@angular/router';
|
||||||
|
import {SongComponent} from './song/song.component';
|
||||||
|
|
||||||
|
const routes: Routes = [{
|
||||||
|
path: '',
|
||||||
|
pathMatch: 'full',
|
||||||
|
component: SongComponent
|
||||||
|
}];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [RouterModule.forChild(routes)],
|
||||||
|
exports: [RouterModule]
|
||||||
|
})
|
||||||
|
export class ReadRoutingModule {
|
||||||
|
}
|
||||||
50
WEB/src/app/songs/modules/read/read.module.ts
Normal file
50
WEB/src/app/songs/modules/read/read.module.ts
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
import {NgModule} from '@angular/core';
|
||||||
|
import {CommonModule} from '@angular/common';
|
||||||
|
|
||||||
|
import {ReadRoutingModule} from './read-routing.module';
|
||||||
|
import {SongFormModule} from '../widget-modules/song-form/song-form.module';
|
||||||
|
import {SongComponent} from './song/song.component';
|
||||||
|
import {SongReadComponent} from './read/read.component';
|
||||||
|
import {SongFilesEditComponent} from './files/edit/song-files-edit.component';
|
||||||
|
import {SongFilesComponent} from './files/files.component';
|
||||||
|
import {FontAwesomeModule} from '@fortawesome/angular-fontawesome';
|
||||||
|
import {
|
||||||
|
MatButtonModule,
|
||||||
|
MatCardModule,
|
||||||
|
MatChipsModule,
|
||||||
|
MatInputModule,
|
||||||
|
MatSelectModule,
|
||||||
|
MatTableModule,
|
||||||
|
MatTooltipModule
|
||||||
|
} from '@angular/material';
|
||||||
|
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
||||||
|
import {FileUploadModule} from 'ng2-file-upload';
|
||||||
|
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
SongComponent,
|
||||||
|
SongReadComponent,
|
||||||
|
SongFilesEditComponent,
|
||||||
|
SongFilesComponent
|
||||||
|
],
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
ReadRoutingModule,
|
||||||
|
SongFormModule,
|
||||||
|
FontAwesomeModule,
|
||||||
|
FormsModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
FileUploadModule,
|
||||||
|
|
||||||
|
MatCardModule,
|
||||||
|
MatChipsModule,
|
||||||
|
MatSelectModule,
|
||||||
|
MatInputModule,
|
||||||
|
MatTableModule,
|
||||||
|
MatButtonModule,
|
||||||
|
MatTooltipModule
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class ReadModule {
|
||||||
|
}
|
||||||
3
WEB/src/app/songs/modules/read/song/song.component.html
Normal file
3
WEB/src/app/songs/modules/read/song/song.component.html
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<app-song-read [song]="song | async"></app-song-read>
|
||||||
|
<app-song-files [song]="song | async"></app-song-files>
|
||||||
|
|
||||||
25
WEB/src/app/songs/modules/read/song/song.component.spec.ts
Normal file
25
WEB/src/app/songs/modules/read/song/song.component.spec.ts
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
|
||||||
|
|
||||||
|
import {SongComponent} from './song.component';
|
||||||
|
|
||||||
|
describe('SongComponent', () => {
|
||||||
|
let component: SongComponent;
|
||||||
|
let fixture: ComponentFixture<SongComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [SongComponent]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(SongComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
19
WEB/src/app/songs/modules/read/song/song.component.ts
Normal file
19
WEB/src/app/songs/modules/read/song/song.component.ts
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import {Component} from '@angular/core';
|
||||||
|
import {ActivatedRoute} from '@angular/router';
|
||||||
|
import {Song} from '../../../models/song.model';
|
||||||
|
import {Observable} from 'rxjs';
|
||||||
|
import {map} from 'rxjs/operators';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-song',
|
||||||
|
templateUrl: './song.component.html',
|
||||||
|
})
|
||||||
|
export class SongComponent {
|
||||||
|
|
||||||
|
constructor(private route: ActivatedRoute) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public get song(): Observable<Song> {
|
||||||
|
return this.route.data.pipe(map((data: { song: Song }) => data.song));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import {NgModule} from '@angular/core';
|
||||||
|
import {CommonModule} from '@angular/common';
|
||||||
|
import {SongFormComponent} from './song-form.component';
|
||||||
|
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
||||||
|
import {MatInputModule, MatRadioModule, MatSelectModule} from '@angular/material';
|
||||||
|
import {FontAwesomeModule} from '@fortawesome/angular-fontawesome';
|
||||||
|
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
SongFormComponent
|
||||||
|
],
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
FormsModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
FontAwesomeModule,
|
||||||
|
|
||||||
|
MatInputModule,
|
||||||
|
MatSelectModule,
|
||||||
|
MatRadioModule,
|
||||||
|
|
||||||
|
],
|
||||||
|
exports: [
|
||||||
|
SongFormComponent
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class SongFormModule {
|
||||||
|
}
|
||||||
28
WEB/src/app/songs/song-resolver.ts
Normal file
28
WEB/src/app/songs/song-resolver.ts
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import {Injectable} from '@angular/core';
|
||||||
|
import {Song} from './models/song.model';
|
||||||
|
import {ActivatedRouteSnapshot, Resolve, RouterStateSnapshot} from '@angular/router';
|
||||||
|
import {Observable} from 'rxjs';
|
||||||
|
import {ODataBaseService} from '../data/ODataBaseService';
|
||||||
|
import {ODataService} from 'odata-v4-ng';
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class SongResolver extends ODataBaseService implements Resolve<Song> {
|
||||||
|
|
||||||
|
constructor(odataService: ODataService) {
|
||||||
|
super(odataService, 'songs');
|
||||||
|
}
|
||||||
|
|
||||||
|
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<Song> {
|
||||||
|
const id = +route.params.songId;
|
||||||
|
const get$ = this.get$<Song>(
|
||||||
|
id,
|
||||||
|
['ID', 'Name', 'Text', 'Comments', 'SongType', 'Key', 'Tempo'],
|
||||||
|
['Files']
|
||||||
|
);
|
||||||
|
|
||||||
|
return get$;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
48
WEB/src/app/songs/songs-routing.module.ts
Normal file
48
WEB/src/app/songs/songs-routing.module.ts
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
import {NgModule} from '@angular/core';
|
||||||
|
import {RouterModule, Routes} from '@angular/router';
|
||||||
|
import {SongsComponent} from './components/songs/songs.component';
|
||||||
|
import {SongResolver} from './song-resolver';
|
||||||
|
|
||||||
|
|
||||||
|
const routes: Routes = [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
component: SongsComponent,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: 'new',
|
||||||
|
loadChildren: () => import('./modules/new/new.module').then(_ => _.NewModule)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: ':songId',
|
||||||
|
resolve: {
|
||||||
|
song: SongResolver
|
||||||
|
},
|
||||||
|
runGuardsAndResolvers: 'always',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
redirectTo: 'read',
|
||||||
|
pathMatch: 'full',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'read',
|
||||||
|
loadChildren: () => import('./modules/read/read.module').then(_ => _.ReadModule)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'edit',
|
||||||
|
loadChildren: () => import('./modules/edit/edit.module').then(_ => _.EditModule)
|
||||||
|
}
|
||||||
|
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [RouterModule.forChild(routes)],
|
||||||
|
exports: [RouterModule]
|
||||||
|
})
|
||||||
|
export class SongsRoutingModule {
|
||||||
|
}
|
||||||
24
WEB/src/app/songs/songs.module.ts
Normal file
24
WEB/src/app/songs/songs.module.ts
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
import {NgModule} from '@angular/core';
|
||||||
|
import {CommonModule} from '@angular/common';
|
||||||
|
|
||||||
|
import {SongsRoutingModule} from './songs-routing.module';
|
||||||
|
import {SongsComponent} from './components/songs/songs.component';
|
||||||
|
import {TableComponent} from './components/songs/table/table.component';
|
||||||
|
import {FontAwesomeModule} from '@fortawesome/angular-fontawesome';
|
||||||
|
import {MatButtonModule, MatChipsModule, MatTableModule} from '@angular/material';
|
||||||
|
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [SongsComponent, TableComponent],
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
SongsRoutingModule,
|
||||||
|
FontAwesomeModule,
|
||||||
|
|
||||||
|
MatTableModule,
|
||||||
|
MatChipsModule,
|
||||||
|
MatButtonModule
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class SongsModule {
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user