graphdb-workbench
Version:
The web application for GraphDB APIs
2 lines • 6.19 kB
JavaScript
export const __webpack_id__=47133;export const __webpack_ids__=[971,30222,47133,48581,70962];export const __webpack_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,o=e&&e.length>=t&&e.length<=a;return r.$setValidity("lengthValidator",o),e}r.$parsers.push(a),r.$formatters.push(a)}}})},47133:(e,t,n)=>{n.r(t),n(971),n(30222);var r=n(24508),a=n(70962);const o={minLen:"3",maxLen:"255"};function i(e,t,n,i,s,c,l){return{restrict:"E",templateUrl:"js/angular/clustermanagement/templates/cluster-configuration/multi-region.html",scope:{clusterModel:"=",clusterConfiguration:"="},link:g=>{const u=[];g.topology=void 0,g.TopologyState=a.TopologyState,g.isAdmin=!1,g.addingTag=!1,g.loaderTimeout=void 0,g.secondaryTag=void 0,g.TagLengthConstraints=o,g.add=()=>{g.addingTag=!0},g.cancel=()=>{g.addingTag=!1},g.createTag=e=>{const n={tag:e};return m(!0),c.addCusterTag(n).then(()=>{i.success(t.instant("cluster_management.cluster_configuration_multi_region.created_tag",{tag:e}))}).catch(e=>{const n=getError(e);i.error(n,t.instant("cluster_management.cluster_configuration_multi_region.error.creating"))}).finally(()=>{g.addingTag=!1,m(!1)})},g.deleteTag=e=>{s.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(()=>(m(!0),c.deleteClusterTag(e))).then(()=>i.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);i.error(n,t.instant("cluster_management.cluster_configuration_multi_region.error.deleting"))}).finally(()=>m(!1))},g.enableSecondaryMode=()=>{g.addingTag=!1;const e={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};s.openSimpleModal(e).result.then(()=>_()).then(e=>(m(!0),c.enableSecondaryMode(e))).then(()=>i.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);i.error(n,t.instant("cluster_management.cluster_configuration_multi_region.error.secondary"))}).finally(()=>m(!1))},g.disableSecondaryMode=()=>{s.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(()=>(m(!0),c.disableSecondaryMode())).then(()=>i.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);i.error(n,t.instant("cluster_management.cluster_configuration_multi_region.error.disabling"))}).finally(()=>m(!1))};const _=()=>{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 s.openCustomModal(e).result},d=e=>{m(!0),c.getClusterConfig().then(t=>{g.secondaryTag=r.ClusterConfiguration.fromJSON(t.data).secondaryTag,(e=>{const t=e.nodes.find(e=>e.nodeState===a.NodeState.LEADER);g.topology=t.topologyStatus})(r.ClusterModel.fromJSON(e))}).catch(e=>{const n=getError(e);i.error(n,t.instant("cluster_management.cluster_configuration_multi_region.error.disabling"))}).finally(()=>m(!1))},m=(e,t)=>{n.cancel(g.loaderTimeout),e?(g.loaderMessage=t,g.loaderTimeout=n(()=>{g.loader=e},150)):g.loader=!1};g.$on("$destroy",function(){u.forEach(e=>e())}),g.isAdmin=e.isAuthenticated()&&e.isAdmin(),u.push(g.$watch("clusterModel",function(e,t){e!==t&&d(e)},!0)),u.push(l.onShowClusterConfigurationPanel(e=>{e||(g.addingTag=!1)})),d(g.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",i),i.$inject=["$jwtAuth","$translate","$timeout","toastr","ModalService","ClusterRestService","ClusterViewContextService"]},70962:(e,t,n)=>{n.r(t),n.d(t,{LinkState:()=>o,NodeState:()=>r,RecoveryState:()=>a,TopologyState:()=>i});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"},o={IN_SYNC:"IN_SYNC",OUT_OF_SYNC:"OUT_OF_SYNC",SYNCING:"SYNCING",NO_CONNECTION:"NO_CONNECTION",RECEIVING_SNAPSHOT:"RECEIVING_SNAPSHOT"},i={PRIMARY_NODE:"PRIMARY_NODE",SECONDARY_NODE:"SECONDARY_NODE"}}};
//# sourceMappingURL=47133.90b1171ae105c6e08af9.bundle.js.map