/*! For license information please see module-4.bundle.js.LICENSE.txt */
"use strict";(self.webpackChunkapplication=self.webpackChunkapplication||[]).push([[364],{1336:(e,t,i)=>{i.r(t),i.d(t,{default:()=>n});var s=i(6178),a=i(9941),l=i(1669);class n extends s.BaseModule{constructor(){super("clusterConfig"),this.REQ_GET_CONFIG="getConfig",this.REQ_UPDATE_CONFIG="updConfig",this.RESP_CONFIG="config",this.RESP_CONFIG_UPDATE_CONFIRM="configUpdate"}initialize(e,t){super.initialize(e,t),l("#clc-progressBar").kendoProgressBar({min:0,max:100,value:!1,type:"value",animation:{duration:400}}),this._interfaceBuilder=new a.p,l("#clc-reloadButton").on("click",l.proxy(this._onReloadClick,this)),l("#clc-submitButton").on("click",l.proxy(this._onSubmitClick,this)),this.sendExtensionRequest(this.REQ_GET_CONFIG)}destroy(){super.destroy(),l("#clc-reloadButton").off("click"),l("#clc-submitButton").off("click"),this._clearTabs()}onExtensionCommand(e,t){if(e==this.RESP_CONFIG)this._interfaceBuilder.buildInterface(t.getSFSArray("settings"),"clc-tabNavigator",!1),this._enableButtons(!0),this._tabNavInitialized||(l("#clc-tabNavigator > #tabs").scrollingTabs({bootstrapVersion:4,scrollToTabEdge:!0,enableSwiping:!0,disableScrollArrowsOnFullyScrolled:!0,cssClassLeftArrow:"fa fa-chevron-left",cssClassRightArrow:"fa fa-chevron-right"}),this._tabNavInitialized=!0),this._interfaceBuilder.checkIsValid(),this._switchView("clc-main");else if(e==this.RESP_CONFIG_UPDATE_CONFIRM){this._enableButtons(!0),this._interfaceBuilder.disableInterface(!1);let e=t.getUtfString("user");e==this.smartFox.mySelf.name?(this._interfaceBuilder.resetIsModified(),this.shellCtrl.showNotification("Cluster settings updated",'Immediate changes (<i class="fas fa-bolt"></i>) have been applied; all other changes will be active after next server restart')):(this.shellCtrl.showSimpleAlert(`Administrator ${e} has modified the cluster settings; please reload to update your view.`),l("#clc-submitButton").attr("disabled",!0))}}_enableButtons(e){l("#clc-reloadButton").attr("disabled",!e),l("#clc-submitButton").attr("disabled",!e),l("#clc-backupCheck").attr("disabled",!e)}_switchView(e){document.getElementById("clc-viewstack").selectedElement=document.getElementById(e)}_clearTabs(){l("#clc-tabNavigator #tabs").scrollingTabs("destroy"),this._interfaceBuilder.destroyInterface()}_onReloadClick(){this._enableButtons(!1),this._switchView("clc-loading"),this._interfaceBuilder.resetValidation(),this.sendExtensionRequest(this.REQ_GET_CONFIG)}_onSubmitClick(){if(this._interfaceBuilder.checkIsValid()){let e=this._interfaceBuilder.getChangedData();if(e.size()>0){this._enableButtons(!1),this._interfaceBuilder.disableInterface(!0);let t=new SFS2X.SFSObject;t.putSFSArray("settings",e),t.putBool("backup",l("#clc-backupCheck").prop("checked")),this.sendExtensionRequest(this.REQ_UPDATE_CONFIG,t)}}else this.shellCtrl.showSimpleAlert("Unable to submit configuration changes due to an invalid value; please verify the highlighted form fields in all tabs.",!0)}_updateConfigFormItemDisplayedValue(e,t){const i=this._interfaceBuilder.getConfigFormItem(e);i.data.value=t,i.data.resetIsModified(),i._setWidgetValue()}}}}]);