@@ -358,6 +358,21 @@ export class ApiComponent implements OnInit {
358
358
name : "Worst sites by " + worstsle
359
359
} ) ;
360
360
}
361
+
362
+ ////////////////////////////////////////////////////////////////////////////////////
363
+ ////////////////////// SLE FUNCTION
364
+ forgeSlehUrl ( host : string , scope : string , site_id : string , scope_id : string , sles : string [ ] , extra_params : string = null ) : void {
365
+ /*
366
+ host: mist.com, eu.mist.com, gc1.mist.com
367
+ scope: wifi, wire, wan
368
+ */
369
+ sles . forEach ( sle => {
370
+ this . quick_links . push ( {
371
+ url : "https://api." + host + "/api/v1/sites/" + site_id + "/sle/" + scope + "/" + scope_id + "/metric/" + sle + "/summary-trend?" + extra_params ,
372
+ name : sle + " " + scope + " SLE"
373
+ } ) ;
374
+ } )
375
+ }
361
376
////////////////////////////////////////////////////////////////////////////////////
362
377
////////////////////////////////////////////////////////////////////////////////////
363
378
////////////////////// COMMON URL FUNCTION DISPATCHER
@@ -593,18 +608,79 @@ export class ApiComponent implements OnInit {
593
608
}
594
609
////////////////////////////////////////////////////////////////////////////////////
595
610
////////////////////////////////////////////////////////////////////////////////////
611
+ ////////////////////// SLE URL FUNCTION DISPATCHER
612
+
613
+ sleUrl ( res : RegExpExecArray ) : void {
614
+ console . log ( res )
615
+ this . org_id = res . groups . org_id ;
616
+ this . site_id = res . groups . site_id ;
617
+ let extra_params = null ;
618
+ let scope = "" ;
619
+ if ( res . groups . scope != "site" ) {
620
+ this . setName ( res . groups . scope , "sle" ) ;
621
+ this . obj_id = res . groups . scope_id ;
622
+ }
623
+ if ( res . groups . scope == "juniperSwitch" ) {
624
+ scope = "switch" ;
625
+ } else if ( res . groups . scope == "juniperGateway" ) {
626
+ scope = "gateway" ;
627
+ } else if ( res . groups . scope == "device" ) {
628
+ scope = "ap" ;
629
+ } else {
630
+ scope = res . groups . scope ;
631
+ }
632
+ if ( res . groups . start && res . groups . stop ) {
633
+ extra_params = "start=" + res . groups . start + "&end=" + res . groups . stop ;
634
+ }
635
+ if ( res . groups . host && res . groups . org_id ) {
636
+ let sles : string [ ] = [ ]
637
+ switch ( res . groups . detail ) {
638
+ case "serviceLevels" :
639
+ sles = [
640
+ "time-to-connect" ,
641
+ "failed-to-connect" ,
642
+ "roaming" ,
643
+ "throughput" ,
644
+ "coverage" ,
645
+ "capacity" ,
646
+ "ap-availability"
647
+ ]
648
+ break ;
649
+ case "wiredServiceLevels" :
650
+ sles = [
651
+ "switch-stc" ,
652
+ "switch-health" ,
653
+ "switch-throughput"
654
+ ]
655
+ break ;
656
+ case "wanServiceLevels" :
657
+ sles = [
658
+ "gateway-health" ,
659
+ "wan-link-health"
660
+ ]
661
+ break ;
662
+ }
663
+ this . forgeSlehUrl ( res . groups . host , scope , res . groups . site_id , res . groups . scope_id , sles , extra_params )
664
+ }
665
+ }
666
+ ////////////////////////////////////////////////////////////////////////////////////
667
+ ////////////////////////////////////////////////////////////////////////////////////
596
668
// API URL ENTRYPOINT
597
669
598
670
generateApiUrl ( ) {
599
671
const orgsle_re = / h t t p s : \/ \/ m a n a g e \. (?< 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 \/ (?< scope > s i t e C o m p a r i s o n | w i r e d S i t e C o m p a r i s o n | w a n S i t e C o m p a r i s o n ) \/ (?< sle > [ a - z - ] * ) \/ (?< worstsle > [ a - z - ] * ) \/ ( [ a - z - _ ] * ) \/ (?< period > [ 0 - 9 a - z - ] * ) \/ (?< start > [ 0 - 9 ] * ) \/ (?< stop > [ 0 - 9 ] * ) / iys;
672
+ const sle_re = / h t t p s : \/ \/ m a n a g e \. (?< 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 \/ (?< detail > s e r v i c e L e v e l s | w i r e d s e r v i c e L e v e l s | w a n s e r v i c e L e v e l s ) \/ (?< scope > [ a - z - ] * ) \/ (?< scope_id > [ a - f 0 - 9 - ] * ) \/ (?< period > [ 0 - 9 a - z - ] * ) \/ (?< start > [ 0 - 9 ] * ) \/ (?< stop > [ 0 - 9 ] * ) \/ (?< site_id > [ a - f 0 - 9 - ] * ) / iys;
600
673
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;
601
674
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 | v i e w ) \/ ) ? ( [ 0 - 9 ] \/ ) ? ( (?< obj_id > [ 0 - 9 a - z _ - ] * ) \/ ) ? (?< site_id > [ 0 - 9 a - f - ] * ) ? / yis;
602
675
603
676
const orgsle = orgsle_re . exec ( this . tabUrl ) ;
677
+ const sle = sle_re . exec ( this . tabUrl ) ;
604
678
const insights = insights_re . exec ( this . tabUrl ) ;
605
679
const common = common_re . exec ( this . tabUrl ) ;
606
680
if ( orgsle ) {
607
681
this . orgSleUrl ( orgsle ) ;
682
+ } else if ( sle ) {
683
+ this . sleUrl ( sle ) ;
608
684
} else if ( insights ) {
609
685
this . insightsUrl ( insights ) ;
610
686
} else if ( common ) {
0 commit comments