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
6596ab64
Commit
6596ab64
authored
3 years ago
by
Maximilian Betz
Browse files
Options
Downloads
Patches
Plain Diff
some simple sync feedback implemented
parent
5cc95545
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/viewevents.dart
+17
-45
17 additions, 45 deletions
lib/viewevents.dart
with
17 additions
and
45 deletions
lib/viewevents.dart
+
17
−
45
View file @
6596ab64
...
...
@@ -13,9 +13,16 @@ class ViewEvents extends StatefulWidget {
class
_ViewEvents
extends
State
<
ViewEvents
>
{
// Get singleton to access locally stored events:
EventStoreInstance
events
=
EventStoreInstance
();
EventStoreInstance
_events
=
EventStoreInstance
();
String
_sync_status
=
''
;
//TODO: add exception handling and display exceptions to user.
@override
void
initState
()
{
_sync_status
=
_events
.
getPendingEventCount
()
.
toString
()
+
' event(s) pending'
;
super
.
initState
();
}
Future
<
bool
>
syncEvents
()
async
{
//final EventStoreInstance events = EventStoreInstance();
final
ConfigurationStoreInstance
configuration
=
ConfigurationStoreInstance
();
...
...
@@ -26,11 +33,11 @@ class _ViewEvents extends State<ViewEvents> {
configuration
.
loginInformation
.
password
);
if
(
token
!=
null
)
{
_synccounter
=
events
.
getPendingEventCount
();
debugPrint
(
'Number of Events: '
+
events
.
events
.
length
.
toString
());
_synccounter
=
_
events
.
getPendingEventCount
();
debugPrint
(
'Number of Events: '
+
_
events
.
events
.
length
.
toString
());
debugPrint
(
'Number of Pending Events: '
+
_synccounter
.
toString
());
var
index
=
0
;
for
(
var
event
in
events
.
events
)
{
for
(
var
event
in
_
events
.
events
)
{
if
(
event
.
status
==
'PENDING'
)
{
debugPrint
(
'Idx: '
+
index
.
toString
()
+
' '
+
event
.
toSensorJson
()
.
toString
());
...
...
@@ -41,9 +48,12 @@ class _ViewEvents extends State<ViewEvents> {
debugPrint
(
'put success, remaining events: '
+
_synccounter
.
toString
());
event
.
status
=
'EXPORTED'
;
//Update event status so that it is only exported once.
setState
(()
{});
}
else
{
_sync_status
=
'export failed: '
+
event
.
urn
;
}
}
}
_sync_status
=
'export success'
;
return
true
;
}
return
false
;
...
...
@@ -134,7 +144,7 @@ class _ViewEvents extends State<ViewEvents> {
),
],
rows:
<
DataRow
>[
for
(
var
event
in
events
.
events
)
for
(
var
event
in
_
events
.
events
)
DataRow
(
cells:
<
DataCell
>[
DataCell
(
Text
(
event
.
id
.
toString
())),
...
...
@@ -208,58 +218,20 @@ class _ViewEvents extends State<ViewEvents> {
bottomNavigationBar:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Text
(
'Remaining events to sync: '
+
events
.
getPendingEventCount
()
.
toString
()),
const
SizedBox
(
width:
10
),
Text
(
_sync_status
),
FloatingActionButton
.
extended
(
heroTag:
null
,
tooltip:
'Upload Events'
,
icon:
null
,
label:
const
Text
(
'Sync'
),
onPressed:
()
{
syncEvents
();
//showDialog(
// barrierDismissible: false,
// context: context,
// builder: (BuildContext context) => _buildPopupDialog(context),
//);
},
),
],
),
);
}
Widget
_buildPopupDialog
(
BuildContext
context
)
{
return
AlertDialog
(
title:
const
Text
(
'Uploading Events'
),
content:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
<
Widget
>[
//Text("Progress"),
const
CircularProgressIndicator
(),
const
SizedBox
(
height:
10
),
Text
(
'Remaining events to sync'
),
],
),
actions:
<
Widget
>[
TextButton
(
onPressed:
()
{
//syncEvents();
setState
(()
{
});
//Navigator.of(context).pop();
},
//textColor: Theme.of(context).primaryColor,
child:
const
Text
(
'Close'
),
),
],
);
}
}
//TODO: allow editing fields here. Check validation of input value!
\ 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