Skip to content

Commit

Permalink
Support multiple shells from same environment in blazor
Browse files Browse the repository at this point in the history
  • Loading branch information
aorzelskiGH committed Jan 10, 2025
1 parent 1b52ee4 commit 24879a2
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 70 deletions.
141 changes: 72 additions & 69 deletions src/AasxServerBlazor/Data/AASService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,91 +76,94 @@ public void BuildTree()

for (var i = 0; i < Program.envimax; i++)
{
var root = new Item
{
envIndex = i
};
if (Program.env[i] != null && Program.env[i].AasEnv.AssetAdministrationShells != null && Program.env[i].AasEnv.AssetAdministrationShells.Count > 0)
{
root.Text = Program.env[i].AasEnv.AssetAdministrationShells[0].IdShort;
root.Tag = Program.env[i].AasEnv.AssetAdministrationShells[0];
if (Program.envSymbols[i] != "L")
foreach (var aas in Program.env[i].AasEnv.AssetAdministrationShells)
{
var children = new List<Item>();
var env = Program.env[i];
var aas = env.AasEnv.AssetAdministrationShells[0];
if (env != null && aas.Submodels is {Count: > 0})
foreach (var smr in aas.Submodels)
{
var sm = env.AasEnv.FindSubmodel(smr);
if (sm is not {IdShort: not null})
var root = new Item
{
envIndex = i
};
root.Text = aas.IdShort;
root.Tag = aas;
if (Program.envSymbols[i] != "L")
{
var children = new List<Item>();
var env = Program.env[i];
//var aas = env.AasEnv.AssetAdministrationShells[0];
if (env != null && aas.Submodels is { Count: > 0 })
foreach (var smr in aas.Submodels)
{
continue;
}
var sm = env.AasEnv.FindSubmodel(smr);
if (sm is not { IdShort: not null })
{
continue;
}

var smItem = new Item
{
envIndex = i,
Text = sm.IdShort,
Tag = sm
};
children.Add(smItem);
var smItemChildren = new List<Item>();
if (sm.SubmodelElements != null)
foreach (var sme in sm.SubmodelElements)
var smItem = new Item
{
var smeItem = new Item
{
envIndex = i,
Text = sme.IdShort,
Tag = sme
};
smItemChildren.Add(smeItem);
switch (sme)
envIndex = i,
Text = sm.IdShort,
Tag = sm
};
children.Add(smItem);
var smItemChildren = new List<Item>();
if (sm.SubmodelElements != null)
foreach (var sme in sm.SubmodelElements)
{
case SubmodelElementCollection collection:
var smeItem = new Item
{
createSMECItems(smeItem, collection, i);
break;
}
case Operation operation:
{
createOperationItems(smeItem, operation, i);
break;
}
case Entity entity:
envIndex = i,
Text = sme.IdShort,
Tag = sme
};
smItemChildren.Add(smeItem);
switch (sme)
{
CreateEntityItems(smeItem, entity, i);
break;
case SubmodelElementCollection collection:
{
createSMECItems(smeItem, collection, i);
break;
}
case Operation operation:
{
createOperationItems(smeItem, operation, i);
break;
}
case Entity entity:
{
CreateEntityItems(smeItem, entity, i);
break;
}
case AnnotatedRelationshipElement annotatedRelationshipElement:
CreateAnnotatedRelationshipElementItems(smeItem, annotatedRelationshipElement, i);
break;
case SubmodelElementList smeList:
CreateSMEListItems(smeItem, smeList, i);
break;
}
case AnnotatedRelationshipElement annotatedRelationshipElement:
CreateAnnotatedRelationshipElementItems(smeItem, annotatedRelationshipElement, i);
break;
case SubmodelElementList smeList:
CreateSMEListItems(smeItem, smeList, i);
break;
}
}

smItem.Children = smItemChildren;
foreach (var c in smItemChildren)
c.parent = smItem;
}
smItem.Children = smItemChildren;
foreach (var c in smItemChildren)
c.parent = smItem;
}

root.Children = children;
foreach (var c in children)
c.parent = root;
items.Add(root);
}

root.Children = children;
foreach (var c in children)
c.parent = root;
if (Program.envSymbols[i] != "L")
{
continue;
}

root.Text = Path.GetFileName(Program.envFileName[i]);
items.Add(root);
}
}

if (Program.envSymbols[i] != "L")
{
continue;
}

root.Text = Path.GetFileName(Program.envFileName[i]);
items.Add(root);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/AasxServerBlazor/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"AasxServerBlazor": {
"commandName": "Project",
"commandLineArgs": "--with-db --start-index 100 --no-security --save-temp 30 --secret-string-api 1234 --aasx-in-memory 1000 --data-path \"C:\\Development\\aasxs-repository\" --edit --external-blazor http://localhost:5001",
"commandLineArgs": "--no-security --save-temp 30 --secret-string-api 1234 --aasx-in-memory 1000 --data-path \"\\\\wsl.localhost\\Ubuntu\\home\\oze\\assethub\\aasx\" --edit --external-blazor http://localhost:5001",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
Expand Down

0 comments on commit 24879a2

Please sign in to comment.