acrn-hypervisor/misc/config_tools/configurator/pyodide/pyodide.py
Weiyi-Feng 06b942f5eb config_tools: Add vue-json-schema-form and advanced custom component for IVSHMEM field
1. add Vue devtools support
2. update project dependencies
3. refactor configurator source code tree for private library hook
4. fix build issue
5. dynamic load scenario JSON schema(fix cache issue)
6. add vjsf 1.12.2 (latest) for private package dependencies
7. remove vjsf unnecessary files
8. use private vjsf as configurator dependencies
9. Add custom IVSHMEM_REGION widget
10. add a script to populate default values
11. get default values before export scenario xml
12. specify widgets in XML schema
13. add missing vjsf license file
14. populate default values to empty nodes
15. when user clicks save button, update formData with each field default value
16. fix when the user clicks the save button will collapse configFom
17. add success message for saving scenario XML

vue-json-schema-form 1.12.2 (latest)link: b30ea7c2d6/packages/lib

Tracked-On: #6691
Signed-off-by: Weiyi Feng <weiyix.feng@intel.com>
2022-05-08 15:52:28 +08:00

61 lines
1.4 KiB
Python

#!/usr/bin/env python3
__package__ = 'configurator.pyodide'
import json
import sys
from pathlib import Path
class LazyPath:
def __init__(self, my):
self.my = my
def __truediv__(self, other):
return str(self.my / other)
def file_text(path):
return open(path, encoding='utf-8').read()
# path define
config_tools_dir = Path(__file__).absolute().parent.parent.parent
configurator_dir = config_tools_dir / 'configurator' / 'packages' / 'configurator'
schema_dir = config_tools_dir / 'schema'
scenario_xml_schema_path = schema_dir / 'sliced.xsd'
datachecks_xml_schema_path = schema_dir / 'allchecks.xsd'
nuc11_folder = LazyPath(config_tools_dir / 'data' / 'nuc11tnbi5')
# file define
nuc11_board = file_text(nuc11_folder / 'nuc11tnbi5.xml')
nuc11_scenario = file_text(nuc11_folder / 'shared_launch_6user_vm.xml')
scenario_json_schema = file_text(configurator_dir / 'src' / 'assets' / 'schema' / 'scenario.json')
IS_WEB = sys.platform == 'emscripten'
def convert_result(result):
if not IS_WEB:
print(json.dumps(result, indent=' '))
return json.dumps(result)
def write_temp_file(tmpdir, file_dict: dict):
temp_path = Path(tmpdir)
for filename, content in file_dict.items():
with open(temp_path / filename, 'w', encoding='utf-8') as f:
f.write(content)
def main():
pass
def test():
pass
if __name__ == '__main__':
test()