Commit 9b9b3877 authored by Martin Schorb's avatar Martin Schorb
Browse files

check render naming conventions for all inputs

parent 5bb513a9
Pipeline #23814 passed with stage
in 25 seconds
......@@ -18,6 +18,8 @@ import json
from app import app
import params
from utils import checks
from utils import helper_functions as hf
......@@ -64,6 +66,7 @@ def update_mc_owner_dd(init_in, new_owner, dd_own_in):
elif 'input' in trigger:
dd_options = dd_own_in.copy()
new_owner = checks.clean_render_name(new_owner)
dd_options.append({'label':new_owner, 'value':new_owner})
mc_owner = new_owner
......@@ -130,7 +133,8 @@ def pointmatch_mcown_dd_sel(mc_own_sel,new_mc,mc_dd_opt,init_match,new_enabled='
mc_style = {'display':'flex'}
elif 'mc_input' in trigger:
div1style = {'display':'none'}
div1style = {'display':'none'}
new_mc = checks.clean_render_name(new_mc)
mc_dd_opt.append({'label':new_mc, 'value':new_mc})
mc_dd_val = new_mc
mc_style = {'display':'flex'}
......
......@@ -21,7 +21,7 @@ import importlib
from app import app
import params
from utils import launch_jobs
from utils import launch_jobs,checks
# element prefix
......@@ -151,7 +151,9 @@ def sbem_conv_new_proj(project_name,dd_options):
ctx = dash.callback_context
trigger = ctx.triggered[0]['prop_id']
if trigger != '.':
# get list of projects on render server
project_name = checks.clean_render_name(project_name)
# add new project to dropdown
dd_options.append({'label':project_name, 'value':project_name})
return dd_options,project_name
......@@ -217,6 +219,7 @@ def sbem_conv_stacks(project_sel,newstack_name,orig_proj,dd_options):
elif trigger == 'stack_input':
newstack_name = checks.clean_render_name(newstack_name)
dd_options.append({'label':newstack_name, 'value':newstack_name})
stack = newstack_name
......
......@@ -21,7 +21,7 @@ import params
from app import app
from utils import pages,launch_jobs
from utils import pages,launch_jobs,checks
from utils import helper_functions as hf
......@@ -117,8 +117,10 @@ stack_div = html.Div(id=module+'out_stack_div',children=[html.H4("Select Output
],id=module+'newstack',style={'display':'none'}),
html.Br(),
html.Div([html.A('Browse Project',id=module+'browse_proj',target="_blank"),
' - ',
html.A('Browse Stack',id=module+'browse_stack',target="_blank")],style={'display':'flex'}),
html.Div([' - ',
html.A('Browse Stack',id=module+'browse_stack',target="_blank")
],id=module+'browse_stackdiv',style={'display':'flex','white-space': 'pre'})
],style={'display':'flex'}),
html.Br(),]
)
......@@ -154,6 +156,7 @@ def sbem_conv_stacks(dd_options_in,newstack_name,owner,project_sel):
stack = 'newstack'
elif trigger == 'stack_input':
newstack_name=checks.clean_render_name(newstack_name)
dd_options.append({'label':newstack_name, 'value':newstack_name})
stack = newstack_name
......@@ -163,7 +166,7 @@ def sbem_conv_stacks(dd_options_in,newstack_name,owner,project_sel):
@app.callback([Output(module+'browse_stack','href'),
Output(module+'browse_stack','style')],
Output(module+'browse_stackdiv','style')],
Input({'component':'outstack_dd','module' : module},'value'),
[State({'component': 'project_dd', 'module': module}, 'value'),
State({'component': 'owner_dd', 'module': module}, 'value')])
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 30 18:01:50 2021
@author: schorb
"""
import re
def clean_render_name(instr):
return re.sub('[^a-zA-Z0-9_]','_',instr)
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment