Skip to content

Commit fb2fc63

Browse files
committed
improve wired clients QL
1 parent cd6d8bd commit fb2fc63

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

angular/src/app/pages/api/manage/manage.component.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -283,17 +283,20 @@ export class ApiManageComponent implements OnInit {
283283
}
284284
}
285285

286-
forgeSiteObjectSearch(obj_name: string, host: string, detail: string | null, extra_param: string | undefined = undefined): void {
286+
forgeSiteObjectSearch(obj_name: string, host: string, detail: string | null, extra_param: string | undefined = undefined, ui_name: string | undefined = undefined): void {
287287
let url = "";
288-
if (detail && detail != "new") {
288+
if (!ui_name) {
289+
ui_name = obj_name.replace(/_/g, " ");
290+
}
291+
if (detail && !this.not_detail.includes(detail)) {
289292
// set QUICK LINK
290293
url = "https://api." + host + "/api/v1/sites/" + this.site_id + "/" + obj_name + "/search?mac=" + this.obj_id;
291-
this.quick_links.push({ url: url, name: obj_name.replace(/_/g, " ") });
294+
this.quick_links.push({ url: url, name: ui_name});
292295
} else {
293296
// set QUICK LINK
294297
url = "https://api." + host + "/api/v1/sites/" + this.site_id + "/" + obj_name + "/search";
295298
if (extra_param) url += "?" + extra_param;
296-
this.quick_links.push({ url: url, name: obj_name.replace(/_/g, " ") });
299+
this.quick_links.push({ url: url, name: ui_name});
297300
}
298301
}
299302

@@ -784,6 +787,7 @@ export class ApiManageComponent implements OnInit {
784787
this.org_id = res?.groups?.org_id;
785788
let extra_params: string | undefined;
786789
var stats_filter: string | undefined;
790+
var clients_filter: string | undefined;
787791
const uuid_re = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/
788792
if (res?.groups?.host && res?.groups?.org_id && res?.groups?.obj) {
789793
this.obj_id = res?.groups?.obj_id;
@@ -828,17 +832,21 @@ export class ApiManageComponent implements OnInit {
828832
this.setName(res?.groups?.obj, res?.groups?.detail);
829833
if (!res?.groups?.details) extra_params = "type=" + res?.groups?.obj;
830834
stats_filter = "site_id=" + this.site_id;
831-
if (this.obj_id) stats_filter += "&mac=" + this.obj_id.split("-")[4];
835+
clients_filter = "site_id=" + this.site_id;
836+
if (this.obj_id) {
837+
stats_filter += "&mac=" + this.obj_id.split("-")[4];
838+
clients_filter += "&device_mac=" + this.obj_id.split("-")[4];
839+
}
832840

833841
this.forgeSiteObject("devices", res?.groups?.host, res?.groups?.detail, extra_params);
834842
this.forgeSiteObjectStats("devices", res?.groups?.host, res?.groups?.detail, extra_params);
835843
this.forgeSiteObjectEvents("devices", res?.groups?.obj, res?.groups?.host, res?.groups?.detail);
836844
this.forgeSiteObjectAlarms("devices", res?.groups?.obj, res?.groups?.host, res?.groups?.detail);
837-
this.forgeSiteDiscoveredSwitchUrl(res?.groups?.host);
838845
this.forgeSiteDeviceSyntheticTest(res?.groups?.detail, res?.groups?.host, res?.groups?.obj);
839-
this.forgeSiteObjectSearch("wired_clients", res?.groups?.host, null, "last_device_mac=" + this.obj_id.split("-")[4]);
840846
this.forgeOrgObjectStatsSearch("bgp_peers", res?.groups?.host, stats_filter, this.obj_name + " bgp peers");
841847
this.forgeOrgObjectStatsSearch("ports", res?.groups?.host, stats_filter, this.obj_name + " ports");
848+
this.forgeSiteObjectSearch("wired_clients", res?.groups?.host, null, clients_filter, this.obj_name + " clients");
849+
this.forgeSiteDiscoveredSwitchUrl(res?.groups?.host);
842850
}
843851
break;
844852
case "assets":

0 commit comments

Comments
 (0)