server resolver for snapshots page

This commit is contained in:
piotrpekala7
2020-02-10 13:43:48 +01:00
parent f5ee039510
commit 4d369eef30
2 changed files with 8 additions and 8 deletions

View File

@ -83,7 +83,11 @@ const routes: Routes = [
{ path: 'server/:server_id/systemstatus', component: SystemStatusComponent }, { path: 'server/:server_id/systemstatus', component: SystemStatusComponent },
{ path: 'server/:server_ip/:server_port/project/:project_id', component: DirectLinkComponent}, { path: 'server/:server_ip/:server_port/project/:project_id', component: DirectLinkComponent},
{ path: 'server/:server_id/project/:project_id/snapshots', component: ListOfSnapshotsComponent }, {
path: 'server/:server_id/project/:project_id/snapshots',
component: ListOfSnapshotsComponent,
resolve: { server : ServerResolve }
},
{ path: 'server/:server_id/preferences', component: PreferencesComponent }, { path: 'server/:server_id/preferences', component: PreferencesComponent },
{ path: 'server/:server_id/preferences/gns3vm', component: Gns3vmComponent }, { path: 'server/:server_id/preferences/gns3vm', component: Gns3vmComponent },
// { path: 'server/:server_id/preferences/general', component: GeneralPreferencesComponent }, // { path: 'server/:server_id/preferences/general', component: GeneralPreferencesComponent },

View File

@ -23,20 +23,16 @@ export class ListOfSnapshotsComponent implements OnInit {
searchText: string; searchText: string;
constructor( constructor(
private snapshotService: SnapshotService,
private serverService: ServerService,
private route: ActivatedRoute, private route: ActivatedRoute,
private snapshotService: SnapshotService,
private progressDialogService: ProgressDialogService, private progressDialogService: ProgressDialogService,
private toaster: ToasterService private toaster: ToasterService
) {} ) {}
ngOnInit() { ngOnInit() {
let serverId = this.route.snapshot.paramMap.get("server_id");
this.projectId = this.route.snapshot.paramMap.get("project_id"); this.projectId = this.route.snapshot.paramMap.get("project_id");
this.serverService.get(parseInt(serverId, 10)).then((server: Server) => { this.server = this.route.snapshot.data['server'];
this.server = server; this.getSnapshots();
this.getSnapshots();
});
} }
getSnapshots() { getSnapshots() {