Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MobileEventLog
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Data-Logistics-Support
MobileEventLog
Commits
c0a9ff21
Commit
c0a9ff21
authored
3 years ago
by
Maximilian Betz
Browse files
Options
Downloads
Patches
Plain Diff
added switch to show all events. Default only show pending events due to performance reasons
parent
ee74529d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/datamodel.dart
+4
-1
4 additions, 1 deletion
lib/datamodel.dart
lib/viewevents.dart
+28
-3
28 additions, 3 deletions
lib/viewevents.dart
with
32 additions
and
4 deletions
lib/datamodel.dart
+
4
−
1
View file @
c0a9ff21
...
...
@@ -391,6 +391,7 @@ class ConfigurationStoreInstance extends ConfigurationStoreBase {
abstract
class
EventStoreBase
{
bool
gnssSync
=
true
;
bool
showAllEvents
=
false
;
Event
currentEvent
=
Event
(
id:
0
,
urnId:
-
1
,
...
...
@@ -410,13 +411,15 @@ abstract class EventStoreBase{
Map
<
String
,
dynamic
>
toMap
()
{
return
{
'currentEvent'
:
currentEvent
.
toJson
(),
'gnssSync'
:
gnssSync
'gnssSync'
:
gnssSync
,
'showAllEvents'
:
showAllEvents
};
}
void
fromMap
(
Map
<
String
,
dynamic
>
map
)
{
currentEvent
=
Event
.
fromJson
(
map
[
'currentEvent'
]);
gnssSync
=
map
[
'gnssSync'
];
showAllEvents
=
map
[
'showAllEvents'
];
}
}
...
...
This diff is collapsed.
Click to expand it.
lib/viewevents.dart
+
28
−
3
View file @
c0a9ff21
...
...
@@ -15,17 +15,30 @@ class _ViewEvents extends State<ViewEvents> {
final
EventStoreInstance
_events
=
EventStoreInstance
();
String
_status
=
''
;
TextStyle
_statusStyle
=
const
TextStyle
(
color:
Colors
.
black
);
String
_appBarText
=
''
;
var
database
=
DatabaseInstance
();
List
<
Event
>
_localEvents
=
[];
Future
<
void
>
fetchEventsFromDb
()
async
{
_localEvents
=
await
database
.
getEvents
();
int
pendingEvents
=
await
database
.
getPendingEventCnt
();
final
EventStoreInstance
event
=
EventStoreInstance
();
int
pendingEvents
=
0
;
if
(
event
.
showAllEvents
==
false
)
{
_appBarText
=
'Pending Events'
;
//Get only pending events
_localEvents
=
await
database
.
getPendingEvents
();
pendingEvents
=
_localEvents
.
length
;
}
else
{
_appBarText
=
'All Events'
;
_localEvents
=
await
database
.
getEvents
();
pendingEvents
=
await
database
.
getPendingEventCnt
();
}
_status
=
pendingEvents
.
toString
()
+
' event(s) pending'
;
_statusStyle
=
const
TextStyle
(
color:
Colors
.
black
);
setState
(()
{});
//Got events from database, so update UI
setState
(()
{});
//Got events from database, so update UI
}
@override
...
...
@@ -84,9 +97,20 @@ class _ViewEvents extends State<ViewEvents> {
@override
Widget
build
(
BuildContext
context
)
{
final
EventStoreInstance
event
=
EventStoreInstance
();
return
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
"View & Sync"
),
actions:
<
Widget
>[
Text
(
_appBarText
,
style:
const
TextStyle
(
fontStyle:
FontStyle
.
italic
),),
Switch
(
//Enable showing all or only pending events. Default is to show only pending events
value:
event
.
showAllEvents
,
onChanged:
(
value
)
{
event
.
showAllEvents
=
value
;
fetchEventsFromDb
();
setState
(()
{});
}),
],
),
body:
Container
(
margin:
const
EdgeInsets
.
symmetric
(
horizontal:
5.0
),
...
...
@@ -260,3 +284,4 @@ class _ViewEvents extends State<ViewEvents> {
}
}
//TODO: allow editing fields here.
//TODO: show only pending events.
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment