diff --git a/.gitignore b/.gitignore index cb6708344..7d8381853 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ .vscode .DS_Store src/python/.loglogin +.loglogin # Compiled files *.pyc diff --git a/sbin/cdb_create_configuration_openssl.sh b/sbin/cdb_create_configuration_openssl.sh index cd8f48b59..9df68b510 100755 --- a/sbin/cdb_create_configuration_openssl.sh +++ b/sbin/cdb_create_configuration_openssl.sh @@ -13,26 +13,26 @@ # MY_DIR=`dirname $0` && cd $MY_DIR && MY_DIR=`pwd` -if [ -z "${CDB_ROOT_DIR}" ]; then - CDB_ROOT_DIR=$MY_DIR/.. +if [ -z "${LOGR_ROOT_DIR}" ]; then + LOGR_ROOT_DIR=$MY_DIR/.. fi -CDB_ENV_FILE=${CDB_ROOT_DIR}/setup.sh -if [ ! -f ${CDB_ENV_FILE} ]; then - echo "Environment file ${CDB_ENV_FILE} does not exist." +LOGR_ENV_FILE=${LOGR_ROOT_DIR}/setup.sh +if [ ! -f ${LOGR_ENV_FILE} ]; then + echo "Environment file ${LOGR_ENV_FILE} does not exist." exit 2 fi -. ${CDB_ENV_FILE} > /dev/null +. ${LOGR_ENV_FILE} > /dev/null -CDB_ETC_DIR=$CDB_INSTALL_DIR/etc +LOGR_ETC_DIR=$LOGR_INSTALL_DIR/etc -OPENSSL_CONFIG_FILE=$CDB_ETC_DIR/cdb.openssl.cnf +OPENSSL_CONFIG_FILE=$LOGR_ETC_DIR/cdb.openssl.cnf if [ -f $OPENSSL_CONFIG_FILE ]; then echo "Configuration file $OPENSSL_CONFIG_FILE has already been created" exit 0; fi -OPEN_SSL_TEMPLATE_FILE=$CDB_ROOT_DIR/etc/cdb.openssl.cnf.template +OPEN_SSL_TEMPLATE_FILE=$LOGR_ROOT_DIR/etc/cdb.openssl.cnf.template echo "Creating the cdb openSSL configuration file." read -p "Enter the organizational name [company]: " SSL_ORG_NAME diff --git a/sbin/cdb_create_db.sh b/sbin/cdb_create_db.sh index 040ae74c7..afe4edd76 100755 --- a/sbin/cdb_create_db.sh +++ b/sbin/cdb_create_db.sh @@ -281,7 +281,7 @@ if [ -z "$adminWithLocalPassword" ]; then read -sp "Enter password for local portal admin (username: logr): [leave blank for no local password] " LOGR_LOCAL_SYSTEM_ADMIN_PASSWORD echo "" if [ ! -z "$LOGR_LOCAL_SYSTEM_ADMIN_PASSWORD" ]; then - adminCryptPassword=`python -c "from cdb.common.utility.cryptUtility import CryptUtility; print(str(CryptUtility.cryptPasswordWithPbkdf2('$CDB_LOCAL_SYSTEM_ADMIN_PASSWORD')))"` + adminCryptPassword=`python -c "from cdb.common.utility.cryptUtility import CryptUtility; print(str(CryptUtility.cryptPasswordWithPbkdf2('$LOGR_LOCAL_SYSTEM_ADMIN_PASSWORD')))"` echo "update user_info set password = '$adminCryptPassword' where username='logr'" > temporaryAdminCommand.sql execute $mysqlCmd temporaryAdminCommand.sql fi diff --git a/sbin/cdb_deploy_mysqld.sh b/sbin/cdb_deploy_mysqld.sh index 69513b654..ce8f885b9 100755 --- a/sbin/cdb_deploy_mysqld.sh +++ b/sbin/cdb_deploy_mysqld.sh @@ -24,7 +24,7 @@ fi . ${LOGR_ENV_FILE} > /dev/null # Use first argument as db name, if provided -LOGR_DB_NAME=${LOGR_DB_NAME:=cdb} +LOGR_DB_NAME=${LOGR_DB_NAME:=logr} if [ ! -z "$1" ]; then LOGR_DB_NAME=$1 fi diff --git a/src/java/LogrPortal/lib/flexmark-ext-tables-0.64.8.jar b/src/java/LogrPortal/lib/flexmark-ext-tables-0.64.8.jar new file mode 100644 index 000000000..9201e31bf Binary files /dev/null and b/src/java/LogrPortal/lib/flexmark-ext-tables-0.64.8.jar differ diff --git a/src/java/LogrPortal/nbproject/project.properties b/src/java/LogrPortal/nbproject/project.properties index 853ccb196..b97d8bd5c 100644 --- a/src/java/LogrPortal/nbproject/project.properties +++ b/src/java/LogrPortal/nbproject/project.properties @@ -48,6 +48,7 @@ file.reference.dm-api-3.3.1.jar=lib/dm-api-3.3.1.jar file.reference.dm-base-3.3.1.jar=lib/dm-base-3.3.1.jar file.reference.ejb-api-3.0.jar=lib/ejb-api-3.0.jar file.reference.flexmark-0.64.8.jar=lib/flexmark-0.64.8.jar +file.reference.flexmark-ext-tables-0.64.8.jar=lib/flexmark-ext-tables-0.64.8.jar file.reference.flexmark-util-ast-0.64.8.jar=lib/flexmark-util-ast-0.64.8.jar file.reference.flexmark-util-builder-0.64.8.jar=lib/flexmark-util-builder-0.64.8.jar file.reference.flexmark-util-collection-0.64.8.jar=lib/flexmark-util-collection-0.64.8.jar @@ -169,7 +170,8 @@ javac.classpath=\ ${file.reference.flexmark-util-collection-0.64.8.jar}:\ ${file.reference.flexmark-util-format-0.64.8.jar}:\ ${file.reference.flexmark-util-visitor-0.64.8.jar}:\ - ${file.reference.flexmark-util-html-0.64.8.jar} + ${file.reference.flexmark-util-html-0.64.8.jar}:\ + ${file.reference.flexmark-ext-tables-0.64.8.jar} # Space-separated list of extra javac options javac.compilerargs= javac.debug=true diff --git a/src/java/LogrPortal/nbproject/project.xml b/src/java/LogrPortal/nbproject/project.xml index b5acfa92b..d7a9f18fc 100644 --- a/src/java/LogrPortal/nbproject/project.xml +++ b/src/java/LogrPortal/nbproject/project.xml @@ -243,6 +243,10 @@ ${file.reference.flexmark-util-html-0.64.8.jar} WEB-INF/lib + + ${file.reference.flexmark-ext-tables-0.64.8.jar} + WEB-INF/lib + diff --git a/src/java/LogrPortal/src/java/gov/anl/aps/logr/portal/utilities/MarkdownParser.java b/src/java/LogrPortal/src/java/gov/anl/aps/logr/portal/utilities/MarkdownParser.java index 5e8a81081..78048395c 100644 --- a/src/java/LogrPortal/src/java/gov/anl/aps/logr/portal/utilities/MarkdownParser.java +++ b/src/java/LogrPortal/src/java/gov/anl/aps/logr/portal/utilities/MarkdownParser.java @@ -21,6 +21,7 @@ import com.vladsch.flexmark.util.misc.Extension; import com.vladsch.flexmark.util.sequence.BasedSequence; import com.vladsch.flexmark.util.sequence.Escaping; +import com.vladsch.flexmark.ext.tables.TablesExtension; import gov.anl.aps.logr.common.constants.CdbPropertyValue; import java.util.HashSet; @@ -60,13 +61,15 @@ public class MarkdownParser { + "monospaced code content goes here\n" + "```\n" + "\n\n" - + "# Heading Levels:\n" + + "### Table\n\n" + + "| Column1 | Column2 | Column3 |\n" + + "| --- | --- | --- |\n" + + "| Cell 1 | Cell 2 | Cell 3 |\n" + + "\n\n" + + "### Heading Levels\n" + "# Level 1 Heading\n" + "## Level 2 Heading\n" - + "### Level 3 Heading\n" - + "#### Level 4 Heading\n" - + "##### Level 5 Heading\n" - + "###### Level 6 Heading\n"; + + "### Level 3 Heading\n"; private static String contextRoot = null; @@ -79,7 +82,8 @@ public class MarkdownParser { private static MutableDataHolder options = new MutableDataSet() .set(Parser.EXTENSIONS, Arrays.asList( new Extension[]{ - LogrFlexmarkExtension.create() + LogrFlexmarkExtension.create(), + TablesExtension.create() } )); diff --git a/src/java/LogrPortal/web/resources/css/logbook.css b/src/java/LogrPortal/web/resources/css/logbook.css index 4cd29136d..c57d36421 100644 --- a/src/java/LogrPortal/web/resources/css/logbook.css +++ b/src/java/LogrPortal/web/resources/css/logbook.css @@ -133,7 +133,28 @@ pre:has([class^="language-"]) { } .logEntry img { - max-width: 450px; + max-width: 450px; +} + +/* Markdown table styles */ +.logEntry table { + border-collapse: collapse; + width: 100%; + margin: 1em 0; + font-size: 14px; + line-height: 1.5; +} + +.logEntry th, +.logEntry td { + border: 1px solid #ddd; + padding: 10px 12px; +} + +.logEntry th { + background-color: #f5f5f5; + font-weight: 600; + color: #333; } .activeLogEntry { @@ -160,7 +181,7 @@ div.logbookSection { .markdown-example-field { background: white; width: 400px; - height: 700px; + height: 750px; } .markdown-example-field > pre { diff --git a/support/bin/install_netbeans.sh b/support/bin/install_netbeans.sh index 3a9755596..8ff73e496 100755 --- a/support/bin/install_netbeans.sh +++ b/support/bin/install_netbeans.sh @@ -8,7 +8,7 @@ CDB_HOSTNAME=`hostname -f` NETBEANS_VERSION=16 NETBEANS_ZIP_FILE=netbeans-$NETBEANS_VERSION-bin.zip -DOWNLOAD_URL=https://dlcdn.apache.org/netbeans/netbeans/$NETBEANS_VERSION/$NETBEANS_ZIP_FILE +DOWNLOAD_URL=https://archive.apache.org/dist/netbeans/netbeans/$NETBEANS_VERSION/$NETBEANS_ZIP_FILE currentDir=`pwd` cd `dirname $0`/.. && topDir=`pwd` diff --git a/tools/developer_tools/logr_plugins/utilities/plugin_configuration.py b/tools/developer_tools/logr_plugins/utilities/plugin_configuration.py index ed0f8912d..f6b890952 100644 --- a/tools/developer_tools/logr_plugins/utilities/plugin_configuration.py +++ b/tools/developer_tools/logr_plugins/utilities/plugin_configuration.py @@ -28,23 +28,23 @@ def update_plugin_configuration(self, plugin_name, destination_path, configurati ext = ext_split[-1] # Verify that file is not simply called the same as extension adn if ext_split.__len__() > 1 and ext.upper() == configuration_extension.upper(): - print '\n\nUpdating configuration for plugin: %s (%s)' % (plugin_name, listing) + print('\n\nUpdating configuration for plugin: %s (%s)' % (plugin_name, listing)) plugin_listing_path = '%s/%s' % (destination_path, listing) default_configuration = open(plugin_listing_path).read() plugin_configuration_directory = "%s/%s" % (self.cdb_plugin_configuration_storage, plugin_name) plugin_stored_configuration_file = "%s/%s" % (plugin_configuration_directory, listing) if os.path.exists(plugin_stored_configuration_file): - print "Using stored configuration file: %s" % plugin_stored_configuration_file + print("Using stored configuration file: %s" % plugin_stored_configuration_file) else: - print "\n\nNo configuration exists, follow prompts\n" + print("\n\nNo configuration exists, follow prompts\n") resulting_configuration = '' for configuration_line in default_configuration.split('\n'): if configuration_line.startswith('#'): - print 'Configuration Comment: %s' % configuration_line[1:] + print('Configuration Comment: %s' % configuration_line[1:]) resulting_configuration += configuration_line elif configuration_line.startswith('['): - print "Section: %s" % configuration_line + print("Section: %s" % configuration_line) resulting_configuration += configuration_line else: configuration_split = configuration_line.split('=') @@ -56,7 +56,7 @@ def update_plugin_configuration(self, plugin_name, destination_path, configurati if configuration_split.__len__() == 2: config_default_value = configuration_split[1] - config_value = raw_input("%s [%s]: " % (config_key, config_default_value)) + config_value = input("%s [%s]: " % (config_key, config_default_value)) if config_value is None or config_value == '': config_value = config_default_value new_config_line = "%s=%s" % (config_key, config_value) @@ -76,7 +76,7 @@ def update_plugin_configuration(self, plugin_name, destination_path, configurati # Update the configuration stored. shutil.copyfile(plugin_stored_configuration_file, plugin_listing_path) - print 'New configuration stored in deployment: %s' % plugin_listing_path + print('New configuration stored in deployment: %s' % plugin_listing_path) @classmethod def backup_original_plugin_configurations(cls, plugin_storage_path, configuration_extension): @@ -98,7 +98,7 @@ def backup_original_plugin_configurations(cls, plugin_storage_path, configuratio if not os.path.exists(configuration_backup_dir): os.makedirs(configuration_backup_dir) configuration_backup_path = "%s/%s" % (configuration_backup_dir, listing) - print "Storing a default plugin configuration file %s to %s: " % (listing, configuration_backup_path) + print("Storing a default plugin configuration file %s to %s: " % (listing, configuration_backup_path)) shutil.copyfile(configuration_storage_path, configuration_backup_path) return configuration_backup_dir @@ -119,6 +119,6 @@ def restore_configuration(cls, configuration_backup_dir, plugin_storage_path): for listing in directory_listings: configuration_storage_path = "%s/%s" % (plugin_storage_path, listing) configuration_backup_storage_path = "%s/%s" % (configuration_backup_dir, listing) - print "Reverting backup file %s to %s" % (listing, configuration_storage_path) + print("Reverting backup file %s to %s" % (listing, configuration_storage_path)) shutil.move(configuration_backup_storage_path, configuration_storage_path) diff --git a/tools/developer_tools/logr_plugins/utilities/plugin_java_parser.py b/tools/developer_tools/logr_plugins/utilities/plugin_java_parser.py index 51d8c5452..6651371f9 100644 --- a/tools/developer_tools/logr_plugins/utilities/plugin_java_parser.py +++ b/tools/developer_tools/logr_plugins/utilities/plugin_java_parser.py @@ -5,7 +5,7 @@ """ import os -from plugin_configuration import PluginConfiguration +from .plugin_configuration import PluginConfiguration JAVA_PLUGIN_PACKAGE="gov.anl.aps.logr.portal.plugins.support" diff --git a/tools/developer_tools/logr_plugins/utilities/plugin_manager.py b/tools/developer_tools/logr_plugins/utilities/plugin_manager.py index 53fe678d6..68fad43a0 100644 --- a/tools/developer_tools/logr_plugins/utilities/plugin_manager.py +++ b/tools/developer_tools/logr_plugins/utilities/plugin_manager.py @@ -3,7 +3,7 @@ Copyright (c) UChicago Argonne, LLC. All rights reserved. See LICENSE file. """ -from utilities.plugin_python_parser import PluginPythonParser +from .plugin_python_parser import PluginPythonParser try: # attempt to import unique package of cdb python web service to ensure loaded environment @@ -12,17 +12,16 @@ import os, sys directory = os.path.dirname(__file__) fullPath = os.path.abspath(directory + "/../../../..") - print >> sys.stderr, "Environment not loaded. Please run `source %s/setup.sh` before running this script." % ( - fullPath) + print("Environment not loaded. Please run `source %s/setup.sh` before running this script." % fullPath, file=sys.stderr) exit(1) import os import sys -from plugin_java_parser import PluginJavaParser -from plugin_xhtml_parser import PluginXhtmlParser +from .plugin_java_parser import PluginJavaParser +from .plugin_xhtml_parser import PluginXhtmlParser -from objects.cdb_plugin import CdbPlugin +from .objects.cdb_plugin import CdbPlugin LOGR_INSTALL_DIRECTORY = os.environ['LOGR_INSTALL_DIR'] LOGR_DIST_DIRECTORY = os.environ['LOGR_ROOT_DIR'] @@ -62,11 +61,11 @@ def __select_stored_plugin_directory(self): options.append(LOGR_INSTALL_PLUGIN_DIRECTORY) options.append('Specify different directory.') - print 'Select directory for storage of cdb plugins: ' + print('Select directory for storage of cdb plugins: ') for i in range(0, options.__len__()): - print '%i - %s' % (i, options[i]) + print('%i - %s' % (i, options[i])) - selection = raw_input("%i %s [%i]: " % (i, options[i], default_option)) + selection = input("%i %s [%i]: " % (i, options[i], default_option)) if selection is None or selection == '': selection = default_option @@ -76,7 +75,7 @@ def __select_stored_plugin_directory(self): exit(1) if selection == 2: - result = raw_input("Please enter the path to directory with all plug-ins: ") + result = input("Please enter the path to directory with all plug-ins: ") else: result = options[selection] @@ -139,7 +138,7 @@ def __deploy_portal_plugin(self, selection): def __prompt_plugin_action(self, actionPrompt, actionMethod): self.list_plugins() - selection = raw_input("%s [All]: " % actionPrompt) + selection = input("%s [All]: " % actionPrompt) if selection == "" or selection == "All": selection = None else: @@ -147,11 +146,11 @@ def __prompt_plugin_action(self, actionPrompt, actionMethod): actionMethod(selection) - print "\n\nCompleted: result plugin list." + print("\n\nCompleted: result plugin list.") self.list_plugins() def update_auto_generated_files(self, update_configuration=True): - print 'Updating auto-generated CDB plugin files' + print('Updating auto-generated CDB plugin files') self.__update_autogenerated_files(update_configuration) def __update_autogenerated_files(self, update_configuration=True): @@ -194,11 +193,11 @@ def __update_autogenerated_files(self, update_configuration=True): # Create a __init__.py file for all python plugins. init_file_path = "%s/%s" % (LOGR_PYTHON_PLUGIN_PATH, '__init__.py') init_file = os.open(init_file_path, os.O_CREAT|os.O_WRONLY) - os.write(init_file, "#!/usr/bin/env python\n") - os.write(init_file, "\"\"\"\n") - os.write(init_file, "Copyright (c) UChicago Argonne, LLC. All rights reserved.\n") - os.write(init_file, "See LICENSE file.\n") - os.write(init_file, "\"\"\"") + os.write(init_file, b"#!/usr/bin/env python\n") + os.write(init_file, b"\"\"\"\n") + os.write(init_file, b"Copyright (c) UChicago Argonne, LLC. All rights reserved.\n") + os.write(init_file, b"See LICENSE file.\n") + os.write(init_file, b"\"\"\"") os.close(init_file) @staticmethod @@ -254,13 +253,13 @@ def __print_selection_list(self, selection_list, title): listItemFormat = '*%4s - %-' + str(width - 36) + 's %-6s %-6s %-12s*' - print '\nSaved plugins are located in plug-in directory: %s' % self.plugin_storage_directory - print 'for xhtml, java, python (s = stored d=deployed)' + print('\nSaved plugins are located in plug-in directory: %s' % self.plugin_storage_directory) + print('for xhtml, java, python (s = stored d=deployed)') - print "\n%s %s %s" % (header_before, title, header_after) - print listItemFormat % ('#', 'Plugin Name', 'Xhtml', 'Java', 'Python') + print("\n%s %s %s" % (header_before, title, header_after)) + print(listItemFormat % ('#', 'Plugin Name', 'Xhtml', 'Java', 'Python')) column_header_seperator = '-' * (width-2) - print '*%s*' % (column_header_seperator) + print('*%s*' % (column_header_seperator)) for i in range(0, selection_list.__len__()): plugin = selection_list[i] xhtml = '' @@ -281,8 +280,8 @@ def __print_selection_list(self, selection_list, title): xhtml += 'd' - print listItemFormat % (str(i), plugin.plugin_name, xhtml, java, python) - print '*' * width + print(listItemFormat % (str(i), plugin.plugin_name, xhtml, java, python)) + print('*' * width) if __name__ == '__main__': plugin_manager = PluginManager() diff --git a/tools/developer_tools/logr_plugins/utilities/plugin_python_parser.py b/tools/developer_tools/logr_plugins/utilities/plugin_python_parser.py index 6d9c624fb..dcfffe85a 100644 --- a/tools/developer_tools/logr_plugins/utilities/plugin_python_parser.py +++ b/tools/developer_tools/logr_plugins/utilities/plugin_python_parser.py @@ -4,7 +4,7 @@ See LICENSE file. """ -from plugin_configuration import PluginConfiguration +from .plugin_configuration import PluginConfiguration CONFIGURATION_FILE_EXTENSION = "cfg"