feat(app): live terminal log console widget and service dynamic settings management
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
class LogMessageDto {
|
||||
final DateTime timestamp;
|
||||
final String serviceName;
|
||||
final String channel;
|
||||
final String level; // 'Information', 'Warning', 'Error', 'Debug', 'Trace'
|
||||
final String message;
|
||||
final String? exception;
|
||||
|
||||
const LogMessageDto({
|
||||
required this.timestamp,
|
||||
required this.serviceName,
|
||||
required this.channel,
|
||||
required this.level,
|
||||
required this.message,
|
||||
this.exception,
|
||||
});
|
||||
|
||||
factory LogMessageDto.fromJson(Map<String, dynamic> json) {
|
||||
DateTime parsedTime = DateTime.now();
|
||||
if (json['timestamp'] != null) {
|
||||
parsedTime = DateTime.tryParse(json['timestamp'].toString()) ?? DateTime.now();
|
||||
}
|
||||
|
||||
return LogMessageDto(
|
||||
timestamp: parsedTime.toLocal(),
|
||||
serviceName: json['serviceName']?.toString() ?? '',
|
||||
channel: json['channel']?.toString() ?? '',
|
||||
level: json['level']?.toString() ?? 'Information',
|
||||
message: json['message']?.toString() ?? '',
|
||||
exception: json['exception']?.toString(),
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'timestamp': timestamp.toUtc().toIso8601String(),
|
||||
'serviceName': serviceName,
|
||||
'channel': channel,
|
||||
'level': level,
|
||||
'message': message,
|
||||
'exception': exception,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,13 @@
|
||||
class ServiceSettingDto {
|
||||
final String key;
|
||||
final String value;
|
||||
final String type; // 'bool', 'int', 'double', 'string'
|
||||
final String description;
|
||||
|
||||
const ServiceSettingDto({
|
||||
required this.key,
|
||||
required this.value,
|
||||
this.type = 'string',
|
||||
this.description = '',
|
||||
});
|
||||
|
||||
@@ -13,6 +15,7 @@ class ServiceSettingDto {
|
||||
return ServiceSettingDto(
|
||||
key: json['key']?.toString() ?? '',
|
||||
value: json['value']?.toString() ?? '',
|
||||
type: json['dataType']?.toString() ?? json['type']?.toString() ?? 'string',
|
||||
description: json['description']?.toString() ?? '',
|
||||
);
|
||||
}
|
||||
@@ -21,6 +24,7 @@ class ServiceSettingDto {
|
||||
return {
|
||||
'key': key,
|
||||
'value': value,
|
||||
'type': type,
|
||||
'description': description,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user