diff --git a/docker/routlin-dash/app/factory.py b/docker/routlin-dash/app/factory.py
index fd80612..0420628 100644
--- a/docker/routlin-dash/app/factory.py
+++ b/docker/routlin-dash/app/factory.py
@@ -24,7 +24,6 @@ COMMON_JS_FILE = os.path.join(DATA_DIR, 'common.js')
LEVEL_RANK = {'nothing': 0, 'viewer': 1, 'administrator': 2, 'manager': 3}
-STANDARD_INPUT_TYPES = {'text', 'password', 'number', 'checkbox', 'select', 'textarea'}
VALIDATION_FLAGS = {
'VALIDATION_IPV4_FORMAT': 1 << 0,
@@ -114,30 +113,6 @@ def apply_tokens(text, tokens):
return re.sub(r'%([A-Z_]+)%', lambda m: str(tokens.get(m.group(1), m.group(0))), text)
-def expand_fields(obj, tokens):
- """Recursively apply token substitution to a field-definition object.
- String values that resolve to a JSON array or object are parsed back into
- Python structures so they serialize correctly into data-fields JSON."""
- if isinstance(obj, list):
- return [expand_fields(item, tokens) for item in obj]
- if isinstance(obj, dict):
- out = {}
- for k, v in obj.items():
- if isinstance(v, str):
- s = apply_tokens(v, tokens)
- if s != v and s[:1] in ('[', '{'):
- try:
- out[k] = json.loads(s)
- continue
- except Exception:
- pass
- out[k] = s
- else:
- out[k] = expand_fields(v, tokens)
- return out
- return obj
-
-
def js_str(value):
return json.dumps(str(value))
@@ -156,18 +131,6 @@ def parse_validation(s):
return result
-def _encode_field_validations(fields):
- out = []
- for f in fields:
- f2 = dict(f)
- raw = f2.get('validate', '')
- if not raw and f2.get('input_type') == 'number':
- raw = 'VALIDATION_RANGE_INT'
- if raw and isinstance(raw, str):
- f2['validate'] = parse_validation(raw)
- out.append(f2)
- return out
-
def build_big_validate():
body = r"""
@@ -248,12 +211,6 @@ return _ok();"""
return f'function bigValidate(value,validation,collisions,dedup,arg1,arg2){{{body}\n}}'
-def get_worker_id(datasource):
- for prefix in ('config:', 'live:'):
- if datasource.startswith(prefix):
- return datasource[len(prefix):]
- return ''
-
def table_token_key(spec):
return 'TABLE_' + re.sub(r'[^A-Z0-9]', '_', spec.upper())
@@ -920,58 +877,6 @@ def build_editable_list(item, tokens):
f'{hint_html}'
)
-# Table worker script =================================================
-
-def build_table_worker_script(item, expanded_ra_fields):
- """Emit a \n'
- )
- return f'\n'
-
# Table cell renderer =================================================
def build_table_cell(value, render_fn, col_class='', field='', row_idx=None,
@@ -1102,12 +1007,6 @@ def build_table(item, tokens, rows, inherited_req=None):
if row_actions:
thead += '
'
- expanded_ra_fields = {
- i: _encode_field_validations(expand_fields(ra.get('fields', []), tokens))
- for i, ra in enumerate(row_actions)
- if ra.get('method', 'post').lower() == 'inline_edit'
- }
-
if not rows:
colspan = len(columns) + (1 if row_actions else 0)
tbody = f'
{empty}
'
@@ -1157,39 +1056,21 @@ def build_table(item, tokens, rows, inherited_req=None):
row_json = e(json.dumps(row))
btns += (
f''
)
- elif method == 'inline_edit':
- expanded = expanded_ra_fields.get(ra_i, [])
- fields_json = e(json.dumps(expanded))
- row_json = e(json.dumps(row))
- worker_id = get_worker_id(item.get('datasource', ''))
- has_nonstandard = any(
- f.get('input_type', 'text') not in STANDARD_INPUT_TYPES
- for f in expanded
- )
- worker_attr = f' data-worker-id="{e(worker_id)}"' if has_nonstandard and worker_id else ''
- btns += (
- f''
- )
else:
btns += f'{text}'
cells += f'