Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

👑 Імпорт/експорт сторінок #1

Open
pupenasan opened this issue May 23, 2023 · 1 comment
Open

👑 Імпорт/експорт сторінок #1

pupenasan opened this issue May 23, 2023 · 1 comment

Comments

@pupenasan
Copy link

🥰 Requirements Description [Describe the requirements in detail so that everyone can understand]

Функція імпорт/експорт сторінок значно прискорює процес перенесення частини коду UI. Сторінки досить незалежні юніти, тому думаю що не має бути проблеми в реалізації.

🧐 Solution [If you have a solution, articulate it here]

Наразі я спробував зробити рішення по об'єднанню двох проектів в один. Звісно там є купа обмежень, але ця спроба показала, що вирішення задачі не таке важке. Наведу в наступному коментарі.

🚑 Other information [Other information such as screenshots can be posted here]

@pupenasan
Copy link
Author

[{"id":"33cb77a1d269733f","type":"inject","z":"400c0225dfce0fe8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":185,"y":80,"wires":[["186aebe8b3463fc6"]],"l":false},{"id":"186aebe8b3463fc6","type":"file in","z":"400c0225dfce0fe8","name":"","filename":"E:\\san\\AKIT\\ДИСЦИП\\Довідник Node-RED\\NodREDGuide\\ubos\\uijson\\ui_auth.json","filenameType":"str","format":"utf8","chunk":false,"sendError":false,"encoding":"utf8","allProps":false,"x":255,"y":80,"wires":[["5a99aa39a38559a3"]],"l":false},{"id":"5a99aa39a38559a3","type":"json","z":"400c0225dfce0fe8","name":"","property":"payload","action":"","pretty":false,"x":335,"y":80,"wires":[["256ce22cc82e85d2"]],"l":false},{"id":"256ce22cc82e85d2","type":"function","z":"400c0225dfce0fe8","name":"function 5","func":"flow.set (\"oriprj\", JSON.parse(JSON.stringify(msg.payload)));\nflow.set (\"cmpltprj\", msg.payload);\nmsg.toprj = msg.payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":415,"y":80,"wires":[["b35a603c544b2b5f"]],"l":false},{"id":"b35a603c544b2b5f","type":"file in","z":"400c0225dfce0fe8","name":"","filename":"E:\\san\\AKIT\\ДИСЦИП\\Довідник Node-RED\\NodREDGuide\\ubos\\uijson\\dtapp2.json","filenameType":"str","format":"utf8","chunk":false,"sendError":false,"encoding":"utf8","allProps":false,"x":255,"y":140,"wires":[["6923fe59ce90e76f"]],"l":false},{"id":"6923fe59ce90e76f","type":"json","z":"400c0225dfce0fe8","name":"","property":"payload","action":"","pretty":false,"x":345,"y":140,"wires":[["24e1bac83564d191"]],"l":false},{"id":"24e1bac83564d191","type":"function","z":"400c0225dfce0fe8","name":"function 6","func":"flow.set (\"fromprj\", msg.payload);\nmsg.fromprj = msg.payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":425,"y":140,"wires":[["72ca5d26c5cead8f"]],"l":false},{"id":"72ca5d26c5cead8f","type":"function","z":"400c0225dfce0fe8","name":"pages","func":"let cmpltprj = flow.get ('cmpltprj')[0];  \nlet fromprj = flow.get ('fromprj')[0]; \nlet pages = cmpltprj.application.pages;\nfor (let page of fromprj.application.pages) {\n    page.isDefault = false;\n    pages.push (page);\n}\n\nfor (let dsl of cmpltprj.application.function_dsl){\n    for (let page of fromprj.application.pages){\n        let pagename = page._id;\n        dsl.dontLookPage.push(pagename);\n    }\n}\n\n\nlet pagescmplt = cmpltprj.newPage;\nlet pegesfrom = fromprj.newPage;\nlet applicationId = cmpltprj.application.name;\nfor (let page of pegesfrom) {\n    page.applicationId = applicationId;\n    pagescmplt.push (page);\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":290,"y":200,"wires":[["ccf7070a13a66ff1"]]},{"id":"ccf7070a13a66ff1","type":"function","z":"400c0225dfce0fe8","name":"actions","func":"let cmpltprj = flow.get ('cmpltprj')[0];  \nlet oriprj = flow.get ('oriprj')[0];\nlet fromprj = flow.get ('fromprj')[0]; \n\nlet actionsscmplt = cmpltprj.newAction;\nlet actionsfrom = fromprj.newAction;\nlet applicationId = cmpltprj.application.slug;\nlet organizationId = cmpltprj.application.organizationId;\n\nfor (let action of actionsfrom) {\n    action.applicationId = applicationId;\n    action.organizationId = organizationId;\n    //action.Action.datasource.organizationId = organizationId;\n    actionsscmplt.push(action);\n    //console.log (action);\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":300,"y":240,"wires":[["e5bdedd1366951c6"]]},{"id":"e5bdedd1366951c6","type":"function","z":"400c0225dfce0fe8","name":"collections","func":"let cmpltprj = flow.get ('cmpltprj')[0];  \nlet oriprj = flow.get ('oriprj')[0];\nlet fromprj = flow.get ('fromprj')[0]; \n\nlet collscmplt = cmpltprj.newCollection;\nlet collsfrom = fromprj.newCollection;\nlet applicationId = cmpltprj.application.name;\nlet organizationId = cmpltprj.application.organizationId;\n\nfor (let collection of collsfrom) {\n    collection.applicationId = applicationId;\n    collection.organizationId = organizationId;\n    for (let action of collection.actions) {\n        action.applicationId = applicationId;\n        action.organizationId = organizationId;\n    }    \n    collscmplt.push(collection)\n}\nmsg.payload = [cmpltprj];\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":280,"wires":[["f19240e06ec468d4"]]},{"id":"f19240e06ec468d4","type":"file","z":"400c0225dfce0fe8","name":"","filename":"E:\\san\\AKIT\\ДИСЦИП\\Довідник Node-RED\\NodREDGuide\\ubos\\uijson\\cmplt.json","filenameType":"str","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"utf8","x":305,"y":340,"wires":[[]],"l":false}]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant