linuxrouter/docker/routlin-dash/app/pages/accountmanage/view.py

18 lines
801 B
Python
Raw Normal View History

2026-06-02 00:47:03 -04:00
import json
2026-06-07 00:21:08 -04:00
import config_utils
import factory
2026-06-02 00:47:03 -04:00
def collect_tokens(cfg):
2026-06-07 00:21:08 -04:00
tokens = config_utils.collect_layout_tokens(cfg)
2026-06-02 12:49:39 -04:00
tokens['ACCOUNT_LEVEL_OPTIONS'] = json.dumps([
{'value': 'viewer', 'label': 'Viewer (read-only access to live data)'},
{'value': 'administrator', 'label': 'Administrator (can modify configuration)'},
{'value': 'manager', 'label': 'Manager (full access including account management)'},
])
2026-06-07 00:21:08 -04:00
content = factory.load_json(f'{factory.PAGES_DIR}/accountmanage/content.json')
for table_item in factory.iter_table_items(content.get('items', [])):
2026-06-02 12:49:39 -04:00
ds = table_item.get('datasource', '')
2026-06-07 00:21:08 -04:00
tokens[factory.table_token_key(ds)] = factory.build_table(table_item, tokens, config_utils.load_datasource(ds))
2026-06-02 12:49:39 -04:00
return tokens