UNPKG

graphdb-workbench

Version:
2 lines 6.18 kB
export const __webpack_esm_id__=47133;export const __webpack_esm_ids__=[971,30222,47133,48581,70962];export const __webpack_esm_modules__={971(){angular.module("graphdb.framework.core.directives.ascii-validator",[]).directive("asciiValidator",function(){return{restrict:"A",require:"ngModel",link:function(e,t,n,r){function a(e){const t=/^[\x21-\x7E]*$/.test(e);return r.$setValidity("asciiValidator",t),e}r.$parsers.push(a),r.$formatters.push(a)}}})},30222(){angular.module("graphdb.framework.core.directives.length-validator",[]).directive("lengthValidator",function(){return{restrict:"A",require:"ngModel",link:function(e,t,n,r){function a(e){const t=n.minLength?parseInt(n.minLength,10):0,a=n.maxLength?parseInt(n.maxLength,10):1/0,i=e&&e.length>=t&&e.length<=a;return r.$setValidity("lengthValidator",i),e}r.$parsers.push(a),r.$formatters.push(a)}}})},47133(e,t,n){n(971),n(30222);var r=n(24508),a=n(70962),i=n(57154);const o={minLen:"3",maxLen:"255"};function s(e,t,n,s,c,l,g){return{restrict:"E",templateUrl:"js/angular/clustermanagement/templates/cluster-configuration/multi-region.html",scope:{clusterModel:"=",clusterConfiguration:"="},link:e=>{const u=(0,i.service)(i.AuthorizationService),_=(0,i.service)(i.AuthenticationService),d=[];e.topology=void 0,e.TopologyState=a.zB,e.isAdmin=!1,e.addingTag=!1,e.loaderTimeout=void 0,e.secondaryTag=void 0,e.TagLengthConstraints=o,e.add=()=>{e.addingTag=!0},e.cancel=()=>{e.addingTag=!1},e.createTag=n=>{const r={tag:n};return O(!0),l.addCusterTag(r).then(()=>{s.success(t.instant("cluster_management.cluster_configuration_multi_region.created_tag",{tag:n}))}).catch(e=>{const n=getError(e);s.error(n,t.instant("cluster_management.cluster_configuration_multi_region.error.creating"))}).finally(()=>{e.addingTag=!1,O(!1)})},e.deleteTag=e=>{c.openSimpleModal({title:t.instant("cluster_management.cluster_configuration_multi_region.confirm.delete",{tag:e}),message:t.instant("cluster_management.cluster_configuration_multi_region.confirm.warning"),warning:!0,backdrop:"static",stopPropagation:!0}).result.then(()=>(O(!0),l.deleteClusterTag(e))).then(()=>s.success(t.instant("cluster_management.cluster_configuration_multi_region.deleted_tag",{tag:e}))).catch(e=>{if("cancel"===e||"escape key press"===e)return;const n=getError(e);s.error(n,t.instant("cluster_management.cluster_configuration_multi_region.error.deleting"))}).finally(()=>O(!1))},e.enableSecondaryMode=()=>{e.addingTag=!1;const n={title:t.instant("cluster_management.cluster_configuration_multi_region.confirm.enable_secondary"),message:t.instant("cluster_management.cluster_configuration_multi_region.confirm.enable_secondary_warning"),warning:!0,backdrop:"static",confirmButtonKey:"common.ok.btn",stopPropagation:!0};c.openSimpleModal(n).result.then(()=>m()).then(e=>(O(!0),l.enableSecondaryMode(e))).then(()=>s.success(t.instant("cluster_management.cluster_configuration_multi_region.secondary_enabled"))).catch(e=>{if("cancel"===e||"escape key press"===e)return;const n=getError(e);s.error(n,t.instant("cluster_management.cluster_configuration_multi_region.error.secondary"))}).finally(()=>O(!1))},e.disableSecondaryMode=()=>{c.openSimpleModal({title:t.instant("cluster_management.cluster_configuration_multi_region.confirm.disable_secondary_mode"),message:t.instant("cluster_management.cluster_configuration_multi_region.confirm.disable_secondary_mode_warning"),warning:!0,backdrop:"static",stopPropagation:!0}).result.then(()=>(O(!0),l.disableSecondaryMode())).then(()=>s.success(t.instant("cluster_management.cluster_configuration_multi_region.disabled_secondary_mode"))).catch(e=>{if("cancel"===e||"escape key press"===e)return;const n=getError(e);s.error(n,t.instant("cluster_management.cluster_configuration_multi_region.error.disabling"))}).finally(()=>O(!1))};const m=()=>{const e={title:t.instant("cluster_management.cluster_configuration_multi_region.secondary_cluster_settings"),templateUrl:"js/angular/clustermanagement/templates/modal/secondary-mode-modal.html",controller:["$scope","$uibModalInstance","config",function(e,t,n){e.rpcAddress="",e.tag="",e.title=n.title,e.onClick=e=>e.stopPropagation(),e.ok=()=>{t.close({primaryNode:e.rpcAddress,tag:e.tag})},e.cancel=()=>{t.dismiss("cancel")}}],size:"lg",warning:!0,backdrop:"static"};return c.openCustomModal(e).result},N=n=>{O(!0),l.getClusterConfig().then(t=>{e.secondaryTag=r.v9.fromJSON(t.data).secondaryTag,(t=>{const n=t.nodes.find(e=>e.nodeState===a.UY.LEADER);e.topology=n.topologyStatus})(r.kY.fromJSON(n))}).catch(e=>{const n=getError(e);s.error(n,t.instant("cluster_management.cluster_configuration_multi_region.error.disabling"))}).finally(()=>O(!1))},O=(t,r)=>{n.cancel(e.loaderTimeout),t?(e.loaderMessage=r,e.loaderTimeout=n(()=>{e.loader=t},150)):e.loader=!1};e.$on("$destroy",function(){d.forEach(e=>e())}),e.isAdmin=_.isAuthenticated()&&u.isAdmin(),d.push(e.$watch("clusterModel",function(e,t){e!==t&&N(e)},!0)),d.push(g.onShowClusterConfigurationPanel(t=>{t||(e.addingTag=!1)})),N(e.clusterModel)}}}angular.module("graphdb.framework.clustermanagement.directives.cluster-configuration.multi-region",["graphdb.framework.core.directives.ascii-validator","graphdb.framework.core.directives.length-validator"]).directive("multiRegion",s),s.$inject=["$jwtAuth","$translate","$timeout","toastr","ModalService","ClusterRestService","ClusterViewContextService"]},70962(e,t,n){n.d(t,{UY:()=>r,gC:()=>i,vQ:()=>a,zB:()=>o});const r={LEADER:"LEADER",FOLLOWER:"FOLLOWER",CANDIDATE:"CANDIDATE",OUT_OF_SYNC:"OUT_OF_SYNC",NO_CONNECTION:"NO_CONNECTION",READ_ONLY:"READ_ONLY",RESTRICTED:"RESTRICTED",NO_CLUSTER:"NO_CLUSTER"},a={SEARCHING_FOR_NODE:"SEARCHING_FOR_NODE",WAITING_FOR_SNAPSHOT:"WAITING_FOR_SNAPSHOT",RECEIVING_SNAPSHOT:"RECEIVING_SNAPSHOT",APPLYING_SNAPSHOT:"APPLYING_SNAPSHOT",BUILDING_SNAPSHOT:"BUILDING_SNAPSHOT",SENDING_SNAPSHOT:"SENDING_SNAPSHOT",RECOVERY_OPERATION_FAILURE_WARNING:"RECOVERY_OPERATION_FAILURE_WARNING"},i={IN_SYNC:"IN_SYNC",OUT_OF_SYNC:"OUT_OF_SYNC",SYNCING:"SYNCING",NO_CONNECTION:"NO_CONNECTION",RECEIVING_SNAPSHOT:"RECEIVING_SNAPSHOT"},o={PRIMARY_NODE:"PRIMARY_NODE",SECONDARY_NODE:"SECONDARY_NODE"}}}; //# sourceMappingURL=47133.f2dac6f0a51b63457e35.bundle.js.map