From db62c8fb08fb8ea46132b38a860e36e83b3b3548 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Wed, 20 Oct 2021 09:15:50 +0300 Subject: [PATCH] Health check --- lib/data/models/health_check_model.dart | 7 +++ lib/data/models/health_check_model.g.dart | 51 ++++++++++++++++----- lib/ui/app/dialogs/health_check_dialog.dart | 3 +- 3 files changed, 47 insertions(+), 14 deletions(-) diff --git a/lib/data/models/health_check_model.dart b/lib/data/models/health_check_model.dart index f795252ca..0d9fdc825 100644 --- a/lib/data/models/health_check_model.dart +++ b/lib/data/models/health_check_model.dart @@ -48,8 +48,15 @@ abstract class HealthCheckResponse @BuiltValueField(wireName: 'pdf_engine') String get pdfEngine; + @BuiltValueField(wireName: 'trailing_slash') + bool get trailingSlash; + String get queue; + // ignore: unused_element + static void _initializeBuilder(HealthCheckResponseBuilder builder) => + builder..trailingSlash = false; + static Serializer get serializer => _$healthCheckResponseSerializer; } diff --git a/lib/data/models/health_check_model.g.dart b/lib/data/models/health_check_model.g.dart index 26db53618..286ff0d7c 100644 --- a/lib/data/models/health_check_model.g.dart +++ b/lib/data/models/health_check_model.g.dart @@ -59,6 +59,9 @@ class _$HealthCheckResponseSerializer 'pdf_engine', serializers.serialize(object.pdfEngine, specifiedType: const FullType(String)), + 'trailing_slash', + serializers.serialize(object.trailingSlash, + specifiedType: const FullType(bool)), 'queue', serializers.serialize(object.queue, specifiedType: const FullType(String)), @@ -124,6 +127,10 @@ class _$HealthCheckResponseSerializer result.pdfEngine = serializers.deserialize(value, specifiedType: const FullType(String)) as String; break; + case 'trailing_slash': + result.trailingSlash = serializers.deserialize(value, + specifiedType: const FullType(bool)) as bool; + break; case 'queue': result.queue = serializers.deserialize(value, specifiedType: const FullType(String)) as String; @@ -225,6 +232,8 @@ class _$HealthCheckResponse extends HealthCheckResponse { @override final String pdfEngine; @override + final bool trailingSlash; + @override final String queue; factory _$HealthCheckResponse( @@ -243,6 +252,7 @@ class _$HealthCheckResponse extends HealthCheckResponse { this.emailDriver, this.pendingJobs, this.pdfEngine, + this.trailingSlash, this.queue}) : super._() { BuiltValueNullFieldError.checkNotNull( @@ -267,6 +277,8 @@ class _$HealthCheckResponse extends HealthCheckResponse { pendingJobs, 'HealthCheckResponse', 'pendingJobs'); BuiltValueNullFieldError.checkNotNull( pdfEngine, 'HealthCheckResponse', 'pdfEngine'); + BuiltValueNullFieldError.checkNotNull( + trailingSlash, 'HealthCheckResponse', 'trailingSlash'); BuiltValueNullFieldError.checkNotNull( queue, 'HealthCheckResponse', 'queue'); } @@ -295,6 +307,7 @@ class _$HealthCheckResponse extends HealthCheckResponse { emailDriver == other.emailDriver && pendingJobs == other.pendingJobs && pdfEngine == other.pdfEngine && + trailingSlash == other.trailingSlash && queue == other.queue; } @@ -311,17 +324,21 @@ class _$HealthCheckResponse extends HealthCheckResponse { $jc( $jc( $jc( - $jc($jc(0, systemHealth.hashCode), - phpVersion.hashCode), - envWritable.hashCode), - dbCheck.hashCode), - cacheEnabled.hashCode), - phantomEnabled.hashCode), - openBasedir.hashCode), - execEnabled.hashCode), - emailDriver.hashCode), - pendingJobs.hashCode), - pdfEngine.hashCode), + $jc( + $jc( + $jc(0, + systemHealth.hashCode), + phpVersion.hashCode), + envWritable.hashCode), + dbCheck.hashCode), + cacheEnabled.hashCode), + phantomEnabled.hashCode), + openBasedir.hashCode), + execEnabled.hashCode), + emailDriver.hashCode), + pendingJobs.hashCode), + pdfEngine.hashCode), + trailingSlash.hashCode), queue.hashCode)); } @@ -339,6 +356,7 @@ class _$HealthCheckResponse extends HealthCheckResponse { ..add('emailDriver', emailDriver) ..add('pendingJobs', pendingJobs) ..add('pdfEngine', pdfEngine) + ..add('trailingSlash', trailingSlash) ..add('queue', queue)) .toString(); } @@ -395,11 +413,18 @@ class HealthCheckResponseBuilder String get pdfEngine => _$this._pdfEngine; set pdfEngine(String pdfEngine) => _$this._pdfEngine = pdfEngine; + bool _trailingSlash; + bool get trailingSlash => _$this._trailingSlash; + set trailingSlash(bool trailingSlash) => + _$this._trailingSlash = trailingSlash; + String _queue; String get queue => _$this._queue; set queue(String queue) => _$this._queue = queue; - HealthCheckResponseBuilder(); + HealthCheckResponseBuilder() { + HealthCheckResponse._initializeBuilder(this); + } HealthCheckResponseBuilder get _$this { final $v = _$v; @@ -415,6 +440,7 @@ class HealthCheckResponseBuilder _emailDriver = $v.emailDriver; _pendingJobs = $v.pendingJobs; _pdfEngine = $v.pdfEngine; + _trailingSlash = $v.trailingSlash; _queue = $v.queue; _$v = null; } @@ -457,6 +483,7 @@ class HealthCheckResponseBuilder emailDriver, 'HealthCheckResponse', 'emailDriver'), pendingJobs: BuiltValueNullFieldError.checkNotNull(pendingJobs, 'HealthCheckResponse', 'pendingJobs'), pdfEngine: BuiltValueNullFieldError.checkNotNull(pdfEngine, 'HealthCheckResponse', 'pdfEngine'), + trailingSlash: BuiltValueNullFieldError.checkNotNull(trailingSlash, 'HealthCheckResponse', 'trailingSlash'), queue: BuiltValueNullFieldError.checkNotNull(queue, 'HealthCheckResponse', 'queue')); } catch (_) { String _$failedField; diff --git a/lib/ui/app/dialogs/health_check_dialog.dart b/lib/ui/app/dialogs/health_check_dialog.dart index ce066a02a..dde603ba6 100644 --- a/lib/ui/app/dialogs/health_check_dialog.dart +++ b/lib/ui/app/dialogs/health_check_dialog.dart @@ -9,7 +9,6 @@ import 'package:invoiceninja_flutter/redux/app/app_actions.dart'; import 'package:invoiceninja_flutter/redux/app/app_state.dart'; import 'package:invoiceninja_flutter/utils/dialogs.dart'; import 'package:invoiceninja_flutter/utils/localization.dart'; -import 'package:invoiceninja_flutter/utils/strings.dart'; import 'package:url_launcher/url_launcher.dart'; class HealthCheckDialog extends StatefulWidget { @@ -102,7 +101,7 @@ class _HealthCheckDialogState extends State { _HealthListTile( title: 'System Health', subtitle: - 'Email: ${toTitleCase(_response.emailDriver)}\nQueue: ${toTitleCase(_response.queue)}\nPDF: ${_response.pdfEngine.replaceFirst(' PDF Generator', '')}', + 'Email: ${_response.emailDriver}\nQueue: ${_response.queue}\nPDF: ${_response.pdfEngine.replaceFirst(' PDF Generator', '')}', isValid: _response.systemHealth, ), _HealthListTile(