diff --git a/misc/config_tools/configurator/packages/configurator/package.json b/misc/config_tools/configurator/packages/configurator/package.json index 4cb059988..29fbae79e 100644 --- a/misc/config_tools/configurator/packages/configurator/package.json +++ b/misc/config_tools/configurator/packages/configurator/package.json @@ -24,6 +24,7 @@ "ajv-i18n": "^4.2.0", "bootstrap": "^5.1.3", "bootstrap-vue-3": "^0.1.10", + "encoding": "^0.1.13", "js-base64": "^3.7.2", "lodash": "^4.17.21", "naive-ui": "^2.28.1", diff --git a/misc/config_tools/configurator/packages/configurator/src/pages/Config.vue b/misc/config_tools/configurator/packages/configurator/src/pages/Config.vue index d2c8aaf26..38d258cb1 100644 --- a/misc/config_tools/configurator/packages/configurator/src/pages/Config.vue +++ b/misc/config_tools/configurator/packages/configurator/src/pages/Config.vue @@ -34,7 +34,8 @@
-
@@ -94,6 +95,7 @@ export default { props: ['WorkingFolder'], mounted() { this.updateCurrentFormSchema() + window.getCurrentFormSchemaData = this.getCurrentFormSchemaData window.getCurrentScenarioData = this.getCurrentScenarioData }, data() { @@ -147,6 +149,9 @@ export default { this.updateCurrentFormSchema() this.updateCurrentFormData() }, + getCurrentFormSchemaData() { + return this.currentFormSchema + }, getCurrentScenarioData() { return this.scenario }, @@ -189,7 +194,7 @@ export default { let vmConfigcurrent = [] let postvmlist = [] let isserivevm = false - let msg='' + let msg = '' this.scenario.vm.map((vmConfig, vmIndex) => { if (vmConfig['@id'] === this.activeVMID) { currentVMIndex = vmIndex @@ -209,7 +214,7 @@ export default { confirm(msg).then((r) => { if (r) { if (isserivevm) { - for (let i=postvmlist.length-1; i>=0; i--) { + for (let i = postvmlist.length - 1; i >= 0; i--) { this.scenario.vm.splice(postvmlist[i], 1); } } @@ -283,29 +288,29 @@ export default { debugger // begin write down and verify configurator.writeFile(this.WorkingFolder + 'scenario.xml', scenarioXMLData) - .then(() => { - step = 1 - configurator.pythonObject.validateScenario(this.board.content, scenarioXMLData) - }) - .then(() => { + .then(() => { + step = 1 + configurator.pythonObject.validateScenario(this.board.content, scenarioXMLData) + }) + .then(() => { step = 2 let launchScripts = configurator.pythonObject.generateLaunchScript(this.board.content, scenarioXMLData) for (let filename in launchScripts) { configurator.writeFile(this.WorkingFolder + filename, launchScripts[filename]) } - }) - .then(() => { + }) + .then(() => { alert(`${msg.join('')} \n All files successfully saved to your working folder ${this.WorkingFolder}`) - }) - .catch((err) => { - console.log(err) - let outmsg = '' - for (var i = 0; i < step; i++) - outmsg += msg[i] - for (i = step; i < 3; i++) - outmsg += errmsg[i] - alert(`${outmsg} \n Please check your configuration`) - }) + }) + .catch((err) => { + console.log(err) + let outmsg = '' + for (var i = 0; i < step; i++) + outmsg += msg[i] + for (i = step; i < 3; i++) + outmsg += errmsg[i] + alert(`${outmsg} \n Please check your configuration`) + }) } } } @@ -316,7 +321,7 @@ export default { position: absolute; right: 1rem; top: 64px; - z-index: 3; + z-index: 5; } diff --git a/misc/config_tools/configurator/packages/configurator/src/pages/Config/ConfigForm.vue b/misc/config_tools/configurator/packages/configurator/src/pages/Config/ConfigForm.vue index 1d3eec450..f27d9b42c 100644 --- a/misc/config_tools/configurator/packages/configurator/src/pages/Config/ConfigForm.vue +++ b/misc/config_tools/configurator/packages/configurator/src/pages/Config/ConfigForm.vue @@ -57,6 +57,7 @@ import {Icon} from "@vicons/utils"; import {Minus} from "@vicons/fa" import localizeEn from 'ajv-i18n/localize/en'; import IVSHMEM_REGION from "./ConfigForm/CustomWidget/IVSHMEM_REGION.vue"; +import cpu_affinity from "./ConfigForm/CustomWidget/cpu_affinity.vue"; i18n.useLocal(localizeEn); export default { @@ -78,6 +79,9 @@ export default { "labelSuffix": ":" }, uiSchema: { + "cpu_affinity": { + 'ui:field': cpu_affinity + }, "FEATURES": { "IVSHMEM": { "ui:title": "InterVM shared memory", diff --git a/misc/config_tools/configurator/packages/configurator/src/pages/Config/ConfigForm/CustomWidget/cpu_affinity.vue b/misc/config_tools/configurator/packages/configurator/src/pages/Config/ConfigForm/CustomWidget/cpu_affinity.vue new file mode 100644 index 000000000..a79d7b010 --- /dev/null +++ b/misc/config_tools/configurator/packages/configurator/src/pages/Config/ConfigForm/CustomWidget/cpu_affinity.vue @@ -0,0 +1,134 @@ + + + + + \ No newline at end of file diff --git a/misc/config_tools/configurator/packages/configurator/src/pages/Config/ConfigForm/CustomWidget/uiSchemaGenerate.py b/misc/config_tools/configurator/packages/configurator/src/pages/Config/ConfigForm/CustomWidget/uiSchemaGenerate.py new file mode 100644 index 000000000..d7cc9e6cf --- /dev/null +++ b/misc/config_tools/configurator/packages/configurator/src/pages/Config/ConfigForm/CustomWidget/uiSchemaGenerate.py @@ -0,0 +1,30 @@ +import json + + +def generate_ui_schema(cur_node_name): + def _handle(node_path_list: list): + val = node_path_list[0] + if val == '0': + val = 'items' + if len(node_path_list) == 1: + return { + val: {} + } + node_path_list = node_path_list[1:] + + return { + val: _handle(node_path_list) + } + + path_list = cur_node_name.split('.') + return _handle(path_list) + + +def main(): + name = 'cpu_affinity.pcpu.0.pcpu_id' + result = generate_ui_schema(name) + print(json.dumps(result, indent=' ')) + + +if __name__ == '__main__': + main() diff --git a/misc/config_tools/configurator/yarn.lock b/misc/config_tools/configurator/yarn.lock index e5ddaa831..9c89ddd36 100644 --- a/misc/config_tools/configurator/yarn.lock +++ b/misc/config_tools/configurator/yarn.lock @@ -427,6 +427,13 @@ diff-sequences@^27.5.1: resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-27.5.1.tgz#eaecc0d327fd68c8d9672a1e64ab8dccb2ef5327" integrity sha512-k1gCAXAsNgLwEL+Y8Wvl+M6oEFj5bgazfZULpS5CneoPPXRaCCW7dm+q21Ky2VEE5X+VeRDBVg1Pcvvsr4TtNQ== +encoding@^0.1.13: + version "0.1.13" + resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.13.tgz#56574afdd791f54a8e9b2785c0582a2d26210fa9" + integrity sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A== + dependencies: + iconv-lite "^0.6.2" + esbuild-android-64@0.14.38: version "0.14.38" resolved "https://registry.yarnpkg.com/esbuild-android-64/-/esbuild-android-64-0.14.38.tgz#5b94a1306df31d55055f64a62ff6b763a47b7f64" @@ -619,6 +626,13 @@ highlight.js@^11.5.0: resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-11.5.1.tgz#027c24e4509e2f4dcd00b4a6dda542ce0a1f7aea" integrity sha512-LKzHqnxr4CrD2YsNoIf/o5nJ09j4yi/GcH5BnYz9UnVpZdS4ucMgvP61TDty5xJcFGRjnH4DpujkS9bHT3hq0Q== +iconv-lite@^0.6.2: + version "0.6.3" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501" + integrity sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw== + dependencies: + safer-buffer ">= 2.1.2 < 3.0.0" + immutable@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.0.0.tgz#b86f78de6adef3608395efb269a91462797e2c23" @@ -814,6 +828,11 @@ rollup@^2.59.0: optionalDependencies: fsevents "~2.3.2" +"safer-buffer@>= 2.1.2 < 3.0.0": + version "2.1.2" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== + sass@^1.50.0: version "1.51.0" resolved "https://registry.yarnpkg.com/sass/-/sass-1.51.0.tgz#25ea36cf819581fe1fe8329e8c3a4eaaf70d2845"