Skip to content

Commit 1486c1f

Browse files
committed
Changes on Reports and new datasource
1 parent 3e0bcde commit 1486c1f

13 files changed

Lines changed: 136 additions & 100 deletions

.flutter-plugins-dependencies

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 3.5.1
4+
5+
- Renamed `ReportTemplateSource` to `ReportSource` enum, also, added `ReportTemplateSource` as typedef to avoid breaking changes.
6+
- Renamed `ReportTemplateAlgorithm` to `ReportAlgorithm` enum, also, added `ReportTemplateAlgorithm` as typedef to avoid breaking changes.
7+
38
## 3.5.0+1
49

510
- Modified `ApiResponse<T>` generic class to also include a second generic type `Q` for error representation.

lib/src/api/src/response.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,9 @@ abstract class ApiResponse<T, Q> with _$ApiResponse<T, Q> {
1212
Map<String, dynamic> json,
1313
T Function(Object?) fromJsonT,
1414
Q Function(Object?) fromJsonQ,
15-
) => _$ApiResponseFromJson(json, fromJsonT, fromJsonQ);
15+
) => _$ApiResponseFromJson(
16+
json,
17+
fromJsonT,
18+
fromJsonQ,
19+
);
1620
}

lib/src/charts/charts.g.dart

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/charts/src/chart_data_source.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ enum ChartDataSource {
1313
@JsonValue('ATS_OPERATIONS')
1414
atsOperations,
1515
@JsonValue('ATS_PURCHASEORDERS')
16-
atsPurchaseOrders;
16+
atsPurchaseOrders,
17+
@JsonValue('LAST_MESSAGES')
18+
lastMessages,
19+
;
1720

1821
@override
1922
String toString() => toJson();
@@ -39,6 +42,8 @@ enum ChartDataSource {
3942
return "ATS_OPERATIONS";
4043
case ChartDataSource.atsPurchaseOrders:
4144
return "ATS_PURCHASEORDERS";
45+
case ChartDataSource.lastMessages:
46+
return "LAST_MESSAGES";
4247
}
4348
}
4449
}

lib/src/reports/reports.freezed.dart

Lines changed: 44 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/reports/reports.g.dart

Lines changed: 21 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
11
part of '../../reports.dart';
22

3+
@Deprecated('Use ReportAlgorithm instead')
4+
typedef ReportTemplateAlgorithm = ReportAlgorithm;
5+
36
@JsonEnum(alwaysCreate: true)
4-
enum ReportTemplateAlgorithm {
7+
enum ReportAlgorithm {
58
/// Is the report template algorithm for AUTO
69
@JsonValue('AUTO')
710
auto,
811

912
/// Is the report template algorithm for PYTHON
1013
@JsonValue('PYTHON')
11-
python;
14+
python
15+
;
1216

1317
@override
1418
String toString() => toJson();
1519

16-
String toJson() => _$ReportTemplateAlgorithmEnumMap[this] ?? 'AUTO';
20+
String toJson() => _$ReportAlgorithmEnumMap[this] ?? 'AUTO';
1721

18-
static ReportTemplateAlgorithm fromJson(String json) {
19-
return _$ReportTemplateAlgorithmEnumMap.entries.firstWhereOrNull((element) => element.value == json)?.key ??
20-
ReportTemplateAlgorithm.auto;
22+
static ReportAlgorithm fromJson(String json) {
23+
return _$ReportAlgorithmEnumMap.entries.firstWhereOrNull((element) => element.value == json)?.key ??
24+
ReportAlgorithm.auto;
2125
}
2226
}
Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,42 @@
11
part of '../../reports.dart';
22

3+
@Deprecated('Use ReportSource instead')
4+
typedef ReportTemplateSource = ReportSource;
5+
36
@JsonEnum(alwaysCreate: true)
4-
enum ReportTemplateSource {
5-
/// Is the report template source for messages
7+
enum ReportSource {
8+
/// Is the source for messages
69
@JsonValue('MESSAGES')
710
messages,
811

9-
/// Is the report template source for cases
12+
/// Is the source for cases
1013
@JsonValue('CASES')
1114
cases,
1215

13-
/// Is the report template source for checkpoints
16+
/// Is the source for checkpoints
1417
@JsonValue('CHECKPOINTS')
1518
checkpoints,
1619

17-
/// Is the report template source for events
20+
/// Is the source for events
1821
@JsonValue('EVENTS')
1922
events,
2023

21-
/// Is the report template source for outbound services' broadcast
24+
/// Is the source for outbound services' broadcast
2225
@JsonValue('BROADCASTS')
23-
broadcast;
26+
broadcast,
27+
28+
/// Is the source for Last Messages, similar to [messages] but only the latest message per asset
29+
@JsonValue('LAST_MESSAGES')
30+
lastMessages,
31+
;
2432

2533
@override
2634
String toString() => toJson();
2735

28-
String toJson() => _$ReportTemplateSourceEnumMap[this] ?? 'MESSAGES';
36+
String toJson() => _$ReportSourceEnumMap[this] ?? 'MESSAGES';
2937

30-
static ReportTemplateSource fromJson(String json) {
31-
return _$ReportTemplateSourceEnumMap.entries.firstWhereOrNull((element) => element.value == json)?.key ??
32-
ReportTemplateSource.messages;
38+
static ReportSource fromJson(String json) {
39+
return _$ReportSourceEnumMap.entries.firstWhereOrNull((element) => element.value == json)?.key ??
40+
ReportSource.messages;
3341
}
3442
}

lib/src/reports/src/page.dart

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,15 @@ abstract class ReportTemplatePage with _$ReportTemplatePage {
99
required String title,
1010

1111
/// Is the page source
12-
@JsonKey(unknownEnumValue: ReportTemplateSource.messages) required ReportTemplateSource source,
12+
@JsonKey(unknownEnumValue: ReportSource.messages) required ReportSource source,
1313

1414
/// Is the algorithm used to generate the page data.
15-
@JsonKey(unknownEnumValue: ReportTemplateAlgorithm.auto)
16-
@Default(ReportTemplateAlgorithm.auto)
17-
ReportTemplateAlgorithm algorithm,
15+
@JsonKey(unknownEnumValue: ReportAlgorithm.auto) @Default(ReportAlgorithm.auto) ReportAlgorithm algorithm,
1816

19-
/// Is the page data, aka, the cols. Only used when [algorithm] is [ReportTemplateAlgorithm.auto]
17+
/// Is the page data, aka, the cols. Only used when [algorithm] is [ReportAlgorithm.auto]
2018
List<ReportTemplateCol>? cols,
2119

22-
/// Is the script in Python to generate the page data. Only used when [algorithm] is [ReportTemplateAlgorithm.python]
20+
/// Is the script in Python to generate the page data. Only used when [algorithm] is [ReportAlgorithm.python]
2321
String? script,
2422
}) = _ReportTemplatePage;
2523

@@ -31,12 +29,8 @@ abstract class ReportTemplatePageInput with _$ReportTemplatePageInput {
3129
const ReportTemplatePageInput._();
3230
factory ReportTemplatePageInput({
3331
@Default('Page') String title,
34-
@JsonKey(unknownEnumValue: ReportTemplateSource.messages)
35-
@Default(ReportTemplateSource.messages)
36-
ReportTemplateSource source,
37-
@JsonKey(unknownEnumValue: ReportTemplateAlgorithm.auto)
38-
@Default(ReportTemplateAlgorithm.auto)
39-
ReportTemplateAlgorithm algorithm,
32+
@JsonKey(unknownEnumValue: ReportSource.messages) @Default(ReportSource.messages) ReportSource source,
33+
@JsonKey(unknownEnumValue: ReportAlgorithm.auto) @Default(ReportAlgorithm.auto) ReportAlgorithm algorithm,
4034
@Default([]) List<ReportTemplateColInput> cols,
4135
@Default('') String script,
4236
}) = _ReportTemplatePageInput;

0 commit comments

Comments
 (0)