onParamBooleanChanged()

in web-app/src/app/routes/monitor/monitor-form/monitor-form.component.ts [176:206]


  onParamBooleanChanged(booleanValue: boolean, field: string) {
    if (this.monitor.app === 'api') {
      if (field === 'ssl') {
        const portParam = this.params.find(param => param.field === 'port');
        if (portParam) {
          if (booleanValue && (portParam.paramValue == null || parseInt(portParam.paramValue) === 80)) {
            portParam.paramValue = 443;
            this.notifySvc.info(this.i18nSvc.fanyi('common.notice'), this.i18nSvc.fanyi('monitor.new.notify.change-to-https'));
          }
          if (!booleanValue && (portParam.paramValue == null || parseInt(portParam.paramValue) === 443)) {
            portParam.paramValue = 80;
            this.notifySvc.info(this.i18nSvc.fanyi('common.notice'), this.i18nSvc.fanyi('monitor.new.notify.change-to-http'));
          }
        }
      }
    } else if (this.monitor.app === 'ftp') {
      if (field === 'ssl') {
        const portParam = this.params.find(param => param.field === 'port');
        if (portParam) {
          if (booleanValue && (portParam.paramValue == null || parseInt(portParam.paramValue) === 21)) {
            portParam.paramValue = 22;
            this.notifySvc.info(this.i18nSvc.fanyi('common.notice'), this.i18nSvc.fanyi('monitor.new.notify.change-to-sftp'));
          }
          if (!booleanValue && (portParam.paramValue == null || parseInt(portParam.paramValue) === 22)) {
            portParam.paramValue = 21;
            this.notifySvc.info(this.i18nSvc.fanyi('common.notice'), this.i18nSvc.fanyi('monitor.new.notify.change-to-ftp'));
          }
        }
      }
    }
  }