Include diagnostic info in the SCENARIO label when updating a .vsav file.

master
Pacman Ghost 4 years ago
parent 575e217c68
commit 59a05e7a22
  1. 5
      vasl_templates/webapp/data/default-template-pack/scenario.j2
  2. 16
      vasl_templates/webapp/main.py
  3. 2
      vasl_templates/webapp/static/main.js
  4. 9
      vasl_templates/webapp/static/snippets.js
  5. 2
      vasl_templates/webapp/tests/test_vassal.py

@ -1,4 +1,9 @@
<html> <!-- vasl-templates:id {{SNIPPET_ID}} -->
{%if APP_NAME%} <!-- Generated by {{APP_NAME}} {{APP_VERSION}}:
Time: {{TIMESTAMP}}
VASSAL:{%if VASSAL_VERSION %} {{VASSAL_VERSION}} {%else%} - {%endif%}
VASL: {%if VASL_VERSION%} {{VASL_VERSION}} {%else%} - {%endif%}
--> {%endif%}
<head>
<meta charset="utf-8">

@ -8,7 +8,9 @@ from flask import request, render_template, jsonify, send_file, redirect, url_fo
from vasl_templates.webapp import app
from vasl_templates.webapp.utils import MsgStore
import vasl_templates.webapp.config.constants
from vasl_templates.webapp.config.constants import BASE_DIR, DATA_DIR
from vasl_templates.webapp import globvars
startup_msg_store = MsgStore() # store messages generated during startup
_check_versions = True
@ -65,10 +67,20 @@ _APP_CONFIG_DEFAULTS = { # Bodhgaya, India (APR/19)
@app.route( "/app-config" )
def get_app_config():
"""Get the application config."""
return jsonify( {
vals = {
key: app.config.get( key, default )
for key,default in _APP_CONFIG_DEFAULTS.items()
} )
}
for key in ["APP_NAME","APP_VERSION","APP_DESCRIPTION","APP_HOME_URL"]:
vals[ key ] = getattr( vasl_templates.webapp.config.constants, key )
try:
from vasl_templates.webapp.vassal import VassalShim
vals[ "VASSAL_VERSION" ] = VassalShim().get_version()
except: #pylint: disable=bare-except
pass
if globvars.vasl_mod:
vals["VASL_VERSION"] = globvars.vasl_mod.vasl_version
return jsonify( vals )
# ---------------------------------------------------------------------

@ -492,7 +492,7 @@ function update_page_load_status( id )
function show_startup_msgs( msgs, msg_type ) {
if ( msg_type in msgs ) {
for ( var i=0 ; i < msgs[msg_type].length ; ++i )
doShowNotificationMsg( msg_type, msgs[msg_type][i] ) ;
doShowNotificationMsg( msg_type, msgs[msg_type][i] ) ;
}
}

@ -124,7 +124,16 @@ function make_snippet( $btn, params, extra_params, show_date_warnings )
var template_id = $btn.data( "id" ) ;
var snippet_save_name = null ;
// add server constants
if ( ! getUrlParam( "no_app_config_snippet_params" ) ) {
params.APP_NAME = gAppConfig.APP_NAME ;
params.APP_VERSION = gAppConfig.APP_VERSION ;
params.VASSAL_VERSION = gAppConfig.VASSAL_VERSION ;
params.VASL_VERSION = gAppConfig.VASL_VERSION ;
}
// add simple parameters
params.TIMESTAMP = (new Date()).toISOString() ;
params.IMAGES_BASE_URL = gUserSettings["scenario-images-source"] == SCENARIO_IMAGES_SOURCE_INTERNET ?
gAppConfig.ONLINE_IMAGES_URL_BASE :
APP_URL_BASE + gImagesBaseUrl ;

@ -35,7 +35,7 @@ def test_full_update( webapp, webdriver ):
"""Test updating a scenario that contains the full set of snippets."""
# initialize
control_tests = init_webapp( webapp, webdriver, vsav_persistence=1,
control_tests = init_webapp( webapp, webdriver, vsav_persistence=1, no_app_config_snippet_params=1,
reset = lambda ct: ct.set_data_dir( dtype="real" )
)

Loading…
Cancel
Save