Skip to content

Commit 5e04920

Browse files
committed
add bgp and vpn peers QL
1 parent 71029f9 commit 5e04920

File tree

1 file changed

+40
-20
lines changed

1 file changed

+40
-20
lines changed

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

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ export interface actionElement {
1111
}
1212

1313
@Component({
14-
selector: 'app-api-manage',
15-
templateUrl: 'manage.component.html',
16-
styleUrls: [
17-
'../../../scss/button.component.scss',
18-
'../../../scss/popup.component.scss',
19-
'../../../scss/notice.component.scss',
20-
'../../../scss/container.component.scss',
21-
'../../../scss/input.component.scss',
22-
'manage.component.scss',
23-
],
24-
standalone: false
14+
selector: 'app-api-manage',
15+
templateUrl: 'manage.component.html',
16+
styleUrls: [
17+
'../../../scss/button.component.scss',
18+
'../../../scss/popup.component.scss',
19+
'../../../scss/notice.component.scss',
20+
'../../../scss/container.component.scss',
21+
'../../../scss/input.component.scss',
22+
'manage.component.scss',
23+
],
24+
standalone: false
2525
})
2626
export class ApiManageComponent implements OnInit {
2727

@@ -296,12 +296,12 @@ export class ApiManageComponent implements OnInit {
296296
}
297297
}
298298

299-
forgeSiteObjectStatsSearch(obj_name: string, host: string, extra_param: string | undefined = undefined, ui_name: string | undefined = undefined): void {
299+
forgeOrgObjectStatsSearch(obj_name: string, host: string, extra_param: string | undefined = undefined, ui_name: string | undefined = undefined): void {
300300
let url = "";
301301
if (!ui_name) {
302302
ui_name = obj_name.replace(/_/g, " ");
303303
}
304-
url = "https://api." + host + "/api/v1/sites/" + this.site_id + "/stats/" + obj_name + "/search";
304+
url = "https://api." + host + "/api/v1/orgs/" + this.org_id + "/stats/" + obj_name + "/search";
305305
if (extra_param) url += "?" + extra_param;
306306
this.quick_links.push({ url: url, name: ui_name + " STATS" });
307307
}
@@ -368,7 +368,7 @@ export class ApiManageComponent implements OnInit {
368368
this.quick_links.push({ url: url, name: this.obj_name + " ALARMS" })
369369
} else {
370370
if (filter) filter += "*";
371-
url = "https://api." + host + "/api/v1/sites/" + this.site_id + "/alarms/search?limit=1000" + filter;
371+
url = "https://api." + host + "/api/v1/sites/" + this.site_id + "/alarms/search?limit=1000" + filter;
372372
if (!extra_param) {
373373
url += "&duration=1d";
374374
} else {
@@ -781,7 +781,8 @@ export class ApiManageComponent implements OnInit {
781781
////////////////////// COMMON URL FUNCTION DISPATCHER FOR SITE URLS
782782
commonSiteUrl(res: RegExpExecArray): void {
783783
this.org_id = res?.groups?.org_id;
784-
let extra_params: string | undefined = undefined;
784+
let extra_params: string | undefined;
785+
var stats_filter: string | undefined;
785786
const uuid_re = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/
786787
if (res?.groups?.host && res?.groups?.org_id && res?.groups?.obj) {
787788
this.obj_id = res?.groups?.obj_id;
@@ -801,13 +802,18 @@ export class ApiManageComponent implements OnInit {
801802
case "gateway":
802803
this.setName(res?.groups?.obj, res?.groups?.detail);
803804
if (!res?.groups?.details) extra_params = "type=" + res?.groups?.obj;
805+
stats_filter = "site_id=" + this.site_id;
806+
if (this.obj_id) stats_filter += "&mac=" + this.obj_id.split("-")[4];
807+
804808
this.forgeSiteObject("devices", res?.groups?.host, res?.groups?.detail, extra_params);
805809
this.forgeSiteObjectStats("devices", res?.groups?.host, res?.groups?.detail, extra_params);
806810
this.forgeSiteObjectEvents("devices", res?.groups?.obj, res?.groups?.host, res?.groups?.detail);
807811
this.forgeSiteObjectAlarms("devices", res?.groups?.obj, res?.groups?.host, res?.groups?.detail);
808812
this.forgeSiteApLastConfig(res?.groups?.detail, res?.groups?.host, res?.groups?.obj);
809813
this.forgeSiteDeviceSyntheticTest(res?.groups?.detail, res?.groups?.host, res?.groups?.obj);
810-
this.forgeSiteObjectStatsSearch("ports", res?.groups?.host, "mac=" + this.obj_id.split("-")[4], "gateway ports");
814+
this.forgeOrgObjectStatsSearch("bgp_peers", res?.groups?.host, stats_filter, this.obj_name + " bgp peers");
815+
this.forgeOrgObjectStatsSearch("ports", res?.groups?.host, stats_filter, this.obj_name + " ports");
816+
this.forgeOrgObjectStatsSearch("vpn_peers", res?.groups?.host, stats_filter, this.obj_name + " vpn peers");
811817
break;
812818
case "switch":
813819
if (["list", "topology", "location"].includes(this.obj_id)) this.obj_id = undefined;
@@ -820,14 +826,18 @@ export class ApiManageComponent implements OnInit {
820826
} else {
821827
this.setName(res?.groups?.obj, res?.groups?.detail);
822828
if (!res?.groups?.details) extra_params = "type=" + res?.groups?.obj;
829+
stats_filter = "site_id=" + this.site_id;
830+
if (this.obj_id) stats_filter += "&mac=" + this.obj_id.split("-")[4];
831+
823832
this.forgeSiteObject("devices", res?.groups?.host, res?.groups?.detail, extra_params);
824833
this.forgeSiteObjectStats("devices", res?.groups?.host, res?.groups?.detail, extra_params);
825834
this.forgeSiteObjectEvents("devices", res?.groups?.obj, res?.groups?.host, res?.groups?.detail);
826835
this.forgeSiteObjectAlarms("devices", res?.groups?.obj, res?.groups?.host, res?.groups?.detail);
827836
this.forgeSiteDiscoveredSwitchUrl(res?.groups?.host);
828837
this.forgeSiteDeviceSyntheticTest(res?.groups?.detail, res?.groups?.host, res?.groups?.obj);
829838
this.forgeSiteObjectSearch("wired_clients", res?.groups?.host, null, "last_device_mac=" + this.obj_id.split("-")[4]);
830-
this.forgeSiteObjectStatsSearch("ports", res?.groups?.host, "mac=" + this.obj_id.split("-")[4], "switch ports");
839+
this.forgeOrgObjectStatsSearch("bgp_peers", res?.groups?.host, stats_filter, this.obj_name + " bgp peers");
840+
this.forgeOrgObjectStatsSearch("ports", res?.groups?.host, stats_filter, this.obj_name + " ports");
831841
}
832842
break;
833843
case "assets":
@@ -911,7 +921,7 @@ export class ApiManageComponent implements OnInit {
911921
console.log(res?.groups)
912922
var band = (res.groups.inter || "5").replace("/", "");
913923
var band_text = band;
914-
if (band_text=="24") band_text = "2.4";
924+
if (band_text == "24") band_text = "2.4";
915925
this.quick_links.push(
916926
{
917927
url: "https://api." + res?.groups?.host + "/api/v1/sites/" + this.site_id + "/rrm/current",
@@ -1175,7 +1185,7 @@ export class ApiManageComponent implements OnInit {
11751185
scope_id = this.site_id;
11761186
} else if (res?.groups?.org_id) {
11771187
scope = "orgs";
1178-
scope_id = res?.groups?.org_id;
1188+
scope_id = res?.groups?.org_id;
11791189
}
11801190

11811191
if (res?.groups?.start && res?.groups?.stop) {
@@ -1344,7 +1354,8 @@ export class ApiManageComponent implements OnInit {
13441354
this.obj_id = res?.groups?.obj_id;
13451355
}
13461356
if (this.site_id == this.obj_id) this.obj_id = undefined
1347-
let extra_params: string | undefined = undefined;
1357+
let extra_params: string | undefined;
1358+
let stats_filter: string | undefined;
13481359
if (res?.groups?.start && res?.groups?.stop) {
13491360
extra_params = "start=" + res?.groups?.start + "&end=" + res?.groups?.stop;
13501361
}
@@ -1367,18 +1378,27 @@ export class ApiManageComponent implements OnInit {
13671378
this.forgeClientCalls("clients", undefined, res?.groups?.host, "detail", extra_params);
13681379
break;
13691380
case "juniperSwitch":
1381+
stats_filter = "site_id=" + this.site_id;
1382+
if (this.obj_id) stats_filter += "&mac=" + this.obj_id.split("-")[4];
13701383
this.setName("switch", "insights");
13711384
this.forgeSiteObject("devices", res?.groups?.host, "detail");
13721385
this.forgeSiteObjectStats("devices", res?.groups?.host, "detail", extra_params);
13731386
this.forgeSiteObjectEvents("devices", "switch", res?.groups?.host, "detail", extra_params);
13741387
this.forgeSiteObjectAlarms("devices", "switch", res?.groups?.host, "detail", extra_params);
1388+
this.forgeOrgObjectStatsSearch("bgp_peers", res?.groups?.host, stats_filter, this.obj_name + " bgp peers");
1389+
this.forgeOrgObjectStatsSearch("ports", res?.groups?.host, stats_filter, this.obj_name + " ports");
13751390
break;
13761391
case "juniperGateway":
13771392
this.setName("gateway", "insights");
1393+
stats_filter = "site_id=" + this.site_id;
1394+
if (this.obj_id) stats_filter += "&mac=" + this.obj_id.split("-")[4];
13781395
this.forgeSiteObject("devices", res?.groups?.host, "detail");
13791396
this.forgeSiteObjectStats("devices", res?.groups?.host, "detail", extra_params);
13801397
this.forgeSiteObjectEvents("devices", "gateway", res?.groups?.host, "detail", extra_params);
13811398
this.forgeSiteObjectAlarms("devices", "gateway", res?.groups?.host, "detail", extra_params);
1399+
this.forgeOrgObjectStatsSearch("bgp_peers", res?.groups?.host, stats_filter, this.obj_name + " bgp peers");
1400+
this.forgeOrgObjectStatsSearch("ports", res?.groups?.host, stats_filter, this.obj_name + " ports");
1401+
this.forgeOrgObjectStatsSearch("vpn_peers", res?.groups?.host, stats_filter, this.obj_name + " vpn peers");
13821402
break;
13831403
case "wiredClient":
13841404
this.setName("wired client", "insights");

0 commit comments

Comments
 (0)