Skip to content

Commit

Permalink
Add hardware version to new legacy kit and final checks
Browse files Browse the repository at this point in the history
  • Loading branch information
oscgonfer committed Mar 1, 2024
1 parent 2191e6c commit 2513b67
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/app/components/kit/editKit/editKit.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
}

// TODO: Refactor, bring this back once we have a way to create legacy
// if(vm.device.isLegacy){
if(vm.device.isLegacy){
if(!vm.deviceForm.macAddress || vm.deviceForm.macAddress === ''){
/*jshint camelcase: false */
data.mac_address = null;
Expand All @@ -202,7 +202,7 @@
alert.error(message);
data.mac_address = null;
throw new Error('[Client:error] ' + message);
// }
}
}

device.updateDevice(vm.device.id, data)
Expand Down
1 change: 0 additions & 1 deletion src/app/components/kit/editKit/editKit.html
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ <h2>Mac address</h2>
<label>Mac Address</label>
<!-- TODO: Refactor, check -->
<input type="text" ng-model="vm.deviceForm.macAddress">
<!-- <input type="text" pattern="([0-9A-Fa-f]{2}\:){5}([0-9A-Fa-f]{2})" ng-model="vm.macAddress"> -->
</md-input-container>
</div>
</div>
Expand Down
9 changes: 8 additions & 1 deletion src/app/components/kit/newKit/newKit.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
zoom: 16
},
is_private: false,
legacyVersion: '1.1',
tags: []
};

Expand All @@ -33,6 +34,12 @@
{name: 'outdoor', value: 2}
];

// VERSION SELECT
vm.version = [
{name: 'Smart Citizen Kit 1.0', value: '1.0'},
{name: 'Smart Citizen Kit 1.1', value: '1.1'}
];

$scope.$on('leafletDirectiveMarker.dragend', function(event, args){
vm.deviceForm.location.lat = args.model.lat;
vm.deviceForm.location.lng = args.model.lng;
Expand Down Expand Up @@ -62,7 +69,6 @@
vm.removeTag = removeTag;

// MAP CONFIGURATION

var mapBoxToken = 'pk.eyJ1IjoidG9tYXNkaWV6IiwiYSI6ImRTd01HSGsifQ.loQdtLNQ8GJkJl2LUzzxVg';

vm.getLocation = getLocation;
Expand Down Expand Up @@ -119,6 +125,7 @@
latitude: vm.deviceForm.location.lat,
longitude: vm.deviceForm.location.lng,
is_private: vm.deviceForm.is_private,
hardware_version_override: vm.deviceForm.legacyVersion,
/*jshint camelcase: false */
user_tags: _.map(vm.deviceForm.tags, 'name').join(',')
};
Expand Down
6 changes: 6 additions & 0 deletions src/app/components/kit/newKit/newKit.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ <h2>Basic information</h2>
</md-select>
</div>
</div>
<div class="form_blockInput_select" layout="row" layout-align="start center">
<label>Hardware version:</label>
<md-select ng-model="vm.deviceForm.legacyVersion" placeholder="Select hardware version">
<md-option class="color-dropdown" ng-repeat="version in vm.version" ng-value="{{ version.value }}">{{ version.name }}</md-option>
</md-select>
</div>
<md-checkbox ng-if="vm.userRole === 'researcher' || vm.userRole === 'admin'" ng-model="vm.deviceForm.is_private">
<label>Make this device private</label>
</md-checkbox>
Expand Down

0 comments on commit 2513b67

Please sign in to comment.