diff options
author | 2017-08-23 18:27:19 -0400 | |
---|---|---|
committer | 2017-08-23 21:12:56 -0400 | |
commit | 978dbcf0a196acbafad72fe1e2478ec0e384f02f (patch) | |
tree | 17e1ceaa4a12a599320cbb317947e990bf1a5383 /ecomp-portal-widget-ms/widget-ms/src/main/resources | |
parent | bc7350dce5b7b1dcd1c472a3922b42c4ea99809d (diff) |
Deliver centralized role management feature
Repair multiple defects also.
Revise deployment to use docker-compose.
Remove all zip archives.
Issue: PORTAL-21, PORTAL-25, PORTAL-28, PORTAL-52, PORTAL-69,
PORTAL-74, PORTAL-76, PORTAL-80, PORTAL-82
Change-Id: Ie72fec7d35ba78beb162bba6ed27b2caee340c61
Signed-off-by: Christopher Lott (cl778h) <clott@research.att.com>
Diffstat (limited to 'ecomp-portal-widget-ms/widget-ms/src/main/resources')
9 files changed, 415 insertions, 0 deletions
diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/resources/application-properties b/ecomp-portal-widget-ms/widget-ms/src/main/resources/application-properties new file mode 100644 index 00000000..77d2b78d --- /dev/null +++ b/ecomp-portal-widget-ms/widget-ms/src/main/resources/application-properties @@ -0,0 +1,28 @@ +## General App Properties +server.contextPath=/widget +server.port=8082 +spring.http.multipart.max-file-size=128MB +spring.http.multipart.max-request-size=128MB +microservice.widget.location=/demeter/WebApps/dev/ECOMPPORTAL/microservices/widgets-dir/ + +## App DB Properties +spring.datasource.url=jdbc:mariadb:failover://demeter.homer.att.com:3306/ecomp_portal_1702&connectTimeout=2000 +spring.datasource.username=portal +spring.datasource.password=ENC(8tWrJAXdOKaMqvrVy5e2Jg==) +spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect +spring.database.driver.classname=org.mariadb.jdbc.Driver +spring.jpa.show-sql=false +spring.jpa.properties.hibernate.format_sql=false + +## Basic Authentication Properties +security.user.name=widget_user +security.user.password=ENC(IjywcRnI9+nuVEh9+OFFiRWAjBT1n718) + +## Certificate Properties +#server.ssl.key-store=classpath:widget-keystore.p12 +#server.ssl.key-store-password=ENC(DiIYnAMab4u7rEW2yKhF9zBL00uU55q8) +#server.ssl.keyStoreType=PKCS12 +#server.ssl.keyAlias=widget-microservice + +## Jasypt Properties +jasypt.encryptor.password=EncryptionKey diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/resources/application.properties.templated b/ecomp-portal-widget-ms/widget-ms/src/main/resources/application.properties.templated new file mode 100644 index 00000000..ec4803f0 --- /dev/null +++ b/ecomp-portal-widget-ms/widget-ms/src/main/resources/application.properties.templated @@ -0,0 +1,35 @@ +## General App Properties +server.contextPath=/widget +server.port=8082 +spring.http.multipart.max-file-size=128MB +spring.http.multipart.max-request-size=128MB + +## App DB Properties +spring.datasource.url=jdbc:mariadb:failover://{db_host:db_port/{portal_db} +spring.datasource.username={username} +spring.datasource.password=ENC({encrypted_password}) +spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect +spring.database.driver.classname=org.mariadb.jdbc.Driver +spring.jpa.show-sql=false +spring.jpa.properties.hibernate.format_sql=false + +## Basic Authentication Properties +security.user.name={basic_auth_username} +security.user.password=ENC({encrypted_basic_auth_password}) + +## Initalization setting +initialization.default.widgets=true +initialization.widgetData.url={widgetData_url} + +## Account Basic Authentication Properties +account.user.name=portal +account.user.password=6APqvG4AU2rfLgCvMdySwQ== + +## Certificate Properties +#server.ssl.key-store=classpath:widget-keystore.p12 +#server.ssl.key-store-password=ENC(DiIYnAMab4u7rEW2yKhF9zBL00uU55q8) +#server.ssl.keyStoreType=PKCS12 +#server.ssl.keyAlias=widget-microservice + +## Jasypt Properties +jasypt.encryptor.password=EncryptionKey
\ No newline at end of file diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/resources/framework-template.js b/ecomp-portal-widget-ms/widget-ms/src/main/resources/framework-template.js new file mode 100644 index 00000000..45350d91 --- /dev/null +++ b/ecomp-portal-widget-ms/widget-ms/src/main/resources/framework-template.js @@ -0,0 +1,173 @@ +var ARUGMENT1 = (function(window, undefined) { + + var ARUGMENT1 = ARUGMENT1 || {}; + function extractHostPortApp(src) { + ARUGMENT1.microserviceId = MICROSERVICE_ID; + ARUGMENT1.pathArray = src.split( '/' ); + ARUGMENT1.widgetName = ARUGMENT1.pathArray[ARUGMENT1.pathArray.length - 2]; + ARUGMENT1.serviceSeperator = ARUGMENT1.pathArray[ARUGMENT1.pathArray.length - 4]; + ARUGMENT1.commonUrl = src.substring(0, src.lastIndexOf("/" + ARUGMENT1.widgetName)); + ARUGMENT1.recipientDivDataAttrib = 'data-' + ARUGMENT1.widgetName; + ARUGMENT1.controllerName = 'ARUGMENT2'; + ARUGMENT1.readyCssFlag = 'ARUGMENT3'; + ARUGMENT1.readyCssFlagExpectedValue = '#bada55'; + ARUGMENT1.serviceURL = src.substring(0, src.lastIndexOf("/" + ARUGMENT1.serviceSeperator)) + '/portalApi/microservice/proxy/parameter/' + WIDGET_ID; + } + + extractHostPortApp(document.currentScript.src); + + function loadStylesheet(url) { + var link = document.createElement('link'); + link.rel = 'stylesheet'; + link.type = 'text/css'; + link.href = url; + var entry = document.getElementsByTagName('script')[0]; + entry.parentNode.insertBefore(link, entry); + } + + function isCssReady(callback) { + var testElem = document.createElement('span'); + testElem.id = ARUGMENT1.readyCssFlag; + testElem.style = 'CSS_ARG1'; + var entry = document.getElementsByTagName('script')[0]; + entry.parentNode.insertBefore(testElem, entry); + + (function poll() { + var node = document.getElementById('css-ready'); + var value; + if (window.getComputedStyle) { + value = document.defaultView.getComputedStyle(testElem, null) + .getPropertyValue('color'); + } + else if (node.currentStyle) { + value = node.currentStyle.color; + } + if (value && value === 'rgb(186, 218, 85)' || value.toLowerCase() === ARUGMENT1.readyCssFlagExpectedValue) { + callback(); + } else { + setTimeout(poll, 500); + } + })(); + } + + function injectCss(css) { + var style = document.createElement('style'); + style.type = 'text/css'; + css = css.replace(/\}/g, "}\n"); + + if (style.styleSheet) { + style.styleSheet.cssText = css; + } else { + style.appendChild(document.createTextNode(css)); + } + var entry = document.getElementsByTagName('script')[0]; + entry.parentNode.insertBefore(style, entry); + } + + function loadScript(url, callback) { + var script = document.createElement('script'); + script.src = url; + var entry = document.getElementsByTagName('script')[0]; + entry.parentNode.insertBefore(script, entry); + script.onload = script.onreadystatechange = function() { + var rdyState = script.readyState; + if (!rdyState || /complete|loaded/.test(script.readyState)) { + callback(); + script.onload = null; + script.onreadystatechange = null; + } + }; + } + + function loadSupportingFiles(callback) { + callback(); + } + + function getWidgetParams() { + + } + + function getWidgetData(widgetUrl, callback) { + var responseData; + try{ + jQuery.ajax({ + url: widgetUrl, + method: "GET", + xhrFields: { + withCredentials: true + }, + crossDomain: true, + success: function (result) { + if (result.isOk == false){ + + }else{ + callback(result); + } + } + }); + } + catch(e){ + + } + + } + + function getMarkupContent(markupLocation, target){ + + jQuery.ajax({ + url: markupLocation, + success: function (result) { + if (result.isOk == false){ + + }else{ + target.innerHTML = result; + } + }, + async: false + }); + } + + function renderWidget(data, location, $controllerProvider) { + var div = document.createElement('div'); + getMarkupContent(ARUGMENT1.commonUrl + "/markup/" + ARUGMENT1.widgetName, div); + location.append(div); + ARUGMENT1.widgetData = data; + app.controllerProvider.register(ARUGMENT1.controllerName, ARUGMENT1.controller); + var mController = angular.element(document.getElementById("widgets")); + mController.scope().activateThis(location); + } + + function printAllArtifacts(moduleName, controllerName) { + var queue = angular.module(moduleName)._invokeQueue; + for(var i=0;i<queue.length;i++) { + var call = queue[i]; + console.log(i + '. ' + call[0] + ' - ' + call[1] + ' - ' + call[2][0]); + } + } + + function get(name){ + if(name=(new RegExp('[?&]'+encodeURIComponent(name)+'=([^&]*)')).exec(location.search)) + return decodeURIComponent(name[1]); + } + + loadSupportingFiles(function() { + loadStylesheet(ARUGMENT1.commonUrl + '/' + ARUGMENT1.widgetName + '/style.css'); + loadScript(ARUGMENT1.commonUrl + '/' + ARUGMENT1.widgetName + '/controller.js', + function() { + $('['+ ARUGMENT1.recipientDivDataAttrib + ']').each(function() { + var location = jQuery(this); + location.removeAttr(ARUGMENT1.recipientDivDataAttrib); + var id = location.attr(ARUGMENT1.recipientDivDataAttrib); + getWidgetData(ARUGMENT1.serviceURL, function(data) { + isCssReady(function(){ + renderWidget(data, location); + }); + }); + }); + } + ); + }); + + return ARUGMENT1; +})(window); +
\ No newline at end of file diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/resources/logback.xml b/ecomp-portal-widget-ms/widget-ms/src/main/resources/logback.xml new file mode 100644 index 00000000..204a6598 --- /dev/null +++ b/ecomp-portal-widget-ms/widget-ms/src/main/resources/logback.xml @@ -0,0 +1,138 @@ +<?xml version="1.0" encoding="UTF-8"?> +<configuration> + + <property name="WIDGET_LOG_HOME" value="logs" /> + + + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <layout class="ch.qos.logback.classic.PatternLayout"> + <Pattern> + %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n + </Pattern> + </layout> + </appender> + + <logger name="org.springframework.web" level="info" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> + + <contextName>${HOSTNAME}</contextName> + + + <appender name="ADUIT" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${WIDGET_LOG_HOME}/aduit.log</file> + <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> + <Pattern> + %date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestId}|%logger{0}|%-5level|%contextName| %msg%n" + </Pattern> + </encoder> + <!-- %d{yyyy-MM-dd HH:mm:ss} - %msg%n --> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${WIDGET_LOG_HOME}/archived/aduit.%d{yyyy-MM-dd}.%i.zip + </fileNamePattern> + <maxHistory>30</maxHistory> + <timeBasedFileNamingAndTriggeringPolicy + class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> + <maxFileSize>100KB</maxFileSize> + </timeBasedFileNamingAndTriggeringPolicy> + </rollingPolicy> + </appender> + + <appender name="APPLICATION" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${WIDGET_LOG_HOME}/application.log</file> + <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> + <Pattern> + %date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestId}|%logger{0}|%-5level|%contextName| %msg%n" + </Pattern> + </encoder> + <!-- %d{yyyy-MM-dd HH:mm:ss} - %msg%n --> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${WIDGET_LOG_HOME}/archived/application.%d{yyyy-MM-dd}.%i.zip + </fileNamePattern> + <maxHistory>30</maxHistory> + <timeBasedFileNamingAndTriggeringPolicy + class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> + <maxFileSize>100KB</maxFileSize> + </timeBasedFileNamingAndTriggeringPolicy> + </rollingPolicy> + </appender> + + + <appender name="DEBUG" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${WIDGET_LOG_HOME}/debug.log</file> + <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> + <Pattern> + %date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestId}|%logger{0}|%-5level|%contextName| %msg%n" + </Pattern> + </encoder> + <!-- %d{yyyy-MM-dd HH:mm:ss} - %msg%n --> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${WIDGET_LOG_HOME}/archived/debug.%d{yyyy-MM-dd}.%i.zip + </fileNamePattern> + <maxHistory>30</maxHistory> + <timeBasedFileNamingAndTriggeringPolicy + class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> + <maxFileSize>100KB</maxFileSize> + </timeBasedFileNamingAndTriggeringPolicy> + </rollingPolicy> + </appender> + + + <appender name="ERROR" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${WIDGET_LOG_HOME}/error.log</file> + <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> + <Pattern> + %date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestId}|%logger{0}|%-5level|%contextName| %msg%n" + </Pattern> + </encoder> + + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${WIDGET_LOG_HOME}/archived/error.%d{yyyy-MM-dd}.%i.zip + </fileNamePattern> + <maxHistory>30</maxHistory> + <timeBasedFileNamingAndTriggeringPolicy + class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> + <maxFileSize>100KB</maxFileSize> + </timeBasedFileNamingAndTriggeringPolicy> + </rollingPolicy> + </appender> + + + <appender name="METRICS" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${WIDGET_LOG_HOME}/metrics.log</file> + <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> + <Pattern> + %date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestId}|%logger{0}|%-5level|%contextName| %msg%n" + </Pattern> + </encoder> + + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${WIDGET_LOG_HOME}/archived/metrics.%d{yyyy-MM-dd}.%i.zip + </fileNamePattern> + <maxHistory>30</maxHistory> + <timeBasedFileNamingAndTriggeringPolicy + class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> + <maxFileSize>100KB</maxFileSize> + </timeBasedFileNamingAndTriggeringPolicy> + </rollingPolicy> + </appender> + + <logger name="org.openecomp.portalapp.widget" level="debug" additivity="false"> + <appender-ref ref="ERROR" /> + <appender-ref ref="DEBUG" /> + <appender-ref ref="APPLICATION" /> + <appender-ref ref="STDOUT" /> + </logger> + + <root level="info"> + <appender-ref ref="DEBUG" /> + <appender-ref ref="APPLICATION" /> + <appender-ref ref="STDOUT" /> + </root> + +</configuration>
\ No newline at end of file diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/resources/templates/Upload.html b/ecomp-portal-widget-ms/widget-ms/src/main/resources/templates/Upload.html new file mode 100644 index 00000000..a5e7c632 --- /dev/null +++ b/ecomp-portal-widget-ms/widget-ms/src/main/resources/templates/Upload.html @@ -0,0 +1,17 @@ +<html> +<body> + <div align="center"> + <form method="post" action="doUpload/widget-resources" enctype="multipart/form-data"> + <table border="0"> + <tr> + <td>Pick file:</td> + <td><input type="file" name="fileUpload" size="50" /></td> + </tr> + <tr> + <td colspan="2" align="center"><input type="submit" value="Upload" /></td> + </tr> + </table> + </form> + </div> +</body> +</html>
\ No newline at end of file diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/resources/templates/widgetsPage.html b/ecomp-portal-widget-ms/widget-ms/src/main/resources/templates/widgetsPage.html new file mode 100644 index 00000000..440f64ca --- /dev/null +++ b/ecomp-portal-widget-ms/widget-ms/src/main/resources/templates/widgetsPage.html @@ -0,0 +1,15 @@ +<html xmlns:th="http://www.thymeleaf.org"> +<body> + + <p> Uploaded Widgets: </p> + + <div> + <ul> + <li th:each="file : ${files}"> + <a th:href="${file}" th:text="${file}" /> + </li> + </ul> + </div> + +</body> +</html> diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/resources/widget-keystore.p12 b/ecomp-portal-widget-ms/widget-ms/src/main/resources/widget-keystore.p12 Binary files differnew file mode 100644 index 00000000..b2dd42ff --- /dev/null +++ b/ecomp-portal-widget-ms/widget-ms/src/main/resources/widget-keystore.p12 diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/resources/widget_ms_start.sh b/ecomp-portal-widget-ms/widget-ms/src/main/resources/widget_ms_start.sh new file mode 100755 index 00000000..8405fe99 --- /dev/null +++ b/ecomp-portal-widget-ms/widget-ms/src/main/resources/widget_ms_start.sh @@ -0,0 +1,4 @@ +APP_PROPERTY_LOCATION=/tmp/application.properties +echo "Starting ecomp-portal-widget-ms image in a new container !!!" +docker run -d --name "ecomp-portal-widget-ms" -p 8083:8082 -v $APP_PROPERTY_LOCATION:/application.properties ecompportal-widget-ms + diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/resources/widget_ms_stop.sh b/ecomp-portal-widget-ms/widget-ms/src/main/resources/widget_ms_stop.sh new file mode 100755 index 00000000..8c9abf56 --- /dev/null +++ b/ecomp-portal-widget-ms/widget-ms/src/main/resources/widget_ms_stop.sh @@ -0,0 +1,5 @@ +echo "Stopping ecomp-portal-widget-ms container !!!" +docker stop ecomp-portal-widget-ms +echo "Removing docker image portal-widget-ms !!!" +docker rm ecomp-portal-widget-ms + |