Commit 7110881e authored by Labros Papadopoulos's avatar Labros Papadopoulos
Browse files

party registration workflow

parent ebea643a
Loading
Loading
Loading
Loading
Loading
+26 −2
Original line number Original line Diff line number Diff line
import { Component, OnInit } from '@angular/core';
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { Router } from '@angular/router';
import { AppService } from '../../services/app.service';
import { AppService } from '../../services/app.service';
import { AuthService } from 'src/app/shared/services/auth.service';


@Component({
@Component({
  selector: 'app-redirect',
  selector: 'app-redirect',
@@ -11,25 +12,48 @@ export class RedirectComponent implements OnInit {


  constructor(
  constructor(
    private appService: AppService,
    private appService: AppService,
    private router: Router
    private router: Router,
    private authService: AuthService
  ) { }
  ) { }


  ngOnInit() {
  ngOnInit() {
    let isTestbedProvider = false;
    for(var val of this.authService.portalUserJWT.realm_access.roles){
      if (val ==='TESTBED_PROVIDER') {
        isTestbedProvider=true
        }
    }
    //TODO insert redirection logic
    const activePortal = localStorage.getItem('active_portal')
    const activePortal = localStorage.getItem('active_portal')


    if (activePortal === 'services') {
    if (activePortal === 'services') {
        if (isTestbedProvider){
        this.router.navigate(['services', 'individual_update'])
        }
        else {
      this.router.navigate(['services', 'services_marketplace'])
      this.router.navigate(['services', 'services_marketplace'])
      }
      }
    }
    else if (activePortal === 'resources') {
    else if (activePortal === 'resources') {
      this.router.navigate(['resources', 'resource_catalogs'])
      this.router.navigate(['resources', 'resource_catalogs'])
    }
    }
    else if (activePortal === 'testing') {
    else if (activePortal === 'testing') {

    if (isTestbedProvider){
      this.router.navigate(['testing', 'individual_update'])
      } else {
      this.router.navigate(['testing', 'service_test_specs'])
      this.router.navigate(['testing', 'service_test_specs'])
      }
      }
    }


    else if (activePortal === 'products') {
    else if (activePortal === 'products') {

    if (isTestbedProvider){
          this.router.navigate(['products', 'individual_update'])
          } else {
          this.router.navigate(['products', 'marketplace'])
          this.router.navigate(['products', 'marketplace'])
          }
          }
    }


    else {
    else {
      this.router.navigate(['/'])
      this.router.navigate(['/'])
+5 −2
Original line number Original line Diff line number Diff line
@@ -14,6 +14,7 @@ import { ApiConfiguration as ResourceCatalogAPIconfig} from 'src/app/openApis/re
import { ApiConfiguration as ResourceInventoryAPIconfig} from 'src/app/openApis/resourceInventoryManagement/api-configuration'
import { ApiConfiguration as ResourceInventoryAPIconfig} from 'src/app/openApis/resourceInventoryManagement/api-configuration'
import { ApiConfiguration as resourcePoolManagementAPIconfig} from 'src/app/openApis/resourcePoolManagement/api-configuration'
import { ApiConfiguration as resourcePoolManagementAPIconfig} from 'src/app/openApis/resourcePoolManagement/api-configuration'
import { ApiConfiguration as ProductCatalogAPIconfig} from 'src/app/openApis/productCatalogManagement/api-configuration'
import { ApiConfiguration as ProductCatalogAPIconfig} from 'src/app/openApis/productCatalogManagement/api-configuration'
import { ApiConfiguration as GeographicSiteManagementAPIconfig} from 'src/app/openApis/geographicSiteManagement/api-configuration'


import { NavigationEnd, NavigationStart, Router } from '@angular/router';
import { NavigationEnd, NavigationStart, Router } from '@angular/router';
import { filter, first } from 'rxjs/operators';
import { filter, first } from 'rxjs/operators';
@@ -40,7 +41,8 @@ export class AppService {
    private tmfResourceCatalogConfig: ResourceCatalogAPIconfig,
    private tmfResourceCatalogConfig: ResourceCatalogAPIconfig,
    private tmfResourceInventoryConfig: ResourceInventoryAPIconfig,
    private tmfResourceInventoryConfig: ResourceInventoryAPIconfig,
    private resourcePoolManagementAPIconfig: resourcePoolManagementAPIconfig,
    private resourcePoolManagementAPIconfig: resourcePoolManagementAPIconfig,
    private tmfProductCatalogConfig: ProductCatalogAPIconfig
    private tmfProductCatalogConfig: ProductCatalogAPIconfig,
    private tmfGeographicSiteConfig: GeographicSiteManagementAPIconfig
  ) {
  ) {
    this.setAPIurls()
    this.setAPIurls()
    this.recognizePortalDomain()
    this.recognizePortalDomain()
@@ -64,6 +66,7 @@ export class AppService {
    this.serviceTestManagementAPIconfig.rootUrl = this.config.APITMFURL
    this.serviceTestManagementAPIconfig.rootUrl = this.config.APITMFURL
    this.resourcePoolManagementAPIconfig.rootUrl = this.config.APITMFURL
    this.resourcePoolManagementAPIconfig.rootUrl = this.config.APITMFURL
    this.tmfProductCatalogConfig.rootUrl = this.config.APITMFURL
    this.tmfProductCatalogConfig.rootUrl = this.config.APITMFURL
    this.tmfGeographicSiteConfig.rootUrl = this.config.APITMFURL
  }
  }


  //recognition of which portal is used (services/testing/product)
  //recognition of which portal is used (services/testing/product)