X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=portal-FE-os%2Fsrc%2Fapp%2Fshared%2Finterceptors%2Fheader-interceptor.ts;fp=portal-FE-os%2Fsrc%2Fapp%2Flayout%2Fcomponents%2Fglobal-search%2Fglobal-search.component.scss;h=bb76e14b9822b871467bcdb4367728fd402c26ba;hb=3f7386d4245f9a05db961440ebf80d97d788f902;hp=70f1b34c775be1d95b7c4879a3e6ccc953d78628;hpb=e0b464f75666b80976466437fa1057c3b4efd39f;p=portal.git diff --git a/portal-FE-os/src/app/layout/components/global-search/global-search.component.scss b/portal-FE-os/src/app/shared/interceptors/header-interceptor.ts similarity index 54% rename from portal-FE-os/src/app/layout/components/global-search/global-search.component.scss rename to portal-FE-os/src/app/shared/interceptors/header-interceptor.ts index 70f1b34c..bb76e14b 100644 --- a/portal-FE-os/src/app/layout/components/global-search/global-search.component.scss +++ b/portal-FE-os/src/app/shared/interceptors/header-interceptor.ts @@ -36,39 +36,38 @@ * */ - .search-div { - margin-bottom: -14px; - } +import { + HttpEvent, + HttpInterceptor, + HttpHandler, + HttpRequest, + HttpHeaders, +} from '@angular/common/http'; +import { Observable } from 'rxjs'; +import { v4 as uuid } from 'uuid'; +import { Injectable } from '@angular/core'; +declare const getWebJunctionXSRFToken: any; - .search-res-dialog{ - position: fixed; - background: white; - box-shadow: rgba(0, 0, 0, 0.247059) 0px 5px 6px 0px; - top: 2.5em; - border-radius: 0.25rem; - padding: 20px; - opacity: 1; - z-index: 1; - } - .searchUl { - list-style: none; - border-bottom: 1px solid #bbb; - padding-bottom: 20px; - padding-left: 4px; +@Injectable() +export class HeaderInterceptor implements HttpInterceptor { + intercept(req: HttpRequest, next: HttpHandler): Observable> { + // Clone the request to add the new header + // HttpHeader object immutable - copy values + const headerSettings: { [name: string]: string | string[]; } = {}; + headerSettings['X-ECOMP-RequestID'] = uuid(); + const requestType = req.params.get('requestType'); + + if(requestType!=null && requestType==='fileUpload'){ + //headerSettings['Content-Type'] = 'multipart/form-data'; + }else if(requestType!=null && requestType==='downloadWidgetFile'){ + headerSettings['X-Widgets-Type'] = 'all'; + headerSettings['Content-Type'] = 'application/octet-stream'; + }else{ + headerSettings['Content-Type'] = 'application/json'; + } + const newHeader = new HttpHeaders(headerSettings); + const clonedRequest = req.clone({ headers: newHeader, withCredentials: true }); + // Pass the cloned request instead of the original request to the next handle + return next.handle(clonedRequest); } - .searchLiHeader { - font-weight: bold; - color: #0574ac; - font-size: 16px; - padding-bottom: 10px; - line-height: 1.5; - font-family: Omnes-ECOMP-W02,Arial; - - } - .searchLiItems{ - cursor: pointer; - font-weight: normal; - font-size: 12px; - color: #444444; - font-family: Omnes-ECOMP-W02,Arial; - } \ No newline at end of file +} \ No newline at end of file