zioinfo-mail/zioinfo/js/matiComm.js
DESKTOP-TKLFCPR\ython e228faabf5 feat(itsm): G-1~G-12 확장 기능 + 하네스/봇/설치스크립트 구현
G-1: 메신저 Webhook Relay + _send_to_room 실제 httpx 호출 구현
G-2: POST /api/tasks/bulk SR 대량작업 엔드포인트 (최대 100건)
G-3: 라이선스 만료 알림 스케줄러 (매일 09:00 KST)
G-4: 체험판 upgrade_banner 필드 + license.py 배너 로직
G-5: core/auto_rca.py + incidents/problem auto-rca 엔드포인트
G-6: core/deploy_impact.py + vibe impact-analysis 엔드포인트
G-7: core/ticket_classifier.py + SR 생성 시 AI 분류 + ai-suggestion API
G-8: VulnPatchRecord 모델 + vuln_scan 패치추적 4개 엔드포인트
G-9: core/jira_sync.py + gateway Jira/Confluence 연동 엔드포인트
G-10: core/push_notify.py + routers/push.py + PushSubscription 모델
G-11: approvals 다중승인 (위임/서명/기한초과/마감연장)
G-12: alembic.ini + migrations/ + cicd/migrate_to_postgres.sh

하네스: guardia-orchestrator 확장기능 Phase 반영
봇명령어: /sr /status /license /bulk 슬래시 명령어 추가
설치스크립트: setup/ (Ubuntu, CentOS, RHEL, Windows) --test 옵션 포함

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-29 18:18:52 +09:00

209 lines
6.7 KiB
JavaScript

function FormChecker(checkForm) {
this.checkForm = checkForm;
this.validatorList = new Array();
}
FormChecker.prototype.checkRequired = function(fieldName, errorMessage, focus) {
this.validatorList.push(new RequiredValidator(this.checkForm, fieldName, errorMessage, focus));
}
FormChecker.prototype.checkMaxLength = function(fieldName, maxLength, errorMessage, focus) {
this.validatorList.push(new MaxLengthValidator(this.checkForm, fieldName, maxLength, errorMessage, focus));
}
FormChecker.prototype.checkMaxLengthByte = function(fieldName, maxLength, errorMessage, focus) {
this.validatorList.push(new MaxLengthByteValidator(this.checkForm, fieldName, maxLength, errorMessage, focus));
}
FormChecker.prototype.checkMinLength = function(fieldName, minLength, errorMessage, focus) {
this.validatorList.push(new MinLengthValidator(this.checkForm, fieldName, minLength, errorMessage, focus));
}
FormChecker.prototype.checkMinLengthByte = function(fieldName, minLength, errorMessage, focus) {
this.validatorList.push(new MinLengthByteValidator(this.checkForm, fieldName, minLength, errorMessage, focus));
}
FormChecker.prototype.checkRegex = function(fieldName, regex, errorMessage, focus) {
this.validatorList.push(
new RegexValidator(this.checkForm, fieldName, regex, errorMessage, focus));
}
FormChecker.prototype.checkAlphaNum = function(fieldName, errorMessage, focus) {
this.validatorList.push(
new RegexValidator(this.checkForm, fieldName,
/^[a-zA-Z0-9]+$/, errorMessage, focus));
}
FormChecker.prototype.checkOnlyNumber = function(fieldName, errorMessage, focus) {
this.validatorList.push(
new RegexValidator(this.checkForm, fieldName,
/^[0-9]+$/, errorMessage, focus));
}
FormChecker.prototype.checkDecimal = function(fieldName, errorMessage, focus) {
this.validatorList.push(
new RegexValidator(this.checkForm, fieldName,
/^(\-)?[0-9]*(\.[0-9]*)?$/, errorMessage, focus));
}
FormChecker.prototype.checkEmail = function(fieldName, errorMessage, focus) {
this.validatorList.push(
new RegexValidator(this.checkForm, fieldName,
/^((\w|[\-\.])+)@((\w|[\-\.])+)\.([A-Za-z]+)$/, errorMessage, focus));
}
FormChecker.prototype.checkSelected = function(fieldName, firstIdx, errorMessage, focus) {
this.validatorList.push(new SelectionValidator(this.checkForm, fieldName, firstIdx, errorMessage, focus));
}
FormChecker.prototype.checkAtLeastOneChecked = function(fieldName, errorMessage, focus) {
this.validatorList.push(new AtLeastOneCheckValidator(this.checkForm, fieldName, errorMessage, focus));
}
FormChecker.prototype.validate = function() {
for (vali = 0 ; vali < this.validatorList.length ; vali ++ ) {
validator = this.validatorList[vali];
if (validator.validate() == false) {
alert(validator.getErrorMessage());
if (validator.isFocus() == true) {
this.checkForm[validator.getFieldName()].focus();
}
return false;
}
}
return true;
}
FormChecker.prototype.getForm = function() {
return this.checkForm;
}
// Validator is base class of all validators
function Vaildator() {
}
Vaildator.prototype.getFieldName = function() {
return this.fieldName;
}
Vaildator.prototype.getErrorMessage = function() {
return this.errorMessage;
}
Vaildator.prototype.isFocus = function() {
return this.focus;
}
// required validator
function RequiredValidator(form, fieldName, errorMessage, focus) {
this.form = form;
this.fieldName = fieldName;
this.errorMessage = errorMessage;
this.focus = focus;
}
RequiredValidator.prototype = new Vaildator;
RequiredValidator.prototype.validate = function() {
return this.form[this.fieldName].value != '';
}
// max length validator
function MaxLengthValidator(form, fieldName, maxLength, errorMessage, focus) {
this.form = form;
this.fieldName = fieldName;
this.errorMessage = errorMessage;
this.focus = focus;
this.maxLength = maxLength;
}
MaxLengthValidator.prototype = new Vaildator;
MaxLengthValidator.prototype.validate = function() {
return this.form[this.fieldName].value.length <= this.maxLength;
}
// max length(byte) validator
function MaxLengthByteValidator(form, fieldName, maxLength, errorMessage, focus) {
this.form = form;
this.fieldName = fieldName;
this.errorMessage = errorMessage;
this.focus = focus;
this.maxLength = maxLength;
}
MaxLengthByteValidator.prototype = new Vaildator;
MaxLengthByteValidator.prototype.validate = function() {
str = this.form[this.fieldName].value;
return(str.length+(escape(str)+"%u").match(/%u/g).length-1) <= this.maxLength;
}
// min length validator
function MinLengthValidator(form, fieldName, minLength, errorMessage, focus) {
this.form = form;
this.fieldName = fieldName;
this.errorMessage = errorMessage;
this.focus = focus;
this.minLength = minLength;
}
MinLengthValidator.prototype = new Vaildator;
MinLengthValidator.prototype.validate = function() {
return this.form[this.fieldName].value.length >= this.minLength;
}
// min length(byte) validator
function MinLengthByteValidator(form, fieldName, minLength, errorMessage, focus) {
this.form = form;
this.fieldName = fieldName;
this.errorMessage = errorMessage;
this.focus = focus;
this.minLength = minLength;
}
MinLengthByteValidator.prototype = new Vaildator;
MinLengthByteValidator.prototype.validate = function() {
str = this.form[this.fieldName].value;
return(str.length+(escape(str)+"%u").match(/%u/g).length-1) >= this.minLength;
}
// regex pattern validator
function RegexValidator(form, fieldName, regex, errorMessage, focus) {
this.form = form;
this.fieldName = fieldName;
this.regex = regex;
this.errorMessage = errorMessage;
this.focus = focus;
}
RegexValidator.prototype = new Vaildator;
RegexValidator.prototype.validate = function() {
var str = this.form[this.fieldName].value;
if (str.length == 0) return true;
return str.search(this.regex) != -1;
}
// check selected
function SelectionValidator(form, fieldName, firstIdx, errorMessage, focus) {
this.form = form;
this.fieldName = fieldName;
this.firstIdx = firstIdx;
this.errorMessage = errorMessage;
this.focus = focus;
}
SelectionValidator.prototype = new Vaildator;
SelectionValidator.prototype.validate = function() {
var idx = this.form[this.fieldName].selectedIndex;
return idx >= this.firstIdx;
}
// check checkbox checked
function AtLeastOneCheckValidator(form, fieldName, errorMessage, focus) {
this.form = form;
this.fieldName = fieldName;
this.errorMessage = errorMessage;
this.focus = focus;
}
AtLeastOneCheckValidator.prototype = new Vaildator;
AtLeastOneCheckValidator.prototype.validate = function() {
ele = this.form[this.fieldName];
if (typeof(ele[0]) != "undefined") {
// 2~
for (var idxe = 0 ; idxe < ele.length ; idxe++) {
if (ele[idxe].checked == true) {
return true;
}
}
return false;
} else {
// only 1
return ele.checked == true;
}
}