Commit a73f74aa authored by Jie Yuan's avatar Jie Yuan
Browse files

add url params

parent 19431f7d
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -19,11 +19,11 @@ const Routes: Routes = [
  { path: 'dps', component: DataPolicyStatementComponent },
  { path: 'dashboard', canActivate: [AuthGuard],  component: TableComponent},
   
  { path: 'dashboard/site', canActivate: [AuthGuard], component: SiteComponent},
  { path: 'dashboard/hostNameComponent', canActivate: [AuthGuard], component: HostnameComponent},
  { path: 'dashboard/site/:sitename', canActivate: [AuthGuard], component: SiteComponent},
  { path: 'dashboard/hosts/:sitename', canActivate: [AuthGuard], component: HostnameComponent},

 { path: 'dashboard/servComponent',  canActivate: [AuthGuard],component: ServiceComponentComponent},
 { path: 'dashboard/servCompHisComponent', canActivate: [AuthGuard],  component: ServiceComponentHistoryComponent},
 { path: 'dashboard/component-history/:hostname/:component', canActivate: [AuthGuard],  component: ServiceComponentHistoryComponent},
 { path: 'dashboard/fullTableComponent', canActivate: [AuthGuard], component: FulltableComponent},
  { path: '**', redirectTo: 'login'}
];
+3 −3
Original line number Diff line number Diff line
@@ -287,7 +287,7 @@ export class FulltableComponent implements OnInit , DoCheck, AfterViewInit{
          (asite: Site) => {
            sessionStorage.setItem('preSitePage', 'Service');
            sessionStorage.setItem('currentSelectedSite', JSON.stringify(asite) );
            this.router.navigate(['/dashboard/site'], { relativeTo: this.route });
            this.router.navigate(['/dashboard/site',serverData.siteName], { relativeTo: this.route });
  
          }
        ).catch(
@@ -344,7 +344,7 @@ export class FulltableComponent implements OnInit , DoCheck, AfterViewInit{
        .then(
          (asite: Site) => {
            sessionStorage.setItem('currentSelectedSite', JSON.stringify(asite) );
            this.router.navigate(['/dashboard/site'], { relativeTo: this.route });
            this.router.navigate(['/dashboard/site',name], { relativeTo: this.route });
          }
        ).catch(
          error => {
@@ -362,7 +362,7 @@ export class FulltableComponent implements OnInit , DoCheck, AfterViewInit{
    if ( serviceComponent.servCompTagAtSite !== null && serviceComponent.servCompTagAtSite !== ''){
      this.servCompService.setSelectedServComp(serviceComponent);
      sessionStorage.removeItem('currentServComp');
      this.router.navigate(['/dashboard/servCompHisComponent'], { relativeTo: this.route });
      this.router.navigate(['/dashboard/component-history',serviceComponent.hostName,serviceComponent.servCompName], { relativeTo: this.route });
    }
    
  }
+8 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ import { AuthService } from 'src/app/auth.service';
import { MatIconRegistry } from "@angular/material/icon";
import { DomSanitizer } from "@angular/platform-browser";
import { MatDialog } from '@angular/material';
import { switchMap } from 'rxjs/operators';
import {ProfileDialogComponent} from '../profile-dialog/profile-dialog.component';

@Component({
@@ -28,6 +29,7 @@ export class SiteComponent implements OnInit, OnDestroy {
  shortgiisUrl: string;
  previousView: string;
  username: string;
  public sitename: string;

  constructor(private siteService: SiteService,
    public router: Router,
@@ -66,6 +68,8 @@ export class SiteComponent implements OnInit, OnDestroy {
  }

  ngOnInit() {
    //this.sitename = this.site.shortName;
    this.sitename = this.route.snapshot.paramMap.get("sitename")
  }

  cuturls(){
@@ -152,6 +156,9 @@ export class SiteComponent implements OnInit, OnDestroy {
          (asite: Site) => {
            sessionStorage.setItem('currentSelectedSite', JSON.stringify(asite) );
            this.site = asite;
            this.sitename = this.site.shortName;
            this.router.navigate(['/dashboard/site',this.sitename], { relativeTo: this.route });
            this.sitename = this.route.snapshot.paramMap.get("sitename");
            if ( this.site.hostNames !== null && this.site.hostNames.length >0) {
              this.hasHosts = true;
            } else {
@@ -165,6 +172,7 @@ export class SiteComponent implements OnInit, OnDestroy {
               
              }
            );
            
            this.setNameLists();
            this.cuturls();
          }
+3 −3
Original line number Diff line number Diff line
@@ -189,7 +189,7 @@ onClick(serverData: SiteShort) {
        (asite: Site) => {
          sessionStorage.setItem('preSitePage', 'Site');
          sessionStorage.setItem('currentSelectedSite', JSON.stringify(asite) );
          this.router.navigate(['/dashboard/site'], { relativeTo: this.route });
          this.router.navigate(['/dashboard/site',serverData.siteName], { relativeTo: this.route });

        }
      ).catch(
@@ -209,7 +209,7 @@ onSiteNameSelected(name: string) {
      .then(
        (asite: Site) => {
          sessionStorage.setItem('currentSelectedSite', JSON.stringify(asite) );
          this.router.navigate(['/dashboard/site'], { relativeTo: this.route });
          this.router.navigate(['/dashboard/site',name], { relativeTo: this.route });
        }
      ).catch(
        error => {
@@ -317,7 +317,7 @@ public onHostsSelected(site: SiteShort) {
    sessionStorage.removeItem('currentHostList');
    sessionStorage.removeItem('currentServCompList');
    sessionStorage.removeItem('noOfServices');
    this.router.navigate(['/dashboard/hostNameComponent'], { relativeTo: this.route });
    this.router.navigate(['/dashboard/hosts',site.siteName], { relativeTo: this.route });
  }

}