From 99565bb6bd87cfc46591cea73985c58c3a3697dd Mon Sep 17 00:00:00 2001 From: "Christopher Lott (cl778h)" Date: Mon, 10 Jul 2017 14:04:15 -0400 Subject: [PORTAL-20,PORTAL-23,PORTAL-32] Repair defects PORTAL-20: remove mariadb client reference from be-common pom PORTAL-23: Release Portal's SDK version 1.1.0 PORTAL-32: API URL correction for onboarded Apps Change-Id: If75b54ca9202f94ce63c59343b94384da1040912 Signed-off-by: Christopher Lott (cl778h) --- deliveries/Apps_Users_OnBoarding_Script.sql | 18 +- deliveries/README.md | 1 + ecomp-portal-BE-common-test/pom.xml | 2 +- .../UserRecommendationControllerTest.java | 69 -- ecomp-portal-BE-common/pom.xml | 11 +- .../controller/UserRecommendationController.java | 87 -- .../portalapp/portal/listener/HealthMonitor.java | 76 +- .../portal/service/UserRolesCommonServiceImpl.java | 32 +- .../src/main/webapp/WEB-INF/fusion/orm/EP.hbm.xml | 16 +- ecomp-portal-BE-os/pom.xml | 8 +- ecomp-portal-DB-os/EcompPortalDMLMySql_1707_OS.sql | 13 +- ecomp-portal-FE-common/.gitignore | 1 + .../pagination-start-from/start-from.filter.js | 30 + .../recommendation/recommendation.service.js | 88 -- .../add-catalog-dialogs/new-catalog.modal.less | 125 --- .../client/app/views/catalog/catalog.controller.js | 16 +- .../client/app/views/catalog/catalog.tpl.html | 14 +- .../app/views/catalog/information-box.tpl.html | 12 +- .../app/views/dashboard/dashboard.controller.js | 990 ++++++++++----------- .../client/app/views/header/header.controller.js | 81 +- .../client/app/views/header/header.tpl.html | 61 +- .../support/get-access/get-access.controller.js | 24 +- .../views/support/get-access/get-access.tpl.html | 4 +- .../users/new-user-dialogs/bulk-user.controller.js | 2 +- .../widget-onboarding.controller.js | 9 +- .../src/directives/search-users/search-users.less | 4 + .../recommendation/recommendation.service.js | 24 + .../services/userProfile/userProfile.service.js | 2 +- .../add-catalog-dialogs/new-catalog.controller.js | 218 ----- .../add-catalog-dialogs/new-catalog.modal.html | 113 --- .../client/src/views/catalog/get-accessswitch.html | 10 + .../client/src/views/footer/footer.controller.js | 16 +- .../client/src/views/footer/footer.tpl.html | 11 +- .../headerRecommendations.controller.js | 20 + .../headerRecommendations.tpl.html | 21 + 35 files changed, 768 insertions(+), 1461 deletions(-) create mode 100644 deliveries/README.md delete mode 100644 ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/UserRecommendationControllerTest.java delete mode 100644 ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserRecommendationController.java create mode 100644 ecomp-portal-FE-common/client/app/filters/pagination-start-from/start-from.filter.js delete mode 100644 ecomp-portal-FE-common/client/app/services/recommendation/recommendation.service.js delete mode 100644 ecomp-portal-FE-common/client/app/views/catalog/add-catalog-dialogs/new-catalog.modal.less create mode 100644 ecomp-portal-FE-os/client/src/services/recommendation/recommendation.service.js delete mode 100644 ecomp-portal-FE-os/client/src/views/catalog/add-catalog-dialogs/new-catalog.controller.js delete mode 100644 ecomp-portal-FE-os/client/src/views/catalog/add-catalog-dialogs/new-catalog.modal.html create mode 100644 ecomp-portal-FE-os/client/src/views/catalog/get-accessswitch.html create mode 100644 ecomp-portal-FE-os/client/src/views/headerRecommendation/headerRecommendations.controller.js create mode 100644 ecomp-portal-FE-os/client/src/views/headerRecommendation/headerRecommendations.tpl.html diff --git a/deliveries/Apps_Users_OnBoarding_Script.sql b/deliveries/Apps_Users_OnBoarding_Script.sql index 64edfc3d..73468d31 100644 --- a/deliveries/Apps_Users_OnBoarding_Script.sql +++ b/deliveries/Apps_Users_OnBoarding_Script.sql @@ -5,10 +5,10 @@ SET FOREIGN_KEY_CHECKS=1; INSERT INTO `fn_app` (`app_id`, `app_name`, `app_image_url`, `app_description`, `app_notes`, `app_url`, `app_alternate_url`, `app_rest_endpoint`, `ml_app_name`, `ml_app_admin_id`, `mots_id`, `app_password`, `open`, `enabled`, `thumbnail`, `app_username`, `ueb_key`, `ueb_secret`, `ueb_topic_name`, `app_type`) VALUES -(2, 'xDemo App', 'images/cache/portal-222865671_37476.png', NULL, NULL, 'http://portal.api.simpledemo.openecomp.org:8989/ECOMPSDKAPP/welcome.htm', NULL, 'http://portal.api.simpledemo.openecomp.org:8989/ECOMPSDKAPP/api', '', '', NULL, 'okYTaDrhzibcbGVq5mjkVQ==', 'N', 'Y', NULL, 'Default', 'ueb_key', 'ueb_secret', 'ECOMP-PORTAL-OUTBOX', 1), -(3, 'DMaaP Bus Ctrl', 'images/cache/portal944583064_80711.png', NULL, NULL, 'http://portal.api.simpledemo.openecomp.org:8989/ECOMPDBCAPP/dbc#/dmaap', NULL, 'http://portal.api.simpledemo.openecomp.org:8989/ECOMPDBCAPP/api', '', '', NULL, 'okYTaDrhzibcbGVq5mjkVQ==', 'N', 'Y', NULL, 'Default', 'ueb_key', 'ueb_secret', 'ECOMP-PORTAL-OUTBOX', 1), -(4, 'SDC', 'images/cache/portal956868231_53879.png', NULL, NULL, 'http://sdc.api.simpledemo.openecomp.org:8181/sdc1/portal', NULL, 'http://sdc.api.simpledemo.openecomp.org:8080/api/', '', '', NULL, '78ot0W94rpB0o4FYzVoIOg==', 'N', 'Y', NULL, 'Default', 'ueb_key', 'ueb_secret', 'ECOMP-PORTAL-OUTBOX', 1), -(5, 'Policy', 'images/cache/portal1470452815_67021.png', NULL, NULL, 'http://policy.api.simpledemo.openecomp.org:8443/ecomp/policy#/Editor', NULL, 'http://policy.api.simpledemo.openecomp.org:8443/ecomp/api', '', '', NULL, 'okYTaDrhzibcbGVq5mjkVQ==', 'N', 'Y', NULL, 'Default', 'ueb_key', 'ueb_secret', 'ECOMP-PORTAL-OUTBOX', 1), +(2, 'xDemo App', 'images/cache/portal-222865671_37476.png', NULL, NULL, 'http://portal.api.simpledemo.openecomp.org:8989/ECOMPSDKAPP/welcome.htm', NULL, 'http://portal.api.simpledemo.openecomp.org:8989/ECOMPSDKAPP/api/v2', '', '', NULL, 'okYTaDrhzibcbGVq5mjkVQ==', 'N', 'Y', NULL, 'Default', 'ueb_key', 'ueb_secret', 'ECOMP-PORTAL-OUTBOX', 1), +(3, 'DMaaP Bus Ctrl', 'images/cache/portal944583064_80711.png', NULL, NULL, 'http://portal.api.simpledemo.openecomp.org:8989/ECOMPDBCAPP/dbc#/dmaap', NULL, 'http://portal.api.simpledemo.openecomp.org:8989/ECOMPDBCAPP/api/v2', '', '', NULL, 'okYTaDrhzibcbGVq5mjkVQ==', 'N', 'Y', NULL, 'Default', 'ueb_key', 'ueb_secret', 'ECOMP-PORTAL-OUTBOX', 1), +(4, 'SDC', 'images/cache/portal956868231_53879.png', NULL, NULL, 'http://sdc.api.simpledemo.openecomp.org:8181/sdc1/portal', NULL, 'http://sdc.api.simpledemo.openecomp.org:8080/api/v2', '', '', NULL, '78ot0W94rpB0o4FYzVoIOg==', 'N', 'Y', NULL, 'Default', 'ueb_key', 'ueb_secret', 'ECOMP-PORTAL-OUTBOX', 1), +(5, 'Policy', 'images/cache/portal1470452815_67021.png', NULL, NULL, 'http://policy.api.simpledemo.openecomp.org:8443/ecomp/policy#/Editor', NULL, 'http://policy.api.simpledemo.openecomp.org:8443/ecomp/api/v2', '', '', NULL, 'okYTaDrhzibcbGVq5mjkVQ==', 'N', 'Y', NULL, 'Default', 'ueb_key', 'ueb_secret', 'ECOMP-PORTAL-OUTBOX', 1), (6, 'Virtual Infrastructure Deployment', 'images/cache/portal-345993588_92550.png', NULL, NULL, 'http://vid.api.simpledemo.openecomp.org:8080/vid/welcome.htm', NULL, 'http://vid.api.simpledemo.openecomp.org:8080/vid/api/v2', '', '', NULL, 'okYTaDrhzibcbGVq5mjkVQ==', 'N', 'Y', NULL, 'Default', 'ueb_key', 'ueb_secret', 'ECOMP-PORTAL-OUTBOX', 1), (7, 'A&AI UI', 'images/cache/portal-345993588_92550.png', NULL, NULL, 'http://aai.ui.simpledemo.openecomp.org:9517/services/aai/webapp/index.html#/viewInspect', NULL, 'http://aai.ui.simpledemo.openecomp.org:9517/api/v2', '', '', NULL, 'okYTaDrhzibcbGVq5mjkVQ==', 'N', 'Y', NULL, 'Default', 'ueb_key', 'ueb_secret', 'ECOMP-PORTAL-OUTBOX', 1); @@ -345,4 +345,14 @@ select * from fn_role where app_id = (select app_id from fn_app where app_name = ) b ); -- end new +INSERT INTO `fn_common_widget_data` (`id`,`CATEGORY`,`HREF`,`TITLE`,`content`,`event_date`,`SORT_ORDER`) VALUES (6,'NEWS','http://about.att.com/innovationblog/next_att_labs','What\s Next at AT&T Labs? AI Set to Revolutionize the Network',NULL,NULL,10); +INSERT INTO `fn_common_widget_data` (`id`,`CATEGORY`,`HREF`,`TITLE`,`content`,`event_date`,`SORT_ORDER`) VALUES (7,'NEWS','http://about.att.com/innovationblog/ecomp_code','Code, Community and Commitment – the 3 Cs of Open Source',NULL,NULL,20); +INSERT INTO `fn_common_widget_data` (`id`,`CATEGORY`,`HREF`,`TITLE`,`content`,`event_date`,`SORT_ORDER`) VALUES (8,'NEWS','http://about.att.com/story/orange_testing_att_open_source_ecomp_platform.html','Orange Testing AT&Ts Open Source ECOMP Platform for Building Software-Defined Network Capabilities',NULL,NULL,30); +INSERT INTO `fn_common_widget_data` (`id`,`CATEGORY`,`HREF`,`TITLE`,`content`,`event_date`,`SORT_ORDER`) VALUES (9,'NEWS', 'http://about.att.com/innovationblog/linux_foundation','Opening up ECOMP: Our Network Operating System for SDN',NULL,NULL,40); +INSERT INTO `fn_common_widget_data` (`id`,`CATEGORY`,`HREF`,`TITLE`,`content`,`event_date`,`SORT_ORDER`) VALUES (10,'EVENTS',NULL,'OpenECOMP Launches into Open Source',NULL,'2017-02-14',1); +INSERT INTO `fn_common_widget_data` (`id`,`CATEGORY`,`HREF`,`TITLE`,`content`,`event_date`,`SORT_ORDER`) VALUES (11,'IMPORTANTRESOURCES','http://about.att.com/content/dam/snrdocs/ecomp.pdf','ECOMP White Paper',NULL,NULL,1); +INSERT INTO `fn_common_widget_data` (`id`,`CATEGORY`,`HREF`,`TITLE`,`content`,`event_date`,`SORT_ORDER`) VALUES (12,'IMPORTANTRESOURCES','https://wiki.onap.org/','ONAP Wiki',NULL,NULL,2); +INSERT INTO `fn_common_widget_data` (`id`,`CATEGORY`,`HREF`,`TITLE`,`content`,`event_date`,`SORT_ORDER`) VALUES (13,'IMPORTANTRESOURCES','https://wiki.onap.org/display/DW/Portal','ONAP Wiki, Portal',NULL,NULL,3); +INSERT INTO `fn_common_widget_data` (`id`,`CATEGORY`,`HREF`,`TITLE`,`content`,`event_date`,`SORT_ORDER`) VALUES (14,'IMPORTANTRESOURCES','https://wiki.onap.org/display/DW/Development+Guides','ONAP User Guide',NULL,NULL,4); + commit; diff --git a/deliveries/README.md b/deliveries/README.md new file mode 100644 index 00000000..bc9bc3fe --- /dev/null +++ b/deliveries/README.md @@ -0,0 +1 @@ + "moved insert statement to fn_common_widget_data table from EcompPortalDMLMySql_1707_OS.sql to Apps_Users_OnBoarding_Script.sql, the Onboard script in deliveries folder". diff --git a/ecomp-portal-BE-common-test/pom.xml b/ecomp-portal-BE-common-test/pom.xml index a2090cf1..93e153fa 100644 --- a/ecomp-portal-BE-common-test/pom.xml +++ b/ecomp-portal-BE-common-test/pom.xml @@ -4,7 +4,7 @@ org.openecomp.portal ecomp-portal-BE-common-test - 1.1.0-SNAPSHOT + 1.1.0 jar ecompportal-be-common-test diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/UserRecommendationControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/UserRecommendationControllerTest.java deleted file mode 100644 index 8c0a5cd3..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/UserRecommendationControllerTest.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.openecomp.portalapp.portal.test.controller; - -import static org.junit.Assert.assertTrue; - -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.MockitoAnnotations; -import org.openecomp.portalapp.portal.controller.UserRecommendationController; -import org.openecomp.portalapp.portal.test.core.MockEPUser; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; -import org.openecomp.portalsdk.core.web.support.UserUtils; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - -@RunWith(PowerMockRunner.class) -@PrepareForTest(UserUtils.class) -public class UserRecommendationControllerTest { - - /* - * @Mock FunctionalMenuService functionalMenuService = new - * FunctionalMenuServiceImpl(); - * - * @Mock UserNotificationService userNotificationService = new - * UserNotificationServiceImpl(); - */ - - @InjectMocks - UserRecommendationController userRecommendationController = new UserRecommendationController(); - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - MockEPUser mockUser = new MockEPUser(); - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); - NullPointerException nullPointerException = new NullPointerException(); - - - @Test - public void getRecommendationsTest() throws Exception { - String recommendations = "{\"id\": \"USERID\", \"timestamp\": \"TIMESTAMP\", \"count\": \"count of recommendations returned\",\"recommendations\": [\"recommended action 1\",\"recommended action 2\"] }"; - // String actualPortalRestResponse = null; - String actualPortalRestResponse = recommendations; - actualPortalRestResponse = userRecommendationController.getRecommendations(mockedRequest, mockedResponse); - assertTrue(actualPortalRestResponse.equals(actualPortalRestResponse)); - - } - - @Test - public void getRecommendationsTestForRecommendations() throws Exception { - String recommendations = "{\"id\": \"USERID\", \"timestamp\": \"TIMESTAMP\", \"count\": \"count of recommendations returned\" }"; - // String actualPortalRestResponse = null; - String actualPortalRestResponse = recommendations; - actualPortalRestResponse = userRecommendationController.getRecommendations(mockedRequest, mockedResponse); - assertTrue(actualPortalRestResponse.equals(actualPortalRestResponse)); - - } - - -} diff --git a/ecomp-portal-BE-common/pom.xml b/ecomp-portal-BE-common/pom.xml index bff7ed21..bf5f9f1a 100644 --- a/ecomp-portal-BE-common/pom.xml +++ b/ecomp-portal-BE-common/pom.xml @@ -5,14 +5,14 @@ ecompportal-be-common war - 1.1.0-SNAPSHOT + 1.1.0 4.2.0.RELEASE 4.3.11.Final 1.0.0 2.7.4 - 1.1.0-SNAPSHOT + 1.1.0 UTF-8 true @@ -367,13 +367,6 @@ 9.1-901-1.jdbc4 - - - org.mariadb.jdbc - mariadb-java-client - 1.5.8 - - org.elasticsearch diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserRecommendationController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserRecommendationController.java deleted file mode 100644 index 3ec06ed3..00000000 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserRecommendationController.java +++ /dev/null @@ -1,87 +0,0 @@ -package org.openecomp.portalapp.portal.controller; - -import java.util.HashMap; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.openecomp.portalapp.controller.EPRestrictedBaseController; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; -import org.openecomp.portalapp.portal.service.ConsulHealthService; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.EnableAspectJAutoProxy; -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.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.client.RestTemplate; - -@RestController -@org.springframework.context.annotation.Configuration -@EnableAspectJAutoProxy -@EPAuditLog -public class UserRecommendationController extends EPRestrictedBaseController { - - private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(UserRecommendationController.class); - - @Autowired - private ConsulHealthService consulHealthService; - - private static final String MACHINE_LEARNING_SERVICE_CTX = "/ml_api"; - private static final String GET_RECOMMENDATION = MACHINE_LEARNING_SERVICE_CTX + "/" + "getRecommendation"; - private static final String GET_RECOMM_COUNT = MACHINE_LEARNING_SERVICE_CTX + "/" + "getRecommCount"; - private static final String CONSUL_ML_SERVICE_ID = "mlearning-service"; - private static final String SERVICE_PROTOCOL = "http"; - - @RequestMapping(value = { - "/portalApi/getRecommendationsCount" }, method = RequestMethod.GET, produces = "application/json") - public String getRecommendationsCount(HttpServletRequest request, HttpServletResponse response) { - EPUser user = EPUserUtils.getUserSession(request); - Map requestMapping = new HashMap(); - requestMapping.put("id", user.getOrgUserId()); - requestMapping.put("action", "reports"); - - HttpHeaders headers = new HttpHeaders(); - headers.setContentType(MediaType.APPLICATION_JSON); - - // set your entity to send - HttpEntity> entity = new HttpEntity<>(requestMapping, headers); - String endpoint = SERVICE_PROTOCOL + "://"+ consulHealthService.getServiceLocation(CONSUL_ML_SERVICE_ID, - SystemProperties.getProperty("microservices.m-learn.local.port")) + GET_RECOMM_COUNT; - logger.debug(EELFLoggerDelegate.debugLogger, "Going to hit mlearning endpoint on: {1}", endpoint); - ResponseEntity out = new RestTemplate().exchange(endpoint, HttpMethod.POST, entity, String.class); - return out.getBody(); - } - - @RequestMapping(value = { - "/portalApi/getRecommendations" }, method = RequestMethod.GET, produces = "application/json") - public String getRecommendations(HttpServletRequest request, HttpServletResponse response) { - EPUser user = EPUserUtils.getUserSession(request); - Map requestMapping = new HashMap(); - requestMapping.put("id", user.getOrgUserId()); - requestMapping.put("action", "reports"); - requestMapping.put("recommendations", "1"); - - HttpHeaders headers = new HttpHeaders(); - headers.setContentType(MediaType.APPLICATION_JSON); - - // set your entity to send - HttpEntity> entity = new HttpEntity<>(requestMapping, headers); - String endpoint = SERVICE_PROTOCOL + "://"+ - consulHealthService.getServiceLocation(CONSUL_ML_SERVICE_ID, - SystemProperties.getProperty("microservices.m-learn.local.port")) + GET_RECOMMENDATION; - logger.debug(EELFLoggerDelegate.debugLogger, "Going to hit mlearning endpoint on: {1}", endpoint); - ResponseEntity out = new RestTemplate().exchange(endpoint, HttpMethod.POST, entity, String.class); - return out.getBody(); - } - -} \ No newline at end of file diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/listener/HealthMonitor.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/listener/HealthMonitor.java index 9de7a4c9..f9a6b905 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/listener/HealthMonitor.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/listener/HealthMonitor.java @@ -19,7 +19,6 @@ */ package org.openecomp.portalapp.portal.listener; -import java.util.Date; import java.util.List; import javax.annotation.PostConstruct; @@ -28,11 +27,9 @@ import javax.annotation.PreDestroy; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; -import org.openecomp.portalapp.portal.domain.SharedContext; import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; import org.openecomp.portalapp.portal.logging.format.EPAppMessagesEnum; import org.openecomp.portalapp.portal.logging.logic.EPLogUtil; -import org.openecomp.portalapp.portal.service.SharedContextService; import org.openecomp.portalapp.portal.ueb.EPUebHelper; import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; @@ -47,29 +44,29 @@ import org.springframework.transaction.annotation.Transactional; @EPMetricsLog public class HealthMonitor { + private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(HealthMonitor.class); + @Autowired private SessionFactory sessionFactory; @Autowired private EPUebHelper epUebHelper; - @Autowired - private SharedContextService sharedContextService; - private static boolean databaseUp; private static boolean uebUp; private static boolean frontEndUp; private static boolean backEndUp; private static boolean dbClusterStatusOk; private static boolean dbPermissionsOk; + + /** + * Read directly by external classes. + */ public static boolean isSuspended = false; private Thread healthMonitorThread; - private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(HealthMonitor.class); - public HealthMonitor() { - } public static boolean isDatabaseUp() { @@ -103,7 +100,7 @@ public class HealthMonitor { int numIntervalsDatabasePermissionsIncorrect = 0; int numIntervalsUebHasBeenDown = 0; - logger.debug(EELFLoggerDelegate.debugLogger, "monitorEPHealth started"); + logger.debug(EELFLoggerDelegate.debugLogger, "monitorEPHealth thread started"); long sleepInterval = (Long .valueOf(SystemProperties.getProperty(EPCommonSystemProperties.HEALTH_POLL_INTERVAL_SECONDS)) * 1000); @@ -146,7 +143,7 @@ public class HealthMonitor { if (dbPermissionsOk == false) { if ((numIntervalsDatabasePermissionsIncorrect % numIntervalsBetweenAlerts) == 0) { logger.debug(EELFLoggerDelegate.debugLogger, - "monitorEPHealth: database permissions not correct, logging to error log to trigger alert."); + "monitorEPHealth: database permissions incorrect, logging to error log to trigger alert."); EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeHealthCheckMySqlError); numIntervalsDatabasePermissionsIncorrect++; } else { @@ -162,8 +159,10 @@ public class HealthMonitor { // uebUp = this.checkIfUebUp(); if (uebUp == false) { + if ((numIntervalsUebHasBeenDown % numIntervalsBetweenAlerts) == 0) { - logger.debug(EELFLoggerDelegate.debugLogger, "UEB down, logging to error log to trigger alert"); + logger.debug(EELFLoggerDelegate.debugLogger, + "monitorEPHealth: UEB down, logging to error log to trigger alert"); // Write a Log entry that will generate an alert EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeHealthCheckUebClusterError); numIntervalsUebHasBeenDown++; @@ -189,15 +188,18 @@ public class HealthMonitor { // could return information in the json content of a health check. // + // + // Get DB status. If down, signal alert once every X intervals. + // if (Thread.interrupted()) { - logger.debug(EELFLoggerDelegate.debugLogger, "monitorEPHealth: interrupted, leaving loop"); + logger.info(EELFLoggerDelegate.errorLogger, "monitorEPHealth: thread interrupted"); break; } try { Thread.sleep(sleepInterval); } catch (InterruptedException e) { - logger.error(EELFLoggerDelegate.errorLogger, "monitorEPHealth interrupted", e); + logger.error(EELFLoggerDelegate.errorLogger, "monitorEPHealth: sleep interrupted", e); Thread.currentThread().interrupt(); } } @@ -205,7 +207,6 @@ public class HealthMonitor { @PostConstruct public void initHealthMonitor() { - healthMonitorThread = new Thread("EP HealthMonitor thread") { public void run() { try { @@ -228,28 +229,35 @@ public class HealthMonitor { } /** - * Writes and reads the database; cleans up when finished. + * This routine checks whether the database can be read. In June 2017 we + * experimented with checking if the database can be WRITTEN. Writes failed + * with some regularity in a MariaDB Galera cluster, and in that + * environment, the resulting alerts in the log triggered a health monitor + * cron job to shut down the Tomcat instance. The root cause of the cluster + * write failures was not determined. * - * @return True on success; false otherwise. + * @return true if the database can be read. */ private boolean checkIfDatabaseUp() { boolean isUp = false; + Session localSession = null; try { - final Date now = new Date(); - final String contextId = "checkIfDatabaseUp-" + Long.toString(now.getTime()); - final String key = "checkIfDatabaseUp-key"; - final String value = "checkIfDatabaseUp-value"; - sharedContextService.addSharedContext(contextId, key, value); - SharedContext sc = sharedContextService.getSharedContext(contextId, key); - if (sc == null || sc.getCvalue() == null || !value.equals(sc.getCvalue())) - throw new Exception("Failed to retrieve shared context"); - int removed = sharedContextService.deleteSharedContexts(contextId); - if (removed != 1) - throw new Exception("Failed to delete shared context"); - isUp = true; + localSession = sessionFactory.openSession(); + if (localSession != null) { + String sql = "select app_name from fn_app where app_id=1"; + Query query = localSession.createSQLQuery(sql); + @SuppressWarnings("unchecked") + List queryList = query.list(); + if (queryList != null) { + isUp = true; + } + } } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "checkIfDatabaseUp failed", e); + logger.debug(EELFLoggerDelegate.debugLogger, "checkIfDatabaseUp failed", e); isUp = false; + } finally { + if (localSession != null) + localSession.close(); } return isUp; } @@ -273,8 +281,7 @@ public class HealthMonitor { } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "checkClusterStatus failed", e); if ((e.getCause() != null) && (e.getCause().getMessage() != null)) { - logger.error(EELFLoggerDelegate.errorLogger, - "checkClusterStatus() exception cause", e.getCause()); + logger.error(EELFLoggerDelegate.errorLogger, "checkClusterStatus failure cause", e.getCause()); } isUp = false; } finally { @@ -305,7 +312,7 @@ public class HealthMonitor { } if (isUp == false) { logger.error(EELFLoggerDelegate.errorLogger, - "checkDatabaseAndPermissions() returning false. SHOW GRANTS FOR CURRENT_USER being dumped:"); + "checkDatabasePermissions returning false. SHOW GRANTS FOR CURRENT_USER being dumped:"); for (String str : grantsList) { logger.error(EELFLoggerDelegate.errorLogger, "grants output item = [" + str + "]"); } @@ -314,8 +321,7 @@ public class HealthMonitor { } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "checkDatabasePermissions failed", e); if ((e.getCause() != null) && (e.getCause().getMessage() != null)) { - logger.error(EELFLoggerDelegate.errorLogger, - "checkDatabasePermissions() exception msg = ", e.getCause()); + logger.error(EELFLoggerDelegate.errorLogger, "checkDatabasePermissions failure cause", e.getCause()); } isUp = false; } finally { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserRolesCommonServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserRolesCommonServiceImpl.java index 727f83dd..80408954 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserRolesCommonServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserRolesCommonServiceImpl.java @@ -243,7 +243,10 @@ public class UserRolesCommonServiceImpl { if (!userRole.getRoleId().equals(PortalConstants.ACCOUNT_ADMIN_ROLE_ID) && userRole.getRoleId() != PortalConstants.SYS_ADMIN_ROLE_ID && !extRequestValue){ syncUserRolesExtension(userRole, appId, localSession, userAppRoles, newUserAppRolesMap); } - else if (extRequestValue){ + else if (extRequestValue && ("PUT".equals(reqType) || "POST".equals(reqType) || "DELETE".equals(reqType))){ + syncUserRolesExtension(userRole, appId, localSession, userAppRoles, newUserAppRolesMap); + } + else if (extRequestValue && !userRole.getRoleId().equals(PortalConstants.ACCOUNT_ADMIN_ROLE_ID)){ syncUserRolesExtension(userRole, appId, localSession, userAppRoles, newUserAppRolesMap); } } @@ -276,15 +279,18 @@ public class UserRolesCommonServiceImpl { } EPRole role = null; for (EcompRole userRole : newRolesToAdd) { + EPUserApp userApp = new EPUserApp(); if (("PUT".equals(reqType) || "POST".equals(reqType)) && userRole.getName().equals(PortalConstants.ADMIN_ROLE)) { role = (EPRole) localSession.get(EPRole.class, new Long(PortalConstants.ACCOUNT_ADMIN_ROLE_ID)); + userApp.setRole(role); } else if (userRole.getId().equals(PortalConstants.ACCOUNT_ADMIN_ROLE_ID) && !extRequestValue){ continue; + } else { + userApp.setRole(rolesMap.get(userRole.getId())); } - EPUserApp userApp = new EPUserApp(); + userApp.setUserId(client.getId()); userApp.setApp(app); - userApp.setRole(("PUT".equals(reqType) || "POST".equals(reqType) && userRole.getId().equals(PortalConstants.ACCOUNT_ADMIN_ROLE_ID)) ? role : rolesMap.get(userRole.getId())); localSession.save(userApp); localSession.flush(); } @@ -698,7 +704,7 @@ public class UserRolesCommonServiceImpl { result = true; } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, - "applyChangesInUserRolesForAppToEcompDB: failed to syncUserRoles for attuid " + userId, e); + "applyChangesInUserRolesForAppToEcompDB: failed to syncUserRoles for orgUserId " + userId, e); if("DELETE".equals(reqType)){ throw new Exception(e.getMessage()); } @@ -953,7 +959,7 @@ public class UserRolesCommonServiceImpl { * Pushes specified user details to the specified remote app. * * @param userId - * ATT UID identifying user at remote app in REST endpoint path + * OrgUserId identifying user at remote app in REST endpoint path * @param user * User details to be pushed * @param app @@ -1118,10 +1124,10 @@ public class UserRolesCommonServiceImpl { /*if (userRolesInRemoteApp.size() == 0) { logger.debug(EELFLoggerDelegate.debugLogger, "setAppWithUserRoleStateForUser: no roles in app {}, set user {} to inactive", app, - attuid); + orgUserId); //TODO Need to fix the logged in user is not set to inactive remoteAppUser.setActive(false); - postUserToRemoteApp(attuid, user, app, applicationsRestClientService); + postUserToRemoteApp(orgUserId, user, app, applicationsRestClientService); }*/ } @@ -1189,7 +1195,7 @@ public class UserRolesCommonServiceImpl { if (existingAppRole == null) { logger.error(EELFLoggerDelegate.errorLogger, "roleInAppForUserList failed for the roles {}", roleInAppForUserList); - throw new Exception("'" +roleInAppForUser.getRoleName() + "'" +" role does not exist for" + appName + " application"); + throw new Exception("'" +roleInAppForUser.getRoleName() + "'" +" role does not exist for " + appName + " application"); } if (!existingAppRole.getActive()) { logger.error(EELFLoggerDelegate.errorLogger, "roleInAppForUserList failed for the roles {}", @@ -1265,10 +1271,18 @@ public class UserRolesCommonServiceImpl { public List getAppRolesForUser(Long appId, String userId, Boolean extRequestValue) { List rolesInAppForUser = null; + List userInfo = null; try { // for ecomp portal app, no need to make a remote call - if (appId == PortalConstants.PORTAL_APP_ID) { + if (appId == PortalConstants.PORTAL_APP_ID) { + final Map userParams = new HashMap<>(); + userParams.put("orgUserIdValue", userId); + userInfo = checkIfUserExists(userParams); + if(userInfo.size() == 0 || userInfo.isEmpty()) + { + createLocalUserIfNecessary(userId); + } List roleList = roleService.getAvailableRoles(); List activeRoleList = new ArrayList(); diff --git a/ecomp-portal-BE-common/src/main/webapp/WEB-INF/fusion/orm/EP.hbm.xml b/ecomp-portal-BE-common/src/main/webapp/WEB-INF/fusion/orm/EP.hbm.xml index 84f7b7ed..eea9467a 100644 --- a/ecomp-portal-BE-common/src/main/webapp/WEB-INF/fusion/orm/EP.hbm.xml +++ b/ecomp-portal-BE-common/src/main/webapp/WEB-INF/fusion/orm/EP.hbm.xml @@ -630,13 +630,13 @@ and a.is_for_all_roles = 'N' ) a, ( - select a.user_id, c.role_id, c.app_id, d.APP_NAME + select distinct a.user_id, c.role_id, c.app_id, d.APP_NAME from fn_user a, fn_user_role b, fn_role c, fn_app d - where a.user_id = b.user_id + where COALESCE(c.app_id,1) = d.app_id + and a.user_id = b.user_id and a.user_id = :user_id and b.role_id = c.role_id - and c.app_id = d.app_id - and d.enabled='Y' + and (d.enabled='Y' or d.app_id=1) )b where ( @@ -821,13 +821,13 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' order by app_name ) ) a, ( - select a.user_id, c.role_id, c.app_id, d.APP_NAME + select distinct a.user_id, c.role_id, c.app_id, d.APP_NAME from fn_user a, fn_user_role b, fn_role c, fn_app d - where a.user_id = b.user_id + where COALESCE(c.app_id,1) = d.app_id + and a.user_id = b.user_id and a.user_id = :user_id and b.role_id = c.role_id - and c.app_id = d.app_id - and d.enabled='Y' + and (d.enabled='Y' or d.app_id=1) ) b where ( diff --git a/ecomp-portal-BE-os/pom.xml b/ecomp-portal-BE-os/pom.xml index 0e7eb0bd..45927490 100644 --- a/ecomp-portal-BE-os/pom.xml +++ b/ecomp-portal-BE-os/pom.xml @@ -11,11 +11,13 @@ 4.2.0.RELEASE 4.3.11.Final 1.0.0 - 1.1.0-SNAPSHOT - 1.1.0-SNAPSHOT + 1.1.0 + 1.1.0 UTF-8 false + + 0 **.js https://nexus.onap.org content/repositories/snapshots/ @@ -109,7 +111,7 @@ true - ${build.number} + ${project.version}.${build.number} ${maven.build.timestamp} diff --git a/ecomp-portal-DB-os/EcompPortalDMLMySql_1707_OS.sql b/ecomp-portal-DB-os/EcompPortalDMLMySql_1707_OS.sql index bbdba3c3..ace9d45e 100644 --- a/ecomp-portal-DB-os/EcompPortalDMLMySql_1707_OS.sql +++ b/ecomp-portal-DB-os/EcompPortalDMLMySql_1707_OS.sql @@ -17,16 +17,9 @@ Insert into fn_user_role (USER_ID,ROLE_ID,PRIORITY,APP_ID) values (1,1,NULL,1); Insert into fn_user_role (USER_ID,ROLE_ID,PRIORITY,APP_ID) values (1,950,NULL,1); Insert into fn_user_role (USER_ID,ROLE_ID,PRIORITY,APP_ID) values (1,999,NULL,1); - -INSERT INTO fn_common_widget_data (id,CATEGORY,HREF,TITLE,content,event_date,SORT_ORDER) values (6,'NEWS','http://about.att.com/innovationblog/next_att_labs','What\s Next at AT&T Labs? AI Set to Revolutionize the Network',NULL,NULL,10); -INSERT INTO fn_common_widget_data (id,CATEGORY,HREF,TITLE,content,event_date,SORT_ORDER) values (7,'NEWS','http://about.att.com/innovationblog/ecomp_code','Code, Community and Commitment - the 3 Cs of Open Source',NULL,NULL,20); -INSERT INTO fn_common_widget_data (id,CATEGORY,HREF,TITLE,content,event_date,SORT_ORDER) values (8,'NEWS','http://about.att.com/story/orange_testing_att_open_source_ecomp_platform.html','Orange Testing AT&Ts Open Source ECOMP Platform for Building Software-Defined Network Capabilities',NULL,NULL,30); -INSERT INTO fn_common_widget_data (id,CATEGORY,HREF,TITLE,content,event_date,SORT_ORDER) values (9,'NEWS', 'http://about.att.com/innovationblog/linux_foundation','Opening up ECOMP: Our Network Operating System for SDN',NULL,NULL,40); -INSERT INTO fn_common_widget_data (id,CATEGORY,HREF,TITLE,content,event_date,SORT_ORDER) values (10,'EVENTS',NULL,'OpenECOMP Launches into Open Source',NULL,'2017-02-14',1); -INSERT INTO fn_common_widget_data (id,CATEGORY,HREF,TITLE,content,event_date,SORT_ORDER) values (11,'IMPORTANTRESOURCES','http://about.att.com/content/dam/snrdocs/ecomp.pdf','ECOMP White Paper',NULL,NULL,1); -INSERT INTO fn_common_widget_data (id,CATEGORY,HREF,TITLE,content,event_date,SORT_ORDER) values (12,'IMPORTANTRESOURCES','https://openecomp.atlassian.net/wiki/display/DW/Developer+Wiki+for+OpenECOMP','OpenECOMP Wiki',NULL,NULL,2); -INSERT INTO fn_common_widget_data (id,CATEGORY,HREF,TITLE,content,event_date,SORT_ORDER) values (13,'IMPORTANTRESOURCES','https://openecomp.atlassian.net/wiki/display/DW/Portal+and+Dashboard','OpenECOMP Wiki, Portal',NULL,NULL,3); -INSERT INTO fn_common_widget_data (id,CATEGORY,HREF,TITLE,content,event_date,SORT_ORDER) values (14,'IMPORTANTRESOURCES','https://openecomp.atlassian.net/wiki/display/DW/Portal+and+Dashboard','OpenECOMP User Guide',NULL,NULL,4); +-- change to inactive for following menu +update fn_menu set active_yn='N' where menu_id=14; /* web analytics */ +update fn_menu set active_yn='N' where menu_id=16; /* web analytics onboarding*/ INSERT INTO cr_report (rep_id, title, descr, public_yn, report_xml, create_id, create_date, maint_id, maint_date, menu_id, menu_approved_yn, owner_id, folder_id, dashboard_type_yn, dashboard_yn) diff --git a/ecomp-portal-FE-common/.gitignore b/ecomp-portal-FE-common/.gitignore index a82f9459..2b964313 100644 --- a/ecomp-portal-FE-common/.gitignore +++ b/ecomp-portal-FE-common/.gitignore @@ -1,3 +1,4 @@ .classpath .project +/.settings/ /target/ diff --git a/ecomp-portal-FE-common/client/app/filters/pagination-start-from/start-from.filter.js b/ecomp-portal-FE-common/client/app/filters/pagination-start-from/start-from.filter.js new file mode 100644 index 00000000..1bf33987 --- /dev/null +++ b/ecomp-portal-FE-common/client/app/filters/pagination-start-from/start-from.filter.js @@ -0,0 +1,30 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file 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. + * ================================================================================ + */ +'use strict'; + +angular.module('ecompApp') + .filter('startFrom', () => { + return function (input, start) { + if (!input || !input.length) { return; } + + start = +start; + return input.slice(start); + }; + }); diff --git a/ecomp-portal-FE-common/client/app/services/recommendation/recommendation.service.js b/ecomp-portal-FE-common/client/app/services/recommendation/recommendation.service.js deleted file mode 100644 index aa2a4631..00000000 --- a/ecomp-portal-FE-common/client/app/services/recommendation/recommendation.service.js +++ /dev/null @@ -1,88 +0,0 @@ -/*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file 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. - * ================================================================================ - */ -/** - * Created by wl849v on 12/14/2016. - */ -'use strict'; -(function () { - class RecommendationService { - constructor($q, $log, $http, conf, uuid,utilsService) { - this.$q = $q; - this.$log = $log; - this.$http = $http; - this.conf = conf; - this.uuid = uuid; - this.recommendationCount = {count:0}; - this.refreshCount = 0; - this.maxCount = 0; - this.utilsService = utilsService; - } - getRecommendationCount() { - return this.recommendationCount; - } - setRecommendationCount(count) { - this.recommendationCount.count = count; - } - getRefreshCount() { - return this.refreshCount; - } - setRefreshCount(count){ - this.refreshCount = count; - } - setMaxRefreshCount(count){ - this.maxCount = count; - } - decrementRefreshCount(){ - this.refreshCount = this.refreshCount - 1; - } - - - getRecommendations(){ - let deferred = this.$q.defer(); - this.$http({ - method: "GET", - cache: false, - url: this.conf.api.getRecommendations, - headers: { - 'X-ECOMP-RequestID':this.uuid.generate() - } - }) - .then( res => { - // If response comes back as a redirected HTML page which IS NOT a success - if (this.utilsService.isValidJSON(res.data)=== false) { - this.$log.error('NotificationService::getRecommendations Failed'); - deferred.reject("NotificationService::getRecommendations Failed"); - } else { - deferred.resolve(res); - } - }) - .catch( status => { - this.$log.error('NotificationService::getRecommendations Failed', status); - deferred.reject(status); - }); - - return deferred.promise; - } - - - } - RecommendationService.$inject = ['$q', '$log', '$http', 'conf', 'uuid4','utilsService']; - angular.module('ecompApp').service('recommendationService', RecommendationService) -})(); diff --git a/ecomp-portal-FE-common/client/app/views/catalog/add-catalog-dialogs/new-catalog.modal.less b/ecomp-portal-FE-common/client/app/views/catalog/add-catalog-dialogs/new-catalog.modal.less deleted file mode 100644 index 5568ca8e..00000000 --- a/ecomp-portal-FE-common/client/app/views/catalog/add-catalog-dialogs/new-catalog.modal.less +++ /dev/null @@ -1,125 +0,0 @@ -.new-catalog-modal { - height: 430px; - - .user-catalog-roles{ - .title{ - //.n18r; - .dGray18r; //AT&T Dark Gray - border-bottom: @portalDBlue 3px solid; - } - - input:not([type="button"]) { - height: 13px; -} - .display-userApp-Catalog-Roles - { - padding-left: 16px; - padding-top: 10px; - font-family: Omnes-ECOMP-W02,Arial; - font-size: 18px; - color: #5a5a5a; - } - - #pending-checkbox{ - font-family: Omnes-ECOMP-W02,Arial; - font-size: 15px; - color: #5a5a5a; - } - .app-catalog-roles-list{ - height: 286px; - - - .app-catalog-item{ - border: 1px solid @portalLGray; - border-radius: 2px; - background-color: @funcBkgGray; - - padding: 10px; - margin-top: 8px; - //margin-right: 6px; - //margin-left: 6px; - - .app-catalog-item-left{ - padding-top: 0; - line-height: 30px; - height: 30px; - vertical-align: middle; - display:inline-block; - width: 45%; - border-radius: 2px; - border: 1px solid @portalLGray; - margin-right: 10px; - padding-left: 4px; - background: @portalWhite; - white-space: nowrap; - - } - .app-catalog-item-right{ - display:inline-block; - width: 45%; - border-radius: 2px; - border: 1px solid @portalLGray; - background: @portalWhite; - vertical-align: middle; - } - - .app-catalog-item-right-error{ - .portalRed; - padding: 7px 7px 7px 7px; - display:inline-block; - width: 45%; - border-radius: 2px; - border: 1px solid @portalLGray; - background: @portalWhite; - vertical-align: middle; - } - - .app-catalog-item-right-contacting{ - .portalGreen; - padding: 7px 7px 7px 7px; - display:inline-block; - width: 45%; - border-radius: 2px; - border: 1px solid @portalLGray; - background: @portalWhite; - vertical-align: middle; - } - - .app-select-left{ - width: 45%; - margin-right: 10px; - vertical-align: middle; - - - .select-field{ - padding-top: 0; - line-height: 30px; - height: 30px; - vertical-align: middle; - border-radius: 2px; - border: 1px solid @portalLGray; - margin-right: 10px; - padding-left: 4px; - background: @portalWhite; - display:inline-block; - } - } - - - .app-item-delete{ - .ico_trash_default; - display: inline-block; - vertical-align: 2px; - cursor: pointer; - position: relative; - top: 6px; - color: transparent; - margin-left: 8px; - - } - - } - } - - } -} diff --git a/ecomp-portal-FE-common/client/app/views/catalog/catalog.controller.js b/ecomp-portal-FE-common/client/app/views/catalog/catalog.controller.js index 150a305e..1685c133 100644 --- a/ecomp-portal-FE-common/client/app/views/catalog/catalog.controller.js +++ b/ecomp-portal-FE-common/client/app/views/catalog/catalog.controller.js @@ -60,6 +60,13 @@ function _classCallCheck(instance, Constructor) { getExternalAccess(); }; + this.getAccess = function(item) { + if(!item.access) + confirmBoxService.showDynamicInformation(item, + 'app/views/catalog/information-box.tpl.html','CatalogConfirmationBoxCtrl' + ).then(isConfirmed => {}); + }; + var getExternalAccess = () => { ExternalRequestAccessService.getExternalRequestAccessServiceInfo().then( function(property) { @@ -125,19 +132,18 @@ function _classCallCheck(instance, Constructor) { data = { dialogState: 2, selectedUser:{ - attuid: $scope.attuid, + orgUserId: $scope.orgUserId, firstName: $scope.firstName, lastName: $scope.lastName, headerText: item.headerText, haloAppName : item.mlAppName, item: item, - extReqValue : externalRequest } } ngDialog.open({ - templateUrl: 'app/views/catalog/add-catalog-dialogs/new-catalog.modal.html', - controller: 'NewCatalogModalCtrl', + templateUrl: 'app/views/catalog/request-access-catalog-dialogs/request-access-catalog.modal.html', + controller: 'ExternalRequestAccessCtrl', controllerAs: 'userInfo', data: data }).closePromise.then(needUpdate => { @@ -183,7 +189,7 @@ function _classCallCheck(instance, Constructor) { .getUserProfile() .then( function(profile) { - $scope.attuid = profile.orgUserId; + $scope.orgUserId = profile.orgUserId; $scope.firstName = profile.firstName; $scope.lastName = profile.lastName; $scope.appCatalog = []; diff --git a/ecomp-portal-FE-common/client/app/views/catalog/catalog.tpl.html b/ecomp-portal-FE-common/client/app/views/catalog/catalog.tpl.html index b4063ad6..fd71e59b 100644 --- a/ecomp-portal-FE-common/client/app/views/catalog/catalog.tpl.html +++ b/ecomp-portal-FE-common/client/app/views/catalog/catalog.tpl.html @@ -58,18 +58,8 @@ - -
-
+ +
diff --git a/ecomp-portal-FE-common/client/app/views/catalog/information-box.tpl.html b/ecomp-portal-FE-common/client/app/views/catalog/information-box.tpl.html index 8a848545..2802dac4 100644 --- a/ecomp-portal-FE-common/client/app/views/catalog/information-box.tpl.html +++ b/ecomp-portal-FE-common/client/app/views/catalog/information-box.tpl.html @@ -21,17 +21,9 @@
- You do not have access to this application. - See the + You do not have access to this application. To request access to an application, please visit the - Get Access page and request access at MyLogins. -

- You may check this box if access is pending: - + Get Access page
diff --git a/ecomp-portal-FE-common/client/app/views/dashboard/dashboard.controller.js b/ecomp-portal-FE-common/client/app/views/dashboard/dashboard.controller.js index 87558fa8..8481b5ed 100644 --- a/ecomp-portal-FE-common/client/app/views/dashboard/dashboard.controller.js +++ b/ecomp-portal-FE-common/client/app/views/dashboard/dashboard.controller.js @@ -20,506 +20,506 @@ 'use strict'; function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError('Cannot call a class as a function'); - } + if (!(instance instanceof Constructor)) { + throw new TypeError('Cannot call a class as a function'); + } } (function() { - var HTTP_PROTOCOL_RGX = /https?:\/\//; - - var DashboardCtrl = function DashboardCtrl(conf, applicationsService, $log, - $window, userProfileService, $scope, $cookies, $timeout, $interval, - $modal, $state, beReaderService, dashboardService, confirmBoxService, - auditLogService,ngDialog, $compile, widgetsCatalogService) { - - this.conf = conf; - var _this = this; - - _classCallCheck(this, DashboardCtrl); - - // activate spinner - this.isLoading = true; - this.isCommError = false; - $scope.getUserAppsIsDone = false; - this.userProfileService = userProfileService; - $scope.demoNum = 1; - $scope.event_content_show = false; - $scope.widgetData = []; - $scope.activateThis = function(ele){ - $compile(ele.contents())($scope); - $scope.$apply(); - }; - - $scope.editWidgetModalPopup = function(availableData, resourceType) { - $scope.editData = JSON.stringify(availableData); - $scope.availableDataTemp = $scope.availableData; - ngDialog.open({ - templateUrl : 'app/views/dashboard/dashboard-widget-manage.html', - controller : 'CommonWidgetController', - resolve : { - message : function message() { - var message = { - type : resourceType, - availableData : $scope.editData - }; - return message; - } - } - }).closePromise.then(needUpdate => { - if(resourceType=='NEWS'){ - $scope.updateNews(); - }else if(resourceType=='EVENTS'){ - $scope.updateEvents(); - }else if(resourceType=='IMPORTANTRESOURCES'){ - $scope.updateImportRes(); - } - }); - }; - - $scope.editWidgetParameters = function(widgetId) { - let data = { - widgetId: widgetId + var HTTP_PROTOCOL_RGX = /https?:\/\//; + + var DashboardCtrl = function DashboardCtrl(conf, applicationsService, $log, + $window, userProfileService, $scope, $cookies, $timeout, $interval, + $modal, $state, beReaderService, dashboardService, confirmBoxService, + auditLogService, ngDialog, $compile, widgetsCatalogService) { + + this.conf = conf; + var _this = this; + + _classCallCheck(this, DashboardCtrl); + + // activate spinner + this.isLoading = true; + this.isCommError = false; + $scope.getUserAppsIsDone = false; + this.userProfileService = userProfileService; + $scope.demoNum = 1; + $scope.event_content_show = false; + $scope.widgetData = []; + $scope.activateThis = function(ele) { + $compile(ele.contents())($scope); + $scope.$apply(); + }; + + $scope.editWidgetModalPopup = function(availableData, resourceType) { + $scope.editData = JSON.stringify(availableData); + $scope.availableDataTemp = $scope.availableData; + ngDialog.open({ + templateUrl: 'app/views/dashboard/dashboard-widget-manage.html', + controller: 'CommonWidgetController', + resolve: { + message: function message() { + var message = { + type: resourceType, + availableData: $scope.editData + }; + return message; + } + } + }).closePromise.then(needUpdate => { + if (resourceType == 'NEWS') { + $scope.updateNews(); + } else if (resourceType == 'EVENTS') { + $scope.updateEvents(); + } else if (resourceType == 'IMPORTANTRESOURCES') { + $scope.updateImportRes(); + } + }); + }; + + $scope.editWidgetParameters = function(widgetId) { + let data = { + widgetId: widgetId + } + ngDialog.open({ + templateUrl: 'app/views/dashboard/dashboard-widget-parameter-manage.html', + controller: 'WidgetParameterController', + data: data + }).closePromise.then(needUpdate => { + + }); + }; + + $scope.sort_options = [{ + index: 0, + value: 'N', + title: 'Name' + }, + { + index: 1, + value: 'L', + title: 'Last used' + }, + { + index: 2, + value: 'F', + title: 'Most used' + }, + { + index: 3, + value: 'M', + title: 'Manual' + } + ]; + + $scope.selectedSortTypeChanged = function(userAppSortTypePref) { + $scope.appsViewData = []; + $scope.appsView = []; + + $scope.sort_type = userAppSortTypePref; + + applicationsService + .getAppsOrderBySortPref(userAppSortTypePref) + .then(function(res) { + _this.apps = res; + $scope.applyPresentationDetailsToApps(_this.apps); + }) + applicationsService + .saveAppsSortTypePreference($scope.selectedSortType) + .then(function(res) { + // Nothing to do + }) + + } + $scope.$watch('selectedSortType.value', (newVal, oldVal) => { + for (var i = 0; i < $scope.sort_options.length; i++) { + if ($scope.sort_options[i].value == newVal) { + $scope.selectedSortType = angular.copy($scope.sort_options[i]);; + } } - ngDialog.open({ - templateUrl : 'app/views/dashboard/dashboard-widget-parameter-manage.html', - controller : 'WidgetParameterController', - data: data - }).closePromise.then(needUpdate => { - - }); - }; - - $scope.sort_options = [ - {index: 0, value: 'N', title: 'Name'}, - {index: 1, value: 'L', title: 'Last used'}, - {index: 2, value: 'F', title: 'Most used'}, - {index: 3, value: 'M', title: 'Manual'} - ]; - - $scope.selectedSortTypeChanged = function(userAppSortTypePref) { - $scope.appsViewData = []; - $scope.appsView = []; - - $scope.sort_type = userAppSortTypePref; - - applicationsService - .getAppsOrderBySortPref(userAppSortTypePref) - .then(function(res) { - _this.apps = res; - $scope.applyPresentationDetailsToApps(_this.apps); - }) - applicationsService - .saveAppsSortTypePreference($scope.selectedSortType) - .then(function(res) { - // Nothing to do - }) - - } - $scope.$watch('selectedSortType.value', (newVal, oldVal) => { - for(var i=0;i<$scope.sort_options.length;i++){ - if($scope.sort_options[i].value==newVal){ - $scope.selectedSortType=angular.copy($scope.sort_options[i]);; - } - } - }); - - $scope.restoreSortSelected = function(){ - confirmBoxService.confirm("Restore the default size and position of all widgets?").then( - function(confirmed){ - var checkConfirm = confirmed; - if(checkConfirm === true){ - applicationsService - .delWidgetsSortPref($scope.widgetsViewData).then(function(){ - $state.reload(); - }); - } - }); - /* if(confirm('Restore the default size and position of all widgets?') == true) - { - applicationsService - .delWidgetsSortPref($scope.widgetsViewData).then(function(){ - $state.reload(); - }) - }*/ - - } - - $scope.applyPresentationDetailsToApps = function(appsReturned) { - var rowNo = 0; - for (var i = 0; i < _this.apps.length; i++) { - $scope.appsView[i] = { - sizeX : 1, - sizeY : 1, - headerText : '', - subHeaderText : '', - imageLink : '', - order : '', - url : '', - appid: '', - }; - $scope.appsView[i].headerText = appsReturned[i].name; - $scope.appsView[i].subHeaderText = appsReturned[i].notes; - let imgLnk = ''; - if (appsReturned[i].imageUrl) - imgLnk = conf.api.appThumbnail.replace(':appId', appsReturned[i].id); - //$log.debug('DashboardCtlr::applyPresn: imgLink = ' + imgLnk); - $scope.appsView[i].imageLink = imgLnk; - $scope.appsView[i].order = appsReturned[i].order; - $scope.appsView[i].url = appsReturned[i].url; - $scope.appsView[i].restrictedApp = appsReturned[i].restrictedApp; - $scope.appsView[i].appid = appsReturned[i].id; - } - $scope.appsView[_this.apps.length] = { - addRemoveApps : true, - sizeX : 1, - sizeY : 1, - headerText : 'Add/Remove Applications', - subHeaderText : '', - imageLink : 'assets/images/cloud.png', - order : '', - restrictedApp : false, - url : '', - }; - if($scope.appsView.length>6){ - $(".dashboard-boarder").css({ - "height" : "400px" - }); - }else{ - $(".dashboard-boarder").css({ - "height" : "210px" - }); - } - - if ($scope.appsView != undefined - && $scope.appsView != null - && $scope.appsView.length > 0) { - $scope.appsViewData = $scope.appsView; - } - } - -$scope.widgetsView = []; - - $scope.applyPresentationDetailsToWidgets = function(widgetsReturned){ - var rowNo = 0; - for (var i = 0; i < widgetsReturned.length; i++) { - $scope.widgetsView[i] = { - sizeX : '', - sizeY :'', - headerText:'', - widgetText:'', - widgetIdentifier : '', - url : '', - widgetid: '', - attrb:'', - row:'', - col:'', - }; - $scope.widgetsView[i].widgetid = widgetsReturned[i].id; - $scope.widgetsView[i].headerText = widgetsReturned[i].headerName; - $scope.widgetsView[i].widgetText = widgetsReturned[i].name; - - if(widgetsReturned[i].headerName.toLowerCase() === 'news'){ - $scope.widgetsView[i].widgetIdentifier = 'NEWS'; - } - else - if(widgetsReturned[i].headerName.toLowerCase() === 'resources'){ - $scope.widgetsView[i].widgetIdentifier = 'IMPORTANTRESOURCES'; - } - else - if(widgetsReturned[i].headerName.toLowerCase() === 'events'){ - $scope.widgetsView[i].widgetIdentifier = 'EVENTS'; - } - - $scope.widgetsView[i].url = widgetsReturned[i].url; - $scope.widgetsView[i].attrb = widgetsReturned[i].attrs; - if(widgetsReturned[i].width === null){ - $scope.widgetsView[i].sizeX = 2; - }else{ - $scope.widgetsView[i].sizeX = widgetsReturned[i].width; - } - if(widgetsReturned[i].height === null){ - $scope.widgetsView[i].sizeY = 2; - }else{ - $scope.widgetsView[i].sizeY = widgetsReturned[i].height; - } - $scope.widgetsView[i].row = widgetsReturned[i].x; - $scope.widgetsView[i].col = widgetsReturned[i].y; - } - if ($scope.widgetsView != undefined - && $scope.widgetsView != null - && $scope.widgetsView.length > 0) { - $scope.widgetsViewData = $scope.widgetsView; - } - } - - applicationsService - .getUserAppsSortTypePreference().then(function(res) { - var resJson = {}; - resJson.value = res; - if (resJson.value==="N" || resJson.value==="") { - resJson.index = 0; - resJson.title = 'Name'; - }else if (resJson.value==="L") { - resJson.index = 1; - resJson.title = 'Last used'; - }else if(resJson.value==="F"){ - resJson.index = 2; - resJson.title = 'Most used'; - }else { - resJson.index = 3; - resJson.title = 'Manual'; - } - $scope.selectedSortType = resJson; - $scope.selectedSortTypeChanged(res); - - - }); - - $scope.widgetsList = []; - - let getUserWidgets = (loginName) => { - var conf = this.conf; - widgetsCatalogService.getUserWidgets(loginName).then(res => { - if(!(res instanceof Array)){ - this.isCommError = true; - return; - } - for(var i = 0; i < res.length; i++){ - var widget_id = res[i][0]; - var widget_name = res[i][1]; - let url = this.conf.api.widgetCommon + "/" + widget_id + "/framework.js"; - var header_name = widget_name; - if(res[i][7] == 1){ - header_name = (widget_name.length > 9) ?widget_name.substring(0, 8) + '...' : widget_name; - } - if(res[i][4] === "S" || res[i][4] === null ){ - $scope.widgetsList.push({ - id: widget_id, - headerName: header_name, - name: widget_name, - url: url, - attrs: [{attr: 'data-' + res[i][0], value: ''}], - x: res[i][3], - y: res[i][5], - height: res[i][6], - width: res[i][7] - }); - } - var script = document - .createElement('script'); - script.src = url; - script.async = false; - var entry = document - .getElementsByTagName('script')[0]; - entry.parentNode - .insertBefore(script, entry); - } - $scope.applyPresentationDetailsToWidgets($scope.widgetsList); - }).catch(err => { - $log.error('WidgetsHomeCtrl::getUserWidgets error: ' + err); - }).finally(()=> { - }); - }; - - userProfileService.getUserProfile().then( - function(profile) { - $scope.orgUserId = profile.orgUserId; - getUserWidgets($scope.orgUserId); - }); - - /* Widget Gridster Section */ - $scope.newsGridsterItem = { - sizeX : 1, - sizeY : 1, - headerText : 'News', - subHeaderText : '', - imageLink : '', - order : '', - url : '' - }; - - $scope.eventsGridsterItem = { - sizeX : 1, - sizeY : 1, - headerText : 'Events', - subHeaderText : '', - imageLink : '', - order : '', - url : '' - }; - - $scope.impoResGridsterItem = { - sizeX : 1, - sizeY : 1, - headerText : 'Resources', - subHeaderText : '', - imageLink : '', - order : '', - url : '' - }; - - this.gridsterAppOpts = { - columns : 6, - colWidth : 190, - rowHeight : 190, - margins : [ 20, 20 ], - outerMargin : true, - pushing : true, - floating : true, - swapping : true, - resizable: { - enabled: false, - }, - draggable : { - handle:'.icon-content-gridguide', - stop: function stop() { - $scope.defaultSortBy = function() { - var resJson = {}; - resJson.value = 'M'; - resJson.index = 3; - resJson.title = 'Manual'; - $scope.selectedSortType = resJson; - applicationsService.saveAppsSortTypeManual($scope.appsViewData) - applicationsService.saveAppsSortTypePreference($scope.selectedSortType) - } - $scope.defaultSortBy(); - } - } - }; - - this.gridsterWidgetOpts = { - columns : 6, - colWidth : 190, - rowHeight : 190, - margins : [ 20, 20 ], - outerMargin : true, - pushing : true, - floating : true, - swapping : true, - resizable: { - enabled: true, - stop: function stop(event, uiWidget, $element){ - if($element.sizeX == 1) - $element.headerText = ($element.widgetText.length > 9) ? $element.widgetText.substring(0, 8) + '...' : $element.widgetText; - if($element.sizeX >= 2) - $element.headerText = $element.widgetText; - - applicationsService - .saveWidgetsSortManual($scope.widgetsViewData) - - } - }, - draggable : { - handle:'.icon-content-gridguide', - stop: function stop(){ - applicationsService - .saveWidgetsSortManual($scope.widgetsViewData) - - } - } - }; - - this.goToCatalog = function(item) { - $state.go('root.appCatalog'); - } - - this.goToWidgetCatLog = function(item) { - $state.go('root.widgetCatalog'); - } - - // navigate to application url in new tab - this.goToPortal = function(item) { - userProfileService.getUserRolesForApplication($scope.orgUserId,item.appid) - .then(res=>{ - var count = 0; - for(var i=0;i0 && res.length == count)||res.length==0) - { - confirmBoxService.showInformation('You have no roles assigned to this application to access.').then(isConfirmed => {}); - - } - else{ - if (!item.url) { - $log.error('No URL found for this application, doing nothing!'); - return; - } - if (item.restrictedApp) { - // Link-based apps open in their own browser tab - $window.open(item.url, '_blank'); - } else { - // cache control so browsers load app page every time - var ccParam = 'cc=' + new Date().getTime(); - var urlParts = item.url.split('#'); - var appUrl = null; - if (urlParts.length < 2) { - // no # - let urlLastChar = item.url.charAt(item.url.length - 1); - if (item.url.includes("?")) - appUrl = (urlLastChar === '&' ? item.url + ccParam : item.url + '&' + ccParam); - else - appUrl = item.url + '?' + ccParam; - } else { - // has # - let urlLastChar = urlParts[0].charAt(urlParts[0].length - 1); - if (item.url.includes("?")) - appUrl = (urlLastChar === '&' ? urlParts[0] + ccParam + '#' + urlParts[1] : urlParts[0] + '&' + ccParam + '#' + urlParts[1]); - else - appUrl = urlParts[0] + '?' + ccParam + "#" + urlParts[1]; - } - // $log.debug('DashboardCtrlr::goToPortal: opening tab with URL - // ' + appUrl); - var tabContent = { - id: new Date(), - title: item.headerText, - url: appUrl, - appId: item.appId - }; - $cookies.putObject('addTab', tabContent); - } - - } - }); - - - - - }; - - this.auditLog = function(app) { - console.log(app); - auditLogService.storeAudit(app.appid,'app',app.url); - }; - - if (getParameterByName('noUserError') != null) { - if (getParameterByName('noUserError') == "Show") { - $("#errorInfo").show(); - } - } - }; - - DashboardCtrl.$inject = [ 'conf', 'applicationsService', '$log', '$window', - 'userProfileService', '$scope', '$cookies', '$timeout', '$interval', - '$modal', '$state', 'beReaderService', 'dashboardService', 'confirmBoxService', - 'auditLogService', 'ngDialog', '$compile', 'widgetsCatalogService' ]; - angular.module('ecompApp').controller('DashboardCtrl', DashboardCtrl); + + $scope.restoreSortSelected = function() { + confirmBoxService.confirm("Restore the default size and position of all widgets?").then( + function(confirmed) { + var checkConfirm = confirmed; + if (checkConfirm === true) { + applicationsService + .delWidgetsSortPref($scope.widgetsViewData).then(function() { + $state.reload(); + }); + } + }); + /* + * if(confirm('Restore the default size and position of all widgets?') == + * true) { applicationsService + * .delWidgetsSortPref($scope.widgetsViewData).then(function(){ + * $state.reload(); }) } + */ + + } + + $scope.applyPresentationDetailsToApps = function(appsReturned) { + var rowNo = 0; + for (var i = 0; i < _this.apps.length; i++) { + $scope.appsView[i] = { + sizeX: 1, + sizeY: 1, + headerText: '', + subHeaderText: '', + imageLink: '', + order: '', + url: '', + appid: '', + }; + $scope.appsView[i].headerText = appsReturned[i].name; + $scope.appsView[i].subHeaderText = appsReturned[i].notes; + let imgLnk = ''; + if (appsReturned[i].imageUrl) + imgLnk = conf.api.appThumbnail.replace(':appId', appsReturned[i].id); + // $log.debug('DashboardCtlr::applyPresn: imgLink = ' + imgLnk); + $scope.appsView[i].imageLink = imgLnk; + $scope.appsView[i].order = appsReturned[i].order; + $scope.appsView[i].url = appsReturned[i].url; + $scope.appsView[i].restrictedApp = appsReturned[i].restrictedApp; + $scope.appsView[i].appid = appsReturned[i].id; + } + $scope.appsView[_this.apps.length] = { + addRemoveApps: true, + sizeX: 1, + sizeY: 1, + headerText: 'Add/Remove Applications', + subHeaderText: '', + imageLink: 'assets/images/cloud.png', + order: '', + restrictedApp: false, + url: '', + }; + if ($scope.appsView.length > 6) { + $(".dashboard-boarder").css({ + "height": "400px" + }); + } else { + $(".dashboard-boarder").css({ + "height": "210px" + }); + } + + if ($scope.appsView != undefined && + $scope.appsView != null && + $scope.appsView.length > 0) { + $scope.appsViewData = $scope.appsView; + } + } + + $scope.widgetsView = []; + + $scope.applyPresentationDetailsToWidgets = function(widgetsReturned) { + var rowNo = 0; + for (var i = 0; i < widgetsReturned.length; i++) { + $scope.widgetsView[i] = { + sizeX: '', + sizeY: '', + headerText: '', + widgetText: '', + widgetIdentifier: '', + url: '', + widgetid: '', + attrb: '', + row: '', + col: '', + }; + $scope.widgetsView[i].widgetid = widgetsReturned[i].id; + $scope.widgetsView[i].headerText = widgetsReturned[i].headerName; + $scope.widgetsView[i].widgetText = widgetsReturned[i].name; + + if (widgetsReturned[i].headerName.toLowerCase() === 'news') { + $scope.widgetsView[i].widgetIdentifier = 'NEWS'; + } else + if (widgetsReturned[i].headerName.toLowerCase() === 'resources') { + $scope.widgetsView[i].widgetIdentifier = 'IMPORTANTRESOURCES'; + } else + if (widgetsReturned[i].headerName.toLowerCase() === 'events') { + $scope.widgetsView[i].widgetIdentifier = 'EVENTS'; + } + + $scope.widgetsView[i].url = widgetsReturned[i].url; + $scope.widgetsView[i].attrb = widgetsReturned[i].attrs; + if (widgetsReturned[i].width === null) { + $scope.widgetsView[i].sizeX = 2; + } else { + $scope.widgetsView[i].sizeX = widgetsReturned[i].width; + } + if (widgetsReturned[i].height === null) { + $scope.widgetsView[i].sizeY = 2; + } else { + $scope.widgetsView[i].sizeY = widgetsReturned[i].height; + } + $scope.widgetsView[i].row = widgetsReturned[i].x; + $scope.widgetsView[i].col = widgetsReturned[i].y; + } + if ($scope.widgetsView != undefined && + $scope.widgetsView != null && + $scope.widgetsView.length > 0) { + $scope.widgetsViewData = $scope.widgetsView; + } + } + + applicationsService + .getUserAppsSortTypePreference().then(function(res) { + var resJson = {}; + resJson.value = res; + if (resJson.value === "N" || resJson.value === "") { + resJson.index = 0; + resJson.title = 'Name'; + } else if (resJson.value === "L") { + resJson.index = 1; + resJson.title = 'Last used'; + } else if (resJson.value === "F") { + resJson.index = 2; + resJson.title = 'Most used'; + } else { + resJson.index = 3; + resJson.title = 'Manual'; + } + $scope.selectedSortType = resJson; + $scope.selectedSortTypeChanged(res); + + + }); + + $scope.widgetsList = []; + + let getUserWidgets = (loginName) => { + var conf = this.conf; + widgetsCatalogService.getUserWidgets(loginName).then(res => { + if (!(res instanceof Array)) { + this.isCommError = true; + return; + } + for (var i = 0; i < res.length; i++) { + var widget_id = res[i][0]; + var widget_name = res[i][1]; + let url = this.conf.api.widgetCommon + "/" + widget_id + "/framework.js"; + var header_name = widget_name; + if (res[i][7] == 1) { + header_name = (widget_name.length > 9) ? widget_name.substring(0, 8) + '...' : widget_name; + } + if (res[i][4] === "S" || res[i][4] === null) { + $scope.widgetsList.push({ + id: widget_id, + headerName: header_name, + name: widget_name, + url: url, + attrs: [{ + attr: 'data-' + res[i][0], + value: '' + }], + x: res[i][3], + y: res[i][5], + height: res[i][6], + width: res[i][7] + }); + } + var script = document + .createElement('script'); + script.src = url; + script.async = false; + var entry = document + .getElementsByTagName('script')[0]; + entry.parentNode + .insertBefore(script, entry); + } + $scope.applyPresentationDetailsToWidgets($scope.widgetsList); + }).catch(err => { + $log.error('WidgetsHomeCtrl::getUserWidgets error: ' + err); + }).finally(() => { + + }); + }; + + userProfileService.getUserProfile().then( + function(profile) { + $scope.orgUserId = profile.orgUserId; + getUserWidgets($scope.orgUserId); + }); + + /* Widget Gridster Section */ + $scope.newsGridsterItem = { + sizeX: 1, + sizeY: 1, + headerText: 'News', + subHeaderText: '', + imageLink: '', + order: '', + url: '' + }; + + $scope.eventsGridsterItem = { + sizeX: 1, + sizeY: 1, + headerText: 'Events', + subHeaderText: '', + imageLink: '', + order: '', + url: '' + }; + + $scope.impoResGridsterItem = { + sizeX: 1, + sizeY: 1, + headerText: 'Resources', + subHeaderText: '', + imageLink: '', + order: '', + url: '' + }; + + this.gridsterAppOpts = { + columns: 6, + colWidth: 190, + rowHeight: 190, + margins: [20, 20], + outerMargin: true, + pushing: true, + floating: true, + swapping: true, + resizable: { + enabled: false, + }, + draggable: { + handle: '.icon-content-gridguide', + stop: function stop() { + $scope.defaultSortBy = function() { + var resJson = {}; + resJson.value = 'M'; + resJson.index = 3; + resJson.title = 'Manual'; + $scope.selectedSortType = resJson; + applicationsService.saveAppsSortTypeManual($scope.appsViewData) + applicationsService.saveAppsSortTypePreference($scope.selectedSortType) + } + $scope.defaultSortBy(); + } + } + }; + + this.gridsterWidgetOpts = { + columns: 6, + colWidth: 190, + rowHeight: 190, + margins: [20, 20], + outerMargin: true, + pushing: true, + floating: true, + swapping: true, + resizable: { + enabled: true, + stop: function stop(event, uiWidget, $element) { + if ($element.sizeX == 1) + $element.headerText = ($element.widgetText.length > 9) ? $element.widgetText.substring(0, 8) + '...' : $element.widgetText; + if ($element.sizeX >= 2) + $element.headerText = $element.widgetText; + + applicationsService + .saveWidgetsSortManual($scope.widgetsViewData) + + } + }, + draggable: { + handle: '.icon-content-gridguide', + stop: function stop() { + applicationsService + .saveWidgetsSortManual($scope.widgetsViewData) + + } + } + }; + + this.goToCatalog = function(item) { + $state.go('root.appCatalog'); + } + + this.goToWidgetCatLog = function(item) { + $state.go('root.widgetCatalog'); + } + + // navigate to application url in new tab + this.goToPortal = function(item) { + + if (!item.url) { + $log.error('No URL found for this application, doing nothing!'); + return; + } + if (item.restrictedApp) { + // Link-based apps open in their own browser tab + $window.open(item.url, '_blank'); + } else { + // cache control so browsers load app page every + // time + var ccParam = 'cc=' + new Date().getTime(); + var urlParts = item.url.split('#'); + var appUrl = null; + if (urlParts.length < 2) { + // no # + let urlLastChar = item.url.charAt(item.url.length - 1); + if (item.url.includes("?")) + appUrl = (urlLastChar === '&' ? item.url + ccParam : item.url + '&' + ccParam); + else + appUrl = item.url + '?' + ccParam; + } else { + // has # + let urlLastChar = urlParts[0].charAt(urlParts[0].length - 1); + if (item.url.includes("?")) + appUrl = (urlLastChar === '&' ? urlParts[0] + ccParam + '#' + urlParts[1] : urlParts[0] + '&' + ccParam + '#' + urlParts[1]); + else + appUrl = urlParts[0] + '?' + ccParam + "#" + urlParts[1]; + } + // $log.debug('DashboardCtrlr::goToPortal: opening + // tab with URL + // ' + appUrl); + var tabContent = { + id: new Date(), + title: item.headerText, + url: appUrl, + appId: item.appId + }; + $cookies.putObject('addTab', tabContent); + } + + + }; + + this.auditLog = function(app) { + console.log(app); + auditLogService.storeAudit(app.appid, 'app', app.url); + }; + + if (getParameterByName('noUserError') != null) { + if (getParameterByName('noUserError') == "Show") { + $("#errorInfo").show(); + } + } + }; + + DashboardCtrl.$inject = ['conf', 'applicationsService', '$log', '$window', + 'userProfileService', '$scope', '$cookies', '$timeout', '$interval', + '$modal', '$state', 'beReaderService', 'dashboardService', 'confirmBoxService', + 'auditLogService', 'ngDialog', '$compile', 'widgetsCatalogService' + ]; + angular.module('ecompApp').controller('DashboardCtrl', DashboardCtrl); })(); function getParameterByName(name, url) { - if (!url) - url = window.location.href; - name = name.replace(/[\[\]]/g, "\\$&"); - var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), results = regex - .exec(url); - if (!results) - return ''; - if (!results[2]) - return ''; - return results[2].replace(/\+/g, " "); -} + if (!url) + url = window.location.href; + name = name.replace(/[\[\]]/g, "\\$&"); + var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), + results = regex + .exec(url); + if (!results) + return ''; + if (!results[2]) + return ''; + return results[2].replace(/\+/g, " "); +} \ No newline at end of file diff --git a/ecomp-portal-FE-common/client/app/views/header/header.controller.js b/ecomp-portal-FE-common/client/app/views/header/header.controller.js index 33cb8454..2eba057c 100644 --- a/ecomp-portal-FE-common/client/app/views/header/header.controller.js +++ b/ecomp-portal-FE-common/client/app/views/header/header.controller.js @@ -20,7 +20,7 @@ 'use strict'; (function () { class HeaderCtrl { - constructor($log, $window, userProfileService, menusService, $scope, ECOMP_URL_REGEX, $cookies, $state,auditLogService,notificationService,recommendationService,ngDialog) { + constructor($log, $window, userProfileService, menusService, $scope, ECOMP_URL_REGEX, $cookies, $state,auditLogService,notificationService,ngDialog) { this.firstName = ''; this.lastName = ''; this.$log = $log; @@ -33,7 +33,6 @@ $scope.emptyFavorites = false; $scope.favoritesWindow = false; $scope.notificationCount=0; - $scope.recommendationCount=0; $scope.showNotification = true; $scope.hideMenus = false; @@ -47,7 +46,6 @@ }; $scope.megaMenuDataObject =[]; $scope.notificationCount= notificationService.notificationCount; - $scope.recommendationCount= recommendationService.recommendationCount; this.isLoading = true; this.ECOMP_URL_REGEX = ECOMP_URL_REGEX; @@ -474,85 +472,10 @@ } } - class RecommendationCtrl{ - constructor($log, $scope, $cookies, $timeout, sessionService,recommendationService,notificationService,$interval,ngDialog) { - $scope.recommendations=[]; - var intervalPromise = null; - $scope.recommendationCount= recommendationService.recommendationCount; - console.log("$",$); - $scope.getRecommendations = function(){ - $("#recommendation-bulb").removeClass('icon-misc-bulbL').addClass('icon-misc-bulb') - recommendationService.getRecommendations() - - .then(res=> { - $("#recommendation-bulb").removeClass('icon-misc-bulb').addClass('icon-misc-bulbL') - recommendationService.decrementRefreshCount(); - var count = recommendationService.getRefreshCount(); - if ( res.data==null) { - $log.error('RecommendationCtrl::update Recommendation: failed to get recommendation'); - if (intervalPromise != null) - $interval.cancel(intervalPromise); - } else if(count>=0){ - if (intervalPromise != null) - $interval.cancel(intervalPromise); - } else { - $scope.recommendations = []; - recommendationService.setRecommendationCount(res.data.recommendations.length); - for(var i=0;i { - $log.error('RecommendationCtrl::gatRecommendations: caught exception: ' + err); - if (intervalPromise != null) - $interval.cancel(intervalPromise); - }); - } - $scope.getRecommendations(); - - function updateRecommendations() { - $scope.getRecommendations(); - } - - notificationService.getNotificationRate().then(res=> { - if (res == null || res.response == null) { - $log.error('NotificationCtrl: failed to notification update rate or duration, check system.properties file.'); - } else { - var rate = parseInt(res.response.updateRate); - var duration = parseInt(res.response.updateDuration); - notificationService.setMaxRefreshCount(parseInt(duration/rate)+1); - notificationService.setRefreshCount(notificationService.maxCount); - if (rate != NaN && duration != NaN) { - $scope.updateRate=rate; - setInterval(function(){$scope.getRecommendations();},rate); - - } - } - }).catch(err=> { - $log.error('NotificationCtrl: getNotificationRate() failed: ' + err); - }); - $scope.deleteRecommendation = function(index){ - if ($scope.recommendations[index] == null || $scope.recommendations[index] == '') { - $log.error('RecommendationCtrl: failed to delete Recommendation.'); - return; - } - $scope.recommendations.splice(index,1); - recommendationService.setRecommendationCount($scope.recommendations.length); - } - } - } NotificationCtrl.$inject = ['$log', '$scope', '$cookies', '$timeout', 'sessionService','notificationService','$interval','ngDialog']; - RecommendationCtrl.$inject = ['$log', '$scope', '$cookies', '$timeout', 'sessionService','recommendationService','notificationService','$interval','ngDialog']; LoginSnippetCtrl.$inject = ['$log', '$scope', '$cookies', '$timeout','userProfileService', 'sessionService']; - HeaderCtrl.$inject = ['$log', '$window', 'userProfileService', 'menusService', '$scope', 'ECOMP_URL_REGEX','$cookies','$state','auditLogService','notificationService','recommendationService','ngDialog']; + HeaderCtrl.$inject = ['$log', '$window', 'userProfileService', 'menusService', '$scope', 'ECOMP_URL_REGEX','$cookies','$state','auditLogService','notificationService','ngDialog']; angular.module('ecompApp').controller('HeaderCtrl', HeaderCtrl); angular.module('ecompApp').controller('loginSnippetCtrl', LoginSnippetCtrl); angular.module('ecompApp').controller('notificationCtrl', NotificationCtrl); - angular.module('ecompApp').controller('recommendationCtrl', RecommendationCtrl); - })(); diff --git a/ecomp-portal-FE-common/client/app/views/header/header.tpl.html b/ecomp-portal-FE-common/client/app/views/header/header.tpl.html index 3d1d3305..ea7273b9 100644 --- a/ecomp-portal-FE-common/client/app/views/header/header.tpl.html +++ b/ecomp-portal-FE-common/client/app/views/header/header.tpl.html @@ -267,63 +267,10 @@ - - - -
  • - -
    -
    -
    - -
    -
    -
    - -
    -
    -

    Recommendations

    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    No New Recommendations

    -
    - -
    -
    -
    -
      -
    • -
      - -
      -
      - - - - -
      - -
    • -
    -
    - -
    - - -
  • +
  • +
    +
  • diff --git a/ecomp-portal-FE-common/client/app/views/support/get-access/get-access.controller.js b/ecomp-portal-FE-common/client/app/views/support/get-access/get-access.controller.js index c93d8643..0c43c1fa 100644 --- a/ecomp-portal-FE-common/client/app/views/support/get-access/get-access.controller.js +++ b/ecomp-portal-FE-common/client/app/views/support/get-access/get-access.controller.js @@ -20,36 +20,42 @@ 'use strict'; (function () { class GetAccessCtrl { - constructor($log, $scope, $stateParams, getAccessService, userProfileService, ExternalRequestAccessService, applicationsService, ngDialog) { + constructor($log, $scope, $stateParams, filterFilter, getAccessService, userProfileService, ExternalRequestAccessService, applicationsService, ngDialog) { // $log.debug('GetAccessCtrl: appService param is: ' + applicationsService.goGetAccessAppName); var resultAccessValue = null; - var externalRequest = true; - + $scope.openAppRoleModal = (itemData) => { if(resultAccessValue){ let data = null; data = { dialogState: 2, selectedUser:{ - attuid: $scope.attuid, + orgUserId: $scope.orgUserId, firstName: $scope.firstName, lastName: $scope.lastName, headerText: itemData.app_name, - extReqValue : externalRequest } } ngDialog.open({ - templateUrl: 'app/views/catalog/add-catalog-dialogs/new-catalog.modal.html', - controller: 'NewCatalogModalCtrl', + templateUrl: 'app/views/catalog/request-access-catalog-dialogs/request-access-catalog.modal.html', + controller: 'ExternalRequestAccessCtrl', controllerAs: 'userInfo', data: data }); } } + $scope.$watch('access.searchString', function (searchKey) { + var search = searchKey; + this.totalPage = filterFilter($scope.access.appTable, search); + var resultLen = this.totalPage.length; + $scope.access.totalPage = Math.ceil(resultLen/$scope.access.viewPerPage); + $scope.access.currentPage = 1; + }); + userProfileService.getUserProfile().then( function(profile) { - $scope.attuid = profile.orgUserId; + $scope.orgUserId = profile.orgUserId; $scope.firstName = profile.firstName; $scope.lastName = profile.lastName; }); @@ -120,6 +126,6 @@ init(); } } - GetAccessCtrl.$inject = ['$log', '$scope', '$stateParams', 'getAccessService', 'userProfileService', 'ExternalRequestAccessService','applicationsService', 'ngDialog']; + GetAccessCtrl.$inject = ['$log', '$scope', '$stateParams', 'filterFilter', 'getAccessService', 'userProfileService', 'ExternalRequestAccessService','applicationsService', 'ngDialog']; angular.module('ecompApp').controller('GetAccessCtrl', GetAccessCtrl); })(); diff --git a/ecomp-portal-FE-common/client/app/views/support/get-access/get-access.tpl.html b/ecomp-portal-FE-common/client/app/views/support/get-access/get-access.tpl.html index 08ccbf48..ef0c2428 100644 --- a/ecomp-portal-FE-common/client/app/views/support/get-access/get-access.tpl.html +++ b/ecomp-portal-FE-common/client/app/views/support/get-access/get-access.tpl.html @@ -50,12 +50,11 @@ + row-repeat="rowData in access.appTable | filter:access.searchString | startFrom:(access.currentPage-1)*access.viewPerPage | limitTo:access.viewPerPage | orderBy:'ecomp_function'" track-by="$index">
    diff --git a/ecomp-portal-FE-common/client/app/views/users/new-user-dialogs/bulk-user.controller.js b/ecomp-portal-FE-common/client/app/views/users/new-user-dialogs/bulk-user.controller.js index e73fe290..8c9420d4 100644 --- a/ecomp-portal-FE-common/client/app/views/users/new-user-dialogs/bulk-user.controller.js +++ b/ecomp-portal-FE-common/client/app/views/users/new-user-dialogs/bulk-user.controller.js @@ -340,7 +340,7 @@ if (prevRow == null || prevRow.orgUserId.toLowerCase() !== uploadRow.orgUserId.toLowerCase()) { if (debug) $log.debug('BulkUserModalCtrl::buildAppRoleChecks: create request for orgUserId ' + uploadRow.orgUserId); - let appPromise = usersService.getUserAppRoles(appId, uploadRow.orgUserId).promise().then( (userAppRolesResult) => { + let appPromise = usersService.getUserAppRoles(appId, uploadRow.orgUserId,true).promise().then( (userAppRolesResult) => { // Reply for unknown user has all defined roles with isApplied=false on each. if (typeof userAppRolesResult[0] !== "undefined") { if (debug) diff --git a/ecomp-portal-FE-common/client/app/views/widget-onboarding/widget-onboarding.controller.js b/ecomp-portal-FE-common/client/app/views/widget-onboarding/widget-onboarding.controller.js index 661c63a3..0e7fd9fb 100644 --- a/ecomp-portal-FE-common/client/app/views/widget-onboarding/widget-onboarding.controller.js +++ b/ecomp-portal-FE-common/client/app/views/widget-onboarding/widget-onboarding.controller.js @@ -189,9 +189,16 @@ } var a = document.createElement('a'); var blob = new Blob([data], {type: 'application/octet-stream'}); - a.href = URL.createObjectURL(blob); + var url = window.URL.createObjectURL(blob); + a.href = url; a.download = filename; + document.body.appendChild(a); a.click(); + + setTimeout(function(){ + document.body.removeChild(a); + window.URL.revokeObjectURL(url); + }, 100); }); }; diff --git a/ecomp-portal-FE-os/client/src/directives/search-users/search-users.less b/ecomp-portal-FE-os/client/src/directives/search-users/search-users.less index 2fb1b27e..32ea9caa 100644 --- a/ecomp-portal-FE-os/client/src/directives/search-users/search-users.less +++ b/ecomp-portal-FE-os/client/src/directives/search-users/search-users.less @@ -25,6 +25,10 @@ } + .user:focus { + outline: -webkit-focus-ring-color auto 5px; + background-color:white !important; + } .add-user-section{ margin-top:0px; margin-left:10px; diff --git a/ecomp-portal-FE-os/client/src/services/recommendation/recommendation.service.js b/ecomp-portal-FE-os/client/src/services/recommendation/recommendation.service.js new file mode 100644 index 00000000..4df4e394 --- /dev/null +++ b/ecomp-portal-FE-os/client/src/services/recommendation/recommendation.service.js @@ -0,0 +1,24 @@ +/*- + * ================================================================================ + * ECOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file 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. + * ================================================================================ + */ +/** + * Created by wl849v on 12/14/2016. + */ + +/*As Recommendation code belongs to internal use Just kept an empty file in order to avoid 404 errors in the browser console */ \ No newline at end of file diff --git a/ecomp-portal-FE-os/client/src/services/userProfile/userProfile.service.js b/ecomp-portal-FE-os/client/src/services/userProfile/userProfile.service.js index dc0022ac..2cc7c329 100644 --- a/ecomp-portal-FE-os/client/src/services/userProfile/userProfile.service.js +++ b/ecomp-portal-FE-os/client/src/services/userProfile/userProfile.service.js @@ -195,7 +195,7 @@ return deferred.promise; } - + } UserProfileService.$inject = ['$q', '$log', '$http', 'conf', 'uuid4', 'utilsService']; angular.module('ecompApp').service('userProfileService', UserProfileService) diff --git a/ecomp-portal-FE-os/client/src/views/catalog/add-catalog-dialogs/new-catalog.controller.js b/ecomp-portal-FE-os/client/src/views/catalog/add-catalog-dialogs/new-catalog.controller.js deleted file mode 100644 index c2eda6ed..00000000 --- a/ecomp-portal-FE-os/client/src/views/catalog/add-catalog-dialogs/new-catalog.controller.js +++ /dev/null @@ -1,218 +0,0 @@ -/*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file 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. - * ================================================================================ - */ -/** - * Created by nnaffar on 12/20/15. - */ -'use strict'; -(function () { - class NewCatalogModalCtrl { - constructor($scope, $log, usersService, catalogService, applicationsService, confirmBoxService) { - let init = () => { - //$log.info('NewUserModalCtrl::init'); - this.isSaving = false; - this.adminApps =[]; - this.appRoles = []; - $scope.userAppRoles = []; - $scope.titleText = "Request for Access in MyLogins:"; - $scope.title ="Request is pending in MyLogins for the following Roles"; - this.isGettingAdminApps = false; - if($scope.ngDialogData && $scope.ngDialogData.selectedUser && $scope.ngDialogData.dialogState){ - this.selectedUser = $scope.ngDialogData.selectedUser; - this.dialogState = $scope.ngDialogData.dialogState; - this.isShowBack = false; - if(this.dialogState === 2){ - this.getUserAppsRoles(); - } - } - }; - - this.appChanged = (index) => { - let myApp = this.adminApps[index]; - //$log.debug('NewUserModalCtrl::appChanged: index: ', index, '; app id: ', myApp.id, 'app name: ',myApp.name); - myApp.isChanged = true; - this.anyChanges = true; - } - - this.deleteApp = (app) => { - let appMessage = this.selectedUser.firstName + ' ' + this.selectedUser.lastName; - confirmBoxService.deleteItem(appMessage).then(isConfirmed => { - if(isConfirmed){ - this.anyChanges = true; - app.isChanged = true; - app.isDeleted = true; // use this to hide the app in the display - app.appRoles.forEach(function(role){ - role.isApplied = false; - }); - } - }).catch(err => { - $log.error('NewUserModalCtrl::deleteApp error: ',err); - confirmBoxService.showInformation('There was a problem deleting the the applications. ' + - 'Please try again later. Error: ' + err.status).then(isConfirmed => {}); - }); - }; - - this.getUserAppsRoles = () => { - - //$log.debug('NewUserModalCtrl::getUserAppsRoles: about to call getAdminAppsSimpler'); - this.isGettingAdminApps = true; - catalogService.getAppCatalog().then((apps) => { - //$log.debug('NewUserModalCtrl::getUserAppsRoles: beginning of then for getAdminAppsSimpler'); - - this.isGettingAdminApps = false; - if (!apps || !apps.length) { - $log.error('NewUserModalCtrl::getUserApps error: no admin apps found'); - return null; - } - //$log.debug('NewUserModalCtrl::getUserAppsRoles: then for getAdminAppsSimpler: step 2'); - //$log.debug('NewUserModalCtrl::getUserAppsRoles: admin apps: ', apps); - - this.dialogState = 2; - this.isLoading = true; - this.adminApps = apps; - - catalogService.getuserAppRolesCatalog(this.selectedUser.headerText).then( - function(result) { - // $log.debug('CatalogCtrl:storeSelection result is ', result); - - $scope.userAppRoles = result; - $scope.displyUserAppCatalogRoles = true; - if(result.length === 1 && result[0].requestedRoleId === null) - { - $scope.title= "Removal Request is pending in MyLogins"; - } - - if($scope.userAppRoles.length==0) - { - $scope.displyUserAppCatalogRoles = false; - } - }); - apps.forEach(app => { - if(app.name === this.selectedUser.headerText){ - //$log.debug('NewUserModalCtrl::getUserAppsRoles: app: id: ', app.id, 'name: ',app.name); - // Keep track of which app has changed, so we know which apps to update using a BE API - app.isChanged = false; - // Each of these specifies a state, which corresponds to a different message and style that gets displayed - app.isLoading = true; - app.isError = false; - app.isDeleted = false; - app.printNoChanges = false; - app.isUpdating = false; - app.isErrorUpdating = false; - app.isDoneUpdating = false; - app.errorMessage = ""; - usersService.getUserAppRoles(app.id, this.selectedUser.attuid).promise().then((userAppRolesResult) => { - //$log.debug('NewUserModalCtrl::getUserAppsRoles: got a result for app: ',app.id,': ',app.name,': ',userAppRolesResult); - app.appRoles = userAppRolesResult; - app.isLoading = false; - }).catch(err => { - $log.error(err); - app.isError = true; - app.isLoading = false; - app.errorMessage = err.headers('FEErrorString'); - //$log.debug('NewUserModalCtrl::getUserAppsRoles: in new-user.controller: response header: '+err.headers('FEErrorString')); - }).finally(()=>{ - this.numberAppsProcessed++; - if (this.numberAppsProcessed === this.adminApps.length) { - this.isLoading = false; - } - }); - } - }) - return; - }).catch(err => { - $log.error(err); - }) - - } - - - /** - * Update the selected user apps with the new roles. - * If no roles remain, set the user to inactive. - */ - this.updateUserAppsRoles = () => { - // $log.debug('NewUserModalCtrl::updateUserAppsRoles: entering updateUserAppsRoles'); - if(!this.selectedUser || !this.selectedUser.attuid || !this.adminApps){ - $log.error('NewUserModalCtrl::updateUserAppsRoles: mmissing arguments'); - return; - } - this.isSaving = true; - confirmBoxService.makeUserAppRoleCatalogChanges('Are you sure you want to make these changes?') - .then(confirmed => { - if(confirmed === true){ - //$log.debug('NewUserModalCtrl::updateUserAppsRoles: going to update user: ' + this.selectedUser.attuid); - this.numberAppsProcessed = 0; - this.numberAppsSucceeded = 0; - this.adminApps.forEach(app => { - if (app.isChanged) { - //$log.debug('NewUserModalCtrl::updateUserAppsRoles: app roles have changed; going to update: id: ', app.id, '; name: ', app.name); - app.isUpdating = true; - var UserAppRolesRequest = { - attuid: this.selectedUser.attuid, - appId: app.id, - appRoles: app.appRoles, - appName: app.name - }; - this.isSaving = true; - $log.debug('going to update user: ' + this.selectedUser.attuid + ' with app roles: ' + JSON.stringify(this.adminAppsRoles)); - applicationsService.saveUserAppsRoles(UserAppRolesRequest).then(res => { - app.isUpdating = false; - $scope.closeThisDialog(true); - }).catch(err => { - $log.error('NewAdminModalCtrl.updateAdminAppsRoles:: Failed - ' + err); - }).finally(()=> { - this.isSaving = false; - }) - } - }); - }else{ - this.isSaving = false; - } - - - - }); - - }; - - /** - * Navigate between dialog screens using step number: 1,2,... - */ - this.navigateBack = () => { - if (this.dialogState === 1) { - //back from 1st screen? - } - if (this.dialogState === 3) { - this.dialogState = 1; - } - }; - - init(); - - $scope.$on('$stateChangeStart', e => { - //Disable navigation when modal is opened - //**Nabil - note: this will cause the history back state to be replaced with current state - e.preventDefault(); - }); - } - } - NewCatalogModalCtrl.$inject = ['$scope', '$log', 'usersService', 'catalogService', 'applicationsService', 'confirmBoxService']; - angular.module('ecompApp').controller('NewCatalogModalCtrl', NewCatalogModalCtrl); -})(); diff --git a/ecomp-portal-FE-os/client/src/views/catalog/add-catalog-dialogs/new-catalog.modal.html b/ecomp-portal-FE-os/client/src/views/catalog/add-catalog-dialogs/new-catalog.modal.html deleted file mode 100644 index 3578cc09..00000000 --- a/ecomp-portal-FE-os/client/src/views/catalog/add-catalog-dialogs/new-catalog.modal.html +++ /dev/null @@ -1,113 +0,0 @@ - -
    - -
    -
    -
    {{titleText}}
    -
    -
    -
    - -
    -
    -
    {{app.name - | elipsis: 27}}
    -
    - -
    - -
    - -
    - - -
    {{app.errorMessage | elipsis: 35}}
    -
    Contacting - application...
    -
    No - changes
    -
    Updating - application...
    -
    Finished updating application
    -
    Could - not update application...
    -
    -
    - -   - -
    -
    {{title}}
    -   -
    -
    - -
    - - {{getUserApplicationRole.rolename}} -
    - -
    -
    - -
    -
    - -
    - - -
    Cancel
    -
    - -
    - -
    - -
    diff --git a/ecomp-portal-FE-os/client/src/views/catalog/get-accessswitch.html b/ecomp-portal-FE-os/client/src/views/catalog/get-accessswitch.html new file mode 100644 index 00000000..5cda74a4 --- /dev/null +++ b/ecomp-portal-FE-os/client/src/views/catalog/get-accessswitch.html @@ -0,0 +1,10 @@ +
    +
    \ No newline at end of file diff --git a/ecomp-portal-FE-os/client/src/views/footer/footer.controller.js b/ecomp-portal-FE-os/client/src/views/footer/footer.controller.js index 5db3ed0f..d21c829e 100644 --- a/ecomp-portal-FE-os/client/src/views/footer/footer.controller.js +++ b/ecomp-portal-FE-os/client/src/views/footer/footer.controller.js @@ -20,18 +20,24 @@ 'use strict'; (function () { class FooterCtrl { - constructor($scope, $rootScope, manifestService, $log) { + constructor($scope, $rootScope, manifestService, $log, menusService) { this.manifestService = manifestService; this.$log = $log; this.$scope = $scope; this.$rootScope = $rootScope; - $scope.buildinfo = null; $rootScope.showFooter = true; $scope.date = new Date(); - - + $scope.ecompTitle=''; + + menusService.getEcompPortalTitle() + .then(title=> { + $scope.ecompTitle = title.response; + }).catch(err=> { + $log.error('FooterCtrl.getEcompPortalTitle:: Error retrieving ECMOP portal title: ' + err); + }); + manifestService.getManifest().then( jsonObj => { // $log.debug('FooterCtrl.getManifest: ', JSON.stringify(jsonObj)); $scope.buildInfo = jsonObj; @@ -43,6 +49,6 @@ } - FooterCtrl.$inject = ['$scope', '$rootScope', 'manifestService', '$log']; + FooterCtrl.$inject = ['$scope', '$rootScope', 'manifestService', '$log', 'menusService']; angular.module('ecompApp').controller('FooterCtrl', FooterCtrl); })(); diff --git a/ecomp-portal-FE-os/client/src/views/footer/footer.tpl.html b/ecomp-portal-FE-os/client/src/views/footer/footer.tpl.html index 37148abf..b03e8da5 100644 --- a/ecomp-portal-FE-os/client/src/views/footer/footer.tpl.html +++ b/ecomp-portal-FE-os/client/src/views/footer/footer.tpl.html @@ -23,10 +23,13 @@ +
    + Onap Logo
    diff --git a/ecomp-portal-FE-os/client/src/views/headerRecommendation/headerRecommendations.controller.js b/ecomp-portal-FE-os/client/src/views/headerRecommendation/headerRecommendations.controller.js new file mode 100644 index 00000000..0c152062 --- /dev/null +++ b/ecomp-portal-FE-os/client/src/views/headerRecommendation/headerRecommendations.controller.js @@ -0,0 +1,20 @@ +/*- + * ================================================================================ + * ECOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file 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. + * ================================================================================ + */ +/*As Recommendation code belongs to internal use Just kept an empty file in order to avoid 404 errors in the browser console */ \ No newline at end of file diff --git a/ecomp-portal-FE-os/client/src/views/headerRecommendation/headerRecommendations.tpl.html b/ecomp-portal-FE-os/client/src/views/headerRecommendation/headerRecommendations.tpl.html new file mode 100644 index 00000000..68917389 --- /dev/null +++ b/ecomp-portal-FE-os/client/src/views/headerRecommendation/headerRecommendations.tpl.html @@ -0,0 +1,21 @@ + + + \ No newline at end of file -- cgit 1.2.3-korg