File manager - Edit - /usr/local/cpanel/whostmgr/docroot/templates/backup_configuration/views/config.min.js
Back
define(["angular","lodash","cjt/util/locale","cjt/util/table","cjt/services/alertService","cjt/directives/alertList","cjt/directives/actionButtonDirective","cjt/directives/validationContainerDirective","cjt/directives/validationItemDirective","cjt/validator/datatype-validators","cjt/validator/username-validators","cjt/validator/compare-validators","app/services/backupConfigurationServices"],(function(angular,_,LOCALE,Table){"use strict";var app=angular.module("whm.backupConfiguration");var controller=app.controller("config",["$scope","$location","$anchorScroll","$q","$window","backupConfigurationServices","alertService","$timeout",function($scope,$location,$anchorScroll,$q,$window,backupConfigurationServices,alertService,$timeout){var cloneConfiguration=function(sourceConfig){var copyOfConfig=_.clone(sourceConfig);if(sourceConfig.hasOwnProperty("backupdays")){copyOfConfig.backupdays=_.clone(sourceConfig.backupdays)}if(sourceConfig.hasOwnProperty("backup_monthly_dates")){copyOfConfig.backup_monthly_dates=_.clone(sourceConfig.backup_monthly_dates)}return copyOfConfig};$scope.getBackupConfiguration=function(){alertService.clear();backupConfigurationServices.getBackupConfig().then((function(configuration){if(!$scope.initialFormData){$scope.formData=cloneConfiguration(configuration);$scope.initialFormData=cloneConfiguration(configuration)}else{$scope.formData=cloneConfiguration(configuration)}$scope.backupConfigLoaded=true;$scope.formEnabled=$scope.formData.backupenable;$scope.setMonthlyBackupDays()}),(function(error){alertService.add({type:"danger",message:error,id:"configuration-loading-error",closeable:true});$scope.backupConfigLoaded=true}))};$scope.handleUnitToggle=function(value){if(value==="%"){$scope.formData.min_free_space_unit="percent"}else if(value==="MB"){$scope.formData.min_free_space_unit="MB"}else{throw"DEVELOPER ERROR: value argument has unexpected value: "+value}};$scope.handleDaysToggle=function(index,form){if($scope.formData.backupdays[index]){delete $scope.formData.backupdays[index]}else{$scope.formData.backupdays[index]=index.toString()}form.$setDirty();$scope.selectedDays=Object.keys($scope.formData.backupdays)};$scope.handleDayToggle=function(index,form){$scope.formData.backup_weekly_day=index;form.$setDirty()};$scope.handleMonthlyToggle=function(day){if(!$scope.formData.backup_monthly_dates){$scope.formData.backup_monthly_dates={}}if(day==="first"){if($scope.formData.backup_monthly_dates[1]){delete $scope.formData.backup_monthly_dates[1]}else{$scope.formData.backup_monthly_dates[1]="1"}}else if(day==="fifteenth"){if($scope.formData.backup_monthly_dates[15]){delete $scope.formData.backup_monthly_dates[15]}else{$scope.formData.backup_monthly_dates[15]="15"}}else{throw"DEVELOPER ERROR: value argument has unexpected value: "+day}$scope.setMonthlyBackupDays()};$scope.setMonthlyBackupDays=function(){if(!$scope.monthlyBackupBool){$scope.monthlyBackupBool={}}if($scope.formData.backup_monthly_dates[1]){$scope.monthlyBackupBool["first"]=true}else{$scope.monthlyBackupBool["first"]=false}if($scope.formData.backup_monthly_dates[15]){$scope.monthlyBackupBool["fifteenth"]=true}else{$scope.monthlyBackupBool["fifteenth"]=false}if(!$scope.monthlyBackupBool["first"]&&!$scope.monthlyBackupBool["fifteenth"]){delete $scope.formData.backup_monthly_dates}};$scope.redirectToSelectUsers=function(){window.open("../backup_user_selection")};$scope.saveConfiguration=function(form){$scope.saving=true;return backupConfigurationServices.setBackupConfig($scope.formData).then((function(success){$scope.initialFormData=cloneConfiguration($scope.formData);alertService.add({type:"success",autoClose:5e3,message:LOCALE.maketext("The system successfully saved the backup configuration."),id:"save-configuration-succeeded"});form.$setPristine()})).catch((function(error){alertService.add({type:"danger",closeable:true,message:error,id:"save-configuration-failed"})})).finally((function(){$scope.saving=false}))};$scope.resetConfiguration=function(form){$scope.formData=cloneConfiguration($scope.initialFormData);$scope.enableBackupConfig();$scope.selectedDays=Object.keys($scope.formData.backupdays);$scope.setMonthlyBackupDays();form.$setPristine();$location.hash("backup_status");$anchorScroll()};$scope.enableBackupConfig=function(){if(!$scope.formData.backupenable){$scope.formEnabled=false}else{$scope.formEnabled=true}};$scope.noDecimalPoints=function(keyEvent){var actualEvent=keyEvent.originalEvent;if(actualEvent.hasOwnProperty("key")&&actualEvent.key==="."||actualEvent.keyCode===190){keyEvent.preventDefault()}};$scope.onlyNumbers=function(pasteEvent){var pastedData=pasteEvent.originalEvent.clipboardData.getData("text");if(!pastedData.match(/[0-9]+/)){pasteEvent.preventDefault()}};$scope.init=function(){$scope.backupConfigLoaded=false;$scope.getBackupConfiguration();$scope.dailyDays=[LOCALE.maketext("Sunday"),LOCALE.maketext("Monday"),LOCALE.maketext("Tuesday"),LOCALE.maketext("Wednesday"),LOCALE.maketext("Thursday"),LOCALE.maketext("Friday"),LOCALE.maketext("Saturday")];$scope.weeklyDays=[LOCALE.maketext("Sunday"),LOCALE.maketext("Monday"),LOCALE.maketext("Tuesday"),LOCALE.maketext("Wednesday"),LOCALE.maketext("Thursday"),LOCALE.maketext("Friday"),LOCALE.maketext("Saturday")];$scope.absolutePathRegEx=/^\/./;$scope.relativePathRegEx=/^\w./;$scope.remoteHostValidation=/^[a-z0-9.-]{1,}$/i;$scope.remoteHostLoopbackValue=/^(127(\.\d+){1,3}|[0:]+1|localhost)$/i;$scope.disallowedPathChars=/[\\?%*:|"<>]/g;$scope.validating=false;$scope.toggled=true;$scope.saving=false;$scope.deleting=false;$scope.updating=false;$scope.showDeleteConfirmation=false;$scope.destinationName="";$scope.destinationId="";$scope.activeTab=0};$scope.init()}]);return controller}));
| ver. 1.4 |
Github
|
.
| PHP 8.1.34 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings