Commit 8626b0fa84047b6f27605e1332c46e9d88a8f5cb

Authored by Василь Свідрик
1 parent 60d652eec2

fix turm off component

Showing 5 changed files with 20 additions and 28 deletions Side-by-side Diff

__pycache__/routes.cpython-310.pyc
No preview for this file type
No preview for this file type
k2/__pycache__/k2rout.cpython-310.pyc
No preview for this file type
... ... @@ -32,23 +32,23 @@
32 32 return view_func(*args, **kwargs)
33 33 return decorated_view
34 34  
35   -def append_to_yaml_file(file_path, data):
36   - with open(file_path, 'r') as f:
37   - existing_data = yaml.safe_load(f) or []
  35 +#def append_to_yaml_file(file_path, data):
  36 +# with open(file_path, 'r') as f:
  37 +# existing_data = yaml.safe_load(f) or []
  38 +#
  39 +# if not existing_data:
  40 +# start_id = 1
  41 +# else:
  42 +# start_id = max(item.get('id', 0) for item in existing_data) + 1
  43 +#
  44 +# for i, item in enumerate(data, start=start_id):
  45 +# item['id'] = i
  46 +# existing_data.append(item)
  47 +#
  48 +# with open(file_path, 'w') as f:
  49 +# yaml.dump(existing_data, f, default_flow_style=False)
38 50  
39   - if not existing_data:
40   - start_id = 1
41   - else:
42   - start_id = max(item.get('id', 0) for item in existing_data) + 1
43 51  
44   - for i, item in enumerate(data, start=start_id):
45   - item['id'] = i
46   - existing_data.append(item)
47   -
48   - with open(file_path, 'w') as f:
49   - yaml.dump(existing_data, f, default_flow_style=False)
50   -
51   -
52 52 def remove_from_yaml_file(file_path, component_name):
53 53 with open(file_path, 'r') as f:
54 54 existing_data = yaml.safe_load(f) or []
... ... @@ -298,18 +298,7 @@
298 298  
299 299 @components_bp.route('/install-requirments/<string:selected_component_name>', methods=['GET'])
300 300 def install_requirments(selected_component_name):
301   - #menu items api
302   - response = requests.get(f"{k2.domain}{selected_component_name}/menu-items")
303   - if response.status_code == 200:
304   - data = response.json()
305   -
306   - else:
307   - data = []
308   - # add component_name key for menu items
309   - for item in data:
310   - item['component_name'] = selected_component_name
311   - file_path = 'components/menu.yml'
312   - append_to_yaml_file(file_path, data)
  301 + #menu items
313 302 get_admin_menu()
314 303  
315 304 #install requirements
... ... @@ -8,4 +8,7 @@
8 8 app.register_blueprint(grid, url_prefix='/grid')
9 9 from components.vue.vue.views import vue2
10 10 app.register_blueprint(vue2, url_prefix='/')
  11 +
  12 +from components.adm.adm.views import adm
  13 +app.register_blueprint(adm, url_prefix='/adm')