refactor: complete application rewrite with modern UI

This commit is contained in:
sokol
2026-02-19 22:55:26 +03:00
parent 271b530fa1
commit a6cc5a9827
26 changed files with 3036 additions and 794 deletions

View File

@@ -1,32 +1,73 @@
import { NamedId } from "./NamedId";
import { NamedEntity } from './types';
export class EnvParam implements NamedId {
constructor(
public id?: number,
public name?: string,
public value?: string,
public isChanged: boolean = false
) { }
/**
* Environment parameter representing a key-value configuration pair
*/
export class EnvParam implements NamedEntity {
constructor(
public id?: number,
public name?: string,
public value?: string,
public isChanged: boolean = false
) {}
public Changed(v: boolean = true): EnvParam {
return new EnvParam(
this.id,
this.name,
this.value,
v);
}
/**
* Marks the parameter as changed (backward compatibility)
*/
public Changed(changed: boolean = true): EnvParam {
return this.markChanged(changed);
}
public sanitize(v?: string): string {
return v?.replace(/&/g, "&amp")
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&apos;')
?? "";
}
/**
* Marks the parameter as changed
*/
public markChanged(changed: boolean = true): EnvParam {
return new EnvParam(this.id, this.name, this.value, changed);
}
public humanize(v?: string): string {
return v ?? "";
}
/**
* Creates a copy of this parameter with updated values
*/
public update(updates: Partial<EnvParam>): EnvParam {
return new EnvParam(
updates.id ?? this.id,
updates.name ?? this.name,
updates.value ?? this.value,
updates.isChanged ?? this.isChanged
);
}
/**
* Sanitizes HTML special characters (instance method for backward compatibility)
*/
public sanitize(value?: string): string {
const v = value ?? this.value ?? '';
return EnvParam.sanitize(v);
}
/**
* Sanitizes HTML special characters (static method)
*/
public static sanitize(value: string): string {
return value
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&apos;');
}
/**
* Humanizes the value (backward compatibility)
*/
public humanize(value?: string): string {
return value ?? this.value ?? '';
}
/**
* Validates that the parameter has required fields
*/
public isValid(): boolean {
return !!(this.name && this.name.trim() !== '');
}
}