Skip to content

Commit 2bbce15

Browse files
committed
fix mxedge details quick links (org and site)
1 parent 5182238 commit 2bbce15

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

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

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export class ApiManageComponent implements OnInit {
9797
const site_common_objs = ["ap", "gateway", "switch", "assets", "wlan", "tags", "psk", "tunnels", "clients", "guestclients", "sdkclients", "wiredclients", "wxlan", "security", "switchconfig", "pcap", "siteedge", "cellularedges"]
9898
const org_evpn_re = /https:\/\/(manage|integration|manage-staging)\.(?<host>[a-z0-9.]*(mist|mistsys|mist-federal)\.com)\/admin\/\?org_id=(?<org_id>[0-9a-f-]{36})#!evpn\/org(\/(?<topology_id>[0-9a-f-]{36}))?/yis;
9999
const org_common_re = /https:\/\/(manage|integration|manage-staging)\.(?<host>[a-z0-9.]*(mist|mistsys|mist-federal)\.com)\/admin\/\?org_id=(?<org_id>[0-9a-f-]{36})#!(?<obj>[a-zA-Z]+)\/?((?<detail>detail|site|admin|edgedetail|clusterdetail|new|view|template|rfTemplate|provider)\/)?([0-9]\/)?(?<obj_id>[0-9a-z_-]*)\??(?<query_params>[0-9a-z_=&-]*)?/yis;
100-
const org_common_objs = ["orgtags", "misttunnels", "templates", "switchtemplate", "gatewaytemplates", "hubs", "deviceprofiles", "org", "orgpsk", "configuration", "auditlogs", "apinventory", "adminconfig", "subscription", "edge", "vpns", "template", "rftemplates", "services", "networks", "applicationpolicy", "authpolicylabels", "naccertificates", "nacpolicy", "nacidentityproviders", "onboardingworkflow", "sdk", "premiumanalytics", "private5g", "securityevents", "nacclients", "nacendpoints"];
100+
const org_common_objs = ["orgtags", "misttunnels", "templates", "switchtemplate", "gatewaytemplates", "hubs", "deviceprofiles", "org", "orgpsk", "configuration", "auditlogs", "apinventory", "adminconfig", "subscription", "edge", "vpns", "template", "rftemplates", "services", "networks", "applicationpolicy", "authpolicylabels", "naccertificates", "nacpolicy", "nacidentityproviders", "onboardingworkflow", "sdk", "premiumanalytics", "private5g", "securityevents", "nacclients", "nacendpoints", "sitetemplates"];
101101
const base_re = /https:\/\/(manage|integration|manage-staging)\.(?<host>[a-z0-9.]*(mist|mistsys|mist-federal)\.com)\/admin\/\?org_id=(?<org_id>[0-9a-f-]{36})#!/yis;
102102
const msp_re = /https:\/\/(manage|integration|manage-staging)\.(?<host>[a-z0-9.]*(mist|mistsys|mist-federal)\.com)\/msp\/\?msp_id=(?<msp_id>[0-9a-f-]{36})#!(?<obj>orgs|admins|auditLogs|mspInfo|labels)\/?(?<detail>aiops|details|detail|invite)?\/?(?<obj_id>[0-9a-z_-]*)/yis;;
103103
var regexp_result;
@@ -173,7 +173,7 @@ export class ApiManageComponent implements OnInit {
173173
if (!ui_name) {
174174
ui_name = this.obj_name;
175175
}
176-
if (detail && detail != "new") {
176+
if (detail && detail != "new" || this.obj_id) {
177177
// set QUICK LINK
178178
url = "https://api." + host + "/api/v1/orgs/" + this.org_id + "/" + obj_name + "/" + this.obj_id;
179179
this.quick_links.push({ url: url, name: ui_name });
@@ -199,11 +199,17 @@ export class ApiManageComponent implements OnInit {
199199

200200
forgeOrgObjectEvents(obj_name: string, host: string, detail: string, extra_param: string | undefined = undefined): void {
201201
let url = "";
202+
let filter = "";
202203
if (detail && detail != "new" && this.obj_id) {
203204
// MAC
204205
const mac = this.getMac(this.obj_id);
206+
if (obj_name == "mxedges") {
207+
filter = "mxedge_id=00000000-0000-0000-1000-" + mac;
208+
} else {
209+
filter = "mac" + mac;
210+
}
205211
// set QUICK LINK
206-
url = "https://api." + host + "/api/v1/orgs/" + this.org_id + "/" + obj_name + "/events/search?limit=1000&mac=" + mac;
212+
url = "https://api." + host + "/api/v1/orgs/" + this.org_id + "/" + obj_name + "/events/search?limit=1000&" + filter;
207213
if (!extra_param) {
208214
url += "&duration=1d";
209215
} else {
@@ -538,7 +544,7 @@ export class ApiManageComponent implements OnInit {
538544
this.obj_name = "mxedge";
539545
this.forgeOrgObject("mxedges", host, detail);
540546
this.forgeOrgObjectStats("mxedges", host, detail);
541-
this.forgeSiteObjectEvents("mxedges", "mxedge", host, detail);
547+
this.forgeOrgObjectEvents("mxedges", host, detail);
542548
} else if (detail == "clusterdetail") {
543549
this.obj_name = "mxcluster";
544550
this.forgeOrgObject("mxclusters", host, detail);
@@ -823,6 +829,7 @@ export class ApiManageComponent implements OnInit {
823829
if (this.missing_fields.length == 0) {
824830
this.forgeSiteObject("mxedges", res?.groups?.host, res?.groups?.detail);
825831
this.forgeSiteObjectStats("mxedges", res?.groups?.host, res?.groups?.detail);
832+
this.forgeSiteObjectEvents("mxedges", "mxedge", res?.groups?.host, res?.groups?.detail);
826833
}
827834
break;
828835
case "tunnels":
@@ -1000,6 +1007,7 @@ export class ApiManageComponent implements OnInit {
10001007
this.forgeOrgObject("licenses", res?.groups?.host, res?.groups?.detail);
10011008
break;
10021009
case "edge":
1010+
console.log(res?.groups)
10031011
this.setName("mxedge", res?.groups?.detail);
10041012
this.forgeEdge(res?.groups?.host, res?.groups?.detail)
10051013
break;
@@ -1017,7 +1025,9 @@ export class ApiManageComponent implements OnInit {
10171025
case "deviceprofiles":
10181026
case "gatewaytemplates":
10191027
case "networks":
1020-
this.setName(res?.groups?.obj.substr(0, res?.groups?.obj.length - 1), res?.groups?.detail);
1028+
case "sitetemplates":
1029+
// TODO: fix name when detail/obj_id
1030+
this.setName(res?.groups?.obj.substring(0, res?.groups?.obj.length - 1), res?.groups?.detail);
10211031
this.forgeOrgObject(res?.groups?.obj.toLowerCase(), res?.groups?.host, res?.groups?.detail);
10221032
break;
10231033
case "applicationpolicy":

0 commit comments

Comments
 (0)