Pull request #961: New client dashboard
Merge in DNS/adguard-home from new-client-dashboard to master Squashed commit of the following: commit 7bbd67c1e3d2af62b96bf41bb356cd6b784e473e Merge: 113743a69cd9054cAuthor: Vlad <v.abdulmyanov@adguard.com> Date: Wed Feb 3 16:01:17 2021 +0300 Merge branch 'master' into new-client-dashboard commit 113743a60665e40383d367dc17fa709dc54e4e2e Author: Vlad <v.abdulmyanov@adguard.com> Date: Wed Feb 3 15:45:16 2021 +0300 Remove unneded modal styles commit 04f9d93a9ac17ee046f0d5bedfb2bf5a5e6c0a48 Author: Vlad <v.abdulmyanov@adguard.com> Date: Wed Feb 3 14:19:56 2021 +0300 Consider comments commit 78a96cd8fed8b3e03547e7e45724c23db295f67b Author: Vlad <v.abdulmyanov@adguard.com> Date: Mon Feb 1 18:46:52 2021 +0300 Remove old params for MiniCssExtractPlugin commit 40e5a9b2b1e04036deb70af17f2719eadd0c9c02 Author: Vlad <v.abdulmyanov@adguard.com> Date: Mon Feb 1 18:27:46 2021 +0300 Fix mobile version commit 509cefc308f945b03cafa62bf48257490a0a4be1 Author: Vlad <v.abdulmyanov@adguard.com> Date: Mon Feb 1 18:20:56 2021 +0300 Remove unneeded imports commit d192f39cd2503b8ec942f00ba78fca02cac9fa60 Author: Vlad <v.abdulmyanov@adguard.com> Date: Mon Feb 1 18:20:13 2021 +0300 Finish first version of dashboard commit f82429e53d334874ff7dd0641092ec83c66ab61c Merge: fd91a0a33e0238aaAuthor: Vlad <v.abdulmyanov@adguard.com> Date: Mon Feb 1 17:12:59 2021 +0300 Merge branch 'master' into new-client-dashboard commit fd91a0a3d76c2a052a6548232b75d151d6065b88 Author: Vlad <v.abdulmyanov@adguard.com> Date: Mon Feb 1 17:12:27 2021 +0300 wip commit 237679965052d38acfcd6a72d24b2444cc5b3896 Author: Vlad <v.abdulmyanov@adguard.com> Date: Fri Jan 29 11:18:10 2021 +0300 Finish general settings commit 397a7e10efd34a8d31bb175a5a5a7158338388d4 Author: Vlad <v.abdulmyanov@adguard.com> Date: Thu Jan 28 19:24:03 2021 +0300 Add General settings page commit 486aaa6f3f9ad66f3a0dcfcccad9a32659767e90 Author: Vlad <v.abdulmyanov@adguard.com> Date: Thu Jan 28 14:05:16 2021 +0300 Remove husky commit b895306c0655019ca56ce161e050d83b4e7f5ff1 Merge: a195f1f4154c9c1cAuthor: Vlad <v.abdulmyanov@adguard.com> Date: Thu Jan 28 14:03:37 2021 +0300 Merge branch 'master' into new-client-dashboard commit a195f1f4d46043d9c53dea08734733f9817b95a0 Merge: c45c5fe9 362f390f Author: Vlad <v.abdulmyanov@adguard.com> Date: Wed Jan 27 15:46:18 2021 +0300 Merge branch 'new-client-dashboard' of ssh://bit.adguard.com:7999/dns/adguard-home into new-client-dashboard commit c45c5fe92e6c5c852bec8f512dc46b4cd513156c Author: Vlad <v.abdulmyanov@adguard.com> Date: Wed Jan 27 15:46:01 2021 +0300 wip commit 362f390fd3dcfca75633a8d30a2e54c3c30b4f3d Author: Vladislav Abdulmyanov <v.abdulmyanov@adguard.com> Date: Wed Jan 27 15:45:12 2021 +0300 Pull request #949: + client: add setup guide page Merge in DNS/adguard-home from 2554-setup-guide to new-client-dashboard Squashed commit of the following: commit c240d52e9e5d90429f2018fde808f4d04ccec138 Merge: 256f1056 137b88e4 Author: Ildar Kamalov <ik@adguard.com> Date: Wed Jan 27 14:13:52 2021 +0300 Merge branch 'new-client-dashboard' into 2554-setup-guide commit 256f1056770c67339e93275ab6dc7aaf2c10da0b Author: Ildar Kamalov <ik@adguard.com> Date: Wed Jan 27 14:10:45 2021 +0300 + client: add DNS addresses to the setup guide commit 0ecf91275a16ecc0dca23cae2ae209836fc622d2 Author: Ildar Kamalov <ik@adguard.com> Date: Wed Jan 27 14:00:12 2021 +0300 + client: add setup guide tabs commit 137b88e4253af5be32d542adbe74575ef74805c8 Author: Vlad <v.abdulmyanov@adguard.com> Date: Thu Jan 21 19:17:58 2021 +0300 Add clients top commit c3318e6932d87fdff5f22d76bee12b49f099129a Merge: 2776276b 021eb22f Author: Vlad <v.abdulmyanov@adguard.com> Date: Thu Jan 21 19:15:57 2021 +0300 Merge branch 'new-client-dashboard' of ssh://bit.adguard.com:7999/dns/adguard-home into new-client-dashboard commit 2776276b2e6dc026e1326b02c388fcf7d48d47ff Author: Vlad <v.abdulmyanov@adguard.com> Date: Thu Jan 21 19:15:53 2021 +0300 Add top client info commit 021eb22ff877aec12eb7fab60147a2cc2ddd08b7 Author: Ildar Kamalov <ik@adguard.com> Date: Thu Jan 21 14:13:54 2021 +0300 Merge: client: add sidebar Squashed commit of the following: commit 6885ba953971e68602889fbb3219221f90265421 Author: Ildar Kamalov <ik@adguard.com> Date: Thu Jan 21 13:56:55 2021 +0300 add sidebar mask commit f069bfe8cba2b31355e19a51ca00bf774ee9e560 Author: Ildar Kamalov <ik@adguard.com> Date: Thu Jan 21 13:03:47 2021 +0300 fix store commit 77c8791002887ae022da07dc264d9010576e7bab Merge: d0a6eff6 ea6d54d4 Author: Ildar Kamalov <ik@adguard.com> Date: Thu Jan 21 13:01:04 2021 +0300 Merge branch 'new-client-dashboard' into 2254-sidebar commit d0a6eff67fd74533d63f5d56382085e98ddbb702 Author: Ildar Kamalov <ik@adguard.com> Date: Thu Jan 21 12:47:32 2021 +0300 client: remove unused file commit 9d2424477de85503fe41fa00cc1294cb0c0e7dfa Author: Ildar Kamalov <ik@adguard.com> Date: Thu Jan 21 12:39:13 2021 +0300 client: header commit 9ddea19c136f15b184caa72d7e82738f7d4f3f1f Merge: 797f1248 b694bb05 Author: Ildar Kamalov <ik@adguard.com> Date: Thu Jan 21 10:57:24 2021 +0300 Merge branch 'new-client-dashboard' into 2254-sidebar commit 797f1248df5c1ef8e59c2a9999138f9e05a7adaa Author: Ildar Kamalov <ik@adguard.com> Date: Thu Jan 21 10:51:57 2021 +0300 client: sidebar ... and 14 more commits
This commit is contained in:
76
client2/src/lib/entities/AccessList.ts
Normal file
76
client2/src/lib/entities/AccessList.ts
Normal file
@@ -0,0 +1,76 @@
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface IAccessList {
|
||||
allowed_clients?: string[];
|
||||
blocked_hosts?: string[];
|
||||
disallowed_clients?: string[];
|
||||
}
|
||||
|
||||
export default class AccessList {
|
||||
readonly _allowed_clients: string[] | undefined;
|
||||
|
||||
/** */
|
||||
get allowedClients(): string[] | undefined {
|
||||
return this._allowed_clients;
|
||||
}
|
||||
|
||||
readonly _blocked_hosts: string[] | undefined;
|
||||
|
||||
/** */
|
||||
get blockedHosts(): string[] | undefined {
|
||||
return this._blocked_hosts;
|
||||
}
|
||||
|
||||
readonly _disallowed_clients: string[] | undefined;
|
||||
|
||||
/** */
|
||||
get disallowedClients(): string[] | undefined {
|
||||
return this._disallowed_clients;
|
||||
}
|
||||
|
||||
constructor(props: IAccessList) {
|
||||
if (props.allowed_clients) {
|
||||
this._allowed_clients = props.allowed_clients;
|
||||
}
|
||||
if (props.blocked_hosts) {
|
||||
this._blocked_hosts = props.blocked_hosts;
|
||||
}
|
||||
if (props.disallowed_clients) {
|
||||
this._disallowed_clients = props.disallowed_clients;
|
||||
}
|
||||
}
|
||||
|
||||
serialize(): IAccessList {
|
||||
const data: IAccessList = {
|
||||
};
|
||||
if (typeof this._allowed_clients !== 'undefined') {
|
||||
data.allowed_clients = this._allowed_clients;
|
||||
}
|
||||
if (typeof this._blocked_hosts !== 'undefined') {
|
||||
data.blocked_hosts = this._blocked_hosts;
|
||||
}
|
||||
if (typeof this._disallowed_clients !== 'undefined') {
|
||||
data.disallowed_clients = this._disallowed_clients;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
allowed_clients: !this._allowed_clients ? true : this._allowed_clients.reduce((result, p) => result && typeof p === 'string', true),
|
||||
disallowed_clients: !this._disallowed_clients ? true : this._disallowed_clients.reduce((result, p) => result && typeof p === 'string', true),
|
||||
blocked_hosts: !this._blocked_hosts ? true : this._blocked_hosts.reduce((result, p) => result && typeof p === 'string', true),
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
if (!(validate as any)[key]) {
|
||||
isError.push(key);
|
||||
}
|
||||
});
|
||||
return isError;
|
||||
}
|
||||
|
||||
update(props: Partial<IAccessList>): AccessList {
|
||||
return new AccessList({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
6
client2/src/lib/entities/AccessListResponse.ts
Normal file
6
client2/src/lib/entities/AccessListResponse.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import AccessList, { IAccessList } from './AccessList';
|
||||
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export type IAccessListResponse = IAccessList;
|
||||
export default AccessList;
|
||||
6
client2/src/lib/entities/AccessSetRequest.ts
Normal file
6
client2/src/lib/entities/AccessSetRequest.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import AccessList, { IAccessList } from './AccessList';
|
||||
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export type IAccessSetRequest = IAccessList;
|
||||
export default AccessList;
|
||||
@@ -1,10 +1,10 @@
|
||||
import NetInterface, { INetInterface } from './NetInterface';
|
||||
import NetInterfaces, { INetInterfaces } from './NetInterfaces';
|
||||
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface IAddressesInfo {
|
||||
dns_port: number;
|
||||
interfaces: { [key: string]: INetInterface };
|
||||
interfaces: INetInterfaces;
|
||||
web_port: number;
|
||||
}
|
||||
|
||||
@@ -23,10 +23,9 @@ export default class AddressesInfo {
|
||||
return typeof dnsPort === 'number';
|
||||
}
|
||||
|
||||
readonly _interfaces: { [key: string]: NetInterface };
|
||||
readonly _interfaces: NetInterfaces;
|
||||
|
||||
/** */
|
||||
get interfaces(): { [key: string]: NetInterface } {
|
||||
get interfaces(): NetInterfaces {
|
||||
return this._interfaces;
|
||||
}
|
||||
|
||||
@@ -46,16 +45,14 @@ export default class AddressesInfo {
|
||||
|
||||
constructor(props: IAddressesInfo) {
|
||||
this._dns_port = props.dns_port;
|
||||
this._interfaces = Object.keys(props.interfaces).reduce((prev, key) => {
|
||||
return { ...prev, [key]: new NetInterface(props.interfaces[key])};
|
||||
},{})
|
||||
this._interfaces = new NetInterfaces(props.interfaces);
|
||||
this._web_port = props.web_port;
|
||||
}
|
||||
|
||||
serialize(): IAddressesInfo {
|
||||
const data: IAddressesInfo = {
|
||||
dns_port: this._dns_port,
|
||||
interfaces: Object.keys(this._interfaces).reduce<Record<string, any>>((prev, key) => ({ ...prev, [key]: this._interfaces[key].serialize() }), {}),
|
||||
interfaces: this._interfaces.serialize(),
|
||||
web_port: this._web_port,
|
||||
};
|
||||
return data;
|
||||
@@ -65,6 +62,7 @@ export default class AddressesInfo {
|
||||
const validate = {
|
||||
dns_port: typeof this._dns_port === 'number',
|
||||
web_port: typeof this._web_port === 'number',
|
||||
interfaces: this._interfaces.validate().length === 0,
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
|
||||
@@ -15,7 +15,7 @@ export interface IClientFindSubEntry {
|
||||
upstreams?: string[];
|
||||
use_global_blocked_services?: boolean;
|
||||
use_global_settings?: boolean;
|
||||
whois_info?: IWhoisInfo[];
|
||||
whois_info?: IWhoisInfo;
|
||||
}
|
||||
|
||||
export default class ClientFindSubEntry {
|
||||
@@ -98,9 +98,9 @@ export default class ClientFindSubEntry {
|
||||
return this._use_global_settings;
|
||||
}
|
||||
|
||||
readonly _whois_info: WhoisInfo[] | undefined;
|
||||
readonly _whois_info: WhoisInfo | undefined;
|
||||
|
||||
get whoisInfo(): WhoisInfo[] | undefined {
|
||||
get whoisInfo(): WhoisInfo | undefined {
|
||||
return this._whois_info;
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ export default class ClientFindSubEntry {
|
||||
this._use_global_settings = props.use_global_settings;
|
||||
}
|
||||
if (props.whois_info) {
|
||||
this._whois_info = props.whois_info.map((p) => new WhoisInfo(p));
|
||||
this._whois_info = new WhoisInfo(props.whois_info);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ export default class ClientFindSubEntry {
|
||||
data.use_global_settings = this._use_global_settings;
|
||||
}
|
||||
if (typeof this._whois_info !== 'undefined') {
|
||||
data.whois_info = this._whois_info.map((p) => p.serialize());
|
||||
data.whois_info = this._whois_info.serialize();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
@@ -203,7 +203,7 @@ export default class ClientFindSubEntry {
|
||||
use_global_blocked_services: !this._use_global_blocked_services ? true : typeof this._use_global_blocked_services === 'boolean',
|
||||
blocked_services: !this._blocked_services ? true : this._blocked_services.reduce((result, p) => result && typeof p === 'string', true),
|
||||
upstreams: !this._upstreams ? true : this._upstreams.reduce((result, p) => result && typeof p === 'string', true),
|
||||
whois_info: !this._whois_info ? true : this._whois_info.reduce((result, p) => result && p.validate().length === 0, true),
|
||||
whois_info: !this._whois_info ? true : this._whois_info.validate().length === 0,
|
||||
disallowed: !this._disallowed ? true : typeof this._disallowed === 'boolean',
|
||||
disallowed_rule: !this._disallowed_rule ? true : typeof this._disallowed_rule === 'string' && !this._disallowed_rule ? true : this._disallowed_rule,
|
||||
};
|
||||
|
||||
@@ -1,31 +1,33 @@
|
||||
import ClientFindSubEntry, { IClientFindSubEntry } from './ClientFindSubEntry';
|
||||
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface IClientsFindEntry {
|
||||
[key: string]: IClientFindSubEntry;
|
||||
}
|
||||
|
||||
export default class ClientsFindEntry {
|
||||
readonly data: Record<string, ClientFindSubEntry>;
|
||||
|
||||
constructor(props: IClientsFindEntry) {
|
||||
this.data = Object.entries(props).reduce<Record<string, ClientFindSubEntry>>((prev, [key, value]) => {
|
||||
prev[key] = new ClientFindSubEntry(value!);
|
||||
return prev;
|
||||
}, {})
|
||||
}
|
||||
|
||||
serialize(): IClientsFindEntry {
|
||||
const data: IClientsFindEntry = {
|
||||
};
|
||||
return data;
|
||||
return Object.entries(this.data).reduce<Record<string, IClientFindSubEntry>>((prev, [key, value]) => {
|
||||
prev[key] = value.serialize();
|
||||
return prev;
|
||||
}, {})
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
if (!(validate as any)[key]) {
|
||||
isError.push(key);
|
||||
}
|
||||
});
|
||||
return isError;
|
||||
return []
|
||||
}
|
||||
|
||||
update(props: Partial<IClientsFindEntry>): ClientsFindEntry {
|
||||
update(props: IClientsFindEntry): ClientsFindEntry {
|
||||
return new ClientsFindEntry({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,8 @@ export default class DhcpSearchResultOtherServer {
|
||||
readonly _found: string | undefined;
|
||||
|
||||
/**
|
||||
* Description: yes|no|error
|
||||
* Description: The result of searching the other DHCP server.
|
||||
*
|
||||
* Example: no
|
||||
*/
|
||||
get found(): string | undefined {
|
||||
|
||||
@@ -16,7 +16,8 @@ export default class DhcpSearchResultStaticIP {
|
||||
readonly _static: string | undefined;
|
||||
|
||||
/**
|
||||
* Description: yes|no|error
|
||||
* Description: The result of determining static IP address.
|
||||
*
|
||||
* Example: yes
|
||||
*/
|
||||
get static(): string | undefined {
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
export interface IFilter {
|
||||
enabled: boolean;
|
||||
id: number;
|
||||
lastUpdated: string;
|
||||
last_updated: string;
|
||||
name: string;
|
||||
rulesCount: number;
|
||||
rules_count: number;
|
||||
url: string;
|
||||
}
|
||||
|
||||
@@ -34,14 +34,14 @@ export default class Filter {
|
||||
return typeof id === 'number';
|
||||
}
|
||||
|
||||
readonly _lastUpdated: string;
|
||||
readonly _last_updated: string;
|
||||
|
||||
/**
|
||||
* Description: undefined
|
||||
* Example: 2018-10-30T12:18:57+03:00
|
||||
*/
|
||||
get lastUpdated(): string {
|
||||
return this._lastUpdated;
|
||||
return this._last_updated;
|
||||
}
|
||||
|
||||
static lastUpdatedValidate(lastUpdated: string): boolean {
|
||||
@@ -62,14 +62,14 @@ export default class Filter {
|
||||
return typeof name === 'string' && !!name.trim();
|
||||
}
|
||||
|
||||
readonly _rulesCount: number;
|
||||
readonly _rules_count: number;
|
||||
|
||||
/**
|
||||
* Description: undefined
|
||||
* Example: 5912
|
||||
*/
|
||||
get rulesCount(): number {
|
||||
return this._rulesCount;
|
||||
return this._rules_count;
|
||||
}
|
||||
|
||||
static rulesCountValidate(rulesCount: number): boolean {
|
||||
@@ -94,9 +94,9 @@ export default class Filter {
|
||||
constructor(props: IFilter) {
|
||||
this._enabled = props.enabled;
|
||||
this._id = props.id;
|
||||
this._lastUpdated = props.lastUpdated.trim();
|
||||
this._last_updated = props.last_updated.trim();
|
||||
this._name = props.name.trim();
|
||||
this._rulesCount = props.rulesCount;
|
||||
this._rules_count = props.rules_count;
|
||||
this._url = props.url.trim();
|
||||
}
|
||||
|
||||
@@ -104,9 +104,9 @@ export default class Filter {
|
||||
const data: IFilter = {
|
||||
enabled: this._enabled,
|
||||
id: this._id,
|
||||
lastUpdated: this._lastUpdated,
|
||||
last_updated: this._last_updated,
|
||||
name: this._name,
|
||||
rulesCount: this._rulesCount,
|
||||
rules_count: this._rules_count,
|
||||
url: this._url,
|
||||
};
|
||||
return data;
|
||||
@@ -116,9 +116,9 @@ export default class Filter {
|
||||
const validate = {
|
||||
enabled: typeof this._enabled === 'boolean',
|
||||
id: typeof this._id === 'number',
|
||||
lastUpdated: typeof this._lastUpdated === 'string' && !this._lastUpdated ? true : this._lastUpdated,
|
||||
last_updated: typeof this._last_updated === 'string' && !this._last_updated ? true : this._last_updated,
|
||||
name: typeof this._name === 'string' && !this._name ? true : this._name,
|
||||
rulesCount: typeof this._rulesCount === 'number',
|
||||
rules_count: typeof this._rules_count === 'number',
|
||||
url: typeof this._url === 'string' && !this._url ? true : this._url,
|
||||
};
|
||||
const isError: string[] = [];
|
||||
|
||||
@@ -1,11 +1,18 @@
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface ILogin {
|
||||
name?: string;
|
||||
password?: string;
|
||||
username?: string;
|
||||
}
|
||||
|
||||
export default class Login {
|
||||
readonly _name: string | undefined;
|
||||
|
||||
/** */
|
||||
get name(): string | undefined {
|
||||
return this._name;
|
||||
}
|
||||
|
||||
readonly _password: string | undefined;
|
||||
|
||||
/** */
|
||||
@@ -13,37 +20,30 @@ export default class Login {
|
||||
return this._password;
|
||||
}
|
||||
|
||||
readonly _username: string | undefined;
|
||||
|
||||
/** */
|
||||
get username(): string | undefined {
|
||||
return this._username;
|
||||
}
|
||||
|
||||
constructor(props: ILogin) {
|
||||
if (typeof props.name === 'string') {
|
||||
this._name = props.name.trim();
|
||||
}
|
||||
if (typeof props.password === 'string') {
|
||||
this._password = props.password.trim();
|
||||
}
|
||||
if (typeof props.username === 'string') {
|
||||
this._username = props.username.trim();
|
||||
}
|
||||
}
|
||||
|
||||
serialize(): ILogin {
|
||||
const data: ILogin = {
|
||||
};
|
||||
if (typeof this._name !== 'undefined') {
|
||||
data.name = this._name;
|
||||
}
|
||||
if (typeof this._password !== 'undefined') {
|
||||
data.password = this._password;
|
||||
}
|
||||
if (typeof this._username !== 'undefined') {
|
||||
data.username = this._username;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
username: !this._username ? true : typeof this._username === 'string' && !this._username ? true : this._username,
|
||||
name: !this._name ? true : typeof this._name === 'string' && !this._name ? true : this._name,
|
||||
password: !this._password ? true : typeof this._password === 'string' && !this._password ? true : this._password,
|
||||
};
|
||||
const isError: string[] = [];
|
||||
|
||||
@@ -12,7 +12,8 @@ export default class NetInterface {
|
||||
readonly _flags: string;
|
||||
|
||||
/**
|
||||
* Description: undefined
|
||||
* Description: Flags could be any combination of the following values, divided by the "|" character: "up", "broadcast", "loopback", "pointtopoint" and "multicast".
|
||||
*
|
||||
* Example: up|broadcast|multicast
|
||||
*/
|
||||
get flags(): string {
|
||||
|
||||
33
client2/src/lib/entities/NetInterfaces.ts
Normal file
33
client2/src/lib/entities/NetInterfaces.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import NetInterface, { INetInterface } from './NetInterface';
|
||||
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface INetInterfaces {
|
||||
[key: string]: INetInterface;
|
||||
}
|
||||
|
||||
export default class NetInterfaces {
|
||||
readonly data: Record<string, NetInterface>;
|
||||
|
||||
constructor(props: INetInterfaces) {
|
||||
this.data = Object.entries(props).reduce<Record<string, NetInterface>>((prev, [key, value]) => {
|
||||
prev[key] = new NetInterface(value!);
|
||||
return prev;
|
||||
}, {})
|
||||
}
|
||||
|
||||
serialize(): INetInterfaces {
|
||||
return Object.entries(this.data).reduce<Record<string, INetInterface>>((prev, [key, value]) => {
|
||||
prev[key] = value.serialize();
|
||||
return prev;
|
||||
}, {})
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
return []
|
||||
}
|
||||
|
||||
update(props: INetInterfaces): NetInterfaces {
|
||||
return new NetInterfaces({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ export interface IQueryLogItem {
|
||||
answer?: IDnsAnswer[];
|
||||
answer_dnssec?: boolean;
|
||||
client?: string;
|
||||
client_id?: string;
|
||||
client_proto?: any;
|
||||
elapsedMs?: string;
|
||||
filterId?: number;
|
||||
@@ -38,13 +39,25 @@ export default class QueryLogItem {
|
||||
readonly _client: string | undefined;
|
||||
|
||||
/**
|
||||
* Description: undefined
|
||||
* Description: The client's IP address.
|
||||
*
|
||||
* Example: 192.168.0.1
|
||||
*/
|
||||
get client(): string | undefined {
|
||||
return this._client;
|
||||
}
|
||||
|
||||
readonly _client_id: string | undefined;
|
||||
|
||||
/**
|
||||
* Description: The client ID, if provided in DOH, DOQ, or DOT.
|
||||
*
|
||||
* Example: cli123
|
||||
*/
|
||||
get clientId(): string | undefined {
|
||||
return this._client_id;
|
||||
}
|
||||
|
||||
readonly _client_proto: any | undefined;
|
||||
|
||||
get clientProto(): any | undefined {
|
||||
@@ -156,6 +169,9 @@ export default class QueryLogItem {
|
||||
if (typeof props.client === 'string') {
|
||||
this._client = props.client.trim();
|
||||
}
|
||||
if (typeof props.client_id === 'string') {
|
||||
this._client_id = props.client_id.trim();
|
||||
}
|
||||
if (props.client_proto) {
|
||||
this._client_proto = props.client_proto;
|
||||
}
|
||||
@@ -206,6 +222,9 @@ export default class QueryLogItem {
|
||||
if (typeof this._client !== 'undefined') {
|
||||
data.client = this._client;
|
||||
}
|
||||
if (typeof this._client_id !== 'undefined') {
|
||||
data.client_id = this._client_id;
|
||||
}
|
||||
if (typeof this._client_proto !== 'undefined') {
|
||||
data.client_proto = this._client_proto;
|
||||
}
|
||||
@@ -252,6 +271,7 @@ export default class QueryLogItem {
|
||||
upstream: !this._upstream ? true : typeof this._upstream === 'string' && !this._upstream ? true : this._upstream,
|
||||
answer_dnssec: !this._answer_dnssec ? true : typeof this._answer_dnssec === 'boolean',
|
||||
client: !this._client ? true : typeof this._client === 'string' && !this._client ? true : this._client,
|
||||
client_id: !this._client_id ? true : typeof this._client_id === 'string' && !this._client_id ? true : this._client_id,
|
||||
elapsedMs: !this._elapsedMs ? true : typeof this._elapsedMs === 'string' && !this._elapsedMs ? true : this._elapsedMs,
|
||||
question: !this._question ? true : this._question.validate().length === 0,
|
||||
filterId: !this._filterId ? true : typeof this._filterId === 'number',
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
// All changes will be overwrited on commit.
|
||||
export interface IServerStatus {
|
||||
dhcp_available?: boolean;
|
||||
dns_address: string;
|
||||
dns_addresses: string[];
|
||||
dns_port: number;
|
||||
http_port: number;
|
||||
language: string;
|
||||
protection_enabled: boolean;
|
||||
querylog_enabled: boolean;
|
||||
running: boolean;
|
||||
version: string;
|
||||
}
|
||||
@@ -18,18 +18,18 @@ export default class ServerStatus {
|
||||
return this._dhcp_available;
|
||||
}
|
||||
|
||||
readonly _dns_address: string;
|
||||
readonly _dns_addresses: string[];
|
||||
|
||||
/**
|
||||
* Description: undefined
|
||||
* Example: 127.0.0.1
|
||||
*/
|
||||
get dnsAddress(): string {
|
||||
return this._dns_address;
|
||||
get dnsAddresses(): string[] {
|
||||
return this._dns_addresses;
|
||||
}
|
||||
|
||||
static dnsAddressValidate(dnsAddress: string): boolean {
|
||||
return typeof dnsAddress === 'string' && !!dnsAddress.trim();
|
||||
static dnsAddressesValidate(dnsAddresses: string[]): boolean {
|
||||
return dnsAddresses.reduce<boolean>((result, p) => result && (typeof p === 'string' && !!p.trim()), true);
|
||||
}
|
||||
|
||||
readonly _dns_port: number;
|
||||
@@ -54,6 +54,28 @@ export default class ServerStatus {
|
||||
return dnsPort >= 1 && dnsPort <= 65535;
|
||||
}
|
||||
|
||||
readonly _http_port: number;
|
||||
|
||||
/**
|
||||
* Description: undefined
|
||||
* Example: 80
|
||||
*/
|
||||
get httpPort(): number {
|
||||
return this._http_port;
|
||||
}
|
||||
|
||||
static get httpPortMinValue() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
static get httpPortMaxValue() {
|
||||
return 65535;
|
||||
}
|
||||
|
||||
static httpPortValidate(httpPort: number): boolean {
|
||||
return httpPort >= 1 && httpPort <= 65535;
|
||||
}
|
||||
|
||||
readonly _language: string;
|
||||
|
||||
/**
|
||||
@@ -78,16 +100,6 @@ export default class ServerStatus {
|
||||
return typeof protectionEnabled === 'boolean';
|
||||
}
|
||||
|
||||
readonly _querylog_enabled: boolean;
|
||||
|
||||
get querylogEnabled(): boolean {
|
||||
return this._querylog_enabled;
|
||||
}
|
||||
|
||||
static querylogEnabledValidate(querylogEnabled: boolean): boolean {
|
||||
return typeof querylogEnabled === 'boolean';
|
||||
}
|
||||
|
||||
readonly _running: boolean;
|
||||
|
||||
get running(): boolean {
|
||||
@@ -116,22 +128,22 @@ export default class ServerStatus {
|
||||
if (typeof props.dhcp_available === 'boolean') {
|
||||
this._dhcp_available = props.dhcp_available;
|
||||
}
|
||||
this._dns_address = props.dns_address.trim();
|
||||
this._dns_addresses = props.dns_addresses;
|
||||
this._dns_port = props.dns_port;
|
||||
this._http_port = props.http_port;
|
||||
this._language = props.language.trim();
|
||||
this._protection_enabled = props.protection_enabled;
|
||||
this._querylog_enabled = props.querylog_enabled;
|
||||
this._running = props.running;
|
||||
this._version = props.version.trim();
|
||||
}
|
||||
|
||||
serialize(): IServerStatus {
|
||||
const data: IServerStatus = {
|
||||
dns_address: this._dns_address,
|
||||
dns_addresses: this._dns_addresses,
|
||||
dns_port: this._dns_port,
|
||||
http_port: this._http_port,
|
||||
language: this._language,
|
||||
protection_enabled: this._protection_enabled,
|
||||
querylog_enabled: this._querylog_enabled,
|
||||
running: this._running,
|
||||
version: this._version,
|
||||
};
|
||||
@@ -143,11 +155,11 @@ export default class ServerStatus {
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
dns_address: typeof this._dns_address === 'string' && !this._dns_address ? true : this._dns_address,
|
||||
dns_addresses: this._dns_addresses.reduce((result, p) => result && typeof p === 'string', true),
|
||||
dns_port: this._dns_port >= 1 && this._dns_port <= 65535,
|
||||
http_port: this._http_port >= 1 && this._http_port <= 65535,
|
||||
protection_enabled: typeof this._protection_enabled === 'boolean',
|
||||
dhcp_available: !this._dhcp_available ? true : typeof this._dhcp_available === 'boolean',
|
||||
querylog_enabled: typeof this._querylog_enabled === 'boolean',
|
||||
running: typeof this._running === 'boolean',
|
||||
version: typeof this._version === 'string' && !this._version ? true : this._version,
|
||||
language: typeof this._language === 'string' && !this._language ? true : this._language,
|
||||
|
||||
@@ -107,7 +107,7 @@ export default class Stats {
|
||||
readonly _time_units: string | undefined;
|
||||
|
||||
/**
|
||||
* Description: Time units (hours | days)
|
||||
* Description: Time units
|
||||
* Example: hours
|
||||
*/
|
||||
get timeUnits(): string | undefined {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// All changes will be overwrited on commit.
|
||||
export interface ITopArrayEntry {
|
||||
domain_or_ip?: number;
|
||||
[key: string]: number | undefined;
|
||||
}
|
||||
|
||||
export default class TopArrayEntry {
|
||||
@@ -11,19 +12,20 @@ export default class TopArrayEntry {
|
||||
return this._domain_or_ip;
|
||||
}
|
||||
|
||||
readonly numberData: Record<string, number>;
|
||||
|
||||
constructor(props: ITopArrayEntry) {
|
||||
if (typeof props.domain_or_ip === 'number') {
|
||||
this._domain_or_ip = props.domain_or_ip;
|
||||
}
|
||||
this.numberData = Object.entries(props).reduce<Record<string, number>>((prev, [key, value]) => {
|
||||
prev[key] = value!;
|
||||
return prev;
|
||||
}, {})
|
||||
}
|
||||
|
||||
serialize(): ITopArrayEntry {
|
||||
const data: ITopArrayEntry = {
|
||||
};
|
||||
if (typeof this._domain_or_ip !== 'undefined') {
|
||||
data.domain_or_ip = this._domain_or_ip;
|
||||
}
|
||||
return data;
|
||||
return Object.entries(this.numberData).reduce<Record<string, number>>((prev, [key, value]) => {
|
||||
prev[key] = value;
|
||||
return prev;
|
||||
}, {})
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface IUpstreamsConfigResponse {
|
||||
[key: string]: string;
|
||||
}
|
||||
|
||||
export default class UpstreamsConfigResponse {
|
||||
readonly data: Record<string, string>;
|
||||
|
||||
constructor(props: IUpstreamsConfigResponse) {
|
||||
this.data = Object.entries(props).reduce<Record<string, string>>((prev, [key, value]) => {
|
||||
prev[key] = value!;
|
||||
return prev;
|
||||
}, {})
|
||||
}
|
||||
|
||||
serialize(): IUpstreamsConfigResponse {
|
||||
const data: IUpstreamsConfigResponse = {
|
||||
};
|
||||
return data;
|
||||
return Object.entries(this.data).reduce<Record<string, string>>((prev, [key, value]) => {
|
||||
prev[key] = value;
|
||||
return prev;
|
||||
}, {})
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
if (!(validate as any)[key]) {
|
||||
isError.push(key);
|
||||
}
|
||||
});
|
||||
return isError;
|
||||
return []
|
||||
}
|
||||
|
||||
update(props: Partial<IUpstreamsConfigResponse>): UpstreamsConfigResponse {
|
||||
update(props: IUpstreamsConfigResponse): UpstreamsConfigResponse {
|
||||
return new UpstreamsConfigResponse({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ export interface IVersionInfo {
|
||||
announcement?: string;
|
||||
announcement_url?: string;
|
||||
can_autoupdate?: boolean;
|
||||
disabled: boolean;
|
||||
new_version?: string;
|
||||
}
|
||||
|
||||
@@ -35,6 +36,17 @@ export default class VersionInfo {
|
||||
return this._can_autoupdate;
|
||||
}
|
||||
|
||||
readonly _disabled: boolean;
|
||||
|
||||
/** */
|
||||
get disabled(): boolean {
|
||||
return this._disabled;
|
||||
}
|
||||
|
||||
static disabledValidate(disabled: boolean): boolean {
|
||||
return typeof disabled === 'boolean';
|
||||
}
|
||||
|
||||
readonly _new_version: string | undefined;
|
||||
|
||||
/**
|
||||
@@ -55,6 +67,7 @@ export default class VersionInfo {
|
||||
if (typeof props.can_autoupdate === 'boolean') {
|
||||
this._can_autoupdate = props.can_autoupdate;
|
||||
}
|
||||
this._disabled = props.disabled;
|
||||
if (typeof props.new_version === 'string') {
|
||||
this._new_version = props.new_version.trim();
|
||||
}
|
||||
@@ -62,6 +75,7 @@ export default class VersionInfo {
|
||||
|
||||
serialize(): IVersionInfo {
|
||||
const data: IVersionInfo = {
|
||||
disabled: this._disabled,
|
||||
};
|
||||
if (typeof this._announcement !== 'undefined') {
|
||||
data.announcement = this._announcement;
|
||||
@@ -80,6 +94,7 @@ export default class VersionInfo {
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
disabled: typeof this._disabled === 'boolean',
|
||||
new_version: !this._new_version ? true : typeof this._new_version === 'string' && !this._new_version ? true : this._new_version,
|
||||
announcement: !this._announcement ? true : typeof this._announcement === 'string' && !this._announcement ? true : this._announcement,
|
||||
announcement_url: !this._announcement_url ? true : typeof this._announcement_url === 'string' && !this._announcement_url ? true : this._announcement_url,
|
||||
|
||||
@@ -1,45 +1,31 @@
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface IWhoisInfo {
|
||||
key?: string;
|
||||
[key: string]: string;
|
||||
}
|
||||
|
||||
export default class WhoisInfo {
|
||||
readonly _key: string | undefined;
|
||||
|
||||
get key(): string | undefined {
|
||||
return this._key;
|
||||
}
|
||||
readonly data: Record<string, string>;
|
||||
|
||||
constructor(props: IWhoisInfo) {
|
||||
if (typeof props.key === 'string') {
|
||||
this._key = props.key.trim();
|
||||
}
|
||||
this.data = Object.entries(props).reduce<Record<string, string>>((prev, [key, value]) => {
|
||||
prev[key] = value!;
|
||||
return prev;
|
||||
}, {})
|
||||
}
|
||||
|
||||
serialize(): IWhoisInfo {
|
||||
const data: IWhoisInfo = {
|
||||
};
|
||||
if (typeof this._key !== 'undefined') {
|
||||
data.key = this._key;
|
||||
}
|
||||
return data;
|
||||
return Object.entries(this.data).reduce<Record<string, string>>((prev, [key, value]) => {
|
||||
prev[key] = value;
|
||||
return prev;
|
||||
}, {})
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
key: !this._key ? true : typeof this._key === 'string' && !this._key ? true : this._key,
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
if (!(validate as any)[key]) {
|
||||
isError.push(key);
|
||||
}
|
||||
});
|
||||
return isError;
|
||||
return []
|
||||
}
|
||||
|
||||
update(props: Partial<IWhoisInfo>): WhoisInfo {
|
||||
update(props: IWhoisInfo): WhoisInfo {
|
||||
return new WhoisInfo({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user