Commit a2bb956ac6582cd5509f97c59deded1cfd8cfad7
1 parent
aa5957eced
Exists in
master
change get menu
Showing 12 changed files with 26 additions and 65 deletions Side-by-side Diff
- __pycache__/routes.cpython-310.pyc
- components/k2test/__pycache__/__init__.cpython-310.pyc
- components/k2test/k2test/__pycache__/__init__.cpython-310.pyc
- components/k2test/k2test/__pycache__/views.cpython-310.pyc
- components/k2test/k2test/views.py
- components/menu.yml
- db/database.db
- k2/__pycache__/k2cfg.cpython-310.pyc
- k2/__pycache__/k2inst.cpython-310.pyc
- k2/__pycache__/k2obj.cpython-310.pyc
- k2/k2cfg.py
- k2/k2inst.py
__pycache__/routes.cpython-310.pyc
No preview for this file type
components/k2test/__pycache__/__init__.cpython-310.pyc
No preview for this file type
components/k2test/k2test/__pycache__/__init__.cpython-310.pyc
No preview for this file type
components/k2test/k2test/__pycache__/views.cpython-310.pyc
No preview for this file type
components/k2test/k2test/views.py
| ... | ... | @@ -38,23 +38,16 @@ |
| 38 | 38 | def menu_items(): |
| 39 | 39 | data = [ |
| 40 | 40 | { |
| 41 | - 'url': {'name': 'k2test/new2'}, | |
| 42 | - 'icon': 'mdi-chart-timeline-variant', | |
| 43 | - 'title': 'Тест 2', | |
| 44 | - 'category': 'Тестова компонента', | |
| 45 | - }, | |
| 46 | - { | |
| 47 | - 'url': {'name': 'k2test/new3'}, | |
| 48 | - 'icon': 'mdi-chart-timeline-variant', | |
| 49 | - 'title': 'Тест 3', | |
| 50 | - 'category': 'Тестова компонента', | |
| 51 | - }, | |
| 52 | - { | |
| 53 | - 'url': {'name': 'k2test/new4'}, | |
| 54 | - 'icon': 'mdi-chart-timeline-variant', | |
| 55 | - 'title': 'Тест 4', | |
| 56 | - 'category': 'Тестова компонента', | |
| 57 | - }, | |
| 41 | + | |
| 42 | + 'title': 'Тестова компонента', | |
| 43 | + 'category': 'Тест', | |
| 44 | + 'icon': {'icon': 'mdi-chart-timeline-variant'}, | |
| 45 | + 'children': [ | |
| 46 | + {'title': 'Тест 3', 'to': 'k2test-new3'}, | |
| 47 | + {'title': 'Тест 3', 'to': 'k2test-new4'}, | |
| 48 | + ], | |
| 49 | + } | |
| 50 | + | |
| 58 | 51 | ] |
| 59 | 52 | return data |
components/menu.yml
| 1 | -- category: dashboards | |
| 2 | - component_name: main | |
| 3 | - icon: mdi-chart-timeline-variant | |
| 4 | - id: 1 | |
| 5 | - title: Analytics Dashboard | |
| 6 | - url: | |
| 7 | - name: dashboards- | |
| 8 | -- category: dashboards | |
| 9 | - component_name: main | |
| 10 | - icon: mdi-cart-outline | |
| 11 | - id: 2 | |
| 12 | - title: CRM Dashboard | |
| 13 | - url: | |
| 14 | - name: dashboards-crm | |
| 15 | -- category: error | |
| 1 | +- category: "\u0422\u0435\u0441\u0442" | |
| 2 | + children: | |
| 3 | + - title: "\u0422\u0435\u0441\u0442 3" | |
| 4 | + to: k2test-new3 | |
| 5 | + - title: "\u0422\u0435\u0441\u0442 3" | |
| 6 | + to: k2test-new4 | |
| 16 | 7 | component_name: k2test |
| 17 | - icon: error | |
| 18 | - id: 3 | |
| 19 | - title: k2test--error | |
| 20 | - url: | |
| 21 | - name: error | |
| 22 | -- category: "\u0422\u0435\u0441\u0442\u043E\u0432\u0430 \u043A\u043E\u043C\u043F\u043E\ | |
| 8 | + icon: | |
| 9 | + icon: mdi-chart-timeline-variant | |
| 10 | + id: 2 | |
| 11 | + title: "\u0422\u0435\u0441\u0442\u043E\u0432\u0430 \u043A\u043E\u043C\u043F\u043E\ | |
| 23 | 12 | \u043D\u0435\u043D\u0442\u0430" |
| 24 | - component_name: k2test | |
| 25 | - icon: mdi-chart-timeline-variant | |
| 26 | - id: 4 | |
| 27 | - title: "\u0422\u0435\u0441\u0442 2" | |
| 28 | - url: | |
| 29 | - name: k2test/new2 | |
| 30 | -- category: "\u0422\u0435\u0441\u0442\u043E\u0432\u0430 \u043A\u043E\u043C\u043F\u043E\ | |
| 31 | - \u043D\u0435\u043D\u0442\u0430" | |
| 32 | - component_name: k2test | |
| 33 | - icon: mdi-chart-timeline-variant | |
| 34 | - id: 5 | |
| 35 | - title: "\u0422\u0435\u0441\u0442 3" | |
| 36 | - url: | |
| 37 | - name: k2test/new3 | |
| 38 | -- category: "\u0422\u0435\u0441\u0442\u043E\u0432\u0430 \u043A\u043E\u043C\u043F\u043E\ | |
| 39 | - \u043D\u0435\u043D\u0442\u0430" | |
| 40 | - component_name: k2test | |
| 41 | - icon: mdi-chart-timeline-variant | |
| 42 | - id: 6 | |
| 43 | - title: "\u0422\u0435\u0441\u0442 4" | |
| 44 | - url: | |
| 45 | - name: k2test/new4 |
db/database.db
No preview for this file type
k2/__pycache__/k2cfg.cpython-310.pyc
No preview for this file type
k2/__pycache__/k2inst.cpython-310.pyc
No preview for this file type
k2/__pycache__/k2obj.cpython-310.pyc
No preview for this file type
k2/k2cfg.py
| ... | ... | @@ -10,7 +10,6 @@ |
| 10 | 10 | from flask import session |
| 11 | 11 | |
| 12 | 12 | class k2(k2obj): |
| 13 | - | |
| 14 | 13 | version = '2.5.1.27' |
| 15 | 14 | db = SQLAlchemy() |
| 16 | 15 | domain = 'http://127.0.0.1:5000/' |
| ... | ... | @@ -58,8 +57,6 @@ |
| 58 | 57 | with open('components/menu.yml', 'r') as f: |
| 59 | 58 | yaml_data = yaml.load(f, Loader=yaml.FullLoader) |
| 60 | 59 | cls.menu = yaml_data |
| 61 | - | |
| 62 | - | |
| 63 | 60 | |
| 64 | 61 | |
| 65 | 62 | # load database settings from yml file |
k2/k2inst.py
| ... | ... | @@ -323,7 +323,7 @@ |
| 323 | 323 | |
| 324 | 324 | #add language folders |
| 325 | 325 | k2.search_babel_translation_directories() |
| 326 | - | |
| 326 | + print(k2.domain) | |
| 327 | 327 | return f'''Component installed successfully: {selected_component["name"]} v{version} {k2.babel_translation_directories}, |
| 328 | 328 | \n \n please wait installing requirments... |
| 329 | 329 | <meta http-equiv="refresh" content="0;url=/install-requirments/{selected_component["name"]}" />''' |
| ... | ... | @@ -334,7 +334,7 @@ |
| 334 | 334 | @components_bp.route('/install-requirments/<string:selected_component_name>', methods=['GET']) |
| 335 | 335 | def install_requirments(selected_component_name): |
| 336 | 336 | #menu items api |
| 337 | - response = requests.get(f"{k2.domain}{selected_component_name}/menu-items") | |
| 337 | + response = requests.get(f"{k2.domain}{selected_component_name}/menu-items") | |
| 338 | 338 | if response.status_code == 200: |
| 339 | 339 | data = response.json() |
| 340 | 340 | print(data) |
| ... | ... | @@ -450,4 +450,8 @@ |
| 450 | 450 | except Exception as e: |
| 451 | 451 | # Повертаємо повідомлення про помилку видалення |
| 452 | 452 | return 'Error removing component: ' + str(e) |
| 453 | + | |
| 454 | +@components_bp.route('/api/main-menu/') | |
| 455 | +def project_menu(): | |
| 456 | + return k2.menu |