Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement/checkboxes policy #479

Merged
merged 2 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/app/components/kit/editKit/editKit.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@
zoom: 16
},
is_private: vm.device.isPrivate,
precise_location: vm.device.preciseLocation,
enable_forwarding: vm.device.enableForwarding,
notify_low_battery: vm.device.notifications.lowBattery,
notify_stopped_publishing: vm.device.notifications.stopPublishing,
tags: vm.device.userTags,
Expand Down Expand Up @@ -165,6 +167,8 @@
latitude: vm.deviceForm.location.lat,
longitude: vm.deviceForm.location.lng,
is_private: vm.deviceForm.is_private,
enable_forwarding: vm.deviceForm.enable_forwarding,
precise_location: vm.deviceForm.precise_location,
notify_low_battery: vm.deviceForm.notify_low_battery,
notify_stopped_publishing: vm.deviceForm.notify_stopped_publishing,
mac_address: "",
Expand Down
11 changes: 9 additions & 2 deletions src/app/components/kit/editKit/editKit.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ <h2 class="timeline_stepName timeline-title">
</div>
<!-- TODO: Cosmetic Make nicer -->
<!-- <md-button style="margin-left: auto" class="md-flat md-primary timeline_buttonBack" ng-click="vm.backToDevice()">Back to Device</md-button> -->
<md-button ng-show="vm.step===1" class="timeline_buttonBack btn-round-new btn-outline-white" ng-click="vm.backToProfile()">Back<span class="timeline-btn-extra"> to Profile</span></md-button>
<md-button ng-show="vm.step===1" class="timeline_buttonBack btn-round-new btn-outline-white" ng-click="vm.backToProfile()">Back</md-button>
<md-button class="btn-round-new btn-outline-white-blue" ng-click="vm.submitFormAndKit()">Save</md-button>
</div>
</section>
Expand Down Expand Up @@ -142,12 +142,13 @@ <h2>About the hardware</h2>
</div>
</div>
</section> -->
<!-- TODO - Only for admins and researchers now, but should be private for anyone, same for precise location -->
<section class="bg-white relaxed-layout" layout="row" layout-xs="column" layout-align="space-around start" layout-padding ng-if="vm.userRole === 'researcher' || vm.userRole === 'admin'">
<div flex-gt-xs="50">
<div layout="row">
<div class="">
<h2>Open data</h2>
<small>Sometimes, your devices might be collecting sensitive personal data (i.e. your exact location or by GPS using in your bike).<br>Check the box in case you want to prevent others from accesssing your data.
<small>Sometimes, your devices might be collecting sensitive personal data (i.e. your exact location or by GPS using in your bike).<br>Check the box in case you want to prevent others from accesssing your data. You can also choose to blurr the location, or enable MQTT forwarding.
</small>
</div>
</div>
Expand All @@ -158,6 +159,12 @@ <h2>Open data</h2>
<md-checkbox ng-model="vm.deviceForm.is_private">
<label>Make this device private</label>
</md-checkbox>
<md-checkbox ng-model="vm.deviceForm.precise_location">
<label>Enable precise location</label>
</md-checkbox>
<md-checkbox ng-model="vm.deviceForm.enable_forwarding">
<label>Enable MQTT forwarding</label>
</md-checkbox>
</div>
</div>
</section>
Expand Down
2 changes: 2 additions & 0 deletions src/app/core/constructors/device/device.constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
this.systemTags = deviceUtils.parseSystemTags(object);
this.userTags = deviceUtils.parseUserTags(object);
this.isPrivate = deviceUtils.isPrivate(object);
this.preciseLocation = deviceUtils.preciseLocation(object);
this.enableForwarding = deviceUtils.enableForwarding(object);
this.notifications = deviceUtils.parseNotifications(object);
this.lastReadingAt = timeUtils.parseDate(object.last_reading_at);
this.createdAt = timeUtils.parseDate(object.created_at);
Expand Down
12 changes: 11 additions & 1 deletion src/app/core/utils/deviceUtils.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
parseHardwareInfo: parseHardwareInfo,
parseHardwareName: parseHardwareName,
isPrivate: isPrivate,
preciseLocation: preciseLocation,
enableForwarding: enableForwarding,
isLegacyVersion: isLegacyVersion,
isSCKHardware: isSCKHardware,
parseState: parseState,
Expand Down Expand Up @@ -167,7 +169,15 @@
}

function isPrivate(object) {
return object.is_private;
return object.data_policy.is_private;
}

function preciseLocation(object) {
return object.data_policy.precise_location;
}

function enableForwarding(object) {
return object.data_policy.enable_forwarding ;
}

function isLegacyVersion (object) {
Expand Down
Loading