mirror of
https://github.com/GNS3/gns3-server.git
synced 2024-12-22 14:12:29 +00:00
1 line
14 KiB
JavaScript
1 line
14 KiB
JavaScript
"use strict";(self.webpackChunkgns3_web_ui=self.webpackChunkgns3_web_ui||[]).push([[465],{2465:function(z,u,l){l.r(u),l.d(u,{TopologySummaryComponent:function(){return p}});var f=l(5671),v=l(3144),t=l(5e3),y=l(5366),C=l(9971),x=l(5542),S=l(6215),T=l(4068),g=l(9808),b=l(2072),d=l(3251),E=l(4107),_=l(508),O=l(4834);function P(s,n){if(1&s){var e=t.EpF();t.TgZ(0,"div",2),t.NdJ("mousemove",function(a){return t.CHM(e),t.oxw().dragWidget(a)},!1,t.evT)("mouseup",function(){return t.CHM(e),t.oxw().toggleDragging(!1)},!1,t.evT),t.qZA()}}function M(s,n){1&s&&(t.O4$(),t.TgZ(0,"svg",28),t._UZ(1,"rect",29),t.qZA())}function w(s,n){1&s&&(t.O4$(),t.TgZ(0,"svg",28),t._UZ(1,"rect",30),t.qZA())}function Z(s,n){1&s&&(t.O4$(),t.TgZ(0,"svg",28),t._UZ(1,"rect",31),t.qZA())}function F(s,n){if(1&s&&(t.TgZ(0,"div"),t._uU(1),t.qZA()),2&s){var e=t.oxw().$implicit;t.xp6(1),t.lnq(" ",e.console_type," ",e.console_host,":",e.console," ")}}function D(s,n){1&s&&(t.TgZ(0,"div"),t._uU(1," none "),t.qZA())}function I(s,n){if(1&s&&(t.TgZ(0,"div",25)(1,"div"),t.YNc(2,M,2,0,"svg",26),t.YNc(3,w,2,0,"svg",26),t.YNc(4,Z,2,0,"svg",26),t._uU(5),t.qZA(),t.YNc(6,F,2,3,"div",27),t.YNc(7,D,2,0,"div",27),t.qZA()),2&s){var e=n.$implicit;t.xp6(2),t.Q6J("ngIf","started"===e.status),t.xp6(1),t.Q6J("ngIf","suspended"===e.status),t.xp6(1),t.Q6J("ngIf","stopped"===e.status),t.xp6(1),t.hij(" ",e.name," "),t.xp6(1),t.Q6J("ngIf",null!=e.console&&null!=e.console&&"none"!=e.console_type),t.xp6(1),t.Q6J("ngIf",null===e.console||void 0===e.console||"none"===e.console_type)}}function k(s,n){1&s&&(t.O4$(),t.TgZ(0,"svg",28),t._UZ(1,"rect",29),t.qZA())}function A(s,n){1&s&&(t.O4$(),t.TgZ(0,"svg",28),t._UZ(1,"rect",31),t.qZA())}function N(s,n){if(1&s&&(t.TgZ(0,"div",25)(1,"div"),t.YNc(2,k,2,0,"svg",26),t.YNc(3,A,2,0,"svg",26),t._uU(4),t.qZA(),t.TgZ(5,"div"),t._uU(6),t.qZA(),t.TgZ(7,"div"),t._uU(8),t.qZA()()),2&s){var e=n.$implicit,o=t.oxw(2);t.xp6(2),t.Q6J("ngIf",e.connected),t.xp6(1),t.Q6J("ngIf",!e.connected),t.xp6(1),t.hij(" ",e.name," "),t.xp6(2),t.hij(" ",e.host," "),t.xp6(2),t.hij(" ",o.controller.location," ")}}var U=function(n){return{lightTheme:n}},W=function(){return{right:!0,left:!0,bottom:!0,top:!0}};function R(s,n){if(1&s){var e=t.EpF();t.TgZ(0,"div",3),t.NdJ("mousedown",function(){return t.CHM(e),t.oxw().toggleDragging(!0)})("resizeStart",function(){return t.CHM(e),t.oxw().toggleDragging(!1)})("resizeEnd",function(i){return t.CHM(e),t.oxw().onResizeEnd(i)}),t.TgZ(1,"div",4)(2,"mat-tab-group")(3,"mat-tab",5),t.NdJ("click",function(){return t.CHM(e),t.oxw().toggleTopologyVisibility(!0)}),t.TgZ(4,"div",6)(5,"div",7)(6,"mat-select",8)(7,"mat-optgroup",9)(8,"mat-option",10),t.NdJ("onSelectionChange",function(){return t.CHM(e),t.oxw().applyStatusFilter("started")}),t._uU(9,"started"),t.qZA(),t.TgZ(10,"mat-option",11),t.NdJ("onSelectionChange",function(){return t.CHM(e),t.oxw().applyStatusFilter("suspended")}),t._uU(11,"suspended"),t.qZA(),t.TgZ(12,"mat-option",12),t.NdJ("onSelectionChange",function(){return t.CHM(e),t.oxw().applyStatusFilter("stopped")}),t._uU(13,"stopped"),t.qZA()(),t.TgZ(14,"mat-optgroup",13)(15,"mat-option",14),t.NdJ("onSelectionChange",function(){return t.CHM(e),t.oxw().applyCaptureFilter("capture")}),t._uU(16,"active capture(s)"),t.qZA(),t.TgZ(17,"mat-option",15),t.NdJ("onSelectionChange",function(){return t.CHM(e),t.oxw().applyCaptureFilter("packet")}),t._uU(18,"active packet captures"),t.qZA()()()(),t.TgZ(19,"div",16)(20,"mat-select",17),t.NdJ("selectionChange",function(){return t.CHM(e),t.oxw().setSortingOrder()})("valueChange",function(i){return t.CHM(e),t.oxw().sortingOrder=i}),t.TgZ(21,"mat-option",18),t._uU(22,"sort by name ascending"),t.qZA(),t.TgZ(23,"mat-option",19),t._uU(24,"sort by name descending"),t.qZA()()(),t._UZ(25,"mat-divider",20),t.TgZ(26,"div",21),t.YNc(27,I,8,6,"div",22),t.qZA()()(),t.TgZ(28,"mat-tab",23),t.NdJ("click",function(){return t.CHM(e),t.oxw().toggleTopologyVisibility(!1)}),t.TgZ(29,"div",6)(30,"div",24),t.YNc(31,N,9,5,"div",22),t.qZA()()()()()()}if(2&s){var o=t.oxw();t.Q6J("ngStyle",o.style)("ngClass",t.VKq(9,U,o.isLightThemeEnabled))("validateResize",o.validate)("resizeEdges",t.DdM(11,W))("enableGhostResize",!0),t.xp6(20),t.Q6J("value",o.sortingOrder),t.xp6(6),t.Q6J("ngStyle",o.styleInside),t.xp6(1),t.Q6J("ngForOf",o.filteredNodes),t.xp6(4),t.Q6J("ngForOf",o.computes)}}var p=function(){function s(n,e,o,a,i){(0,f.Z)(this,s),this.nodesDataSource=n,this.projectService=e,this.computeService=o,this.linksDataSource=a,this.themeService=i,this.closeTopologySummary=new t.vpe,this.style={},this.styleInside={height:"280px"},this.subscriptions=[],this.nodes=[],this.filteredNodes=[],this.sortingOrder="asc",this.startedStatusFilterEnabled=!1,this.suspendedStatusFilterEnabled=!1,this.stoppedStatusFilterEnabled=!1,this.captureFilterEnabled=!1,this.packetFilterEnabled=!1,this.computes=[],this.isTopologyVisible=!0,this.isDraggingEnabled=!1,this.isLightThemeEnabled=!1}return(0,v.Z)(s,[{key:"ngOnInit",value:function(){var e=this;"light"===this.themeService.getActualTheme()?this.isLightThemeEnabled=!0:this.isLightThemeEnabled=!1,this.subscriptions.push(this.nodesDataSource.changes.subscribe(function(o){e.nodes=o,e.nodes.forEach(function(a){("0.0.0.0"===a.console_host||"0:0:0:0:0:0:0:0"===a.console_host||"::"===a.console_host)&&(a.console_host=e.controller.host)}),"asc"===e.sortingOrder?e.filteredNodes=o.sort(e.compareAsc):e.filteredNodes=o.sort(e.compareDesc)})),this.projectService.getStatistics(this.controller,this.project.project_id).subscribe(function(o){e.projectsStatistics=o}),this.computeService.getComputes(this.controller).subscribe(function(o){e.computes=o}),this.revertPosition()}},{key:"revertPosition",value:function(){var e=localStorage.getItem("leftPosition"),o=localStorage.getItem("rightPosition"),a=localStorage.getItem("topPosition"),i=localStorage.getItem("widthOfWidget"),r=localStorage.getItem("heightOfWidget");this.style=a?{position:"fixed",left:"".concat(+e,"px"),right:"".concat(+o,"px"),top:"".concat(+a,"px"),width:"".concat(+i,"px"),height:"".concat(+r,"px")}:{top:"60px",right:"0px",width:"320px",height:"400px"}}},{key:"toggleDragging",value:function(e){this.isDraggingEnabled=e}},{key:"dragWidget",value:function(e){var o=Number(e.movementX),a=Number(e.movementY),i=Number(this.style.width.split("px")[0]),r=Number(this.style.height.split("px")[0]),c=Number(this.style.top.split("px")[0])+a;if(this.style.left){var m=Number(this.style.left.split("px")[0])+o;this.style={position:"fixed",left:"".concat(m,"px"),top:"".concat(c,"px"),width:"".concat(i,"px"),height:"".concat(r,"px")},localStorage.setItem("leftPosition",m.toString()),localStorage.setItem("topPosition",c.toString()),localStorage.setItem("widthOfWidget",i.toString()),localStorage.setItem("heightOfWidget",r.toString())}else{var h=Number(this.style.right.split("px")[0])-o;this.style={position:"fixed",right:"".concat(h,"px"),top:"".concat(c,"px"),width:"".concat(i,"px"),height:"".concat(r,"px")},localStorage.setItem("rightPosition",h.toString()),localStorage.setItem("topPosition",c.toString()),localStorage.setItem("widthOfWidget",i.toString()),localStorage.setItem("heightOfWidget",r.toString())}}},{key:"validate",value:function(e){return!(e.rectangle.width&&e.rectangle.height&&(e.rectangle.width<290||e.rectangle.height<260))}},{key:"onResizeEnd",value:function(e){this.style={position:"fixed",left:"".concat(e.rectangle.left,"px"),top:"".concat(e.rectangle.top,"px"),width:"".concat(e.rectangle.width,"px"),height:"".concat(e.rectangle.height,"px")},this.styleInside={height:"".concat(e.rectangle.height-120,"px")}}},{key:"toggleTopologyVisibility",value:function(e){this.isTopologyVisible=e,this.revertPosition()}},{key:"compareAsc",value:function(e,o){return e.name<o.name?-1:1}},{key:"compareDesc",value:function(e,o){return e.name<o.name?1:-1}},{key:"ngOnDestroy",value:function(){this.subscriptions.forEach(function(e){return e.unsubscribe()})}},{key:"setSortingOrder",value:function(){"asc"===this.sortingOrder?this.filteredNodes=this.filteredNodes.sort(this.compareAsc):this.filteredNodes=this.filteredNodes.sort(this.compareDesc)}},{key:"applyStatusFilter",value:function(e){"started"===e?this.startedStatusFilterEnabled=!this.startedStatusFilterEnabled:"stopped"===e?this.stoppedStatusFilterEnabled=!this.stoppedStatusFilterEnabled:"suspended"===e&&(this.suspendedStatusFilterEnabled=!this.suspendedStatusFilterEnabled),this.applyFilters()}},{key:"applyCaptureFilter",value:function(e){"capture"===e?this.captureFilterEnabled=!this.captureFilterEnabled:"packet"===e&&(this.packetFilterEnabled=!this.packetFilterEnabled),this.applyFilters()}},{key:"applyFilters",value:function(){var e=[];this.startedStatusFilterEnabled&&(e=e.concat(this.nodes.filter(function(o){return"started"===o.status}))),this.stoppedStatusFilterEnabled&&(e=e.concat(this.nodes.filter(function(o){return"stopped"===o.status}))),this.suspendedStatusFilterEnabled&&(e=e.concat(this.nodes.filter(function(o){return"suspended"===o.status}))),!this.startedStatusFilterEnabled&&!this.stoppedStatusFilterEnabled&&!this.suspendedStatusFilterEnabled&&(e=e.concat(this.nodes)),this.captureFilterEnabled&&(e=this.checkCapturing(e)),this.packetFilterEnabled&&(e=this.checkPacketFilters(e)),"asc"===this.sortingOrder?this.filteredNodes=e.sort(this.compareAsc):this.filteredNodes=e.sort(this.compareDesc)}},{key:"checkCapturing",value:function(e){var o=this.linksDataSource.getItems(),a=[];o.forEach(function(r){r.capturing&&r.nodes.forEach(function(c){a.push(c.node_id)})});var i=[];return e.forEach(function(r){a.includes(r.node_id)&&i.push(r)}),i}},{key:"checkPacketFilters",value:function(e){var o=this.linksDataSource.getItems(),a=[];o.forEach(function(r){(r.filters.bpf||r.filters.corrupt||r.filters.corrupt||r.filters.packet_loss||r.filters.frequency_drop)&&r.nodes.forEach(function(c){a.push(c.node_id)})});var i=[];return e.forEach(function(r){a.includes(r.node_id)&&i.push(r)}),i}},{key:"close",value:function(){this.closeTopologySummary.emit(!1)}}]),s}();p.\u0275fac=function(n){return new(n||p)(t.Y36(y.G),t.Y36(C.Y),t.Y36(x.X),t.Y36(S.F),t.Y36(T.f))},p.\u0275cmp=t.Xpm({type:p,selectors:[["app-topology-summary"]],inputs:{controller:"controller",project:"project"},outputs:{closeTopologySummary:"closeTopologySummary"},decls:2,vars:2,consts:[[3,"mousemove","mouseup",4,"ngIf"],["class","summaryWrapper","mwlResizable","",3,"ngStyle","ngClass","validateResize","resizeEdges","enableGhostResize","mousedown","resizeStart","resizeEnd",4,"ngIf"],[3,"mousemove","mouseup"],["mwlResizable","",1,"summaryWrapper",3,"ngStyle","ngClass","validateResize","resizeEdges","enableGhostResize","mousedown","resizeStart","resizeEnd"],[1,"summaryHeader"],["label","Map topology",3,"click"],[1,"tabContent"],[1,"summaryFilters"],["placeholder","Filter nodes","multiple",""],["label","Status filter"],["value","started",3,"onSelectionChange"],["value","suspended",3,"onSelectionChange"],["value","stopped",3,"onSelectionChange"],["label","Capture filter"],["value","capture",3,"onSelectionChange"],["value","packet",3,"onSelectionChange"],[1,"summarySorting"],["placeholder","Sorting",3,"value","selectionChange","valueChange"],["value","asc"],["value","desc"],[1,"divider"],[1,"summaryContent",3,"ngStyle"],["class","nodeRow",4,"ngFor","ngForOf"],["label","Computes",3,"click"],[1,"summaryContentComputes"],[1,"nodeRow"],["width","10","height","10",4,"ngIf"],[4,"ngIf"],["width","10","height","10"],["x","0","y","0","width","10","height","10","fill","green",1,"status_started"],["x","0","y","0","width","10","height","10","fill","yellow",1,"status_suspended"],["x","0","y","0","width","10","height","10","fill","red",1,"status_stopped"]],template:function(n,e){1&n&&(t.YNc(0,P,1,0,"div",0),t.YNc(1,R,32,12,"div",1)),2&n&&(t.Q6J("ngIf",e.isDraggingEnabled),t.xp6(1),t.Q6J("ngIf",e.projectsStatistics))},directives:[g.O5,b.E$,g.PC,g.mk,d.SP,d.uX,E.gD,_.Nv,_.ey,O.d,g.sg],styles:["@media screen and (max-width: 600px){.summaryWrapper[_ngcontent-%COMP%]{visibility:hidden}}mat-tab-group[_ngcontent-%COMP%]{width:100%}.summaryWrapper[_ngcontent-%COMP%]{box-shadow:0 4px 8px #0003,0 6px 20px #00000030;position:fixed;top:60px;right:0px;height:400px;width:320px;background:#263238;color:#fff;overflow:hidden;font-size:12px;margin:20px;border-radius:8px}.lightTheme[_ngcontent-%COMP%]{background-color:#f4f8fcf2;color:#000;margin:20px;border-radius:8px}.summaryHeaderMenu[_ngcontent-%COMP%]{height:24px}.summaryHeader[_ngcontent-%COMP%]{width:100%;display:flex}.summaryFilters[_ngcontent-%COMP%], .summarySorting[_ngcontent-%COMP%]{height:25px;margin-left:5px;margin-right:5px}.tabContent[_ngcontent-%COMP%]{padding:10px}.summaryContent[_ngcontent-%COMP%]{overflow:auto;scrollbar-color:darkgrey #263238;scrollbar-width:thin}.summaryContentComputes[_ngcontent-%COMP%]{max-height:350px;overflow:auto;scrollbar-color:darkgrey #263238;scrollbar-width:thin}.titleButton[_ngcontent-%COMP%]{margin-left:5px;margin-top:4px;outline:none;border-radius:0}.marked[_ngcontent-%COMP%]{color:#0097a7;border-bottom:2px solid #0097a7}.divider[_ngcontent-%COMP%]{margin-top:5px;margin-bottom:5px;width:100%;height:2px}.nodeRow[_ngcontent-%COMP%]{width:100%;display:flex;justify-content:space-between;padding-right:5px}[_ngcontent-%COMP%]::-webkit-scrollbar{width:.5em}[_ngcontent-%COMP%]::-webkit-scrollbar-track{-webkit-box-shadow:inset 0 0 6px rgba(0,0,0,.3)}[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background-color:#a9a9a9;outline:1px solid #263238}.radio-group-wrapper[_ngcontent-%COMP%]{margin-top:5px}.radio-group[_ngcontent-%COMP%]{display:flex;justify-content:space-between}.closeButton[_ngcontent-%COMP%]{cursor:pointer;font-size:24px;margin-top:8px;margin-right:5px}.filterBox[_ngcontent-%COMP%]{display:flex;justify-content:space-between}.notvisible[_ngcontent-%COMP%]{display:none}"]})}}]); |