Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.vscode
.DS_Store
src/python/.loglogin
.loglogin

# Compiled files
*.pyc
Expand Down
18 changes: 9 additions & 9 deletions sbin/cdb_create_configuration_openssl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion sbin/cdb_create_db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion sbin/cdb_deploy_mysqld.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Binary file not shown.
4 changes: 3 additions & 1 deletion src/java/LogrPortal/nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/java/LogrPortal/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@
<file>${file.reference.flexmark-util-html-0.64.8.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library dirs="200">
<file>${file.reference.flexmark-ext-tables-0.64.8.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
</web-module-libraries>
<web-module-additional-libraries/>
<source-roots>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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()
}
));

Expand Down
25 changes: 23 additions & 2 deletions src/java/LogrPortal/web/resources/css/logbook.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -160,7 +181,7 @@ div.logbookSection {
.markdown-example-field {
background: white;
width: 400px;
height: 700px;
height: 750px;
}

.markdown-example-field > pre {
Expand Down
2 changes: 1 addition & 1 deletion support/bin/install_netbeans.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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('=')
Expand All @@ -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)
Expand All @@ -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):
Expand All @@ -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
Expand All @@ -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)

Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
49 changes: 24 additions & 25 deletions tools/developer_tools/logr_plugins/utilities/plugin_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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']
Expand Down Expand Up @@ -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

Expand All @@ -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]

Expand Down Expand Up @@ -139,19 +138,19 @@ 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:
selection = int(selection)

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):
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 = ''
Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
See LICENSE file.
"""

from plugin_configuration import PluginConfiguration
from .plugin_configuration import PluginConfiguration

CONFIGURATION_FILE_EXTENSION = "cfg"

Expand Down