Skip to content

Commit

Permalink
fix(edit): Make SerialPort configurable in editing mode
Browse files Browse the repository at this point in the history
Serial port for fine particular matter sensor can be configured for senseBox MCU models.
  • Loading branch information
mpfeil committed Nov 28, 2018
1 parent f81a9d8 commit 6076f39
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
24 changes: 23 additions & 1 deletion app/scripts/controllers/account.box.edit.script.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,36 @@

function EditBoxScriptController (boxData, AccountService) {
var vm = this;
vm.box = boxData;

vm.serialPort = 'Serial1';
vm.boxScript = '';
vm.showConfiguration = false;

vm.changeSerialPort = changeSerialPort;

activate();

////

function activate () {
return AccountService.getScript(boxData._id)
if (boxData.model.startsWith('homeV2')) {
vm.showConfiguration = true;
}

return getScript();
}

function changeSerialPort () {
vm.boxScript = 'Neuer Sketch wird generiert...';

return getScript();
}

function getScript () {
return AccountService.getScript(boxData._id, {
serialPort: vm.serialPort
})
.then(function (response) {
vm.boxScript = response;
})
Expand Down
16 changes: 16 additions & 0 deletions app/views/account.box.edit.script.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
<h2 style="margin-top: 0px; margin-bottom: 0px">{{'EDIT_SCRIPT'|translate}}</h2>
<hr>

<div ng-if="script.showConfiguration">
<h3>Konfiguration</h5>
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-4" style="height: 90px; text-align: left; margin-top: 15px;">
<div class="form-group">
<label for="groupTag">Anschluss (Feinstaubsensor)</label>
<div class="input-group xxxl">
<select id="groupTag" class="form-control" style="border-radius: 4px;" ng-model="script.serialPort" ng-change="script.changeSerialPort()">
<!---->
<option value="Serial1">Serial 1</option>
<option value="Serial2">Serial 2</option>
</select>
</div>
</div>
</div>
</div>

<div>
<textarea class="form-control" ng-model="script.boxScript" onclick="this.select()" style="height:350px;font-family:monospace;font-size:80%;resize: vertical;"></textarea>
</div>
Expand Down

0 comments on commit 6076f39

Please sign in to comment.