17 lines
655 B
Python
17 lines
655 B
Python
import json
|
|
import config_utils
|
|
import factory
|
|
|
|
|
|
def collect_tokens(cfg):
|
|
tokens = config_utils.collect_layout_tokens(cfg)
|
|
tokens['PROTOCOL_OPTIONS'] = json.dumps([
|
|
{'value': 'tcp', 'label': 'TCP'},
|
|
{'value': 'udp', 'label': 'UDP'},
|
|
{'value': 'both', 'label': 'TCP/UDP'},
|
|
])
|
|
content = factory.load_json(f'{factory.PAGES_DIR}/portforwarding/content.json')
|
|
for table_item in factory.iter_table_items(content.get('items', [])):
|
|
ds = table_item.get('datasource', '')
|
|
tokens[factory.table_token_key(ds)] = factory.build_table(table_item, tokens, config_utils.load_datasource(ds))
|
|
return tokens
|