Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/oneteme/inspect-app into…
Browse files Browse the repository at this point in the history
… develop
  • Loading branch information
antonin77 committed Nov 26, 2024
2 parents d7a5280 + d9d7597 commit 2596954
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 14 deletions.
14 changes: 12 additions & 2 deletions src/app/model/trace.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,12 @@ export class LinkRequestNode implements Link<Label> {
this.nodeObject = nodeObject;
}
getLinkStyle(): string {
return this.nodeObject.status > 400 || this.nodeObject.status == 0 ? 'FAILURE' : 'SUCCES'
switch(true){
case (this.nodeObject.status >= 200 && this.nodeObject.status < 300): return "SUCCES";
case (this.nodeObject.status >= 400 && this.nodeObject.status < 500): return "CLIENT_ERROR"
case (this.nodeObject.status >=500): return "SERVER_ERROR";
case (this.nodeObject.status == 0): return "UNREACHABLE"
}
}

formatLink(field: Label): string {
Expand Down Expand Up @@ -433,7 +438,12 @@ export class RestRequestNode implements Node<Label> {
}

getLinkStyle(): string {
return this.nodeObject.status > 400 || this.nodeObject.status == 0 ? 'FAILURE' : 'SUCCES'
switch(true){
case (this.nodeObject.status >= 200 && this.nodeObject.status < 300): return "SUCCES";
case (this.nodeObject.status > 400 && this.nodeObject.status < 500): return "CLIENT_ERROR"
case (this.nodeObject.status >=500): return "SERVER_ERROR";
case (this.nodeObject.status == 0): return "UNREACHABLE"
}
}
}

Expand Down
17 changes: 12 additions & 5 deletions src/app/model/tree.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,24 @@ export class TreeGraph {
if (cell.value.nodes) {
let res = tg.groupBy(cell.value.nodes, (v: any) => v.formatLink(cell.value.linkLbl))
let entries = Object.entries(res)
let extendMessage = '';
let max;

let max;
let count = 0;
if (entries.length > 5) {
max = 5;
extendMessage = `...<b>${cell.value.nodes.length - 5} Autres</b>`

} else {
max = entries.length;
}

for (let i = 0; i < max; i++) {
modal += `<b>${entries[i][0]}</b>${entries[i][1].length>1 ?' ×'+entries[i][1].length: ''}<br>`
count +=entries[i][1].length;
}
if(entries.length> 5){
modal += `...<b>${cell.value.nodes.length - count} Autres</b>`
}
modal += extendMessage;

}
else {
modal += `<b>${cell.value}</b>`
Expand Down Expand Up @@ -241,6 +246,8 @@ export const ServerConfig = {
}
export const LinkConfig = {
SUCCES: "strokeColor=green;",
FAILURE: "strokeColor=red;"
CLIENT_ERROR: "strokeColor=yellow;",
SERVER_ERROR: "strokeColor=red;",
UNREACHABLE: "strokeColor=red;"
}

1 change: 0 additions & 1 deletion src/app/views/dashboard/dashboard.component.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.exception-card {
display: flex;
flex-direction: row;
display: -webkit-box;
gap: 1em;
margin-bottom: 1em;
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/views/detail/database/detail-database.view.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<mat-card-title>
<p style="display: flex; align-items: center; gap: 0.5em">
<mat-icon class="material-symbols-outlined">Database</mat-icon>
{{ request.host ? request.host + ':' + request.port + ' -- ' + request.name : 'N/A'}}
{{ request.host ? request.host + ':' + (request.port || '') + ' -- ' + request.name : 'N/A'}}
</p>

<div class="right">
Expand Down
10 changes: 5 additions & 5 deletions src/app/views/tree/tree.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export class TreeView implements OnDestroy {
if (v[1].length > 1) {
b = this.draw(treeGraph, this.mergeRestRequests(v[0], v[1]), serverlbl, linklbl);
label = { linkLbl: linklbl, nodes: v[1] };
linkStyle = LinkConfig[this.checkSome<RestRequestNode>(v[1], v => { return v.nodeObject.status > 400 || v.nodeObject.status == 0 }) ? 'FAILURE' : 'SUCCES'] + "strokeWidth=1.5;"
linkStyle = LinkConfig[this.checkSome<RestRequestNode>(v[1], v => { return v.nodeObject.status > 400 || v.nodeObject.status == 0 }) ? 'SERVER_ERROR' : 'SUCCES'] + "strokeWidth=1.5;"
}
else {
let restRequestNode = v[1][0];
Expand All @@ -169,7 +169,7 @@ export class TreeView implements OnDestroy {
b = treeGraph.insertServer(jdbcRequestNode.formatNode(serverlbl), "JDBC"); // demon server
if (v[1].length > 1) {
label = { linkLbl: linklbl, nodes: v[1] };
linkStyle = LinkConfig[this.checkSome<JdbcRequestNode>(v[1], v => { return !v.nodeObject.status }) ? 'FAILURE' : 'SUCCES'] + "strokeWidth=1.5;"
linkStyle = LinkConfig[this.checkSome<JdbcRequestNode>(v[1], v => { return !v.nodeObject.status }) ? 'SERVER_ERROR' : 'SUCCES'] + "strokeWidth=1.5;"
} else {
label = jdbcRequestNode.formatLink(linklbl);
linkStyle = LinkConfig[jdbcRequestNode.getLinkStyle()];
Expand All @@ -186,7 +186,7 @@ export class TreeView implements OnDestroy {
b = treeGraph.insertServer(ftpRequestNode.formatNode(serverlbl), "FTP"); // demon server
if (v[1].length > 1) {
label = { linkLbl: linklbl, nodes: v[1] };
linkStyle = LinkConfig[this.checkSome<FtpRequestNode>(v[1], v => { return !v.nodeObject.status }) ? 'FAILURE' : 'SUCCES'] + "strokeWidth=1.5;"
linkStyle = LinkConfig[this.checkSome<FtpRequestNode>(v[1], v => { return !v.nodeObject.status }) ? 'SERVER_ERROR' : 'SUCCES'] + "strokeWidth=1.5;"
} else {
label = ftpRequestNode.formatLink(linklbl);
linkStyle = LinkConfig[ftpRequestNode.getLinkStyle()];
Expand All @@ -203,7 +203,7 @@ export class TreeView implements OnDestroy {
b = treeGraph.insertServer(mailRequestNode.formatNode(serverlbl), "SMTP"); // demon server
if (v[1].length > 1) {
label = { linkLbl: linklbl, nodes: v[1] };
linkStyle = LinkConfig[this.checkSome<MailRequestNode>(v[1], v => { return !v.nodeObject.status }) ? 'FAILURE' : 'SUCCES'] + "strokeWidth=1.5;"
linkStyle = LinkConfig[this.checkSome<MailRequestNode>(v[1], v => { return !v.nodeObject.status }) ? 'SERVER_ERROR' : 'SUCCES'] + "strokeWidth=1.5;"
} else {
label = mailRequestNode.formatLink(linklbl);
linkStyle = LinkConfig[mailRequestNode.getLinkStyle()];
Expand All @@ -220,7 +220,7 @@ export class TreeView implements OnDestroy {
b = treeGraph.insertServer(ldapRequestNode.formatNode(serverlbl), "LDAP"); // demon server
if (v[1].length > 1) {
label = { linkLbl: linklbl, nodes: v[1] };
linkStyle = LinkConfig[this.checkSome<MailRequestNode>(v[1], v => { return !v.nodeObject.status }) ? 'FAILURE' : 'SUCCES'] + "strokeWidth=1.5;"
linkStyle = LinkConfig[this.checkSome<MailRequestNode>(v[1], v => { return !v.nodeObject.status }) ? 'SERVER_ERROR' : 'SUCCES'] + "strokeWidth=1.5;"
} else {
label = ldapRequestNode.formatLink(linklbl);
linkStyle = LinkConfig[ldapRequestNode.getLinkStyle()];
Expand Down

0 comments on commit 2596954

Please sign in to comment.