Upload of projects and themes
This commit is contained in:
@@ -0,0 +1,146 @@
|
||||
def get_udt_configuration(instance_path, category = None):
|
||||
"""
|
||||
Scans a UDT instance for members belonging to a UI category
|
||||
and returns their display configurations. Optional category argumen,
|
||||
if defined, it will returna filtered list.
|
||||
Beware of this instruction, it uses system.tag.readBlocking.
|
||||
Args:
|
||||
instance_path (str): The UDT path
|
||||
target_category (str): The filter criteria (e.g., 'Status', 'Control', 'Config').
|
||||
|
||||
Returns:
|
||||
list: A list of UDT items tagpaths and it's custom properties.
|
||||
"""
|
||||
# 1. Browse for all tags inside the instance
|
||||
fltr = {'tagType':'UdtInstance', 'recursive':True}
|
||||
results = system.tag.browse(instance_path, fltr)
|
||||
|
||||
# Identify the properties we need for each tag founf
|
||||
property_names = [
|
||||
'.isReadOnly',
|
||||
'.uiAccessLevel',
|
||||
'.uiGroup',
|
||||
'.isHidden',
|
||||
'.uiStates',
|
||||
'.uiOrder',
|
||||
'.uiType',
|
||||
'.uiWidget',
|
||||
'/parameters.Parent_Asset_Label',
|
||||
'.uiFormat',
|
||||
'.uiConfig']
|
||||
|
||||
# 2. Build a flat list of paths to read everything in on Gatewya request
|
||||
read_paths = []
|
||||
tags_found = [str(r['fullPath']) for r in results]
|
||||
|
||||
for tag in tags_found:
|
||||
for prop in property_names:
|
||||
read_paths.append('%s%s' % (tag, prop))
|
||||
|
||||
|
||||
all_values = system.tag.readBlocking(read_paths)
|
||||
# for value in all_values:
|
||||
# print value
|
||||
# 3. Process the result in 'chunks'
|
||||
# step by the length of properties
|
||||
output = []
|
||||
step = len(property_names)
|
||||
for i in range(0, len(all_values), step):
|
||||
chunk = all_values[i : i + step]
|
||||
if category is not None and chunk[6].value != category:
|
||||
continue
|
||||
subpath = tags_found[i // step].split(instance_path)[-1]
|
||||
output.append({
|
||||
"sub_path": subpath,
|
||||
"read_only": bool(chunk[0].value),
|
||||
"access_level": chunk[1].value,
|
||||
"group": chunk[2].value,
|
||||
"is_hidden": bool(chunk[3].value),
|
||||
"states": chunk[4].value,
|
||||
"order": chunk[5].value,
|
||||
"type": chunk[6].value,
|
||||
"widget": chunk[7].value,
|
||||
"label": chunk[8].value,
|
||||
"format": chunk[9].value,
|
||||
"config": chunk[10].value,
|
||||
})
|
||||
return output
|
||||
|
||||
def get_udt_configuration_async(instance_path, on_finished_callback):
|
||||
"""
|
||||
Scans a UDT instance for members belonging to a UI category
|
||||
and returns their display configurations.
|
||||
|
||||
Args:
|
||||
instance_path (str): The UDT path
|
||||
target_category (str): The filter criteria (e.g., 'Status', 'Control', 'Config').
|
||||
|
||||
Returns:
|
||||
list: A list of strings representing the full paths to the matching tags.
|
||||
"""
|
||||
# 1. Browse for all tags inside the instance
|
||||
fltr = {'tagType':'UdtInstance', 'recursive':True}
|
||||
results = system.tag.browse(instance_path, fltr)
|
||||
|
||||
# Identify the properties we need for each tag founf
|
||||
property_names = [
|
||||
'.isReadOnly',
|
||||
'.uiAccessLevel',
|
||||
'.uiGroup',
|
||||
'.isHidden',
|
||||
'.uiStates',
|
||||
'.uiOrder',
|
||||
'.uiType',
|
||||
'.uiWidget',
|
||||
'/parameters.Parent_Asset_Label']
|
||||
|
||||
# 2. Build a flat list of paths to read everything in on Gatewya request
|
||||
|
||||
read_paths = []
|
||||
tags_found = [str(r['fullPath']) for r in results]
|
||||
|
||||
for tag in tags_found:
|
||||
for prop in property_names:
|
||||
read_paths.append('%s%s' % (tag, prop))
|
||||
|
||||
def handle_read_finished(all_values):
|
||||
output = []
|
||||
step = len(property_names)
|
||||
for i in range(0, len(all_values), step):
|
||||
chunk = all_values[i : i + step]
|
||||
output.append({
|
||||
"tagPath": tags_found[i // step],
|
||||
"read_only": bool(chunk[0].value),
|
||||
"access_level": chunk[1].value,
|
||||
"group": chunk[2].value,
|
||||
"is_hidden": bool(chunk[3].value),
|
||||
"states": chunk[4].value,
|
||||
"order": chunk[5].value,
|
||||
"type": chunk[6].value,
|
||||
"widget": chunk[7].value,
|
||||
"label": chunk[8].value,
|
||||
})
|
||||
on_finished_callback(output)
|
||||
system.tag.readAsync(read_paths, handle_read_finished)
|
||||
|
||||
def generate_flex_array(list_tags, base_path):
|
||||
"""
|
||||
This function, generates de array for the flex repeater
|
||||
in details pages, it hides the elements based on is_hidden property
|
||||
and concatenates the dinamyc tagpath with the item sub path
|
||||
Args:
|
||||
instance_path (str): The UDT path
|
||||
|
||||
Returns:
|
||||
list: A list of tags to be used in detail pages flex repeater.
|
||||
"""
|
||||
output = []
|
||||
for item in list_tags:
|
||||
if item['is_hidden'] is True:
|
||||
continue
|
||||
new_item = dict(item)
|
||||
new_item['tagpath'] = base_path + str(item.get('sub_path', ''))
|
||||
tag= {'item': new_item}
|
||||
output.append(tag)
|
||||
|
||||
return output
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"scope": "A",
|
||||
"version": 1,
|
||||
"restricted": false,
|
||||
"overridable": true,
|
||||
"files": [
|
||||
"code.py"
|
||||
],
|
||||
"attributes": {
|
||||
"hintScope": 2,
|
||||
"lastModificationSignature": "65fe97c61732cda7def7a6acb35a3157851b8ce17a8615f73086f6b0a84b304f",
|
||||
"lastModification": {
|
||||
"actor": "Prime",
|
||||
"timestamp": "2026-02-13T17:22:49Z"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
def get_structure():
|
||||
return [
|
||||
{
|
||||
"label": "Home",
|
||||
"target": "Pages/Dashboard/Home",
|
||||
"icon": {"path": "material/home"},
|
||||
"items": []
|
||||
},
|
||||
{
|
||||
"label": "Spaces",
|
||||
"target": "Pages/Dashboard/Spaces",
|
||||
"icon": {"path": "material/domain"},
|
||||
"items": [
|
||||
{
|
||||
"label": "Fisrt Floor",
|
||||
"target": "",
|
||||
"icon": {"path": ".."},
|
||||
"items": [
|
||||
{
|
||||
"label": "DM11",
|
||||
"target": "Pages/Spaces/Floor_01/DM11",
|
||||
"icon": {"path": ".."},
|
||||
"items": []
|
||||
},
|
||||
{
|
||||
"label": "DM12",
|
||||
"target": "Pages/Spaces/Floor_01/DM12",
|
||||
"icon": {"path": ".."},
|
||||
"items": []
|
||||
},
|
||||
{
|
||||
"label": "DM13",
|
||||
"target": "Pages/Spaces/Floor_01/DM13",
|
||||
"icon": {"path": ".."},
|
||||
"items": []
|
||||
},
|
||||
{
|
||||
"label": "DM14",
|
||||
"target": "Pages/Spaces/Floor_01/DM14",
|
||||
"icon": {"path": ".."},
|
||||
"items": []
|
||||
}]
|
||||
},
|
||||
{
|
||||
"label": "Second Floor",
|
||||
"target": "",
|
||||
"icon": {"path": ".."},
|
||||
"items": [
|
||||
{
|
||||
"label": "DM21",
|
||||
"target": "Pages/Spaces/Floor_02/DM21",
|
||||
"icon": {"path": ".."},
|
||||
"items": []
|
||||
},
|
||||
{
|
||||
"label": "DM22",
|
||||
"target": "Pages/Spaces/Floor_02/DM22",
|
||||
"icon": {"path": ".."},
|
||||
"items": []
|
||||
},
|
||||
{
|
||||
"label": "DM23",
|
||||
"target": "Pages/Spaces/Floor_02/DM23",
|
||||
"icon": {"path": ".."},
|
||||
"items": []
|
||||
},
|
||||
{
|
||||
"label": "DM24",
|
||||
"target": "Pages/Spaces/Floor_02/DM24",
|
||||
"icon": {"path": ".."},
|
||||
"items": []
|
||||
}]
|
||||
},
|
||||
{
|
||||
"label": "Third Floor",
|
||||
"target": "",
|
||||
"icon": {"path": ".."},
|
||||
"items": [
|
||||
{
|
||||
"label": "DM31",
|
||||
"target": "Pages/Spaces/Floor_03/DM31",
|
||||
"icon": {"path": ".."},
|
||||
"items": []
|
||||
},
|
||||
{
|
||||
"label": "DM32",
|
||||
"target": "Pages/Spaces/Floor_03/DM32",
|
||||
"icon": {"path": ".."},
|
||||
"items": []
|
||||
},
|
||||
{
|
||||
"label": "DM33",
|
||||
"target": "Pages/Spaces/Floor_03/DM33",
|
||||
"icon": {"path": ".."},
|
||||
"items": []
|
||||
},
|
||||
{
|
||||
"label": "DM34",
|
||||
"target": "Pages/Spaces/Floor_03/DM34",
|
||||
"icon": {"path": ".."},
|
||||
"items": []
|
||||
}]
|
||||
}]
|
||||
},
|
||||
{
|
||||
"label": "Equipment",
|
||||
"target": "Pages/Dashboard/Equipment",
|
||||
"icon": {"path": "material/settings_input_component"},
|
||||
"items": [
|
||||
{
|
||||
"label": "CDU",
|
||||
"target": "Pages/Systems/CDU",
|
||||
"icon": {"path": ".."},
|
||||
"items": []
|
||||
},
|
||||
{
|
||||
"label": "RPP",
|
||||
"target": "Pages/Systems/RPP",
|
||||
"icon": {"path": ".."},
|
||||
"items": []
|
||||
}]
|
||||
},
|
||||
{
|
||||
"label": "Analysis",
|
||||
"target": "",
|
||||
"icon": {"path": "material/analytics"},
|
||||
"items": [
|
||||
{
|
||||
"label": "Trend Builder",
|
||||
"target": "Pages/Analysis/Trend_Builder",
|
||||
"icon": {"path": ".."},
|
||||
"items": []
|
||||
}]
|
||||
},
|
||||
{
|
||||
"label": "Alarms",
|
||||
"target": "",
|
||||
"icon": {"path": "material/notifications"},
|
||||
"items": [
|
||||
{
|
||||
"label": "Active",
|
||||
"target": "Pages/Alarms/Active",
|
||||
"icon": {"path": ".."},
|
||||
"items": []
|
||||
},
|
||||
{
|
||||
"label": "History",
|
||||
"target": "Pages/Alarms/History",
|
||||
"icon": {"path": ".."},
|
||||
"items": []
|
||||
}]
|
||||
},
|
||||
{
|
||||
"label": "Diagnostics",
|
||||
"target": "",
|
||||
"icon": {"path": "material/build"},
|
||||
"items": [
|
||||
{
|
||||
"label": "Gateway",
|
||||
"target": "",
|
||||
"icon": {"path": ".."},
|
||||
"items": []
|
||||
},
|
||||
{
|
||||
"label": "Connections",
|
||||
"target": "",
|
||||
"icon": {"path": ".."},
|
||||
"items": []
|
||||
},
|
||||
{
|
||||
"label": "Panels",
|
||||
"target": "",
|
||||
"icon": {"path": ".."},
|
||||
"items": []
|
||||
}]
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"scope": "A",
|
||||
"version": 1,
|
||||
"restricted": false,
|
||||
"overridable": true,
|
||||
"files": [
|
||||
"code.py"
|
||||
],
|
||||
"attributes": {
|
||||
"hintScope": 2,
|
||||
"lastModificationSignature": "49880d3344aaae469b826cb9efd2491704bf330baf4a246880f9efb695e351ac",
|
||||
"lastModification": {
|
||||
"actor": "Prime",
|
||||
"timestamp": "2026-01-31T13:06:11Z"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user