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
776f17d0
Commit
776f17d0
authored
2 years ago
by
Maximilian Betz
Browse files
Options
Downloads
Patches
Plain Diff
cleanup
parent
63223af3
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/configuration.dart
+105
-101
105 additions, 101 deletions
lib/configuration.dart
lib/sensorconnector.dart
+1
-1
1 addition, 1 deletion
lib/sensorconnector.dart
lib/viewevents.dart
+3
-2
3 additions, 2 deletions
lib/viewevents.dart
with
109 additions
and
104 deletions
lib/configuration.dart
+
105
−
101
View file @
776f17d0
...
...
@@ -49,6 +49,10 @@ class _MyHomePageState extends State<Configuration> {
final
File
file
=
File
(
filepath
);
await
file
.
writeAsString
(
eventsJson
);
debugPrint
(
'Stored file at: '
+
filepath
);
_status
=
'Event database dump created: '
+
filepath
;
_statusStyle
=
const
TextStyle
(
color:
Colors
.
green
);
setState
(()
{});
HapticFeedback
.
vibrate
();
}
}
...
...
@@ -84,15 +88,15 @@ class _MyHomePageState extends State<Configuration> {
await
configuration
.
storeToSharedPrefs
();
debugPrint
(
'Configuration stored!'
);
_status
=
'Login success
& configuration stored
'
;
_status
=
'Login success
, got all EventTypes, loaded Collection Devices & stored configuration for offline usage.
'
;
_statusStyle
=
const
TextStyle
(
color:
Colors
.
green
);
setState
(()
{});
}
catch
(
e
)
{
debugPrint
(
'Exception:
$e
'
);
_status
=
'
$e
'
;
String
errorText
=
e
.
toString
();
errorText
=
errorText
.
substring
(
10
,
errorText
.
length
);
//Remove 'Exception' from string.
_status
=
errorText
;
_statusStyle
=
const
TextStyle
(
color:
Colors
.
red
);
setState
(()
{});
}
}
...
...
@@ -102,8 +106,9 @@ class _MyHomePageState extends State<Configuration> {
futureCollections
=
connector
.
fetchCollections
();
await
futureCollections
;
//wait and catch error here!
}
catch
(
e
){
debugPrint
(
e
.
toString
());
_status
=
'
$e
'
;
String
errorText
=
e
.
toString
();
errorText
=
errorText
.
substring
(
10
,
errorText
.
length
);
//Remove 'Exception' from string.
_status
=
errorText
;
_statusStyle
=
const
TextStyle
(
color:
Colors
.
red
);
setState
(()
{});
}
...
...
@@ -124,107 +129,106 @@ class _MyHomePageState extends State<Configuration> {
appBar:
AppBar
(
title:
const
Text
(
'Configuration'
),
),
body:
SingleChildScrollView
(
child:
Container
(
margin:
const
EdgeInsets
.
symmetric
(
horizontal:
5.0
),
child:
Center
(
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
mainAxisSize:
MainAxisSize
.
max
,
children:
<
Widget
>[
const
SizedBox
(
height:
50
),
const
Text
(
'You must be online to do something here!'
,
style:
TextStyle
(
fontSize:
14
)
body:
Container
(
//constraints: const BoxConstraints.expand(),
margin:
const
EdgeInsets
.
symmetric
(
horizontal:
5.0
),
child:
SingleChildScrollView
(
scrollDirection:
Axis
.
vertical
,
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
mainAxisSize:
MainAxisSize
.
max
,
children:
<
Widget
>[
const
SizedBox
(
height:
50
),
const
Text
(
'You must be online to do something here!'
,
style:
TextStyle
(
fontSize:
14
)
),
const
SizedBox
(
height:
50
),
TextFormField
(
keyboardType:
TextInputType
.
emailAddress
,
autofocus:
false
,
initialValue:
configuration
.
loginInformation
.
mail
,
decoration:
const
InputDecoration
(
border:
OutlineInputBorder
(),
labelText:
'E-Mail'
,
hintText:
''
,
),
c
on
st
SizedBox
(
height:
50
),
TextFormField
(
keyboardType:
TextInputType
.
emailAddress
,
autofocus:
false
,
initialValue:
configuration
.
loginInformation
.
mail
,
decoration:
const
InputDecoration
(
border:
OutlineInputBorder
()
,
labelText:
'E-Mail'
,
hintText:
''
,
),
onChanged:
(
value
)
{
configuration
.
loginInformation
.
mail
=
value
;
}
,
on
Changed:
(
value
)
{
configuration
.
loginInformation
.
mail
=
value
;
}
,
)
,
const
SizedBox
(
height:
15.0
)
,
TextFormField
(
obscureText:
true
,
autofocus:
false
,
initialValue:
configuration
.
loginInformation
.
password
,
decoration:
const
InputDecoration
(
border:
OutlineInputBorder
(),
labelText:
'Password'
,
hintText:
''
,
),
const
SizedBox
(
height:
15.0
),
TextFormField
(
obscureText:
true
,
autofocus:
false
,
initialValue:
configuration
.
loginInformation
.
password
,
decoration:
const
InputDecoration
(
border:
OutlineInputBorder
(),
labelText:
'Password'
,
hintText:
''
,
),
onChanged:
(
value
){
configuration
.
loginInformation
.
password
=
value
;
},
),
const
SizedBox
(
height:
50
),
FutureBuilder
<
List
<
Collection
>>(
future:
futureCollections
,
builder:
(
context
,
snapshot
){
if
(
snapshot
.
hasData
)
{
configuration
.
collections
=
[];
snapshot
.
data
?.
forEach
((
element
)
{
configuration
.
collections
.
add
(
element
);
});
/*Initialize active collection with first received collection if not initialized yet*/
if
(
configuration
.
currentCollection
.
id
==
-
1
){
configuration
.
currentCollection
=
configuration
.
collections
[
0
];
}
onChanged:
(
value
){
configuration
.
loginInformation
.
password
=
value
;
},
),
const
SizedBox
(
height:
50
),
FutureBuilder
<
List
<
Collection
>>(
future:
futureCollections
,
builder:
(
context
,
snapshot
){
if
(
snapshot
.
hasData
)
{
configuration
.
collections
=
[];
snapshot
.
data
?.
forEach
((
element
)
{
configuration
.
collections
.
add
(
element
);
});
return
DropdownButtonFormField
(
value:
configuration
.
currentCollection
.
collectionName
,
decoration:
const
InputDecoration
(
labelText:
'Chose Collection'
,
border:
OutlineInputBorder
(),
),
items:
configuration
.
collections
.
map
((
Collection
collection
)
{
return
DropdownMenuItem
(
value:
collection
.
collectionName
,
child:
Text
(
collection
.
collectionName
),
);
})
.
toList
(),
onChanged:
(
value
)
{
configuration
.
currentCollection
=
configuration
.
getCollectionFromName
(
value
.
toString
());
//Fetch new selected collection devices
futureDevices
=
connector
.
fetchCollectionDevices
(
configuration
.
currentCollection
.
id
);
}
);
}
if
(
snapshot
.
hasError
)
{
debugPrint
(
'Some error happened'
);
return
const
CircularProgressIndicator
();
}
else
{
return
const
CircularProgressIndicator
();
/*Initialize active collection with first received collection if not initialized yet*/
if
(
configuration
.
currentCollection
.
id
==
-
1
){
configuration
.
currentCollection
=
configuration
.
collections
[
0
];
}
return
DropdownButtonFormField
(
value:
configuration
.
currentCollection
.
collectionName
,
decoration:
const
InputDecoration
(
labelText:
'Chose Collection'
,
border:
OutlineInputBorder
(),
),
items:
configuration
.
collections
.
map
((
Collection
collection
)
{
return
DropdownMenuItem
(
value:
collection
.
collectionName
,
child:
Text
(
collection
.
collectionName
),
);
})
.
toList
(),
onChanged:
(
value
)
{
configuration
.
currentCollection
=
configuration
.
getCollectionFromName
(
value
.
toString
());
//Fetch new selected collection devices
futureDevices
=
connector
.
fetchCollectionDevices
(
configuration
.
currentCollection
.
id
);
}
);
}
if
(
snapshot
.
hasError
)
{
debugPrint
(
'Some error happened'
);
return
const
CircularProgressIndicator
();
}
else
{
return
const
CircularProgressIndicator
();
}
}
),
const
SizedBox
(
height:
50.0
),
TextFormField
(
minLines:
1
,
maxLines:
5
,
readOnly:
true
,
autofocus:
false
,
enabled:
false
,
style:
_statusStyle
,
controller:
TextEditingController
(
text:
_status
,
),
const
SizedBox
(
height:
50.0
),
TextFormField
(
readOnly:
true
,
autofocus:
false
,
enabled:
false
,
style:
_statusStyle
,
controller:
TextEditingController
(
text:
_status
,
),
),
const
SizedBox
(
height:
15.0
),
],
),
),
],
),
),
),
...
...
This diff is collapsed.
Click to expand it.
lib/sensorconnector.dart
+
1
−
1
View file @
776f17d0
...
...
@@ -144,7 +144,7 @@ class SensorConnector {
if
(
response
.
statusCode
==
201
)
{
return
true
;
}
else
if
(
response
.
statusCode
==
401
)
{
throw
Exception
(
'No
editor
for UrnId '
+
event
.
urnId
.
toString
());
throw
Exception
(
'No
write access
for UrnId
:
'
+
event
.
urnId
.
toString
());
}
else
{
debugPrint
(
response
.
statusCode
.
toString
());
...
...
This diff is collapsed.
Click to expand it.
lib/viewevents.dart
+
3
−
2
View file @
776f17d0
...
...
@@ -72,8 +72,9 @@ class _ViewEvents extends State<ViewEvents> {
_status
=
'export success'
;
_statusStyle
=
const
TextStyle
(
color:
Colors
.
green
);
}
catch
(
e
)
{
debugPrint
(
'Exception:
$e
'
);
_status
=
'
$e
'
;
String
errorText
=
e
.
toString
();
errorText
=
errorText
.
substring
(
10
,
errorText
.
length
);
//Remove 'Exception' from string.
_status
=
errorText
;
_statusStyle
=
const
TextStyle
(
color:
Colors
.
red
);
setState
(()
{});
}
...
...
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