export const __webpack_esm_id__=96972;export const __webpack_esm_ids__=[14267,96972];export const __webpack_esm_modules__={96972(e,t,n){n(38473),n(23236);var o=n(24125),s=n(22723),r=n(14267),a=n(44482),c=n(57154);const i={select:a.select};let l=240;const d={no_cluster_configured:"",create_cluster_btn:"",legend_node_state:"",legend_link_state:"",node_state_leader:"Leader",node_state_follower:"Follower",node_state_candidate:"Candidate",node_state_no_cluster:"No cluster",node_state_out_of_sync:"Out of sync",node_state_no_connection:"No connection",node_state_read_only:"Read only",node_state_restricted:"Restricted",link_state_in_sync:"In sync",link_state_syncing:"Syncing",link_state_out_of_sync:"Out of sync",recovery_state:{searching_for_node:"Searching for node",waiting_for_snapshot:"Waiting for snapshot from node",receiving_snapshot:"Receiving a snapshot from node",applying_snapshot:"Applying a snapshot",building_snapshot:"Building a snapshot for node",sending_snapshot:"Sending a snapshot to node",recovery_operation_failure_warning:"Node unable to recover. Action required"}},u={node_state:"legend_node_state",link_state:"legend_link_state"};angular.module("graphdb.framework.clustermanagement.directives.cluster-graphical-view",["graphdb.framework.utils.localstorageadapter","graphdb.framework.clustermanagement.directives.cluster-legend"]).directive("clusterGraphicalView",["$window","LocalStorageAdapter","LSKeys","UriUtils","$translate","$jwtAuth","$rootScope","ClusterViewContextService",function(e,t,n,a,_,p,g,f){return{restrict:"E",scope:{clusterModel:"="},link:function(p,h){const m=(0,c.service)(c.AuthorizationService),y=angular.element(e),w=[];let v,k,S,b,C,M=L(),x=j(),A=Math.min(M,x)/2-100,D=M/2,E=x/2;function N(){const e=f.getClusterViewD3Container();M=L(),x=j(),e.attr("width",M),e.attr("height",x),z()}function V(e,t=""){Object.keys(e).forEach(n=>{let o="";t&&(o+=t),o+=`.${n}`;const s=e[n];"string"==typeof s?e[n]=_.instant(`cluster_management.cluster_graphical_view${o}`):"object"==typeof s&&V(s,o)})}function L(){const o="collapsedMenu"===t.get(n.MENU_STATE);return l=o?70:240,Math.max(Math.floor(.95*(e.innerWidth-l)),600)}function j(){return Math.max(.95*(e.innerHeight-250),675)}function I(e){p.$emit(r.DP,e.target)}function z(){A=Math.min(M,x)/2-100,D=M/2,E=x/2,o.cZ(S,D,E),S.select(".cluster-zone").attr("r",A),k!==p.clusterModel.hasCluster&&(k=!!p.clusterModel.hasCluster,function(e){o.Xl(e,S,d,v),!e&&v&&S.on("mouseup",()=>{p.$emit(r.Yn)})}(k));const e=function(){const e=(0,s.cloneDeep)(p.clusterModel.nodes)||[];return e.forEach(e=>{if(e.hostname=a.shortenIri(e.endpoint),!(0,s.isEmpty)(e.recoveryStatus)){let t=`cluster_management.cluster_graphical_view.recovery_state.${e.recoveryStatus.state.toLowerCase()}`;e.recoveryStatus.affectedNodes&&e.recoveryStatus.affectedNodes.length>0&&(t+="_with_affected_node"),e.recoveryStatus.message=_.instant(t,{node:e.recoveryStatus.affectedNodes.join(", ")})}}),e}();!function(e){const t=b.selectAll("#node-group").data(e,e=>e.address),n=o.kI(t,45);n.on("click",(e,t)=>{p.$emit(r.vu,t);const n=i.select(".nodetooltip"),o=$(window).width();e.pageX<o/2?(n.style("left",e.pageX+"px"),n.style("right","")):(n.style("left",""),n.style("right",o-e.pageX+"px")),n.style("top",e.pageY-28+"px")}),o.HF(n),o.ss(n,D,E,A)}(e),function(e,t){const n=C.selectAll(".link").data(e,e=>e.id);o.cy(n),o.$$(n,t),o.Tk(C,e,t)}((0,s.cloneDeep)(p.clusterModel.links)||[],e)}p.width=function(){return M},p.height=function(){return x},p.$on("$destroy",function(){y.unbind("resize",N),y.unbind("mousedown",I),o.Wg(),w.forEach(e=>e())}),v=m.isAdmin(),y.bind("resize",N),y.bind("mousedown",I),w.push(g.$on("$translateChangeSuccess",function(){V(d),o.r_(k,S,d),Object.keys(u).forEach(e=>{i.select(`#${e}`).text(function(e){return d[u[e]]}(e))})})),w.push(p.$on(r.aV,function(){z()})),V(d),function(e){const t=o.J5(h[0]).attr("width",M).attr("height",x);S=o.dB(t,e),C=t.append("g").attr("id","links-group"),b=t.append("g").attr("id","nodes-group"),o.D6(t,o.ZC.BIG),o.D6(t,o.ZC.SMALL),f.updateClusterViewD3Container(t)}(!(!p.clusterModel.nodes||!p.clusterModel.nodes.length)),z()}}}])},14267(e,t,n){n.d(t,{DP:()=>r,Yn:()=>c,aV:()=>i,fe:()=>s,pw:()=>o,vu:()=>a});const o="updateCluster",s="deleteCluster",r="clickInView",a="nodeSelected",c="createCluster",i="modelUpdated"}};
//# sourceMappingURL=96972.fc25a13bb1bc69ad785c.bundle.js.map