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
0045f696
Commit
0045f696
authored
3 years ago
by
Maximilian Betz
Browse files
Options
Downloads
Patches
Plain Diff
some ui improvements
parent
02b8797e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/configuration.dart
+157
-147
157 additions, 147 deletions
lib/configuration.dart
lib/viewevents.dart
+1
-1
1 addition, 1 deletion
lib/viewevents.dart
with
158 additions
and
148 deletions
lib/configuration.dart
+
157
−
147
View file @
0045f696
...
@@ -44,160 +44,170 @@ class _MyHomePageState extends State<Configuration> {
...
@@ -44,160 +44,170 @@ class _MyHomePageState extends State<Configuration> {
final
EventStoreInstance
events
=
EventStoreInstance
();
final
EventStoreInstance
events
=
EventStoreInstance
();
return
Scaffold
(
return
Scaffold
(
appBar:
AppBar
(
appBar:
AppBar
(
title:
const
Text
(
'Configuration'
),
title:
const
Text
(
'Configuration'
),
),
),
body:
Center
(
body:
Container
(
child:
Column
(
margin:
const
EdgeInsets
.
symmetric
(
horizontal:
5.0
),
mainAxisAlignment:
MainAxisAlignment
.
center
,
child:
children:
<
Widget
>[
Center
(
const
Text
(
child:
Column
(
'You must be online to do something here!'
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
style:
TextStyle
(
fontSize:
14
)
children:
<
Widget
>[
),
const
Text
(
const
SizedBox
(
height:
50
),
'You must be online to do something here!'
,
TextFormField
(
style:
TextStyle
(
fontSize:
14
)
keyboardType:
TextInputType
.
emailAddress
,
),
autofocus:
false
,
const
SizedBox
(
height:
50
),
initialValue:
configuration
.
loginInformation
.
mail
,
TextFormField
(
decoration:
const
InputDecoration
(
keyboardType:
TextInputType
.
emailAddress
,
labelText:
'Sensor E-Mail'
,
autofocus:
false
,
hintText:
'User for writing events'
,
initialValue:
configuration
.
loginInformation
.
mail
,
),
decoration:
const
InputDecoration
(
onChanged:
(
value
)
{
labelText:
'Sensor E-Mail'
,
configuration
.
loginInformation
.
mail
=
value
;
hintText:
'User for writing events'
,
},
),
onFieldSubmitted:
(
value
)
{
onChanged:
(
value
)
{
futureAuthToken
=
connector
.
getAuthToken
(
configuration
.
loginInformation
.
mail
,
configuration
.
loginInformation
.
password
);
configuration
.
loginInformation
.
mail
=
value
;
},
},
),
onFieldSubmitted:
(
value
)
{
TextFormField
(
futureAuthToken
=
connector
.
getAuthToken
(
configuration
.
loginInformation
.
mail
,
configuration
.
loginInformation
.
password
);
autofocus:
false
,
},
initialValue:
configuration
.
loginInformation
.
password
,
),
decoration:
const
InputDecoration
(
TextFormField
(
labelText:
'Sensor Password'
,
autofocus:
false
,
hintText:
'Password for writing events'
,
initialValue:
configuration
.
loginInformation
.
password
,
),
decoration:
const
InputDecoration
(
onChanged:
(
value
){
labelText:
'Sensor Password'
,
configuration
.
loginInformation
.
password
=
value
;
hintText:
'Password for writing events'
,
},
),
onFieldSubmitted:
(
value
)
{
onChanged:
(
value
){
futureAuthToken
=
connector
.
getAuthToken
(
configuration
.
loginInformation
.
mail
,
configuration
.
loginInformation
.
password
);
configuration
.
loginInformation
.
password
=
value
;
},
},
),
onFieldSubmitted:
(
value
)
{
const
SizedBox
(
height:
50
),
futureAuthToken
=
connector
.
getAuthToken
(
configuration
.
loginInformation
.
mail
,
configuration
.
loginInformation
.
password
);
FutureBuilder
<
List
<
Collection
>>(
},
future:
futureCollections
,
),
builder:
(
context
,
snapshot
){
const
SizedBox
(
height:
50
),
if
(
snapshot
.
hasData
)
FutureBuilder
<
List
<
Collection
>>(
{
future:
futureCollections
,
configuration
.
collections
=
[];
builder:
(
context
,
snapshot
){
snapshot
.
data
?.
forEach
((
element
)
{
if
(
snapshot
.
hasData
)
configuration
.
collections
.
add
(
element
);
{
});
configuration
.
collections
=
[];
snapshot
.
data
?.
forEach
((
element
)
{
/*Initialize active collection with first received
configuration
.
collections
.
add
(
element
);
});
/*Initialize active collection with first received
collection if not initialized yet*/
collection if not initialized yet*/
if
(
configuration
.
currentCollection
.
id
==
-
1
){
if
(
configuration
.
currentCollection
.
id
==
-
1
){
configuration
.
currentCollection
=
configuration
.
collections
[
0
];
configuration
.
currentCollection
=
configuration
.
collections
[
0
];
futureDevices
=
connector
.
fetchCollectionDevices
(
configuration
.
currentCollection
.
id
);
}
return
DropdownButtonFormField
(
value:
configuration
.
currentCollection
.
collectionName
,
decoration:
const
InputDecoration
(
labelText:
'Chose Collection'
,
),
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
);
futureDevices
=
connector
.
fetchCollectionDevices
(
configuration
.
currentCollection
.
id
);
}
}
);
}
return
DropdownButtonFormField
(
else
{
value:
configuration
.
currentCollection
.
collectionName
,
return
const
CircularProgressIndicator
();
decoration:
const
InputDecoration
(
}
labelText:
'Chose Collection'
,
}
),
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
);
}
);
}
else
{
return
const
CircularProgressIndicator
();
}
}
),
],
),
),
],
),
),
bottomNavigationBar:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
FloatingActionButton
.
extended
(
heroTag:
null
,
tooltip:
'Reset all data'
,
icon:
const
Icon
(
Icons
.
cancel
),
label:
const
Text
(
'Reset all'
),
onPressed:
()
{
//events.reset(); //TODO: remove before release!
configuration
.
reset
();
//TODO: remove before release this is not a real use case!
},
),
),
FloatingActionButton
.
extended
(
),
heroTag:
null
,
bottomNavigationBar:
Container
(
tooltip:
'Select Collection and download corresponding devices'
,
margin:
const
EdgeInsets
.
symmetric
(
vertical:
10.0
),
icon:
const
Icon
(
Icons
.
save
),
child:
Row
(
label:
const
Text
(
'Store'
),
mainAxisAlignment:
MainAxisAlignment
.
end
,
onPressed:
()
{
children:
[
futureAuthToken
.
then
((
value
){
//NOTE: Counterintuitive async callback function
const
SizedBox
(
width:
10.0
),
debugPrint
(
"Login credentials correct! Auth Token: "
+
value
);
FloatingActionButton
.
extended
(
heroTag:
null
,
futureDevices
.
then
((
value
)
{
tooltip:
'Reset all data'
,
debugPrint
(
"Device List complete"
);
icon:
const
Icon
(
Icons
.
cancel
),
configuration
.
devices
=
value
;
label:
const
Text
(
'Reset all'
),
onPressed:
()
{
futureEventTypes
.
then
((
value
)
{
//events.reset(); //TODO: remove before release!
debugPrint
(
"Event Types List complete"
);
configuration
.
reset
();
//TODO: remove before release this is not a real use case!
configuration
.
eventTypes
=
value
;
},
),
debugPrint
(
"EventType Json: "
+
jsonEncode
(
const
SizedBox
(
width:
50
),
configuration
.
eventTypes
[
0
]));
FloatingActionButton
.
extended
(
debugPrint
(
"Device Json: "
+
jsonEncode
(
heroTag:
null
,
configuration
.
devices
[
0
]));
tooltip:
'Select Collection and download corresponding devices'
,
debugPrint
(
"Current Collection Json: "
+
jsonEncode
(
icon:
const
Icon
(
Icons
.
save
),
configuration
.
currentCollection
));
label:
const
Text
(
'Store'
),
debugPrint
(
"Sensor Login Json: "
+
jsonEncode
(
onPressed:
()
{
configuration
.
loginInformation
));
futureAuthToken
.
then
((
value
){
//NOTE: Counterintuitive async callback function
debugPrint
(
"Login credentials correct! Auth Token: "
+
value
);
try
{
//Update id and urn for the add event widget with some initial data
futureDevices
.
then
((
value
)
{
events
.
currentEvent
.
id
=
configuration
.
devices
[
0
]
debugPrint
(
"Device List complete"
);
.
id
;
//TODO: fix if devices are an empty list.
configuration
.
devices
=
value
;
events
.
currentEvent
.
urn
=
configuration
.
devices
[
0
]
.
urn
;
events
.
currentEvent
.
description
=
''
;
futureEventTypes
.
then
((
value
)
{
events
.
currentEvent
.
label
=
''
;
debugPrint
(
"Event Types List complete"
);
events
.
currentEvent
.
type
=
configuration
.
eventTypes
[
0
]
configuration
.
eventTypes
=
value
;
.
name
;
debugPrint
(
"EventType Json: "
+
jsonEncode
(
var
date
=
DateTime
.
now
()
.
toUtc
();
configuration
.
eventTypes
[
0
]));
var
isoDate
=
date
.
toIso8601String
();
debugPrint
(
"Device Json: "
+
jsonEncode
(
events
.
currentEvent
.
startDate
=
isoDate
;
configuration
.
devices
[
0
]));
events
.
currentEvent
.
endDate
=
isoDate
;
debugPrint
(
"Current Collection Json: "
+
jsonEncode
(
configuration
.
initialized
=
true
;
configuration
.
currentCollection
));
debugPrint
(
"Sensor Login Json: "
+
jsonEncode
(
HapticFeedback
.
vibrate
();
configuration
.
loginInformation
));
//TODO: display success user feedback
}
catch
(
e
)
{
try
{
throw
Exception
(
'Something went wrong try again'
);
//Update id and urn for the add event widget with some initial data
}
events
.
currentEvent
.
id
=
configuration
.
devices
[
0
]
.
id
;
//TODO: fix if devices are an empty list.
events
.
currentEvent
.
urn
=
configuration
.
devices
[
0
]
.
urn
;
events
.
currentEvent
.
description
=
''
;
events
.
currentEvent
.
label
=
''
;
events
.
currentEvent
.
type
=
configuration
.
eventTypes
[
0
]
.
name
;
var
date
=
DateTime
.
now
()
.
toUtc
();
var
isoDate
=
date
.
toIso8601String
();
events
.
currentEvent
.
startDate
=
isoDate
;
events
.
currentEvent
.
endDate
=
isoDate
;
configuration
.
initialized
=
true
;
HapticFeedback
.
vibrate
();
//TODO: display success user feedback
}
catch
(
e
)
{
throw
Exception
(
'Something went wrong try again'
);
}
});
});
});
});
});
//TODO: display failed as user feedback somehow
});
},
//TODO: display failed as user feedback somehow
),
},
const
SizedBox
(
width:
10.0
),
],
),
),
],
)
),
);
);
}
}
}
}
This diff is collapsed.
Click to expand it.
lib/viewevents.dart
+
1
−
1
View file @
0045f696
...
@@ -246,7 +246,7 @@ class _ViewEvents extends State<ViewEvents> {
...
@@ -246,7 +246,7 @@ class _ViewEvents extends State<ViewEvents> {
},
},
),
),
),
),
const
SizedBox
(
width:
10
.0
),
const
SizedBox
(
width:
5
.0
),
],
],
),
),
);
);
...
...
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