Merge "Start portal mariadb db docker with non root user"
authorSunder Tattavarada <statta@research.att.com>
Tue, 18 Aug 2020 17:20:31 +0000 (17:20 +0000)
committerGerrit Code Review <gerrit@onap.org>
Tue, 18 Aug 2020 17:20:31 +0000 (17:20 +0000)
53 files changed:
deliveries/local-dev-host-clone.sh
docs/conf.py
docs/tutorials/portal-BE/setting-up.rst
docs/tutorials/portal-sdk/setting-up.rst
ecomp-portal-BE-common/pom.xml
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/config/ExternalSecurityConfig.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsCatalogController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsCatalogUnRestrictedController.java [new file with mode: 0644]
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/SchedulerRestInterface.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/SchedulerUtil.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduleraux/SchedulerAuxRestInt.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPAppCommonServiceImpl.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPLeftMenuServiceImpl.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPRoleServiceImpl.java
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/WidgetsCatalogControllerTest.java
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/WidgetsCatalogUnRestrictedControllerTest.java [new file with mode: 0644]
ecomp-portal-BE-os/src/main/webapp/WEB-INF/conf/system.properties
ecomp-portal-widget-ms/widget-ms/pom.xml
ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/controller/WidgetsCatalogController.java
ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/service/StorageService.java
ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/service/impl/StorageServiceImpl.java
ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/service/impl/WidgetCatalogServiceImpl.java
ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/utils/UnzipUtil.java
portal-FE-common/src/app/layout/components/footer/footer.component.html
portal-FE-common/src/app/layout/components/footer/footer.component.scss
portal-FE-common/src/app/layout/components/header/header.component.html
portal-FE-common/src/app/layout/components/header/header.component.scss
portal-FE-common/src/app/layout/components/header/header.component.ts
portal-FE-common/src/app/layout/components/sidebar/sidebar.component.ts
portal-FE-common/src/app/layout/components/tabbar/tabbar.component.html
portal-FE-common/src/app/layout/components/tabbar/tabbar.component.spec.ts
portal-FE-common/src/app/layout/components/tabbar/tabbar.component.ts
portal-FE-common/src/app/layout/layout.component.html
portal-FE-common/src/app/layout/layout.component.spec.ts
portal-FE-common/src/app/layout/layout.component.ts
portal-FE-common/src/app/material-module.ts [new file with mode: 0644]
portal-FE-common/src/app/pages/functional-menu/functional-menu.component.html
portal-FE-common/src/app/pages/functional-menu/functional-menu.component.ts
portal-FE-common/src/app/pages/web-analytics/web-analytics.component.scss
portal-FE-common/src/app/shared/services/menus/menus.service.ts
portal-FE-common/src/app/shared/services/sidebar/sidebar.service.ts
portal-FE-common/src/assets/images/pdf.png [new file with mode: 0644]
portal-FE-common/src/assets/images/xlsx.png [new file with mode: 0644]
portal-FE-os/.gitignore
portal-FE-os/pom.xml
portal-FE-os/src/app/pages/application-onboarding/application-details-dialog/application-details-dialog.component.html
portal-FE-os/src/app/pages/application-onboarding/application-details-dialog/application-details-dialog.component.ts
portal-FE-os/src/app/pages/application-onboarding/application-onboarding.component.html
portal-FE-os/src/app/pages/application-onboarding/application-onboarding.component.ts
portal-FE-os/src/app/pages/pages-routing.module.ts
portal-FE-os/src/app/pages/pages.module.ts
portal-FE-os/src/environments/environment.prod.ts
portal-FE-os/src/environments/environment.ts

index 1d7ae42..43153d3 100644 (file)
@@ -2,6 +2,6 @@
 # Sets up a new build area for Portal projects on on a dev/test host such as vm-ep-dev3
 
 USER=org.UserId-goes-here
-git clone https://${USER}@gerrit.onap.org/r/a/portal
+git clone --depth 1 https://${USER}@gerrit.onap.org/r/a/portal
 cd lf_portal
-git clone https://${USER}@gerrit.onap.org/r/a/portal/sdk
+git clone --depth 1 https://${USER}@gerrit.onap.org/r/a/portal/sdk
index 8f40e8b..5371015 100644 (file)
@@ -12,4 +12,4 @@ intersphinx_mapping = {}
 html_last_updated_fmt = '%d-%b-%y %H:%M'
 
 def setup(app):
-    app.add_stylesheet("css/ribbon_onap.css")
+    app.add_stylesheet("css/ribbon.css")
index 22d7f47..3644899 100644 (file)
@@ -18,7 +18,7 @@ Clone the Portal repository with git:
 
 ::
 
-    git clone "https://gerrit.onap.org/r/portal"
+    git clone --depth 1 "https://gerrit.onap.org/r/portal"
 
 Building
 -----------------
index ce32dbb..ae03f1a 100644 (file)
@@ -18,7 +18,7 @@ Clone the Portal SDK repository with git:
 
 ::
 
-    git clone http://gerrit.onap.org/r/portal/sdk
+    git clone --depth 1 http://gerrit.onap.org/r/portal/sdk
 
 Building the base
 -----------------
index 85cf875..c106df0 100644 (file)
                <dependency>
                        <groupId>org.apache.poi</groupId>
                        <artifactId>poi</artifactId>
-                       <version>4.1.1</version>
+                       <version>3.17</version>
                        <exclusions>
                                <exclusion>
                                        <groupId>commons-logging</groupId>
index 9f125b7..ae08a34 100644 (file)
@@ -69,6 +69,11 @@ public class ExternalSecurityConfig extends WebSecurityConfigurerAdapter {
                                return false;
                        }
                };
+               
+               
+               //Added this code to enable Raptor charts within Iframe
+               http.headers().frameOptions().sameOrigin();
+               
                if(MusicUtil.isMusicEnable())
                        http.csrf().csrfTokenRepository(MusicCookieCsrfTokenRepository.withHttpOnlyFalse()).requireCsrfProtectionMatcher(csrfRequestMatcher);
                else
index 4b68a01..e2cd13c 100644 (file)
@@ -282,16 +282,7 @@ public class WidgetsCatalogController extends EPRestrictedBaseController {
                 + MS_WIDGET_URL + widgetId + "/framework.js", String.class,
                                WidgetServiceHeaders.getInstance());
        }
-
-       @GetMapping(value = "/portalApi/microservices/{widgetId}/controller.js")
-       public String getWidgetController(@PathVariable("widgetId") long widgetId) throws Exception {
-               return template.getForObject(EcompPortalUtils.widgetMsProtocol() + "://"
-                               + widgetMService.getServiceLocation(whatService,
-                                               SystemProperties.getProperty(MS_WIDGET_LOCAL_PORT))
-                + MS_WIDGET_URL + widgetId + "/controller.js", String.class,
-                               WidgetServiceHeaders.getInstance());
-       }
-
+       
        @GetMapping(value = "/portalApi/microservices/{widgetId}/style.css")
        public String getWidgetCSS(@PathVariable("widgetId") long widgetId) throws Exception {
                return template.getForObject(EcompPortalUtils.widgetMsProtocol() + "://"
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsCatalogUnRestrictedController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsCatalogUnRestrictedController.java
new file mode 100644 (file)
index 0000000..55cb08d
--- /dev/null
@@ -0,0 +1,133 @@
+/*-
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2020 AT&T 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.controller;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang.StringUtils;
+import org.onap.portalapp.controller.EPUnRestrictedBaseController;
+import org.onap.portalapp.portal.domain.EPUser;
+import org.onap.portalapp.portal.domain.MicroserviceParameter;
+import org.onap.portalapp.portal.domain.WidgetCatalog;
+import org.onap.portalapp.portal.domain.WidgetCatalogParameter;
+import org.onap.portalapp.portal.domain.WidgetParameterResult;
+import org.onap.portalapp.portal.domain.WidgetServiceHeaders;
+import org.onap.portalapp.portal.ecomp.model.PortalRestResponse;
+import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum;
+import org.onap.portalapp.portal.logging.aop.EPAuditLog;
+import org.onap.portalapp.portal.service.WidgetMService;
+import org.onap.portalapp.portal.utils.EPCommonSystemProperties;
+import org.onap.portalapp.portal.utils.EcompPortalUtils;
+import org.onap.portalapp.util.EPUserUtils;
+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.onap.portalsdk.core.util.SystemProperties;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
+import org.springframework.core.io.FileSystemResource;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.client.RestClientException;
+import org.springframework.web.client.RestTemplate;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.multipart.commons.CommonsMultipartResolver;
+
+@SuppressWarnings("unchecked")
+@RestController
+@org.springframework.context.annotation.Configuration
+@EnableAspectJAutoProxy
+@EPAuditLog
+public class WidgetsCatalogUnRestrictedController extends EPUnRestrictedBaseController {
+
+       private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WidgetsCatalogUnRestrictedController.class);
+
+       private static final String MS_WIDGET_LOCAL_PORT = "microservices.widget.local.port";
+
+    private static final String MS_WIDGET_URL = "/widget/microservices/";
+
+       private RestTemplate template = new RestTemplate();
+
+       private String whatService = "widgets-service";
+
+       @Autowired
+       private WidgetMService widgetMService;
+
+
+       @Bean
+       public CommonsMultipartResolver multipartResolver() {
+               return new CommonsMultipartResolver();
+       }
+
+       static {
+               // for localhost testing only
+               javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(new javax.net.ssl.HostnameVerifier() {
+                       public boolean verify(String hostname, javax.net.ssl.SSLSession sslSession) {
+                               if ("localhost".equals(hostname))
+                                       return true;
+                               return false;
+                       }
+               });
+       }
+       @GetMapping(value = "/portalApi/microservices/{widgetId}/controller.js")
+       public String getWidgetController(@PathVariable("widgetId") long widgetId) throws Exception {
+               return template.getForObject(EcompPortalUtils.widgetMsProtocol() + "://"
+                               + widgetMService.getServiceLocation(whatService,
+                                               SystemProperties.getProperty(MS_WIDGET_LOCAL_PORT))
+                + MS_WIDGET_URL + widgetId + "/controller.js", String.class,
+                               WidgetServiceHeaders.getInstance());
+       }
+}
index 6a581c1..0f6f3ce 100644 (file)
@@ -151,9 +151,6 @@ public class SchedulerRestInterface implements SchedulerRestInterfaceIfc {
                                
                logger.debug(EELFLoggerDelegate.debugLogger, "Client Initialized");
                
-               
-               
-
        }
 
        @SuppressWarnings("unchecked")
@@ -178,7 +175,7 @@ public class SchedulerRestInterface implements SchedulerRestInterfaceIfc {
                        if (cres.getEntity() != null) {
                                try {
                                        String str = (cres).readEntity(String.class);
-                                       if (t.getClass().getName().equals(String.class.getName())) {
+                                       if (t.getClass().isAssignableFrom(String.class)) {
                                                t = (T) str;
 
                                        } else {
@@ -233,7 +230,7 @@ public class SchedulerRestInterface implements SchedulerRestInterfaceIfc {
 
                                try {
                                        String str = (cres).readEntity(String.class);
-                                       if (t.getClass().getName().equals(String.class.getName())) {
+                                       if (t.getClass().isAssignableFrom(String.class)) {
                                                t = (T) str;
 
                                        } else {
index c1ca873..675cfe1 100644 (file)
@@ -57,17 +57,17 @@ public class SchedulerUtil {
 
        public static GetTimeSlotsWrapper getTimeSlotsWrapResponse (GetTimeSlotsRestObject<String> rs) {        
                
-               String resp_str = "";
+               String respStr = "";
                int status = 0;
                
                if ( rs != null ) {
-                       resp_str = rs.get();
+                       respStr = rs.get();
                        status = rs.getStatusCode();
                }
                                
                GetTimeSlotsWrapper w = new GetTimeSlotsWrapper();
                
-               w.setEntity(resp_str);
+               w.setEntity(respStr);
                w.setStatus (status);
                
                return (w);
@@ -75,19 +75,19 @@ public class SchedulerUtil {
        
        public static PostSubmitVnfChangeTimeSlotsWrapper postSubmitNewVnfWrapResponse (PostSubmitVnfChangeRestObject<String> rs) {     
                
-               String resp_str = "";
+               String respStr = "";
                int status = 0;
                String uuid = "";
                
                if ( rs != null ) {
-                       resp_str = rs.get();
+                       respStr = rs.get();
                        status = rs.getStatusCode();
                        uuid = rs.getUUID();
                }
                                
                PostSubmitVnfChangeTimeSlotsWrapper w = new PostSubmitVnfChangeTimeSlotsWrapper();
                
-               w.setEntity(resp_str);
+               w.setEntity(respStr);
                w.setStatus (status);
                w.setUuid(uuid);
                
@@ -96,19 +96,19 @@ public class SchedulerUtil {
        
        public static PostCreateNewVnfWrapper postCreateNewVnfWrapResponse (PostCreateNewVnfRestObject<String> rs) {    
                
-               String resp_str = "";
+               String respStr = "";
                int status = 0;
                String uuid = "";
                
                if ( rs != null ) {
-                       resp_str = rs.get();
+                       respStr = rs.get();
                        status = rs.getStatusCode();
                        uuid = rs.getUUID();
                }
                                
                PostCreateNewVnfWrapper w = new PostCreateNewVnfWrapper();
                
-               w.setEntity(resp_str);
+               w.setEntity(respStr);
                w.setStatus (status);
                w.setUuid(uuid);
                
@@ -121,14 +121,14 @@ public class SchedulerUtil {
                ObjectMapper mapper = new ObjectMapper();
                String r_json_str = "";
            if ( t != null ) {
-                   try {
-                       r_json_str = mapper.writeValueAsString(t);
-                   }
-                   catch ( com.fasterxml.jackson.core.JsonProcessingException j ) {
-                                       logger.debug(EELFLoggerDelegate.debugLogger,
-                                               DateUtil.getDateFormat().format(new Date()) + "<== " + methodName + " Unable " + "to "
-                                                       + "parse object as json");
-                               }
+            try {
+                r_json_str = mapper.writeValueAsString(t);
+            } catch (com.fasterxml.jackson.core.JsonProcessingException j) {
+                logger.debug(
+                        EELFLoggerDelegate.debugLogger, DateUtil.getDateFormat().format(new Date())
+                                + "<== " + methodName + " Unable " + "to " + "parse object as json",
+                        j);
+            }
            }
            return (r_json_str);
        }
index 75919ee..f120c4f 100644 (file)
@@ -63,24 +63,21 @@ public class SchedulerAuxRestInt {
         *
         * @param r the r
         */
-       public void logRequest ( RequestDetails r ) {
-                 SimpleDateFormat dateFormat = DateUtil.getDateFormat();
-       String methodName = "logRequest";
-           ObjectMapper mapper = new ObjectMapper();
-           String r_json_str = "";
-           if ( r != null ) {
-               r_json_str = r.toString();
-                   try {
-                       r_json_str = mapper.writeValueAsString(r);
-                   }
-                   catch ( com.fasterxml.jackson.core.JsonProcessingException j ) {
-                       logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " +  methodName + " "
-                                               + "Unable to "
-                                               + "parse request as json");
-                   }
-           }
-           logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " +  methodName + " Request="
-                               + "(" +
-                               r_json_str + ")");
+    public void logRequest(RequestDetails r) {
+        SimpleDateFormat dateFormat = DateUtil.getDateFormat();
+        String methodName = "logRequest";
+        ObjectMapper mapper = new ObjectMapper();
+        String rJsonStr = "";
+        if (r != null) {
+            rJsonStr = r.toString();
+            try {
+                rJsonStr = mapper.writeValueAsString(r);
+            } catch (com.fasterxml.jackson.core.JsonProcessingException j) {
+                logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== "
+                        + methodName + " " + "Unable to " + "parse request as json", j);
+            }
+        }
+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== "
+                + methodName + " Request=" + "(" + rJsonStr + ")");
     }
 }
index a4463c7..3d2432c 100644 (file)
@@ -1634,7 +1634,11 @@ public class EPAppCommonServiceImpl implements EPAppService {
        }
 
        protected String constructImageName(OnboardingApp onboardingApp) {
-               return "portal_" + String.valueOf(onboardingApp.getLandingPage().hashCode() + "_" + (int) (Math.random() * 100000.0))
+               String appLandingPageURL = onboardingApp.getLandingPage();
+               if(appLandingPageURL == null) {
+                       appLandingPageURL = "";
+               }
+               return "portal_" + String.valueOf(appLandingPageURL.hashCode() + "_" + (int) (Math.random() * 100000.0))
                                + ".png";
        }
 
index 4de10d9..930c4a9 100644 (file)
@@ -141,7 +141,7 @@ public class EPLeftMenuServiceImpl implements EPLeftMenuService {
                        MenuData menuData = iterator.next();
                        for (int index = 0; index < displayTexts.size(); index++) {
                                DisplayText displayText = displayTexts.get(index);
-                               if (menuData.getId() == displayText.getTextId()) {
+                               if (menuData.getId().equals(displayText.getTextId())) {
                                        menuData.setLabel(displayText.getLabel());
                                        break;
                                }
index 5d38317..4adf1fd 100644 (file)
@@ -62,6 +62,9 @@ import org.onap.portalsdk.core.service.DataAccessService;
 public class EPRoleServiceImpl implements EPRoleService {
     EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EPRoleServiceImpl.class);
 
+    private static final String GET_APP_ROLE_SQL_FORMAT =
+            "SELECT * FROM fn_role where APP_ID = %s AND APP_ROLE_ID = %s";
+
     @Autowired
     private DataAccessService dataAccessService;
 
@@ -123,10 +126,6 @@ public class EPRoleServiceImpl implements EPRoleService {
         return (EPRole) getDataAccessService().getDomainObject(EPRole.class, id, null);
     }
 
-    // TODO: refactor
-    private static final String GET_APP_ROLE_SQL_FORMAT =
-            "SELECT * FROM fn_role where APP_ID = %s AND APP_ROLE_ID = %s";
-
     @SuppressWarnings("unchecked")
     public EPRole getRole(Long appId, Long appRoleid) {
         if (appId == null || appRoleid == null) {
@@ -185,7 +184,7 @@ public class EPRoleServiceImpl implements EPRoleService {
             if (roles != null) {
                 return roles.get(0);
             }
-        } else if (resultsCount == 1) {
+        } else if (roles!=null && resultsCount == 1) {
             return roles.get(0);
         }
         return null;
index 675e4f4..5daacbd 100644 (file)
@@ -351,28 +351,6 @@ public class WidgetsCatalogControllerTest {
                assertNull(result);
        }
 
-       @SuppressWarnings("unchecked")
-       @Test
-       public void getWidgetControllerTest() throws Exception {
-               PowerMockito.mockStatic(EcompPortalUtils.class);
-               PowerMockito.mockStatic(SystemProperties.class);
-               PowerMockito.mockStatic(EPCommonSystemProperties.class);
-               PowerMockito.mockStatic(CipherUtil.class);
-               Mockito.when(EcompPortalUtils.widgetMsProtocol()).thenReturn("test1");
-               Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.WIDGET_MS_PROTOCOL)).thenReturn("https");
-               Mockito.when(SystemProperties.getProperty("microservices.widget.local.port")).thenReturn("test");
-               Mockito.when(EcompPortalUtils.getPropertyOrDefault("microservices.widget.username", "widget_user"))
-                               .thenReturn("test");
-               Mockito.when(CipherUtil
-                               .decryptPKC(EcompPortalUtils.getPropertyOrDefault("microservices.widget.password", "widget_password")))
-                               .thenReturn("abc");
-               Mockito.when(widgetMService.getServiceLocation("widgets-service", "test")).thenReturn("test.com");
-               Mockito.when(template.getForObject(Mockito.anyString(), Mockito.any(Class.class), Mockito.any(String.class)))
-                               .thenReturn("test123");
-               String result = widgetsCatalogController.getWidgetController(1);
-               assertNull(result);
-       }
-
        @SuppressWarnings("unchecked")
        @Test
        public void getWidgetCSSTest() throws Exception {
diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/WidgetsCatalogUnRestrictedControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/WidgetsCatalogUnRestrictedControllerTest.java
new file mode 100644 (file)
index 0000000..fbee764
--- /dev/null
@@ -0,0 +1,143 @@
+/*-
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2020 AT&T 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.controller;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.portal.core.MockEPUser;
+import org.onap.portalapp.portal.domain.EPUser;
+import org.onap.portalapp.portal.domain.MicroserviceParameter;
+import org.onap.portalapp.portal.domain.WidgetCatalog;
+import org.onap.portalapp.portal.domain.WidgetCatalogParameter;
+import org.onap.portalapp.portal.domain.WidgetParameterResult;
+import org.onap.portalapp.portal.ecomp.model.PortalRestResponse;
+import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum;
+import org.onap.portalapp.portal.framework.MockitoTestSuite;
+import org.onap.portalapp.portal.service.MicroserviceServiceImpl;
+import org.onap.portalapp.portal.service.WidgetMService;
+import org.onap.portalapp.portal.service.WidgetMServiceImpl;
+import org.onap.portalapp.portal.service.WidgetParameterServiceImpl;
+import org.onap.portalapp.portal.utils.EPCommonSystemProperties;
+import org.onap.portalapp.portal.utils.EcompPortalUtils;
+import org.onap.portalapp.util.EPUserUtils;
+import org.onap.portalsdk.core.onboarding.util.CipherUtil;
+import org.onap.portalsdk.core.util.SystemProperties;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.mock.web.MockHttpServletResponse;
+import org.springframework.mock.web.MockMultipartFile;
+import org.springframework.mock.web.MockMultipartHttpServletRequest;
+import org.springframework.web.client.RestClientException;
+import org.springframework.web.client.RestTemplate;
+
+@SuppressWarnings("rawtypes")
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ EPUserUtils.class, CipherUtil.class, EcompPortalUtils.class, SystemProperties.class,
+               EPCommonSystemProperties.class, EPUserUtils.class })
+public class WidgetsCatalogUnRestrictedControllerTest {
+
+       @Mock
+       WidgetMService widgetMService = new WidgetMServiceImpl();
+
+       @InjectMocks
+       WidgetsCatalogUnRestrictedController widgetsCatalogControllerTest = new WidgetsCatalogUnRestrictedController();
+
+       @Before
+       public void setup() {
+               MockitoAnnotations.initMocks(this);
+       }
+
+       @Mock
+       RestTemplate template = new RestTemplate();
+
+       MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+
+       HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+       HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+
+       NullPointerException nullPointerException = new NullPointerException();
+
+       MockEPUser mockUser = new MockEPUser();
+
+
+       @SuppressWarnings("unchecked")
+       @Test
+       public void getWidgetControllerTest() throws Exception {
+               PowerMockito.mockStatic(EcompPortalUtils.class);
+               PowerMockito.mockStatic(SystemProperties.class);
+               PowerMockito.mockStatic(EPCommonSystemProperties.class);
+               PowerMockito.mockStatic(CipherUtil.class);
+               Mockito.when(EcompPortalUtils.widgetMsProtocol()).thenReturn("test1");
+               Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.WIDGET_MS_PROTOCOL)).thenReturn("https");
+               Mockito.when(SystemProperties.getProperty("microservices.widget.local.port")).thenReturn("test");
+               Mockito.when(EcompPortalUtils.getPropertyOrDefault("microservices.widget.username", "widget_user"))
+                               .thenReturn("test");
+               Mockito.when(CipherUtil
+                               .decryptPKC(EcompPortalUtils.getPropertyOrDefault("microservices.widget.password", "widget_password")))
+                               .thenReturn("abc");
+               Mockito.when(widgetMService.getServiceLocation("widgets-service", "test")).thenReturn("test.com");
+               Mockito.when(template.getForObject(Mockito.anyString(), Mockito.any(Class.class), Mockito.any(String.class)))
+                               .thenReturn("test123");
+               String result = widgetsCatalogControllerTest.getWidgetController(1);
+               assertNull(result);
+       }
+
+       
+       
+}
index a3aa565..b9a99e0 100644 (file)
@@ -40,7 +40,7 @@ db.driver = org.mariadb.jdbc.Driver
 #db.connectionURL = jdbc:mariadb:failover://localhost:3306/ecomp_portal
 #db.userName = XXXX
 #db.password = XXXX
-db.connectionURL = jdbc:mariadb:failover://localhost:3306/portal_3_2_os
+db.connectionURL = jdbc:mariadb:failover://localhost:3306/portal_os
 db.userName = root
 db.password = root
 # is the db.password property encrypted?
@@ -147,7 +147,7 @@ external_system_notification_url= https://jira.onap.org/browse/
 # External Access System Basic Auth Credentials & Rest endpoint(These credentials doesn't work as these are place holders for now)
 ext_central_access_user_name = aaf_admin@people.osaaf.org
 ext_central_access_password = CkmGguWw+Yn0yzqximmSExkOSJ7BdKvOTHFmTMg9Yvc=
-ext_central_access_url = https://aaf-service:31110/authz/
+ext_central_access_url = https://aaf-service:30247/authz/
 ext_central_access_user_domain = @csp.onap.org
 
 # External Central Auth system access
index 50a285c..2cdf13f 100644 (file)
@@ -91,7 +91,7 @@
                <dependency>
                        <groupId>org.mariadb.jdbc</groupId>
                        <artifactId>mariadb-java-client</artifactId>
-                       <!-- <version>1.5.8</version> -->
+                       <version>1.5.8</version>
                </dependency>
                <dependency>
                        <groupId>com.github.ulisesbocchio</groupId>
index 1896a4f..e6c1c0a 100644 (file)
@@ -163,13 +163,14 @@ public class WidgetsCatalogController {
                try {
                        //check the zip file structure first
                        respond = storageService.checkZipFile(file);
+                       logger.debug("Check file validity"+respond.isValid()+respond.getError());
                        if(respond.isValid()){
                                //update the widget catalog
                                WidgetCatalog newWidget = new ObjectMapper().readValue(widget, WidgetCatalog.class);
                                widgetCatalogService.updateWidgetCatalog(widgetId, newWidget);
                                logger.debug("WidgetsCatalogController.saveWidgetCatalog: updating widget with widgetId={}", widgetId);
                                //update the widget zip file
-                               storageService.update(file, newWidget, widgetId);
+                               storageService.updateJsFile(file, newWidget, widgetId);
                        }
                } catch (Exception e) {
                        logger.error("Exception occurred while performing WidgetsCatalogController.saveWidgetCatalog in widget microservices. Details:", e);
index fbd0f96..d8b5642 100644 (file)
@@ -30,5 +30,7 @@ public interface StorageService {
     
     void update(MultipartFile file, WidgetCatalog newWidget, long widgetId);
     
+    void updateJsFile(MultipartFile file, WidgetCatalog newWidget, long widgetId);
+    
        byte[] getWidgetCatalogContent(long widgetId) throws Exception;
 }
index 7a35ba4..3bb41b6 100644 (file)
@@ -73,7 +73,7 @@ public class StorageServiceImpl implements StorageService {
                Criteria criteria = session.createCriteria(WidgetFile.class);
                criteria.add(Restrictions.eq("widgetId", widgetId));
                List<WidgetFile> widgetFiles = criteria.list();
-               session.flush();
+               //session.flush();
                session.close();
                if (widgetFiles.size() > 0)
                        widgetFile = widgetFiles.get(0);
@@ -148,7 +148,7 @@ public class StorageServiceImpl implements StorageService {
                        logger.error("StorageServiceImpl.save: Failed to store file " + file.getOriginalFilename(), e);
                        throw new StorageException("Failed to store file " + file.getOriginalFilename(), e);
                }
-               saveHelper(newWidget, widgetId, map);
+               saveJsHelper(newWidget, widgetId, map);
        }
 
        @Override
@@ -167,7 +167,7 @@ public class StorageServiceImpl implements StorageService {
                        throw new StorageException("Failed to store file " + file.getName(), e);
                }
                
-               saveHelper(newWidget, widgetId, map);
+               saveJsHelper(newWidget, widgetId, map);
        }
 
        /**
@@ -259,6 +259,90 @@ public class StorageServiceImpl implements StorageService {
                                widgetId);
 
        }
+       
+       /**
+        * Helper method to UnZip File
+        * 
+        * @param file
+        */
+       private Map<String, byte[]> unZipFile(MultipartFile file) {
+               UnzipUtil unzipper = new UnzipUtil();
+               Map<String, byte[]> map;
+               File convFile;
+               try {
+                       if (file.isEmpty()) {
+                               logger.error("StorageServiceImpl.update: Failed to store empty file " + file.getOriginalFilename());
+                               throw new StorageException("Failed to store empty file " + file.getOriginalFilename());
+                       }
+                       String fileLocation = file.getOriginalFilename();
+                       logger.debug("StorageServiceImpl.update: store the widget to:" + fileLocation);
+                       convFile = new File(fileLocation);
+                       try(FileOutputStream fos = new FileOutputStream(convFile)){
+                               fos.write(file.getBytes());
+                       }
+                       map = unzipper.unzip_db(fileLocation, ".", "tempWidgets");
+                       convFile.delete();
+                       return map;
+               } catch (IOException e) {
+                       logger.error("StorageServiceImpl.update: Failed to store file " + file.getOriginalFilename(), e);
+                       throw new StorageException("StorageServiceImpl.update: Failed to store file " + file.getOriginalFilename(),
+                                       e);
+               }
+       }
+       
+       /**
+        * Helper method for saving widget file (controller.js) to ep_widget_catalog_files table in database
+        * 
+        * @param newWidget
+        * @param widgetId
+        * @param map
+        */
+       private void saveJsHelper(WidgetCatalog newWidget, long widgetId, Map<String, byte[]> map) {
+
+               logger.debug("Going to save controller.js " + newWidget);
+               WidgetFile widgetFile = new WidgetFile();
+               widgetFile.setName(newWidget.getName());
+               widgetFile.setWidgetId(widgetId);
+               final byte[] controllerLoc = map.get(WidgetConstant.WIDGET_CONTROLLER_LOCATION);
+               if (controllerLoc == null || controllerLoc.length == 0)
+                       throw new IllegalArgumentException(
+                                       "Map is missing required key " + WidgetConstant.WIDGET_CONTROLLER_LOCATION);
+               String javascript = new String(controllerLoc);
+
+               widgetFile.setController(javascript.getBytes());
+               Session session = sessionFactory.openSession();
+               session.save(widgetFile);
+               session.flush();
+               session.close();
+               logger.debug(
+                               "StorageServiceImpl.save: saved controller.js file to the database for widget {}",
+                               widgetId);
+
+       }
+       
+       @Override
+       public void updateJsFile(MultipartFile file, WidgetCatalog newWidget, long widgetId) {
+               Map<String, byte[]> map;
+               map = unZipFile(file);
+               //Get existing widget file from DB      
+               WidgetFile widgetFile = getWidgetFile(widgetId);
+               
+               String javascript = new String(map.get(WidgetConstant.WIDGET_CONTROLLER_LOCATION));
+               widgetFile.setController(javascript.getBytes());
+               Session session = sessionFactory.openSession();
+               Transaction tx = session.beginTransaction();
+               session.update(widgetFile);
+               tx.commit();
+               session.flush();
+               session.close();
+               logger.debug(
+                               "StorageServiceImpl.save: updated controller.js file to the database for widget {}",
+                               widgetId);
+       }
+       
+       
+       
+       
 
        @Override
        public void update(MultipartFile file, WidgetCatalog newWidget, long widgetId) {
@@ -424,53 +508,14 @@ public class StorageServiceImpl implements StorageService {
        public byte[] getWidgetCatalogContent(long widgetId) throws Exception {
 
                WidgetCatalog widget = widgetCatalogService.getWidgetCatalog(widgetId);
-               String namespace = "Portal" + widgetId + "Widget";
-               String controllerName = "Portal" + widgetId + "Ctrl";
-               String cssName = "portal" + widgetId + "-css-ready";
-
-               String styles = getWidgetCSS(widgetId).replaceAll(cssName, widget.getName() + "-css-ready");
                File f = File.createTempFile("temp", ".zip");
                try(ZipOutputStream out = new ZipOutputStream(new FileOutputStream(f))){
-                       ZipEntry e = new ZipEntry(widget.getName() + "/styles/styles.css");
-                       out.putNextEntry(new ZipEntry(widget.getName() + "/"));
-                       out.putNextEntry(new ZipEntry(widget.getName() + "/styles/"));
-                       out.putNextEntry(e);
-                       byte[] data = styles.getBytes();
-                       out.write(data, 0, data.length);
-       
-                       String widgetData = namespace + "=" + namespace + "||{};" + "var res = " + namespace + ".widgetData;";
-                       String javascript = getWidgetController(widgetId).replace(widgetData, "").replace(namespace + ".controller =",
-                                       "");
-       
-                       String functionHeader = javascript.substring(javascript.indexOf("function"), javascript.indexOf(")") + 1);
-                       javascript = javascript.replaceFirst(controllerName, widget.getName() + "Ctrl");
-                       String functionParam = functionHeader.substring(functionHeader.indexOf("(") + 1, functionHeader.indexOf(")"));
-                       StringBuilder injectStr = new StringBuilder().append("[");
-                       List<String> paramList = Arrays.asList(functionParam.split(","));
-                       for (int i = 0; i < paramList.size(); i++) {
-                               if (i == paramList.size() - 1)
-                                       injectStr.append("'" + paramList.get(i).trim() + "'];");
-                               else
-                                       injectStr.append("'" + paramList.get(i).trim() + "',");
-                       }
-                       javascript = javascript.replace(";" + namespace + ".controller.$inject = " + injectStr.toString(), "");
+                       String javascript = getWidgetController(widgetId);
        
-                       e = new ZipEntry(widget.getName() + "/js/controller.js");
+                       ZipEntry e = new ZipEntry(widget.getName() + "/js/controller.js");
                        out.putNextEntry(new ZipEntry(widget.getName() + "/js/"));
                        out.putNextEntry(e);
-                       data = javascript.getBytes();
-                       out.write(data, 0, data.length);
-       
-                       String html = getWidgetMarkup(widgetId).replaceFirst(controllerName, widget.getName() + "Ctrl");
-       
-                       // new
-                       // String(map.get(WidgetConstant.WIDGET_MARKUP_LOCATION)).replaceFirst(functionName,
-                       // controllerName);;
-       
-                       e = new ZipEntry(widget.getName() + "/markup/markup.html");
-                       out.putNextEntry(new ZipEntry(widget.getName() + "/markup/"));
-                       out.putNextEntry(e);
-                       data = html.getBytes();
+                       byte[] data = javascript.getBytes();
                        out.write(data, 0, data.length);
                        out.closeEntry();
                        byte[] result = Files.readAllBytes(Paths.get(f.getPath()));
index f5558e2..d71356f 100644 (file)
@@ -148,14 +148,13 @@ public class WidgetCatalogServiceImpl implements WidgetCatalogService {
        @Override
        public WidgetCatalog getWidgetCatalog(Long widgetCatalogId) {
                Session session = sessionFactory.getCurrentSession();
-               Transaction tx = session.beginTransaction();
                WidgetCatalog widget = (WidgetCatalog) session.get(WidgetCatalog.class, widgetCatalogId);
-               tx.commit();
                logger.debug("WidgetCatalogServiceImpl.getWidgetCatalog: getting widget={}", widget);
                return widget;
        }
        
        @Override
+       @Transactional
        public void deleteWidgetCatalog(long widgetCatalogId) {
                logger.debug("WidgetCatalogServiceImpl.deleteWidgetCatalog: deleting the widget with widgetId={}", widgetCatalogId);
                WidgetCatalog widget = getWidgetCatalog(widgetCatalogId);
@@ -164,7 +163,7 @@ public class WidgetCatalogServiceImpl implements WidgetCatalogService {
                        return;
                }
                Session session = sessionFactory.getCurrentSession();
-               Transaction tx = session.beginTransaction();
+               //Transaction tx = session.beginTransaction();
                Query query = session.createSQLQuery("delete from ep_pers_user_widget_sel where widget_id = :widgetId ").setParameter("widgetId", widgetCatalogId);
                query.executeUpdate();
                query = session.createSQLQuery("delete from ep_pers_user_widget_placement where widget_id = :widgetId ").setParameter("widgetId", widgetCatalogId);
@@ -174,7 +173,7 @@ public class WidgetCatalogServiceImpl implements WidgetCatalogService {
                query = session.createSQLQuery("delete from ep_widget_catalog_parameter where widget_id = :widgetId ").setParameter("widgetId", widgetCatalogId);
                query.executeUpdate();
                session.delete(widget);
-               tx.commit();
+               //tx.commit();
        }
        
        @Override
index f20ed1b..164a698 100644 (file)
@@ -51,8 +51,7 @@ public class UnzipUtil {
                        ZipEntry entry = zipIn.getNextEntry();
                        Map<String, byte[]> map = new HashMap<>();
        
-                       String[] requiredKeys = { WidgetConstant.WIDGET_CONTROLLER_LOCATION, WidgetConstant.WIDGET_MARKUP_LOCATION,
-                                       WidgetConstant.WIDGET_STYLE_LOCATION };
+                       String[] requiredKeys = { WidgetConstant.WIDGET_CONTROLLER_LOCATION };
                        for (String k : requiredKeys)
                                map.put(k, null);
        
index 47a53cd..93c529a 100644 (file)
@@ -35,7 +35,7 @@
  
   
   -->
-<footer>
+<footer class="portal-footer">
       <div id="footer-text"  class="footerText">
           <p class="copyright-text">
             <a class="footer-link" href="{{footerLink}}" target="_blank">
index 82c81d7..0a6fc6c 100644 (file)
@@ -50,3 +50,7 @@ $topnav-background-color: #222;
   margin-top: 20px;
   text-align: center;
 }
+
+.portal-footer{ 
+  margin-top: calc(100vh - 620px);
+}
index 97f4a26..865ce07 100644 (file)
         <br>
     </div>
 </div>
+<div class = "language-dropdown">
+    <span class="dropdown-item-name"> {{ 'Language' }}: </span>
+    <select #langSelect (change)="setLanguage(langSelect.value)">
+        <option *ngFor="let lang of languages" [value]="lang.languageId" [selected]="lang.selected">
+            {{ lang.languageAlias }}
+        </option>
+    </select>
+</div>
 <hr>
 <div id="reg-logout-div" >
 <button type="button" class="btn btn-primary"  (click)="allAppsLogout()">
index 65a4be0..0d14531 100644 (file)
@@ -81,4 +81,7 @@ $topnav-background-color: #222;
   .header-menu-display {
     width: 250px;
   }
+  .language-dropdown {
+    padding: 0.25rem 1.5rem;
+  }
 }
index 429587d..f09c772 100644 (file)
@@ -35,7 +35,7 @@
  *
  * 
  */
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, Output, EventEmitter } from '@angular/core';
 import { Router, NavigationEnd } from '@angular/router';
 import { UserProfileService, MenusService } from 'src/app/shared/services';
 import { CookieService } from 'ngx-cookie-service';
@@ -60,6 +60,10 @@ export class HeaderComponent implements OnInit {
     brandName: string;
     brandLogoImagePath: string;
     isSystemUser: boolean = false;
+       languages: string[] = [];
+    result: any;
+       
+    @Output() languageEvent = new EventEmitter();
 
     constructor(public router: Router, private userProfileService: UserProfileService, private menusService: MenusService, private cookieService: CookieService) {
 
@@ -87,6 +91,20 @@ export class HeaderComponent implements OnInit {
         if(this.api.brandLogoImagePath != ''){
            this.brandLogoImagePath = this.api.brandLogoImagePath;
         }
+               
+               this.menusService.getAllLanguages().subscribe(data =>{
+        this.result = data;
+            for(let lang of this.result.languageList ){
+                this.languages.push(lang);
+            }
+                       
+        this.menusService.getCurrentLang(this.loginSnippetUserid).subscribe(data=>{
+        this.result = data;
+                this.languages.map((obj:any)=>{
+                    obj.selected = obj.languageId == parseInt(this.result.languageId);
+                })   ;
+            });
+        });
     }
 
     getUserInformation() {
@@ -196,4 +214,11 @@ export class HeaderComponent implements OnInit {
     onLoggedout() {
         localStorage.removeItem('isLoggedin');
     }
+       
+       setLanguage(langId : string){
+        
+        this.menusService.setLanguage(langId, this.loginSnippetUserid).subscribe(data =>{
+            this.languageEvent.emit(langId);
+        });
+    }
 }
index 1c689e1..9ea540c 100644 (file)
@@ -35,7 +35,7 @@
  *
  * 
  */
-import { Component, Output, EventEmitter, OnInit, Input } from '@angular/core';
+import { Component, Output, EventEmitter, OnInit, Input, OnChanges } from '@angular/core';
 import { Router, NavigationEnd } from '@angular/router';
 import { SidebarService } from '../../../shared/services/index'
 
@@ -57,6 +57,9 @@ export class SidebarComponent implements OnInit {
     menuData: Array<object> = [];
     page: any;
 
+    languageFinal : string;
+    @Input() langFromTab:string;
+
     @Output() collapsedEvent = new EventEmitter<boolean>();
 
     constructor(public router: Router, public sidebarService: SidebarService) {
@@ -71,64 +74,75 @@ export class SidebarComponent implements OnInit {
         });
     }
 
-    ngOnInit() {
+    ngOnChanges() {
+        if(this.langFromTab)
+           this.changeLang();
+    }
+    
+    changeLang(){
+        this.menuData=[];
         this.isActive = false;
         this.collapsed = false;
+       // this.languageFinal=lang;
         this.showMenu = '';
         this.pushRightClass = 'push-right';
         this.sidebarService.getLeftMenu()
-            .subscribe(data => {
-                this.result = data;
-                if (this.result.data && this.result.data2) {
-                    this.leftParentData = JSON.parse(this.result.data);
-                    this.leftChildData = JSON.parse(this.result.data2);
+        .subscribe(data => {
+            this.result = data;
+            if (this.result.data && this.result.data2) {
+                this.leftParentData = JSON.parse(this.result.data);
+                this.leftChildData = JSON.parse(this.result.data2);
+            } else {
+                this.labelName = this.result.label;
+                this.leftParentData = this.result.navItems;
+                this.showOnlyParentMenu = true;
+            }
+
+            for (var i = 0; i < this.leftParentData.length; i++) {
+                var parentItem = {
+                    name: null,
+                    imageSrc: null,
+                    href: null,
+                    menuItems: [],
+                    state: null
+                }
+                if (this.showOnlyParentMenu) {
+                    parentItem.name = this.leftParentData[i].name;
+                    parentItem.imageSrc = this.leftParentData[i].imageSrc;
+                    parentItem.state = '/'+this.leftParentData[i].state;
                 } else {
-                    this.labelName = this.result.label;
-                    this.leftParentData = this.result.navItems;
-                    this.showOnlyParentMenu = true;
+                    parentItem.name = this.leftParentData[i].label;
+                    parentItem.imageSrc = this.leftParentData[i].imageSrc;
                 }
+                // Add link to items with no subitems
+                if (!this.showOnlyParentMenu) {
+                    if (this.leftChildData[i].length == 0)
+                        parentItem.href = this.leftParentData[i].action;
 
-                for (var i = 0; i < this.leftParentData.length; i++) {
-                    var parentItem = {
-                        name: null,
-                        imageSrc: null,
-                        href: null,
-                        menuItems: [],
-                        state: null
-                    }
-                    if (this.showOnlyParentMenu) {
-                        parentItem.name = this.leftParentData[i].name;
-                        parentItem.imageSrc = this.leftParentData[i].imageSrc;
-                        parentItem.state = '/'+this.leftParentData[i].state;
-                    } else {
-                        parentItem.name = this.leftParentData[i].label;
-                        parentItem.imageSrc = this.leftParentData[i].imageSrc;
-                    }
-                    // Add link to items with no subitems
-                    if (!this.showOnlyParentMenu) {
-                        if (this.leftChildData[i].length == 0)
-                            parentItem.href = this.leftParentData[i].action;
-
-                        for (var j = 0; j < this.leftChildData[i].length; j++) {
-
-                            var childItem = {
-                                name: null,
-                                href: null
-                            };
-                            if (this.leftChildData[i][j].label != null && this.leftChildData[i][j].label.length > 0) {
-
-                                childItem.name = this.leftChildData[i][j].label;
-                                childItem.href = this.leftChildData[i][j].action;
-                                parentItem.menuItems.push(childItem);
-                            }
+                    for (var j = 0; j < this.leftChildData[i].length; j++) {
+
+                        var childItem = {
+                            name: null,
+                            href: null
+                        };
+                        if (this.leftChildData[i][j].label != null && this.leftChildData[i][j].label.length > 0) {
+
+                            childItem.name = this.leftChildData[i][j].label;
+                            childItem.href = this.leftChildData[i][j].action;
+                            parentItem.menuItems.push(childItem);
                         }
                     }
-                    this.menuData.push(parentItem);
                 }
+                this.menuData.push(parentItem);
+            }
 
-            });
+        });        
+    }
 
+    ngOnInit() {
+        this.changeLang();
     }
+
     eventCalled() {
         this.isActive = !this.isActive;
     }
@@ -155,4 +169,4 @@ export class SidebarComponent implements OnInit {
         const dom: any = document.querySelector('body');
         dom.classList.toggle(this.pushRightClass);
     }
-}
+}
\ No newline at end of file
index 65ccf1d..a12a8df 100644 (file)
 
   -->
 
+  <style>
+    .apps-tab {
+     position: absolute;
+     width: 100%;
+     height: 100%;
+     top: 100px;
+     left: 5px;
+     background-color: white;
+   }
+ </style>
+
   <div style="display: flex; flex-direction:column">
 
       <mat-tab-group [selectedIndex]="selected.value" (selectedIndexChange)="selected.setValue($event)"
@@ -57,7 +68,7 @@
 
           <div style="display: flex; flex-direction:column; overflow-y: scroll; height: calc(100vh - 100px)">
             <div style="display: flex; flex-direction:row;">
-              <app-sidebar (collapsedEvent)="receiveCollapsed($event)"></app-sidebar>
+                         <app-sidebar (collapsedEvent)="receiveCollapsed($event)" [langFromTab]="inputedLanguage"></app-sidebar>
               <app-userbar></app-userbar>
               <div class="container" [ngStyle]="setStyle()">
                 <router-outlet></router-outlet>
 
       </mat-tab-group>
 
-
-
-
-
-        <div *ngFor="let tab of tabs; let index = index"
-          [style.display]='tab.active? "inline" : "none"'
-          [style.position]='tab.active? "static" : "absolute"'
-          [style.height]='tab.active? "calc(100vh)" : "calc(0vh)"'>
-
-          <iframe id="tabframe-{{tab.label.split(' ').join('-')}}-{{index}}" scrolling='yes' frameBorder='0' width='100%'
-            scrolling='yes' frameBorder='0' width='100%' height='90%' [src]='tab.url'></iframe>
-
-        </div>
-
-
-    </div>
+      <div class="apps-tab" *ngFor="let tab of tabs; let index = index"
+          [style.display]='"inline"'
+          [style.position]='"absolute"'
+          [style.height]='"calc(100vh)"'
+          [style.z-index]="tab.active? 1 : 0"
+          [style.opacity]="tab.active? 1 : 0"
+      >
+          <iframe id="tabframe-{{tab.label.split(' ').join('-')}}-{{index}}" scrolling='yes' frameBorder='0'
+            scrolling='yes' frameBorder='0' width='100%' height='90%' [src]='tab.url'>
+          </iframe>
+      </div>
+</div>
index 066d73f..37a7e91 100644 (file)
@@ -40,7 +40,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { TabbarComponent } from './tabbar.component';
 import { NgMaterialModule } from 'src/app/ng-material-module';
-import { Component } from '@angular/core';
+import { Component, Input } from '@angular/core';
 import { ElipsisPipe } from 'src/app/shared/pipes/elipsis/elipsis.pipe';
 import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 import { HttpClientTestingModule} from '@angular/common/http/testing';
@@ -69,7 +69,7 @@ describe('TabbarComponent', () => {
 });
 
 @Component({selector: 'app-sidebar', template: ''})
-class AppSideBarStubComponent {}
+class AppSideBarStubComponent {@Input() langFromTab:string;}
 
 @Component({selector: 'router-outlet', template: ''})
 class RouterOutletStubComponent { }
index 86f7659..f44b4ef 100644 (file)
@@ -35,7 +35,7 @@
  *
  *
  */
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, Input, OnChanges } from '@angular/core';
 import { FormControl } from '@angular/forms';
 import { DomSanitizer } from '@angular/platform-browser';
 import { Tab } from './tab';
@@ -54,6 +54,10 @@ export class TabbarComponent implements OnInit {
   mainTab = 'Home';
   selected = new FormControl(0);
   collapedSideBar: boolean;
+  inputedLanguage: string;
+  @Input() language:string;
+
 
   constructor(private sanitizer: DomSanitizer, private addTabFuntionService: AddTabFunctionService, private auditLogService: AuditLogService) {
 
@@ -68,6 +72,13 @@ export class TabbarComponent implements OnInit {
       
     })
   }
+  
+  ngOnChanges() {
+    this.changeLang(this.language);
+  }
+  changeLang(lang){
+    this.inputedLanguage=lang;
+  }
 
   addTab(selectAfterAdding: boolean, label: string, url: string) {
     const tab = new Tab(label);
index fa7ada0..4c2bb4d 100644 (file)
@@ -36,8 +36,8 @@
 
   -->
 
-  <app-header></app-header>
-  <app-tabbar></app-tabbar>
+   <app-header (languageEvent)="setLanguage($event)"></app-header>
+   <app-tabbar [language]="language"></app-tabbar>
 
 
 
index 3074c29..91b43c2 100644 (file)
@@ -38,7 +38,7 @@
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { LayoutComponent } from './layout.component';
-import { Component } from '@angular/core';
+import { Component, Input } from '@angular/core';
 
 describe('LayoutComponent', () => {
   let component: LayoutComponent;
@@ -65,4 +65,4 @@ describe('LayoutComponent', () => {
 class AppheaderStubComponent {}
 
 @Component({selector: 'app-tabbar', template: ''})
-class AppTabBarStubComponent { }
\ No newline at end of file
+class AppTabBarStubComponent { @Input() language: string; }
\ No newline at end of file
index b512988..d74f84d 100644 (file)
@@ -45,6 +45,8 @@ import { Component, OnInit } from '@angular/core';
 export class LayoutComponent implements OnInit {
 
     collapedSideBar: boolean;
+       language: string;
+
 
     constructor() {}
 
@@ -53,4 +55,8 @@ export class LayoutComponent implements OnInit {
     receiveCollapsed($event) {
         this.collapedSideBar = $event;
     }
+       
+       setLanguage(lang) {
+        this.language= lang;
+    }
 }
diff --git a/portal-FE-common/src/app/material-module.ts b/portal-FE-common/src/app/material-module.ts
new file mode 100644 (file)
index 0000000..9ae1c4d
--- /dev/null
@@ -0,0 +1,96 @@
+/**  Copyright 2019 Google Inc. All Rights Reserved.
+    Use of this source code is governed by an MIT-style license that
+    can be found in the LICENSE file at http://angular.io/license */
+import {NgModule} from '@angular/core';
+import {A11yModule} from '@angular/cdk/a11y';
+import {DragDropModule} from '@angular/cdk/drag-drop';
+import {PortalModule} from '@angular/cdk/portal';
+import {ScrollingModule} from '@angular/cdk/scrolling';
+import {CdkStepperModule} from '@angular/cdk/stepper';
+import {CdkTableModule} from '@angular/cdk/table';
+import {CdkTreeModule} from '@angular/cdk/tree';
+import {MatAutocompleteModule} from '@angular/material/autocomplete';
+import {MatBadgeModule} from '@angular/material/badge';
+import {MatBottomSheetModule} from '@angular/material/bottom-sheet';
+import {MatButtonModule} from '@angular/material/button';
+import {MatButtonToggleModule} from '@angular/material/button-toggle';
+import {MatCardModule} from '@angular/material/card';
+import {MatCheckboxModule} from '@angular/material/checkbox';
+import {MatChipsModule} from '@angular/material/chips';
+import {MatStepperModule} from '@angular/material/stepper';
+import {MatDatepickerModule} from '@angular/material/datepicker';
+import {MatDialogModule} from '@angular/material/dialog';
+import {MatDividerModule} from '@angular/material/divider';
+import {MatExpansionModule} from '@angular/material/expansion';
+import {MatFormFieldModule} from '@angular/material';
+import {MatGridListModule} from '@angular/material/grid-list';
+import {MatIconModule} from '@angular/material/icon';
+import {MatInputModule} from '@angular/material/input';
+import {MatListModule} from '@angular/material/list';
+import {MatMenuModule} from '@angular/material/menu';
+import {MatNativeDateModule, MatRippleModule} from '@angular/material/core';
+import {MatPaginatorModule} from '@angular/material/paginator';
+import {MatProgressBarModule} from '@angular/material/progress-bar';
+import {MatProgressSpinnerModule} from '@angular/material/progress-spinner';
+import {MatRadioModule} from '@angular/material/radio';
+import {MatSelectModule} from '@angular/material/select';
+import {MatSidenavModule} from '@angular/material/sidenav';
+import {MatSliderModule} from '@angular/material/slider';
+import {MatSlideToggleModule} from '@angular/material/slide-toggle';
+import {MatSnackBarModule} from '@angular/material/snack-bar';
+import {MatSortModule} from '@angular/material/sort';
+import {MatTableModule} from '@angular/material/table';
+import {MatTabsModule} from '@angular/material/tabs';
+import {MatToolbarModule} from '@angular/material/toolbar';
+import {MatTooltipModule} from '@angular/material/tooltip';
+import {MatTreeModule} from '@angular/material/tree';
+
+
+@NgModule({
+  exports: [
+    A11yModule,
+    CdkStepperModule,
+    CdkTableModule,
+    CdkTreeModule,
+    DragDropModule,
+    MatAutocompleteModule,
+    MatBadgeModule,
+    MatBottomSheetModule,
+    MatButtonModule,
+    MatButtonToggleModule,
+    MatCardModule,
+    MatCheckboxModule,
+    MatChipsModule,
+    MatStepperModule,
+    MatDatepickerModule,
+    MatDialogModule,
+    MatDividerModule,
+    MatExpansionModule,
+    MatFormFieldModule,
+    MatGridListModule,
+    MatIconModule,
+    MatInputModule,
+    MatListModule,
+    MatMenuModule,
+    MatNativeDateModule,
+    MatPaginatorModule,
+    MatProgressBarModule,
+    MatProgressSpinnerModule,
+    MatRadioModule,
+    MatRippleModule,
+    MatSelectModule,
+    MatSidenavModule,
+    MatSliderModule,
+    MatSlideToggleModule,
+    MatSnackBarModule,
+    MatSortModule,
+    MatTableModule,
+    MatTabsModule,
+    MatToolbarModule,
+    MatTooltipModule,
+    MatTreeModule,
+    PortalModule,
+    ScrollingModule,
+  ]
+})
+export class MaterialModule {}
\ No newline at end of file
index d898563..54df2d1 100644 (file)
@@ -40,7 +40,7 @@
     <h1 class="heading-page">Edit Functional Menu</h1>
   </div>
   <div id="jqTree"></div>
-  <div class="functional-admin-button-container">
+  <!-- <div class="functional-admin-button-container">
     <button id="regenrate-functionalmenu-btn"
       class="btn btn-alt btn-small"
       (click)="regenerateFunctionalMenuAncestors()">Regenerate Menu
@@ -48,5 +48,5 @@
     <div class="regenerate-functionalmenu-btn-txt">
       <span class="n16r">Click when you are done with your changes.</span>
     </div>
-  </div>
+  </div> -->
 </div>
index d3b5a16..c231061 100644 (file)
@@ -151,43 +151,42 @@ export class FunctionalMenuComponent implements OnInit {
    * @param ngbModal 
    */
   buildTree(treedataarray,ngbModal: NgbModal , _self){
-    //console.log("treedataarray>>>>",treedataarray);
-  //   $(function() {
-  //       $('#jqTree').tree('loadData', treedataarray);
-  //       $('#jqTree').tree({
-  //           data: treedataarray,
-  //           autoOpen: false,
-  //           dragAndDrop: true,
-  //           onCreateLi: function(node, $li) {
-  //               ////console.log("node >>",node);
-  //           }
-  //       }).on(
-  //         'tree.contextmenu',
-  //         function(event:any) {
-  //             // The clicked node is 'event.node'
-  //             var node = event.node;
-  //             openMenuDetailsModal(node, "view");
-  //         }
-  //       );
+    console.log("treedataarray>>>>",treedataarray);
+    $(function() {
+        (<any>$('#jqTree')).tree('loadData', treedataarray);
+        (<any>$('#jqTree')).tree({
+            data: treedataarray,
+            autoOpen: false,
+            dragAndDrop: true,
+            onCreateLi: function(node, $li) {
+                ////console.log("node >>",node);
+            }
+        }).on(
+          'tree.contextmenu',
+          function(event:any) {
+              // The clicked node is 'event.node'
+              var node = event.node;
+              openMenuDetailsModal(node, "view");
+          }
+        );
 
-  //       var openMenuDetailsModal = function(node: any, actionName: string ){
-  //         const modalRef = ngbModal.open(FunctionalMenuDialogComponent, { size: 'lg' });
-  //         modalRef.componentInstance.title = 'Functional Menu ',actionName;
-  //         if(node != 'undefined' && node){
-  //           modalRef.componentInstance.nodedata = node;
-  //           modalRef.componentInstance.operationName = actionName;
-  //         }else{
-  //           modalRef.componentInstance.nodedata  = {};
-  //         }
-  //         modalRef.componentInstance.passEntry.subscribe((receivedEntry: any) => {
-  //           //console.log("receivedEntry>>>>",receivedEntry);
-  //           ngbModal.dismissAll();
-  //           if(receivedEntry.httpStatusCode===200){
-  //             _self.getFunctionalMenu();
-  //           }
-  //         });
-  //       }
-  //    });
-  // }
+        var openMenuDetailsModal = function(node: any, actionName: string ){
+          const modalRef = ngbModal.open(FunctionalMenuDialogComponent, { size: 'lg' });
+          modalRef.componentInstance.title = 'Functional Menu ',actionName;
+          if(node != 'undefined' && node){
+            modalRef.componentInstance.nodedata = node;
+            modalRef.componentInstance.operationName = actionName;
+          }else{
+            modalRef.componentInstance.nodedata  = {};
+          }
+          modalRef.componentInstance.passEntry.subscribe((receivedEntry: any) => {
+            //console.log("receivedEntry>>>>",receivedEntry);
+            ngbModal.dismissAll();
+            if(receivedEntry.httpStatusCode===200){
+              _self.getFunctionalMenu();
+            }
+          });
+        }
+     });
   }
 }
index c72d11e..7e68e1a 100644 (file)
     padding-bottom: 15px;
     padding-right: 40px;
     font-weight: bold;
+    white-space: nowrap;
+}
+
+td.mat-cell, td.mat-footer-cell, th.mat-header-cell {
+   padding-right: 45px;
 }
 
 .ion-md-trash{
index f0c16d6..392527a 100644 (file)
@@ -61,7 +61,19 @@ export class MenusService {
 
   setFavoriteItem(menuId) {
     return this.http.post(this.apiUrl.setFavoriteItem, menuId);
+  }
+  
+  getAllLanguages() {
+    return this.http.get(this.apiUrl.getLanguages);
+  }
+
+  setLanguage(langId, loginId) {
+    const body = { languageId: langId}
+    return this.http.post(this.apiUrl.updateLang.replace(':loginId',loginId ), body);
+  }
 
+  getCurrentLang(loginId) {
+    return this.http.get(this.apiUrl.getCurrentLang.replace(':loginId',loginId ));
   }
 
   removeFavoriteItem(menuId) {
index b0b21b3..5060534 100644 (file)
@@ -50,5 +50,9 @@ export class SidebarService {
     return this.http.get(this.api.leftmenuItems);
 
   }
+  
+  getAllLanguages() {
+    return this.http.get(this.api.getLanguages);
+  }
 
 }
diff --git a/portal-FE-common/src/assets/images/pdf.png b/portal-FE-common/src/assets/images/pdf.png
new file mode 100644 (file)
index 0000000..ed96c5c
Binary files /dev/null and b/portal-FE-common/src/assets/images/pdf.png differ
diff --git a/portal-FE-common/src/assets/images/xlsx.png b/portal-FE-common/src/assets/images/xlsx.png
new file mode 100644 (file)
index 0000000..1ac3767
Binary files /dev/null and b/portal-FE-common/src/assets/images/xlsx.png differ
index ae8fe5e..9a0c53a 100644 (file)
@@ -37,6 +37,7 @@ testem.log
 # System Files
 .DS_Store
 Thumbs.db
+/ngapp
 
 .history/*
 /target/
index 615e7fa..a65181c 100644 (file)
@@ -10,6 +10,7 @@
                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
                <skipnode>false</skipnode>
                <skipcopy>false</skipcopy>
+               <skipTests>false</skipTests>
                <sonar.typescript.lcov.reportPaths>coverage/lcov.info</sonar.typescript.lcov.reportPaths>
         <sonar.sources>src</sonar.sources>
                <sonar.projectKey>portal-FE-os</sonar.projectKey>
@@ -19,6 +20,8 @@
                <sonar.tests>src</sonar.tests>
                <sonar.sourceEncoding>UTF-8</sonar.sourceEncoding>
                <sonar.nodejs.executable>${project.basedir}\node\</sonar.nodejs.executable>
+                <epsdk.version>3.3.0-SNAPSHOT</epsdk.version>
+
        </properties>
 
        <build>
                                        </filesets>
                                </configuration>
                        </plugin>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                       <artifactId>maven-dependency-plugin</artifactId>
+                               <executions>
+                                               <execution>
+                                                       <id>unpack</id>
+                                                       <phase>initialize</phase>
+                                                       <goals>
+                                                       <goal>unpack</goal>
+                                                       </goals>
+                                                       <configuration>
+                                                       <artifactItems>
+                                                               <artifactItem>
+                                                                       <groupId>org.onap.portal.sdk</groupId>
+                                                                       <artifactId>epsdk-app-overlay</artifactId>
+                                                                       <version>${epsdk.version}</version>
+                                                                       <type>war</type>
+                                                                       <overWrite>false</overWrite>
+                                                                       <includes>ngapp/src/app/pages/analytics/**</includes>
+                                                                       <outputDirectory>${basedir}/</outputDirectory>
+                                                               </artifactItem>
+                                                       </artifactItems>
+                                                       <overWriteReleases>true</overWriteReleases>
+                                                       <overWriteSnapshots>true</overWriteSnapshots>
+                                                       </configuration>
+                                               </execution>
+                                       </executions>
+                                               
+                               
+                       </plugin>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-resources-plugin</artifactId>
+                               <version>3.0.2</version>
+                               <executions>
+
+                                       <execution>
+                                               <id>copy-analytics</id>
+                                               <phase>generate-sources</phase>
+                                               <goals>
+                                                       <goal>copy-resources</goal>
+                                               </goals>
+                                               <configuration>
+                                                       <outputDirectory>${basedir}/src/app/pages/</outputDirectory>
+                                                       
+                                                       <resources>
+                                                               <resource>
+                                                                       <directory>${basedir}/ngapp/src/app/pages</directory>
+                                                               </resource>
+                                                       </resources>
+                                               </configuration>
+                                       </execution>
+
+                               </executions>
+                       </plugin>
 
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                                        <arguments>install</arguments>
                                                </configuration>
                                        </execution>
-                                       
+                                         
                                        <execution>
                                                <id>npm run test</id>
                                                <goals>
 
                                                <configuration>
                                                        <arguments>run-script test</arguments>
+                                                       <skip>${skipTests}</skip>
                                                </configuration>
                                        </execution>
 
index 6d0c544..f68d879 100644 (file)
                                                                <span style="flex: 9">Upload
                                                                        Image</span>
                                                                <app-information-tooltip style="flex: 1;"
-                                                                       [textMessage]="'Image file must be smaller than 1MB'">
+                                                                       [textMessage]="'Image file(.png or.jpg or.jpeg with dimension 200X200 pixel) must be smaller than 1MB.'">
                                                                </app-information-tooltip>
                                                        </div>
-                                                       <input type="file" id="input-app-image-upload"
+                                                       <input #inputAppImageUpload type="file" id="input-app-image-upload"
                                                                class="input-file-field input-app-image-upload-ht" accept="image/*"
                                                                [(ngModel)]="applicationObj.originalImage" name="appImage"
                                                                image-upload="applicationObj.originalImage" image-upload-resize-max-height="300"
                                                <div class="property" *ngIf="!(applicationObj.applicationType == '3')">
                                                        <div class="property-label preview">
                                                                <span class="left-label">Preview</span>
-                                                               <span class="remove" (click)="removeImage()">Remove</span>
+                                                               <span *ngIf="(applicationObj.imageLink && applicationObj.imageLink.indexOf('default_app_image.gif') == -1
+                                                               ||applicationObj.thumbnail && applicationObj.thumbnail.indexOf('default_app_image.gif') == -1
+                                                               ||emptyImgForPreview && emptyImgForPreview.indexOf('default_app_image.gif') == -1)" 
+                                                               class="remove" (click)="removeImage()">Remove</span>
                                                        </div>
                                                        <img id="image-app-preview" class="image-preview"
                                                                src="{{applicationObj.imageLink || applicationObj.thumbnail || emptyImgForPreview}}" />
index 1b15f80..2e55850 100644 (file)
@@ -75,6 +75,7 @@ export class ApplicationDetailsDialogComponent implements OnInit {
   @Input() action: any;
   @Output() passEntry: EventEmitter<any> = new EventEmitter();
   @ViewChild('applicationName') applicationNameElement: ElementRef;
+  @ViewChild('inputAppImageUpload') inputAppImageUpload: ElementRef;
 
   newAppModel = {
     'id': null,
@@ -200,6 +201,7 @@ export class ApplicationDetailsDialogComponent implements OnInit {
         this.applicationObj.imageUrl = null;
         this.applicationObj.imageLink = null;
         this.emptyImgForPreview = '../../../assets/images/default_app_image.gif';
+        this.inputAppImageUpload.nativeElement.value = "";
       }
     }, (resut) => {
       return;
@@ -375,6 +377,14 @@ export class ApplicationDetailsDialogComponent implements OnInit {
     if (this.isEditMode) {
       console.log("Edit application Object : ", JSON.stringify(this.applicationObj));
       console.log("Mode Of iNtegration : ", this.applicationObj.modeOfIntegration);
+      if (this.applicationObj.applicationType == "1" &&  !this.applicationObj.rolesInAAF 
+        || this.applicationObj.applicationType == "3" &&  !this.applicationObj.rolesInAAF) {
+        this.applicationObj.usesCadi = false;
+      }
+
+      if(this.applicationObj && this.applicationObj.usesCadi){
+        this.applicationObj.appBasicAuthPassword = null;
+      }
       this.applicationsService.updateOnboardingApp(this.applicationObj)
         .subscribe( _data => {
           this.result = _data;
@@ -418,6 +428,14 @@ export class ApplicationDetailsDialogComponent implements OnInit {
 
     }else{
       //console.log("Coming inside add application",this.newAppModel);
+      if (this.newAppModel.applicationType == "1" &&  !this.newAppModel.rolesInAAF 
+        || this.newAppModel.applicationType == "3" &&  !this.newAppModel.rolesInAAF) {
+        this.newAppModel.usesCadi = false;
+      }
+
+      if(this.newAppModel && this.newAppModel.usesCadi){
+        this.newAppModel.appBasicAuthPassword = null;
+      }
 
       this.applicationsService.addOnboardingApp(this.newAppModel)
         .subscribe( _data => {
@@ -434,7 +452,7 @@ export class ApplicationDetailsDialogComponent implements OnInit {
           console.log(error);
           if(error.status == 409){
             this.openConfirmationModal('Error', 'There was a problem adding the application changes. ' +
-            'The Application Name and URL should  be unique.  Error: ' +
+            'The Application Name and Namespace should  be unique.  Error: ' +
             error.status);
             return;
           } else if(error.status == 500){
index 19f5d8a..4772247 100644 (file)
@@ -51,6 +51,7 @@
             </button>
           
             <div class="apps-table">
+                <span class="ecomp-spinner" *ngIf="showEcompSpinner"></span>
                 <!-- Applications Table goes here-->
                 <table mat-table [dataSource]="dataSource" matSort>
                     <!-- Thumbnail Column -->
index 5903d65..83cbfa0 100644 (file)
@@ -66,6 +66,7 @@ export class ApplicationOnboardingComponent implements OnInit {
   dataSource = new MatTableDataSource(this.appsList);
   @ViewChild(MatSort) sort: MatSort;
   @ViewChild(MatPaginator) paginator: MatPaginator;
+  showEcompSpinner:boolean = false;
 
   constructor(public applicationsService: ApplicationsService, public ngbModal: NgbModal) { }
 
@@ -77,11 +78,13 @@ export class ApplicationOnboardingComponent implements OnInit {
 
   getOnboardingApps(){
     //console.log("getOnboardingApps called");
+    this.showEcompSpinner = true;
     this.applicationsService.getOnboardingApps()
       .subscribe(_data => {
           this.result = _data;
           if (this.result == null || this.result == 'undefined') {
               console.log('WidgetOnboardingService::getOnboardingWidgets Failed: Result or result.data is null');
+              this.showEcompSpinner = false;
           }else {
             this.appsList = _data;
             for (var i = 0; i < this.appsList.length; i++) {
@@ -94,11 +97,14 @@ export class ApplicationOnboardingComponent implements OnInit {
               }                                        
             }
             this.populateTableData(this.appsList);
+            this.showEcompSpinner = false;
           }
       }, error =>{
         console.log(error);
+        this.showEcompSpinner = false;
         this.openConfirmationModal('Error', error.message);
     });
+    this.showEcompSpinner = false;
   }
 
   applyFilter(filterValue: string) {
@@ -143,13 +149,16 @@ export class ApplicationOnboardingComponent implements OnInit {
           console.log('ApplicationOnboardingCtrl::deleteApplication: No apllication or ID... cannot delete');
           return;
         }
+        this.showEcompSpinner = true;
         this.appsList.splice(this.appsList.indexOf(application), 1);
         this.applicationsService.deleteOnboardingApp(application.id)
           .subscribe( data => {
             this.result = data;
             this.getOnboardingApps();
+            this.showEcompSpinner = false;
           }, error => {
             console.log(error);
+            this.showEcompSpinner = false;
             if(error && error.status == 405){
               this.openConfirmationModal('', 'Application : ' + application.appName+ ' can not be deleted as it is associsted with one of the Microservices.');
             }else{
index d39db03..ea1d8b5 100644 (file)
@@ -56,6 +56,10 @@ import { ContactUsComponent } from './contact-us/contact-us.component';
 import { RoleFunctionsComponent } from './role/role-functions/role-functions.component';
 import { NotificationHistoryComponent } from './notification-history/notification-history.component';
 import { GetAccessComponent } from './get-access/get-access.component';
+import { HeaderTabsWrapperComponent } from './analytics/Report_List/header-tabs-wrapper-component/header-tabs-wrapper.component';
+import { RunReportFormFieldsComponent } from './analytics/Report_List/Report/run/run-report-form-fields/run-report-form-fields.component';
+import { DisplayAreaComponent } from './analytics/Report_List/display-area/display-area.component';
+import { ReportComponent } from './analytics/Report_List/Report/report.component';
 
 const routes: Routes = [
     { path: '', component: DashboardComponent },
@@ -77,6 +81,13 @@ const routes: Routes = [
     { path: 'contactUs', component: ContactUsComponent },
     { path: 'getAccess', component: GetAccessComponent },
     { path: 'recentNotifications', component: NotificationHistoryComponent },
+       { path: 'report-list', component:ReportComponent},
+    { path: 'create', component: HeaderTabsWrapperComponent},
+    { path: 'v2/app/reports/:reportMode/:reportId', component: HeaderTabsWrapperComponent},
+    { path: 'v2/app/run/:reportId', component: RunReportFormFieldsComponent},
+    { path: 'v2/app/run/:reportId/:queryParameters', component: RunReportFormFieldsComponent},
+    { path: 'run', component: RunReportFormFieldsComponent},
+    { path: 'displayArea/:menuId', component: DisplayAreaComponent}
 ];
 
 @NgModule({
index b7163da..c63614a 100644 (file)
@@ -99,6 +99,35 @@ import { BulkUserComponent } from './users/bulk-user/bulk-user.component';
 import { InformationTooltipComponent } from './information-tooltip/information-tooltip.component';
 import { UserDetailsFormComponent } from './users/user-details-form/user-details-form.component';
 import { MatTooltipModule } from '@angular/material';
+import { HeaderTabsWrapperComponent } from './analytics/Report_List/header-tabs-wrapper-component/header-tabs-wrapper.component';
+import { RunReportFormFieldsComponent } from './analytics/Report_List/Report/run/run-report-form-fields/run-report-form-fields.component';
+import { DisplayAreaComponent } from './analytics/Report_List/display-area/display-area.component';
+import { HeaderTabsComponent } from './analytics/Report_List/header-tabs-component/header-tabs.component';
+import { MatTableModule, MatPaginatorModule, MatSortModule, MatTabsModule, MatButtonToggleModule, MatExpansionModule, MatFormFieldModule, MatGridListModule, MatCardModule, MatMenuModule, MatButtonModule } from '@angular/material';
+import { DefinitionComponent } from './analytics/Report_List/Report/definition/definition.component';
+import { SQLComponent } from './analytics/Report_List/Report/sql/sql.component';
+import { ColumnsComponent } from './analytics/Report_List/Report/columns/columns.component';
+import { FormFieldsComponent } from './analytics/Report_List/Report/form-fields/form-fields.component';
+import { ChartWizardComponent } from './analytics/Report_List/Report/chart-wizard/chart-wizard.component';
+import { SecurityComponent } from './analytics/Report_List/Report/security/security.component';
+import { LogComponent } from './analytics/Report_List/Report/log/log.component';
+import { RunComponent } from './analytics/Report_List/Report/run/run.component';
+import { DefinitionSaveDialogComponent } from './analytics/Report_List/Report/definition/definition-save-dialog/definition-save-dialog.component';
+import { SQLSaveChangesDialogComponent } from './analytics/Report_List/Report/sql/sql-save-changes-dialog/sql-save-changes-dialog.component';
+import { SQLValidateChangesDialogComponent } from './analytics/Report_List/Report/sql/sql-validate-changes-dialog/sql-validate-changes-dialog.component';
+import { SQLValidateSuccessDialogComponent } from './analytics/Report_List/Report/sql/sql-validate-success-dialog/sql-validate-success-dialog.component';
+import { SQLValidateErrorDialogComponent } from './analytics/Report_List/Report/sql/sql-validate-error-dialog/sql-validate-error-dialog.component';
+import { ReportComponent } from './analytics/Report_List/Report/report.component';
+import { DashboardReportGridComponent } from './analytics/Report_List/Report/definition/dashboard-report-grid/dashboard-report-grid.component';
+import { DataChartComponent } from './analytics/Report_List/Report/definition/dashboard-report-grid/data-chart/data-chart.component';
+import { RunDashboardReportComponent } from './analytics/Report_List/Report/run/run-report/run-dashboard-report/run-dashboard-report.component';
+import { EditDrillDownLinkComponent } from './analytics/Report_List/Report/columns/columns-edit-component/edit-drill-down-link/edit-drill-down-link.component';
+import { FormFieldsAddEditComponent } from './analytics/Report_List/Report/form-fields/form-fields-add-edit/form-fields-add-edit.component';
+import { RunReportResultSetComponent } from './analytics/Report_List/Report/run/run-report-result-set/run-report-result-set.component';
+import { ColumnListComponent } from './analytics/Report_List/Report/columns/column-list/column-list.component';
+import { ColumnsEditComponent } from './analytics/Report_List/Report/columns/columns-edit-component/columns-edit.component';
+import { ReportListComponent } from './analytics/Report_List/report-list.component';
+import { RunReportComponent } from './analytics/Report_List/Report/run/run-report/run-report.component';
 
 
 @NgModule({
@@ -152,7 +181,35 @@ import { MatTooltipModule } from '@angular/material';
     FunctionalMenuDialogComponent,
     GetAccessComponent,
     UserDetailsFormComponent,
-    InformationTooltipComponent
+    InformationTooltipComponent,
+       RunReportFormFieldsComponent,
+    HeaderTabsWrapperComponent,
+    DisplayAreaComponent,
+    HeaderTabsComponent,
+    DefinitionComponent,
+    SQLComponent,
+    ColumnsComponent,
+    FormFieldsComponent,
+    ChartWizardComponent,
+    SecurityComponent,
+    LogComponent,
+    RunComponent,
+    DefinitionSaveDialogComponent,
+    SQLSaveChangesDialogComponent,
+    SQLValidateChangesDialogComponent,
+    SQLValidateSuccessDialogComponent,
+    SQLValidateErrorDialogComponent,
+    ReportComponent,
+    DashboardReportGridComponent, 
+    DataChartComponent, 
+    RunDashboardReportComponent,
+    EditDrillDownLinkComponent,
+    FormFieldsAddEditComponent,
+    RunReportResultSetComponent,
+    ColumnListComponent,
+    ColumnsEditComponent,
+    ReportListComponent,
+    RunReportComponent
   ],
   imports: [
     CommonModule,
@@ -167,7 +224,18 @@ import { MatTooltipModule } from '@angular/material';
     MatCheckboxModule,
     FormsModule,
     PluginModule,
-    MatTooltipModule
+    MatTooltipModule,
+    MatTableModule,
+    MatPaginatorModule,
+    MatSortModule,
+    MatTabsModule,
+    MatButtonToggleModule,
+    MatExpansionModule,
+    MatFormFieldModule,
+    MatGridListModule,
+    MatCardModule,
+    MatMenuModule,
+    MatButtonModule
   ],
   entryComponents: [
     SchedulerComponent,
index 7cc34da..93fdc51 100644 (file)
@@ -1,5 +1,6 @@
 export const environment = {
   production: true,
+  baseUrl: '',
   "api": {
     "singleAppInfo": "portalApi/singleAppInfo",
     "singleAppInfoById": "portalApi/singleAppInfoById",
index d412522..ef9c35b 100644 (file)
@@ -4,6 +4,7 @@
 
 export const environment = {
   production: false,
+  baseUrl: 'http://www.portal.onap.org:9080/portal-be-os/',
   "api": {
     "singleAppInfo": "http://www.portal.onap.org:9080/portal-be-os/portalApi/singleAppInfo",
     "singleAppInfoById": "http://www.portal.onap.org:9080/portal-be-os/portalApi/singleAppInfoById",