Merge pull request #108 from AnonymusRaccoon/mobile_client_pipeline_error

Mobile client: Pipeline Error Message handling
This commit is contained in:
Zoe Roux
2022-03-06 15:01:41 +01:00
committed by GitHub
5 changed files with 57 additions and 4 deletions
+5
View File
@@ -17,6 +17,9 @@ class Pipeline {
/// Is the pipeline enabled
bool enabled;
/// An error trace, if exists
String? errorMessage;
///The pipeline's reactions
final List<Reaction> reactions;
@@ -27,6 +30,7 @@ class Pipeline {
required this.name,
required this.triggerCount,
required this.enabled,
this.errorMessage,
required this.trigger,
required this.reactions});
@@ -36,6 +40,7 @@ class Pipeline {
var reactions = data['reactions'] as List<dynamic>;
return Pipeline(
errorMessage: action['error'],
name: action['name'] as String,
enabled: action['enabled'] as bool,
id: action['id'] as int,
+37 -1
View File
@@ -148,9 +148,45 @@ class _PipelineDetailPageState extends State<PipelineDetailPage> {
child:
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Padding(
padding: const EdgeInsets.only(bottom: 40),
padding: const EdgeInsets.only(bottom: 30),
child: cardHeader,
),
pipeline.errorMessage != null
? Padding(
child: Card(
elevation: 0,
color: Theme.of(context).colorScheme.errorContainer.withAlpha(100),
shape: RoundedRectangleBorder(
side: BorderSide(
color: Theme.of(context).colorScheme.error
),
borderRadius: const BorderRadius.all(Radius.circular(4)),
),
child: Padding(
padding: const EdgeInsets.only(right: 10, top: 10, bottom: 10),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(flex: 2,
child: Icon(
Icons.warning,
color: Theme.of(context).colorScheme.onErrorContainer
)
),
Expanded(flex: 8, child: Text(
pipeline.errorMessage!,
maxLines: 5, overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Theme.of(context).colorScheme.onErrorContainer
),
))
]
)
),
),
padding: const EdgeInsets.only(bottom: 20),
)
: Container(),
Text(AppLocalizations.of(context).action,
style: const TextStyle(fontWeight: FontWeight.w500)),
ActionDetailCard(
+7 -3
View File
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:aeris/src/models/pipeline.dart';
import 'package:aeris/src/views/pipeline_detail_page.dart';
import 'package:aeris/src/widgets/clickable_card.dart';
import 'package:badges/badges.dart';
import 'aeris_card_page.dart';
/// Widget for Action-reaction card on home page
@@ -27,7 +27,11 @@ class _PipelineCardState extends State<PipelineCard> {
(array, logo) =>
array + [logo, const SizedBox(height: 5)]).toList();
reactionLogos.removeLast();
return ClickableCard(
return Badge(
showBadge: widget.pipeline.errorMessage != null,
badgeContent: Icon(Icons.priority_high, color: Theme.of(context).colorScheme.surface),
position: const BadgePosition(end: -3, top: -5),
child: ClickableCard(
onTap: () {
showAerisCardPage(
context,
@@ -76,6 +80,6 @@ class _PipelineCardState extends State<PipelineCard> {
const SizedBox(width: 10),
Column(children: reactionLogos)
])),
])));
]))));
}
}
+7
View File
@@ -43,6 +43,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.8.2"
badges:
dependency: "direct main"
description:
name: badges
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
boolean_selector:
dependency: transitive
description:
+1
View File
@@ -61,6 +61,7 @@ dependencies:
flutter_typeahead: ^3.2.4
simple_autocomplete_formfield: ^0.3.0
positioned_tap_detector_2: ^1.0.4
badges: ^2.0.2
dev_dependencies:
flutter_launcher_icons: "^0.9.2"