Updated to store data_type
This commit is contained in:
@@ -66,8 +66,8 @@ exports.getAllTags = (req, res) ->
|
||||
|
||||
exports.createTag = (req, res) ->
|
||||
req.app.locals.pool.getConnection (err, db) ->
|
||||
query = 'INSERT INTO tags (tag, units, minExpected, maxExpected, name, description, class, guarantee_sec, change_threshold) VALUES (?, ?, ?, ?, ?, ?, 5, ?, ?)'
|
||||
db.query query, [req.body.tag, req.body.units, req.body.minExpected, req.body.maxExpected, req.body.name, req.body.description, req.body.guarantee_sec, req.body.change_threshold], (err, results) ->
|
||||
query = 'INSERT INTO tags (tag, units, minExpected, maxExpected, name, description, class, guarantee_sec, change_threshold, data_type) VALUES (?, ?, ?, ?, ?, ?, 5, ?, ?)'
|
||||
db.query query, [req.body.tag, req.body.units, req.body.minExpected, req.body.maxExpected, req.body.name, req.body.description, req.body.guarantee_sec, req.body.change_threshold, req.body.data_type], (err, results) ->
|
||||
if err
|
||||
res.json
|
||||
status: 'error'
|
||||
@@ -98,8 +98,8 @@ exports.getTag = (req, res) ->
|
||||
exports.updateTag = (req, res) ->
|
||||
console.log(req.body)
|
||||
req.app.locals.pool.getConnection (err, db) ->
|
||||
query = 'UPDATE tags set tag = ?, units = ?, minExpected = ?, maxExpected = ?, name = ?, description = ?, guarantee_sec = ?, change_threshold = ? WHERE id = ?'
|
||||
db.query query, [req.body.tag, req.body.units, req.body.minExpected, req.body.maxExpected, req.body.name, req.body.description, req.body.guarantee_sec, req.body.change_threshold, req.body.id], (err, results) ->
|
||||
query = 'UPDATE tags set tag = ?, units = ?, minExpected = ?, maxExpected = ?, name = ?, description = ?, guarantee_sec = ?, change_threshold = ?, data_type = ? WHERE id = ?'
|
||||
db.query query, [req.body.tag, req.body.units, req.body.minExpected, req.body.maxExpected, req.body.name, req.body.description, req.body.guarantee_sec, req.body.change_threshold, req.body.data_type, req.body.id], (err, results) ->
|
||||
db.release()
|
||||
if err
|
||||
res.json
|
||||
|
||||
@@ -81,9 +81,9 @@ exports.createTag = (req, res) ->
|
||||
sqlite3 = require('sqlite3').verbose()
|
||||
db = new (sqlite3.Database)(dbFile)
|
||||
db.serialize ->
|
||||
query = 'INSERT INTO tags (tag, units, minExpected, maxExpected, name, description, class, guarantee_sec, change_threshold) VALUES (?, ?, ?, ?, ?, ?, 5, ?, ?)'
|
||||
query = 'INSERT INTO tags (tag, units, minExpected, maxExpected, name, description, class, guarantee_sec, change_threshold, data_type) VALUES (?, ?, ?, ?, ?, ?, 5, ?, ?)'
|
||||
prepQuery = db.prepare(query)
|
||||
prepQuery.run req.body.tag, req.body.units, req.body.minExpected, req.body.maxExpected, req.body.name, req.body.description, req.body.guarantee_sec, req.body.change_threshold, (err) ->
|
||||
prepQuery.run req.body.tag, req.body.units, req.body.minExpected, req.body.maxExpected, req.body.name, req.body.description, req.body.guarantee_sec, req.body.change_threshold, req.body.data_type, (err) ->
|
||||
prepQuery.finalize()
|
||||
db.close()
|
||||
if err
|
||||
@@ -125,9 +125,9 @@ exports.updateTag = (req, res) ->
|
||||
sqlite3 = require('sqlite3').verbose()
|
||||
db = new (sqlite3.Database)(dbFile)
|
||||
db.serialize ->
|
||||
query = 'UPDATE tags set tag = ?, units = ?, minExpected = ?, maxExpected = ?, name = ?, description = ?, guarantee_sec = ?, change_threshold = ? WHERE id = ?'
|
||||
query = 'UPDATE tags set tag = ?, units = ?, minExpected = ?, maxExpected = ?, name = ?, description = ?, guarantee_sec = ?, change_threshold = ?, data_type = ? WHERE id = ?'
|
||||
prepQuery = db.prepare(query)
|
||||
prepQuery.run req.body.tag, req.body.units, req.body.minExpected, req.body.maxExpected, req.body.name, req.body.description, req.body.guarantee_sec, req.body.change_threshold, req.body.id, (err) ->
|
||||
prepQuery.run req.body.tag, req.body.units, req.body.minExpected, req.body.maxExpected, req.body.name, req.body.description, req.body.guarantee_sec, req.body.change_threshold, req.body.data_type, req.body.id, (err) ->
|
||||
prepQuery.finalize()
|
||||
db.close()
|
||||
if err
|
||||
|
||||
@@ -202,7 +202,8 @@ tsCtrlrs.factory('tags',function($q, $http, $log){
|
||||
maxExpected: tag.maxExpected,
|
||||
guarantee_sec: tag.guarantee_sec,
|
||||
change_threshold: tag.change_threshold,
|
||||
description: tag.description
|
||||
description: tag.description,
|
||||
data_type: tag.data_type
|
||||
}).success(function(data){
|
||||
return data;
|
||||
});
|
||||
@@ -219,7 +220,8 @@ tsCtrlrs.factory('tags',function($q, $http, $log){
|
||||
maxExpected: tag.maxExpected,
|
||||
guarantee_sec: tag.guarantee_sec,
|
||||
change_threshold: tag.change_threshold,
|
||||
description: tag.description
|
||||
description: tag.description,
|
||||
data_type: tag.data_type
|
||||
}).success(function(data){
|
||||
return data;
|
||||
}).error(function(err){
|
||||
|
||||
@@ -20,6 +20,14 @@
|
||||
<label for="description">Description</label>
|
||||
<input type="textarea" ng-model="newTag.description" class="form-control" id="description" placeholder="Tag Description Here">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="data_type">Data Type</label>
|
||||
<select ng-model="newTag.data_type" class="form-control" id="data_type">
|
||||
<option value="REAL">Floating Point</option>
|
||||
<option value="DINT">Integer</option>
|
||||
<option value="BOOL">Boolean</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="form-group">
|
||||
<label for="minExpected">Minimum Value Expected</label>
|
||||
@@ -83,6 +91,14 @@
|
||||
<label for="description">Description</label>
|
||||
<input type="textarea" ng-model="editTag.description" class="form-control" id="description" placeholder="Tag Description Here">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="data_type">Data Type</label>
|
||||
<select ng-model="editTag.data_type" class="form-control" id="data_type">
|
||||
<option value="REAL">Floating Point</option>
|
||||
<option value="DINT">Integer</option>
|
||||
<option value="BOOL">Boolean</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="form-group">
|
||||
<label for="minExpected">Minimum Value Expected</label>
|
||||
@@ -204,7 +220,7 @@
|
||||
<tbody>
|
||||
<tr ng-repeat="tag in tags">
|
||||
<td>{{tag.id}}</td>
|
||||
<td><a href="/#/tag/{{tag.id}}">{{tag.name}}</a> <i class="fa fa-info-circle" data-toggle="popover" title="{{tag.name}}" data-content="Tag Name: {{tag.tag}} </br>Details: {{tag.description}}"></i></td>
|
||||
<td><a href="/#/tag/{{tag.id}}">{{tag.name}}</a> <i class="fa fa-info-circle" data-toggle="popover" title="{{tag.name}}" data-content="Tag Name: {{tag.tag}} </br>Details: {{tag.description}}<br/>Type: {{tag.data_type}}"></i></td>
|
||||
<td>{{tag.minExpected}}</td>
|
||||
<td>{{tag.maxExpected}}</td>
|
||||
<td>{{tag.units}}</td>
|
||||
|
||||
Reference in New Issue
Block a user