From: Sunder Tattavarada Date: Wed, 29 Apr 2020 19:39:12 +0000 (+0000) Subject: Merge "junit testcase NoncentralizedAppException" X-Git-Tag: 3.4.0~90 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=013c0393a92ef0c1475a97a112a78cd9ff1b5fc4;hp=5c119d0b5aca523d075a30262d5a7482dc320680;p=portal.git Merge "junit testcase NoncentralizedAppException" --- diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/sessionmgt/SessionCommunicationController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/sessionmgt/SessionCommunicationController.java index d36cf6cb..33006c92 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/sessionmgt/SessionCommunicationController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/sessionmgt/SessionCommunicationController.java @@ -54,6 +54,8 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; import io.swagger.annotations.ApiOperation; @@ -75,14 +77,14 @@ public class SessionCommunicationController extends EPRestrictedRESTfulBaseCont @ApiOperation(value = "Gets session slot-check interval, a duration in milliseconds.", response = Integer.class) - @RequestMapping(value={"/getSessionSlotCheckInterval"}, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value={"/getSessionSlotCheckInterval"}, produces = "application/json") public Integer getSessionSlotCheckInterval(HttpServletRequest request, HttpServletResponse response) throws Exception { return manageService.fetchSessionSlotCheckInterval(); } @ApiOperation(value = "Extends session timeout values for all on-boarded applications.", response = Boolean.class) - @RequestMapping(value={"/extendSessionTimeOuts"}, method = RequestMethod.POST) + @PostMapping(value={"/extendSessionTimeOuts"}) public Boolean extendSessionTimeOuts(HttpServletRequest request, HttpServletResponse response, @RequestParam String sessionMap) { manageService.extendSessionTimeOuts(sessionMap); diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java index 46f96d66..12deabe3 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java @@ -4,6 +4,8 @@ * =================================================================== * Copyright © 2018 AT&T Intellectual Property. All rights reserved. * =================================================================== + * Modifications Copyright (c) 2020 IBM + * =================================================================== * * Unless otherwise specified, all software contained herein is licensed * under the Apache License, Version 2.0 (the "License"); @@ -55,12 +57,11 @@ public class MusicSessionRepositoryHandler { public Session get(String id) { if(musicCache){ - // todo need to add the clean up for "sessions" map if musicCache is enabled + // need to add the clean up for "sessions" map if musicCache is enabled return this.sessions.get(id); }else{ try { - Session session = MusicService.getMetaAttribute(id); - return session; + return MusicService.getMetaAttribute(id); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "get failed with id " + id, e); return null; @@ -72,7 +73,7 @@ public class MusicSessionRepositoryHandler { public void remove(String id) { if(musicCache){ - // todo need to add the clean up for "sessions" map if musicCache is enabled + // need to add the clean up for "sessions" map if musicCache is enabled sessions.remove(id); }else{ try { @@ -87,7 +88,7 @@ public class MusicSessionRepositoryHandler { public void put(String id, MusicSession musicSession) { if(musicCache){ - // todo need to add the clean up for "sessions" map if musicCache is enabled + //need to add the clean up for "sessions" map if musicCache is enabled sessions.put(id, musicSession); }else{ try { diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppCatalogController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppCatalogController.java index 557e4dc3..6ff16fc8 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppCatalogController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppCatalogController.java @@ -62,6 +62,9 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PutMapping; + @RestController @org.springframework.context.annotation.Configuration @@ -90,7 +93,7 @@ public class AppCatalogController extends EPRestrictedBaseController { * @throws IOException If sendError fails * @return List of items suitable for display */ - @RequestMapping(value = { "/portalApi/appCatalog" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { "/portalApi/appCatalog" }, produces = "application/json") public List getAppCatalog(HttpServletRequest request, HttpServletResponse response) throws IOException { EPUser user = EPUserUtils.getUserSession(request); @@ -125,7 +128,7 @@ public class AppCatalogController extends EPRestrictedBaseController { * @return FieldsValidator * @throws IOException If sendError fails */ - @RequestMapping(value = { "/portalApi/appCatalog" }, method = RequestMethod.PUT, produces = "application/json") + @PutMapping(value = { "/portalApi/appCatalog" }, produces = "application/json") public FieldsValidator putAppCatalogSelection(HttpServletRequest request, @RequestBody AppCatalogPersonalization persRequest, HttpServletResponse response) throws IOException { FieldsValidator result = new FieldsValidator(); diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppContactUsController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppContactUsController.java index 8f456fde..e9119de8 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppContactUsController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppContactUsController.java @@ -63,6 +63,8 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; @RestController @RequestMapping("/portalApi/contactus") @@ -94,7 +96,7 @@ public class AppContactUsController extends EPRestrictedBaseController { * @param request HttpServletRequest * @return PortalRestResponse */ - @RequestMapping(value = "/feedback", method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = "/feedback", produces = "application/json") public PortalRestResponse getPortalDetails(HttpServletRequest request) { PortalRestResponse portalRestResponse; try { @@ -123,7 +125,7 @@ public class AppContactUsController extends EPRestrictedBaseController { * @param request HttpServletRequest * @return PortalRestResponse> */ - @RequestMapping(value = "/list", method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = "/list", produces = "application/json") public PortalRestResponse> getAppContactUsList(HttpServletRequest request) { PortalRestResponse> portalRestResponse; try { @@ -145,7 +147,7 @@ public class AppContactUsController extends EPRestrictedBaseController { * @param request HttpServletRequest * @return PortalRestResponse> */ - @RequestMapping(value = "/allapps", method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = "/allapps", produces = "application/json") public PortalRestResponse> getAppsAndContacts(HttpServletRequest request) { PortalRestResponse> portalRestResponse; try { @@ -167,7 +169,7 @@ public class AppContactUsController extends EPRestrictedBaseController { * @param request HttpServletRequest * @return PortalRestResponse> */ - @RequestMapping(value = "/functions", method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = "/functions", produces = "application/json") public PortalRestResponse> getAppCategoryFunctions(HttpServletRequest request) { PortalRestResponse> portalRestResponse; try { @@ -190,7 +192,7 @@ public class AppContactUsController extends EPRestrictedBaseController { * @param contactUs AppContactUsItem * @return PortalRestResponse */ - @RequestMapping(value = "/save", method = RequestMethod.POST, produces = "application/json") + @PostMapping(value = "/save", produces = "application/json") public PortalRestResponse save(@RequestBody AppContactUsItem contactUs) { if (contactUs == null || contactUs.getAppName() == null) { @@ -210,7 +212,7 @@ public class AppContactUsController extends EPRestrictedBaseController { return new PortalRestResponse<>(PortalRestStatusEnum.OK, saveAppContactUs, ""); } - @RequestMapping(value = "/saveAll", method = RequestMethod.POST, produces = "application/json") + @PostMapping(value = "/saveAll", produces = "application/json") public PortalRestResponse save(@RequestBody List contactUsList) { if (contactUsList == null) { @@ -237,7 +239,7 @@ public class AppContactUsController extends EPRestrictedBaseController { * @param id app ID * @return PortalRestResponse */ - @RequestMapping(value = "/delete/{appid}", method = RequestMethod.POST, produces = "application/json") + @PostMapping(value = "/delete/{appid}", produces = "application/json") public PortalRestResponse delete(@PathVariable("appid") Long id) { String saveAppContactUs = FAILURE; diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/SchedulerAuxController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/SchedulerAuxController.java index c99953fa..85c48b7b 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/SchedulerAuxController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/SchedulerAuxController.java @@ -37,9 +37,6 @@ */ package org.onap.portalapp.portal.controller; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; import java.util.UUID; import javax.servlet.http.HttpServletRequest; diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/UserRolesController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/UserRolesController.java index aa180b0e..b3d64dbc 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/UserRolesController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/UserRolesController.java @@ -46,7 +46,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.cxf.transport.http.HTTPException; import org.onap.portalapp.controller.EPRestrictedBaseController; -import org.onap.portalapp.portal.domain.EPApp; import org.onap.portalapp.portal.domain.EPRole; import org.onap.portalapp.portal.domain.EPUser; import org.onap.portalapp.portal.domain.EPUserAppCatalogRoles; @@ -59,7 +58,6 @@ import org.onap.portalapp.portal.logging.aop.EPEELFLoggerAdvice; import org.onap.portalapp.portal.logging.logic.EPLogUtil; import org.onap.portalapp.portal.service.AdminRolesService; import org.onap.portalapp.portal.service.ApplicationsRestClientService; -import org.onap.portalapp.portal.service.EPAppService; import org.onap.portalapp.portal.service.SearchService; import org.onap.portalapp.portal.service.UserRolesService; import org.onap.portalapp.portal.transport.AppNameIdIsAdmin; diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsCatalogController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsCatalogController.java index 015e6c46..a4037375 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsCatalogController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsCatalogController.java @@ -40,7 +40,6 @@ package org.onap.portalapp.portal.controller; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; -import java.io.IOException; import java.io.OutputStream; import java.util.ArrayList; import java.util.List; diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/FunctionalMenuItemWithAppID.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/FunctionalMenuItemWithAppID.java index 9900827f..583b43ad 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/FunctionalMenuItemWithAppID.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/FunctionalMenuItemWithAppID.java @@ -44,7 +44,6 @@ import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Transient; -import javax.validation.constraints.DecimalMax; import javax.validation.constraints.Digits; import javax.validation.constraints.Max; import javax.validation.constraints.NotNull; diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/MicroserviceData.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/MicroserviceData.java index b8f79d06..6db834eb 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/MicroserviceData.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/MicroserviceData.java @@ -39,11 +39,6 @@ package org.onap.portalapp.portal.domain; import java.util.List; -import javax.persistence.Column; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; - import javax.validation.Valid; import org.hibernate.validator.constraints.SafeHtml; import org.onap.portalsdk.core.domain.support.DomainVo; diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPServiceCookieTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPServiceCookieTest.java new file mode 100644 index 00000000..27118a4c --- /dev/null +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPServiceCookieTest.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2020 IBM Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ +package org.onap.portalapp.portal.domain; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; +import static org.junit.Assert.*; +import static org.junit.Assert.assertNotNull; + +public class EPServiceCookieTest { + EPServiceCookie ep=new EPServiceCookie(); + + @Test + public void testGetValue() throws NullPointerException{ + Map mymap = new HashMap<>(); + mymap.put("1", "one"); + ep.setValue(mymap); + assertNotNull(ep.getValue()); + assertTrue(ep.getValue().equals(mymap)); + } + +} diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/DuplicateRecordExceptionTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/DuplicateRecordExceptionTest.java new file mode 100644 index 00000000..9154e8d0 --- /dev/null +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/DuplicateRecordExceptionTest.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2020 IBM Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ +package org.onap.portalapp.portal.exceptions; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class DuplicateRecordExceptionTest { + @Test + public void Test1() + { + String s1 = "Duplicate Record"; + DuplicateRecordException mde=new DuplicateRecordException(s1); + assertEquals(mde.getMessage(),"Duplicate Record"); + + } +} diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/NotValidDataExceptionTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/NotValidDataExceptionTest.java new file mode 100644 index 00000000..889b28f2 --- /dev/null +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/NotValidDataExceptionTest.java @@ -0,0 +1,51 @@ +/*- + * ============LICENSE_START============================================ + * ONAP Portal + * ===================================================================== + * Copyright (C) 2020 IBM Intellectual Property. All rights reserved. + * ===================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END================================================ + * + * + */ +package org.onap.portalapp.portal.exceptions; + +import org.junit.Test; +import static org.junit.Assert.assertEquals; + +public class NotValidDataExceptionTest { + + @Test + public void TestException2() { + String s1 = "data"; + NotValidDataException nca = new NotValidDataException(s1); + assertEquals(nca.toString(),"NotValidDataException{}: data"); + } +} diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/RoleFunctionExceptionTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/RoleFunctionExceptionTest.java new file mode 100644 index 00000000..db17e784 --- /dev/null +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/RoleFunctionExceptionTest.java @@ -0,0 +1,56 @@ +/*- + * ============LICENSE_START============================================ + * ONAP Portal + * ===================================================================== + * Copyright (C) 2020 IBM Intellectual Property. All rights reserved. + * ===================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END================================================ + * + * + */ + +package org.onap.portalapp.portal.exceptions; + +import org.apache.commons.codec.DecoderException; +import org.junit.Test; +import static org.junit.Assert.assertEquals; + +public class RoleFunctionExceptionTest { + + @Test + public void TestRoleFunctionConstructor() + { + String s1 = "Rolefunction Exception Occured"; + String s2 = "value2"; + DecoderException e=new DecoderException(s2); + RoleFunctionException rfe=new RoleFunctionException(s1,e); + assertEquals(rfe.getMessage(),"Rolefunction Exception Occured"); + } +} diff --git a/portal-FE-os/src/app/app.component.html b/portal-FE-os/src/app/app.component.html index dea5177c..2c914c52 100644 --- a/portal-FE-os/src/app/app.component.html +++ b/portal-FE-os/src/app/app.component.html @@ -35,5 +35,7 @@ --> - +
+ {{browserCompatibilityMsg}} +
diff --git a/portal-FE-os/src/app/app.component.scss b/portal-FE-os/src/app/app.component.scss index 7a773398..e739496d 100644 --- a/portal-FE-os/src/app/app.component.scss +++ b/portal-FE-os/src/app/app.component.scss @@ -34,4 +34,14 @@ * ============LICENSE_END============================================ * * - */ \ No newline at end of file + */ + + .diaplay-banner{ + margin-top: 14px; + background-color: yellow; + font-weight: bold; + position: fixed; + z-index: 9999; + margin-left: 34em; + height: 24px; +} \ No newline at end of file diff --git a/portal-FE-os/src/app/app.component.ts b/portal-FE-os/src/app/app.component.ts index dbfb568f..389153bd 100644 --- a/portal-FE-os/src/app/app.component.ts +++ b/portal-FE-os/src/app/app.component.ts @@ -35,13 +35,49 @@ * * */ -import { Component } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; +import { environment } from 'src/environments/environment'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.scss'] }) -export class AppComponent { - -} +export class AppComponent implements OnInit { + diaplayBanner : boolean = false; + api = environment.api; + browserCompatibilityMsg: string; + + ngOnInit() { + this.diaplayBanner = false; + this.browserCompatibilityMsg = this.api.browserCompatibilityMsg; + this.getBrowserName(); + } + + /** + * Identify Browser + */ + getBrowserName() { + const agent = window.navigator.userAgent.toLowerCase(); + switch (true) { + case agent.indexOf('edge') > -1: + return 'edge'; + case agent.indexOf('opr') > -1 && !!(window).opr: + this.diaplayBanner = true; + return 'opera'; + case agent.indexOf('chrome') > -1 && !!(window).chrome: + return 'chrome'; + case agent.indexOf('trident') > -1: + this.diaplayBanner = true; + return 'ie'; + case agent.indexOf('firefox') > -1: + return 'firefox'; + case agent.indexOf('safari') > -1: + this.diaplayBanner = true; + return 'safari'; + default: + this.diaplayBanner = true; + return 'other'; + } + } +} \ No newline at end of file diff --git a/portal-FE-os/src/environments/environment.prod.ts b/portal-FE-os/src/environments/environment.prod.ts index db6b5bf5..7cc34da5 100644 --- a/portal-FE-os/src/environments/environment.prod.ts +++ b/portal-FE-os/src/environments/environment.prod.ts @@ -125,7 +125,8 @@ export const environment = { "footerLogoImagePath": "", "footerLogoText": "", "intraSearcLink": "", - "extraSearcLink": "https://wiki.onap.org/dosearchsite.action?cql=siteSearch+~+searchStringPlaceHolder&queryString=searchStringPlaceHolder" + "extraSearcLink": "https://wiki.onap.org/dosearchsite.action?cql=siteSearch+~+searchStringPlaceHolder&queryString=searchStringPlaceHolder", + "browserCompatibilityMsg": "This Application is best viewed on Firefox, Chrome and Edge." }, "getAccessUrl": "", "getAccessName":"", diff --git a/portal-FE-os/src/environments/environment.ts b/portal-FE-os/src/environments/environment.ts index 0482c20c..d412522f 100644 --- a/portal-FE-os/src/environments/environment.ts +++ b/portal-FE-os/src/environments/environment.ts @@ -129,7 +129,8 @@ export const environment = { "footerLogoImagePath": "", "footerLogoText": "", "intraSearcLink": "", - "extraSearcLink": "https://wiki.onap.org/dosearchsite.action?cql=siteSearch+~+searchStringPlaceHolder&queryString=searchStringPlaceHolder" + "extraSearcLink": "https://wiki.onap.org/dosearchsite.action?cql=siteSearch+~+searchStringPlaceHolder&queryString=searchStringPlaceHolder", + "browserCompatibilityMsg": "This Application is best viewed on Firefox, Chrome and Edge." }, "getAccessUrl": "", "getAccessName": "",