mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2024-11-19 15:19:14 +00:00
68 lines
1.7 KiB
Dart
68 lines
1.7 KiB
Dart
import 'package:easy_localization/easy_localization.dart';
|
|
import 'package:equatable/equatable.dart';
|
|
import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/logs.graphql.dart';
|
|
|
|
class ServerLogEntry extends Equatable {
|
|
ServerLogEntry.fromGraphQL(final Fragment$LogEntry log)
|
|
: this(
|
|
message: log.message,
|
|
cursor: log.cursor,
|
|
priority: log.priority,
|
|
systemdSlice: log.systemdSlice,
|
|
systemdUnit: log.systemdUnit,
|
|
timestamp: log.timestamp,
|
|
);
|
|
|
|
const ServerLogEntry({
|
|
required this.message,
|
|
required this.cursor,
|
|
required this.priority,
|
|
required this.systemdSlice,
|
|
required this.systemdUnit,
|
|
required this.timestamp,
|
|
});
|
|
|
|
final String message;
|
|
final String cursor;
|
|
final int? priority;
|
|
final String? systemdSlice;
|
|
final String? systemdUnit;
|
|
final DateTime timestamp;
|
|
|
|
static final DateFormat _formatter = DateFormat('hh:mm:ss');
|
|
String get timeString => _formatter.format(timestamp);
|
|
String get fullUTCString => timestamp.toUtc().toIso8601String();
|
|
|
|
@override
|
|
List<Object?> get props => [
|
|
message,
|
|
cursor,
|
|
priority,
|
|
systemdSlice,
|
|
systemdUnit,
|
|
timestamp,
|
|
];
|
|
}
|
|
|
|
class ServerLogsPageMeta extends Equatable {
|
|
ServerLogsPageMeta.fromGraphQL(final Query$Logs$logs$paginated$pageMeta meta)
|
|
: this(
|
|
downCursor: meta.downCursor,
|
|
upCursor: meta.upCursor,
|
|
);
|
|
|
|
const ServerLogsPageMeta({
|
|
required this.downCursor,
|
|
required this.upCursor,
|
|
});
|
|
|
|
final String? downCursor;
|
|
final String? upCursor;
|
|
|
|
@override
|
|
List<Object?> get props => [
|
|
downCursor,
|
|
upCursor,
|
|
];
|
|
}
|