Skip to content

Commit

Permalink
Merge branch 'aas_submod_read' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
otto-ifak committed Jan 12, 2025
2 parents e4a3538 + 5d4fd5c commit 6c62efa
Show file tree
Hide file tree
Showing 21 changed files with 536 additions and 140 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ In case of API, the IDTA specifications define service specifications and profil
| Name | Profile Identifier | Description | Support in test-engine |
| :--- | :--- | :--- | :--- |
| AAS Repository Read Profile | https://admin-shell.io/aas/API/3/0/AssetAdministrationShellRepositoryServiceSpecification/SSP-002 | Only read operations for the AAS Repository Service ||
| Submodel Repository Read Profile | https://admin-shell.io/aas/API/3/0/SubmodelServiceSpecification/SSP-002 | Only read operations for the Submodel Repository Service ||
| AAS Registry Read Profile | https://admin-shell.io/aas/API/3/0/AssetAdministrationShellRegistryServiceSpecification/SSP-002 | Only reads operations for AAS Registry Service | (✔️) |
| AAS Read Profile | https://admin-shell.io/aas/API/3/0/AssetAdministrationShellServiceSpecification/SSP-002 | Only read operations for the AAS Service ||
| Submodel Repository Read Profile | https://admin-shell.io/aas/API/3/0/SubmodelRepositoryServiceSpecification/SSP-002 | Only read operations for the Submodel Repository Service ||
| Submodel Read Profile | https://admin-shell.io/aas/API/3/0/SubmodelServiceSpecification/SSP-002 | Only read operations for the Submodel Repository Service ||
| AAS Registry Read Profile | https://admin-shell.io/aas/API/3/0/AssetAdministrationShellRegistryServiceSpecification/SSP-002 | Only read operations for AAS Registry Service | (✔️) |

For a detailed list of what is checked (and what is not), see [here](doc/api.md).

Expand Down
53 changes: 49 additions & 4 deletions aas_test_engines/data/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,32 @@
color: red;
font-weight: bolder;
}

.help {
position: absolute;
right:0;
top:0
}
</style>
</head>

<body>

<h2>Test Result</h2>

<div class="help">
<table>
<tr>
<td>&rarr;</td>
<td>Expand one level</td>
</tr>
<tr>
<td>&larr;</td>
<td>Collapse one level</td>
</tr>
</table>
</div>

<div id="content">
<!-- CONTENT -->
</div>
Expand All @@ -82,15 +101,41 @@ <h2>Test Result</h2>
element.classList.toggle("caret-down");
}

var carets = document.getElementsByClassName("caret");
var i;
function expand(element) {
element.parentElement.parentElement.querySelector(".sub-results").classList.add("visible");
element.classList.add("caret-down");
}

function collapse(element) {
element.parentElement.parentElement.querySelector(".sub-results").classList.remove("visible");
element.classList.remove("caret-down");
}

for (i = 0; i < carets.length; i++) {
carets[i].addEventListener("click", function (event) {
for (const caret of document.getElementsByClassName("caret")) {
caret.addEventListener("click", function (event) {
toggle(event.target);
});
}

let level = 0
document.addEventListener("keyup", (event => {
if (event.code == "ArrowRight") {
const carets = document.getElementsByClassName(`level-${level}`);
if(carets.length == 0) return;
for (const caret of document.getElementsByClassName(`level-${level}`)) {
expand(caret)
}
level++;
} else if (event.code == "ArrowLeft") {
if(level==0) return;
level--;
const carets = document.getElementsByClassName(`level-${level}`);
for (const caret of carets) {
collapse(caret)
}
}
}));

</script>

</body>
Expand Down
8 changes: 4 additions & 4 deletions aas_test_engines/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def to_lines(self, indent=0, path=''):
for sub_result in self.sub_results:
yield from sub_result.to_lines(indent + 1)

def _to_html(self) -> str:
def _to_html(self, level: int) -> str:
cls = {
Level.INFO: 'info',
Level.WARNING: 'warning',
Expand All @@ -65,11 +65,11 @@ def _to_html(self) -> str:
msg = html.escape(self.message)
if self.sub_results:
c = "" if self.ok() else "caret-down"
s += f'<div class="{cls}">{msg}<span class="caret {c}"/></div>\n'
s += f'<div class="{cls}">{msg}<span class="caret level-{level} {c}"/></div>\n'
c = "" if self.ok() else "visible"
s += f'<div class="sub-results {c}">\n'
for sub_result in self.sub_results:
s += sub_result._to_html()
s += sub_result._to_html(level + 1)
s += "</div>\n"
else:
s += f'<div class="{cls}">{msg}</div>\n'
Expand All @@ -86,7 +86,7 @@ def to_html(self) -> str:
"""
with open(os.path.join(script_dir, 'data', 'template.html'), 'r') as f:
content = f.read()
return content.replace("<!-- CONTENT -->", self._to_html())
return content.replace("<!-- CONTENT -->", self._to_html(0))

def to_dict(self):
return {
Expand Down
Loading

0 comments on commit 6c62efa

Please sign in to comment.