UNPKG

graphdb-workbench

Version:
2 lines 3.34 kB
export const __webpack_id__=74780;export const __webpack_ids__=[74780];export const __webpack_modules__={74780:(e,t,o)=>{o.r(t);var n=o(24508);function i(e,t,o,i,a,d,r){return{restrict:"E",templateUrl:"js/angular/clustermanagement/templates/cluster-nodes-configuration.html",link:o=>{const i=[];o.rowHeights={},o.editedNodeIndex=void 0,o.allSuggestions=[],o.loader=!1,o.errors=[],o.addNewLocation=!1,o.hasCluster=!1,o.addNode=()=>{o.addNewLocation=!0,o.newLocation=new n.Location,t(function(){const e=document.querySelector("input[name='location']");e&&e.focus()},0)},o.filterSuggestions=e=>{const t=e.endpoint&&e.endpoint.toLowerCase();t?(o.suggestions=o.allSuggestions.filter(e=>e.toLowerCase().includes(t)),o.showDropdown=!0):(o.suggestions=[],o.showDropdown=!1)},o.selectSuggestion=(e,t)=>{e.endpoint=t,o.suggestions=[],o.showDropdown=!1},o.hideSuggestions=()=>{t(()=>{o.showDropdown=!1},200)},o.handleKeydown=function(e,t,n){"Enter"===e.key&&t?(e.preventDefault(),o.saveNode(n)):"Escape"===e.key&&o.cancel()},o.saveNode=e=>{const t=d.getAvailable(!0);var o,i;o=d.findByEndpoint(t,e)||new n.Location(e),(i=d.getPendingReplace())?d.replace(i,o):d.addLocation(o),a()},o.deleteNode=(t,o)=>{r.openSimpleModal({title:e.instant("location.confirm.detach"),message:e.instant("location.confirm.detach.warning",{uri:o.endpoint}),warning:!0}).result.then(()=>{d.deleteFromCluster(o.item)})},o.replaceNode=(t,n)=>{r.openSimpleModal({title:e.instant("location.change.confirm"),message:e.instant("location.change.confirm.warning"),warning:!0}).result.then(()=>{d.setPendingReplace(n.item),o.editedNodeIndex=t})},o.isClusterConfigurationValid=()=>{const e=void 0===o.editedNodeIndex,t=!1===o.addNewLocation,n=d.hasValidNodesCount(),i=o.form.$valid;return e&&t&&n&&i},o.setLoader=(e,n)=>{t.cancel(o.loaderTimeout),e?o.loaderTimeout=t(()=>{o.loader=e,o.loaderMessage=n},300):o.loader=!1},o.getAdvancedOptionsClass=()=>{const e=document.getElementById("advancedOptions");if(e){const t=e.getAttribute("aria-expanded");if(t&&"true"===t)return"fa fa-angle-down"}return"fa fa-angle-right"},o.cancel=()=>{o.editedNodeIndex=void 0,o.addNewLocation=!1,a(),d.emitUpdateClusterView()},o.restoreNode=e=>{d.restoreNode(e.item)};const a=()=>{d.setPendingReplace(void 0),o.editedNodeIndex=void 0,o.addNewLocation=!1},s=o.$watchGroup(["editedNodeIndex","addNewLocation","clusterConfiguration.electionMinTimeout","clusterConfiguration.electionRangeTimeout","clusterConfiguration.heartbeatInterval","clusterConfiguration.messageSizeKB","clusterConfiguration.verificationTimeout","clusterConfiguration.transactionLogMaximumSizeGB"],(e,t)=>{const n=o.isClusterConfigurationValid();d.updateClusterValidity(n)});i.push(s),i.push(d.onClusterViewChanged(e=>{o.hasCluster=d.hasCluster(),o.viewModel=d.getViewModel(),o.clusterNodesEndpoints=o.viewModel.map(e=>e.endpoint),o.clusterConfiguration=d.getClusterConfiguration(),o.allSuggestions=d.getAvailableNodeEndpoints(),o.canDeleteNode=d.canDeleteNode()})),o.$on("$destroy",()=>{i.forEach(e=>e())})}}}angular.module("graphdb.framework.clustermanagement.directives.cluster-nodes-configuration",[]).directive("clusterNodesConfiguration",i),i.$inject=["$translate","$timeout","productInfo","toastr","RemoteLocationsService","ClusterContextService","ModalService"]}}; //# sourceMappingURL=74780.9381f7196a73dc4bb547.bundle.js.map