# 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
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")
::
- git clone "https://gerrit.onap.org/r/portal"
+ git clone --depth 1 "https://gerrit.onap.org/r/portal"
Building
-----------------
::
- git clone http://gerrit.onap.org/r/portal/sdk
+ git clone --depth 1 http://gerrit.onap.org/r/portal/sdk
Building the base
-----------------
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
- <version>4.1.1</version>
+ <version>3.17</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
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
+ 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() + "://"
--- /dev/null
+/*-
+ * ============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());
+ }
+}
logger.debug(EELFLoggerDelegate.debugLogger, "Client Initialized");
-
-
-
}
@SuppressWarnings("unchecked")
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 {
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 {
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);
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);
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);
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);
}
*
* @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 + ")");
}
}
}
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";
}
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;
}
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;
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) {
if (roles != null) {
return roles.get(0);
}
- } else if (resultsCount == 1) {
+ } else if (roles!=null && resultsCount == 1) {
return roles.get(0);
}
return null;
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 {
--- /dev/null
+/*-
+ * ============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);
+ }
+
+
+
+}
#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?
# 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
<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>
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);
void update(MultipartFile file, WidgetCatalog newWidget, long widgetId);
+ void updateJsFile(MultipartFile file, WidgetCatalog newWidget, long widgetId);
+
byte[] getWidgetCatalogContent(long widgetId) throws Exception;
}
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);
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
throw new StorageException("Failed to store file " + file.getName(), e);
}
- saveHelper(newWidget, widgetId, map);
+ saveJsHelper(newWidget, widgetId, map);
}
/**
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) {
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()));
@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);
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);
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
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);
-->
-<footer>
+<footer class="portal-footer">
<div id="footer-text" class="footerText">
<p class="copyright-text">
<a class="footer-link" href="{{footerLink}}" target="_blank">
margin-top: 20px;
text-align: center;
}
+
+.portal-footer{
+ margin-top: calc(100vh - 620px);
+}
<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()">
.header-menu-display {
width: 250px;
}
+ .language-dropdown {
+ padding: 0.25rem 1.5rem;
+ }
}
*
*
*/
-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';
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) {
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() {
onLoggedout() {
localStorage.removeItem('isLoggedin');
}
+
+ setLanguage(langId : string){
+
+ this.menusService.setLanguage(langId, this.loginSnippetUserid).subscribe(data =>{
+ this.languageEvent.emit(langId);
+ });
+ }
}
*
*
*/
-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'
menuData: Array<object> = [];
page: any;
+ languageFinal : string;
+ @Input() langFromTab:string;
+
@Output() collapsedEvent = new EventEmitter<boolean>();
constructor(public router: Router, public sidebarService: SidebarService) {
});
}
- 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;
}
const dom: any = document.querySelector('body');
dom.classList.toggle(this.pushRightClass);
}
-}
+}
\ No newline at end of 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)"
<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>
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';
});
@Component({selector: 'app-sidebar', template: ''})
-class AppSideBarStubComponent {}
+class AppSideBarStubComponent {@Input() langFromTab:string;}
@Component({selector: 'router-outlet', template: ''})
class RouterOutletStubComponent { }
*
*
*/
-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';
mainTab = 'Home';
selected = new FormControl(0);
collapedSideBar: boolean;
+ inputedLanguage: string;
+
+ @Input() language:string;
+
constructor(private sanitizer: DomSanitizer, private addTabFuntionService: AddTabFunctionService, private auditLogService: AuditLogService) {
})
}
+
+ ngOnChanges() {
+ this.changeLang(this.language);
+ }
+ changeLang(lang){
+ this.inputedLanguage=lang;
+ }
addTab(selectAfterAdding: boolean, label: string, url: string) {
const tab = new Tab(label);
-->
- <app-header></app-header>
- <app-tabbar></app-tabbar>
+ <app-header (languageEvent)="setLanguage($event)"></app-header>
+ <app-tabbar [language]="language"></app-tabbar>
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;
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
export class LayoutComponent implements OnInit {
collapedSideBar: boolean;
+ language: string;
+
constructor() {}
receiveCollapsed($event) {
this.collapedSideBar = $event;
}
+
+ setLanguage(lang) {
+ this.language= lang;
+ }
}
--- /dev/null
+/** 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
<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
<div class="regenerate-functionalmenu-btn-txt">
<span class="n16r">Click when you are done with your changes.</span>
</div>
- </div>
+ </div> -->
</div>
* @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();
+ }
+ });
+ }
+ });
}
}
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{
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) {
return this.http.get(this.api.leftmenuItems);
}
+
+ getAllLanguages() {
+ return this.http.get(this.api.getLanguages);
+ }
}
# System Files
.DS_Store
Thumbs.db
+/ngapp
.history/*
/target/
<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>
<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>
<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}}" />
@Input() action: any;
@Output() passEntry: EventEmitter<any> = new EventEmitter();
@ViewChild('applicationName') applicationNameElement: ElementRef;
+ @ViewChild('inputAppImageUpload') inputAppImageUpload: ElementRef;
newAppModel = {
'id': null,
this.applicationObj.imageUrl = null;
this.applicationObj.imageLink = null;
this.emptyImgForPreview = '../../../assets/images/default_app_image.gif';
+ this.inputAppImageUpload.nativeElement.value = "";
}
}, (resut) => {
return;
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;
}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 => {
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){
</button>
<div class="apps-table">
+ <span class="ecomp-spinner" *ngIf="showEcompSpinner"></span>
<!-- Applications Table goes here-->
<table mat-table [dataSource]="dataSource" matSort>
<!-- Thumbnail Column -->
dataSource = new MatTableDataSource(this.appsList);
@ViewChild(MatSort) sort: MatSort;
@ViewChild(MatPaginator) paginator: MatPaginator;
+ showEcompSpinner:boolean = false;
constructor(public applicationsService: ApplicationsService, public ngbModal: NgbModal) { }
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++) {
}
}
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) {
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{
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 },
{ 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({
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({
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,
MatCheckboxModule,
FormsModule,
PluginModule,
- MatTooltipModule
+ MatTooltipModule,
+ MatTableModule,
+ MatPaginatorModule,
+ MatSortModule,
+ MatTabsModule,
+ MatButtonToggleModule,
+ MatExpansionModule,
+ MatFormFieldModule,
+ MatGridListModule,
+ MatCardModule,
+ MatMenuModule,
+ MatButtonModule
],
entryComponents: [
SchedulerComponent,
export const environment = {
production: true,
+ baseUrl: '',
"api": {
"singleAppInfo": "portalApi/singleAppInfo",
"singleAppInfoById": "portalApi/singleAppInfoById",
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",