@@ -293,7 +293,7 @@ export class ApiComponent implements OnInit {
293
293
}
294
294
295
295
////////////////////////////////////////////////////////////////////////////////////
296
- ////////////////////// MIST EDGEFUNCTION
296
+ ////////////////////// MIST EDGE FUNCTION
297
297
forgeEdge ( host : string , detail : string ) : void {
298
298
if ( detail == "edgedetail" ) {
299
299
this . obj_name = "mxedge" ;
@@ -315,9 +315,19 @@ export class ApiComponent implements OnInit {
315
315
}
316
316
317
317
////////////////////////////////////////////////////////////////////////////////////
318
- ////////////////////////////////////////////////////////////////////////////////////
319
- ////////////////////// DISCOVERED SWITCHES URL FUNCTION DISPATCHER
320
- discoveredSwitchUrl ( res : RegExpExecArray ) : void {
318
+ ////////////////////// DISCOVERED SWITCHES FUNCTION
319
+ forgeSiteDiscoveredSwitchUrl ( host : string , mac : string = null ) : void {
320
+ if ( mac ) {
321
+ this . quick_links . push ( {
322
+ url : "https://api." + host + "/api/v1/sites/" + this . site_id + "/stats/discovered_switches/search?system_name=" + mac ,
323
+ name : "discovered switch"
324
+ } )
325
+ } else if ( ! this . obj_id ) {
326
+ this . quick_links . push ( {
327
+ url : "https://api." + host + "/api/v1/sites/" + this . site_id + "/stats/discovered_switches/search" ,
328
+ name : "discovered switches"
329
+ } )
330
+ }
321
331
}
322
332
////////////////////////////////////////////////////////////////////////////////////
323
333
////////////////////////////////////////////////////////////////////////////////////
@@ -328,8 +338,8 @@ export class ApiComponent implements OnInit {
328
338
const uuid_re = / [ 0 - 9 a - f ] { 8 } - [ 0 - 9 a - f ] { 4 } - [ 0 - 9 a - f ] { 4 } - [ 0 - 9 a - f ] { 4 } - [ 0 - 9 a - f ] { 12 } /
329
339
console . log ( res . groups )
330
340
if ( res . groups . host && res . groups . org_id && res . groups . obj ) {
331
- this . obj_id = res . groups . uuid_1 ;
332
- this . site_id = res . groups . uuid_2 ;
341
+ this . obj_id = res . groups . obj_id ;
342
+ this . site_id = res . groups . site_id ;
333
343
switch ( res . groups . obj . toLowerCase ( ) ) {
334
344
// SITE
335
345
case "ap" :
@@ -341,20 +351,18 @@ export class ApiComponent implements OnInit {
341
351
this . forgeSiteObjectEvents ( "devices" , res . groups . obj , res . groups . host , res . groups . detail ) ;
342
352
break ;
343
353
case "switch" :
344
- const is_uuid = uuid_re . test ( res . groups . uuid_1 )
345
- if ( ! res . groups . uuid_1 || is_uuid ) {
354
+ const is_uuid = uuid_re . test ( this . obj_id )
355
+ if ( this . obj_id && ! is_uuid ) {
356
+ this . obj_name = "discoveredswitch" ;
357
+ this . setName ( "discoveredswitch" , "detail" ) ;
358
+ this . forgeSiteDiscoveredSwitchUrl ( res . groups . host , this . obj_id ) ;
359
+ } else {
346
360
this . setName ( res . groups . obj , res . groups . detail ) ;
347
361
if ( ! res . groups . details ) extra_params = "type=" + res . groups . obj ;
348
362
this . forgeSiteObject ( "devices" , res . groups . host , res . groups . detail , extra_params ) ;
349
363
this . forgeSiteObjectStats ( "devices" , res . groups . host , res . groups . detail , extra_params ) ;
350
364
this . forgeSiteObjectEvents ( "devices" , res . groups . obj , res . groups . host , res . groups . detail ) ;
351
- } else {
352
- this . obj_name = "discoveredswitch" ;
353
- this . setName ( "discoveredswitch" , "detail" ) ;
354
- this . quick_links . push ( {
355
- url : "https://api." + res . groups . host + "/api/v1/sites/" + this . site_id + "/stats/discovered_switches/search?system_name=" + res . groups . uuid_1 ,
356
- name : "discovered switch"
357
- } )
365
+ this . forgeSiteDiscoveredSwitchUrl ( res . groups . host ) ;
358
366
}
359
367
break ;
360
368
case "assets" :
@@ -437,7 +445,7 @@ export class ApiComponent implements OnInit {
437
445
break ;
438
446
case "configuration" :
439
447
this . setName ( "site" , res . groups . detail ) ;
440
- this . forgeSite ( res . groups . host , res . groups . uuid_1 ) ;
448
+ this . forgeSite ( res . groups . host , this . obj_id ) ;
441
449
break ;
442
450
case "rftemplates" :
443
451
case "templates" :
@@ -475,8 +483,8 @@ export class ApiComponent implements OnInit {
475
483
insightsUrl ( res : RegExpExecArray ) : void {
476
484
console . log ( res )
477
485
this . org_id = res . groups . org_id ;
478
- this . site_id = res . groups . uuid_2 ;
479
- this . obj_id = res . groups . uuid_1 ;
486
+ this . site_id = res . groups . site_id ;
487
+ this . obj_id = res . groups . obj_id ;
480
488
let extra_params = null ;
481
489
if ( res . groups . start && res . groups . stop ) {
482
490
extra_params = "start=" + res . groups . start + "&end=" + res . groups . stop ;
@@ -491,7 +499,7 @@ export class ApiComponent implements OnInit {
491
499
break ;
492
500
case "client" :
493
501
this . setName ( "client" , "insights" ) ;
494
- // this.forgeSiteObject ("clients", res.groups.host, "detail");
502
+ this . forgeSiteObjectSearch ( "clients" , res . groups . host , "detail" ) ;
495
503
this . forgeSiteObjectStats ( "clients" , res . groups . host , "detail" , extra_params ) ;
496
504
this . forgeSiteObjectEvents ( "clients" , null , res . groups . host , "detail" , extra_params ) ;
497
505
break ;
@@ -532,8 +540,8 @@ export class ApiComponent implements OnInit {
532
540
// API URL ENTRYPOINT
533
541
534
542
generateApiUrl ( ) {
535
- const insights_re = / h t t p s : \/ \/ ( m a n a g e | i n t e g r a t i o n ) \. (?< host > [ a - z 0 - 1 . ] * m i s t \. c o m ) \/ a d m i n \/ \? o r g _ i d = (?< org_id > [ 0 - 9 a - f - ] * ) # ! d a s h b o a r d \/ i n s i g h t s \/ ( (?< obj > [ a - z ] + ) \/ ) ? ( (?< uuid_1 > [ a - z 0 - 9 - ] + ) \/ ) ( (?< period > [ a - z 0 - 9 ] + ) \/ ) ? ( (?< start > [ 0 - 9 ] * ) \/ ) ? ( (?< stop > [ 0 - 9 ] * ) \/ ) ? (?< uuid_2 > [ 0 - 9 a - f - ] * ) ? / iys;
536
- const common_re = / h t t p s : \/ \/ ( m a n a g e | i n t e g r a t i o n ) \. (?< host > [ a - z 0 - 1 . ] * m i s t \. c o m ) \/ a d m i n \/ \? o r g _ i d = (?< org_id > [ 0 - 9 a - f - ] * ) # ! (?< obj > [ a - z ] + ) \/ ? ( (?< detail > d e t a i l | t e m p l a t e | s i t e | r f T e m p l a t e | a d m i n | e d g e d e t a i l | c l u s t e r d e t a i l | n e w ) \/ ) ? ( [ 0 - 9 ] \/ ) ? ( (?< uuid_1 > [ 0 - 9 a - f - ] * ) \/ ) ? (?< uuid_2 > [ 0 - 9 a - f - ] * ) ? / yis;
543
+ const insights_re = / h t t p s : \/ \/ ( m a n a g e | i n t e g r a t i o n ) \. (?< host > [ a - z 0 - 1 . ] * m i s t \. c o m ) \/ a d m i n \/ \? o r g _ i d = (?< org_id > [ 0 - 9 a - f - ] * ) # ! d a s h b o a r d \/ i n s i g h t s \/ ( (?< obj > [ a - z ] + ) \/ ) ? ( (?< obj_id > [ a - z 0 - 9 - ] + ) \/ ) ( (?< period > [ a - z 0 - 9 ] + ) \/ ) ? ( (?< start > [ 0 - 9 ] * ) \/ ) ? ( (?< stop > [ 0 - 9 ] * ) \/ ) ? (?< site_id > [ 0 - 9 a - f - ] * ) ? / iys;
544
+ const common_re = / h t t p s : \/ \/ ( m a n a g e | i n t e g r a t i o n ) \. (?< host > [ a - z 0 - 1 . ] * m i s t \. c o m ) \/ a d m i n \/ \? o r g _ i d = (?< org_id > [ 0 - 9 a - f - ] * ) # ! (?< obj > [ a - z ] + ) \/ ? ( (?< detail > d e t a i l | t e m p l a t e | s i t e | r f T e m p l a t e | a d m i n | e d g e d e t a i l | c l u s t e r d e t a i l | n e w ) \/ ) ? ( [ 0 - 9 ] \/ ) ? ( (?< obj_id > [ 0 - 9 a - z _ - ] * ) \/ ) ? (?< site_id > [ 0 - 9 a - f - ] * ) ? / yis;
537
545
538
546
const insights = insights_re . exec ( this . tabUrl )
539
547
const common = common_re . exec ( this . tabUrl )
0 commit comments