Exchange object progress
This commit is contained in:
parent
4db1f866f3
commit
7f1933576b
15 changed files with 11013 additions and 43 deletions
|
|
@ -5,8 +5,8 @@
|
|||
<div class="card-actions float-end">
|
||||
<div class="btn-group float-end" role="group">
|
||||
<button type="button" class="btn btn-success"
|
||||
data-toggle="modal" data-target="#exchangeModal" data-action="create_exchange">
|
||||
<i class="bi bi-plus-square"></i>
|
||||
data-bs-toggle="modal" data-bs-target="#exchangeModal" data-action="create_exchange">
|
||||
<i class="bi bi-plus"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Configuration</th>
|
||||
<th>Actions</th>
|
||||
<th class="text-end">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
|
@ -30,26 +30,25 @@
|
|||
<td>{{.getName()}}</td>
|
||||
<td>{{.getClass().getSimpleName()}}</td>
|
||||
<td>{{.getDeviceConfig()}}</td>
|
||||
<td>
|
||||
<td class="text-end">
|
||||
<form method="POST">
|
||||
<input type="hidden" name="id" value="{{.getId()}}">
|
||||
|
||||
<div class="btn-toolbar pull-right">
|
||||
<button type="button" class="btn btn-default btn-xs" data-toggle="modal"
|
||||
data-target="#exchangeModal"
|
||||
<div class="btn-group float-right">
|
||||
<button type="button" class="btn btn-primary btn-sm" data-bs-toggle="modal" data-bs-target="#exchangeModal"
|
||||
data-action="modify_exchange"
|
||||
data-id="{{.getId()}}"
|
||||
data-name="{{.getName()}}"
|
||||
data-type="{{.getType()}}"
|
||||
{{#.getDeviceConfigurator().getConfiguration()}}
|
||||
data-type="{{.getObjectClass()}}"
|
||||
{{#.getObjectConfigurator().getConfiguration()}}
|
||||
data-{{.getName()}}="{{.getString()}}"
|
||||
{{/.getDeviceConfigurator().getConfiguration()}}
|
||||
{{/.getObjectConfigurator().getConfiguration()}}
|
||||
>
|
||||
<span class="glyphicon glyphicon-pencil"></span>
|
||||
<i class="bi bi-pencil"></i>
|
||||
</button>
|
||||
|
||||
<button type="submit" class="btn btn-danger btn-xs" name="action" value="remove_exchange">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
<button type="submit" class="btn btn-danger btn-sm" name="action" value="remove_exchange">
|
||||
<i class="bi bi-small bi-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
|
@ -67,28 +66,41 @@
|
|||
<!------------- MODALS --------------->
|
||||
<script>
|
||||
$(function(){
|
||||
initDynamicModalForm("exchangeModal");
|
||||
initDynamicModalForm("exchangeModal", "exchange-conf-inputs", "exchange-conf-template");
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="modal fade" id="exchangeModal" tabindex="-1">
|
||||
<div class="modal fade" id="exchangeModal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"><span>×</span></button>
|
||||
<h4 class="modal-title">Exchange</h4>
|
||||
<h5 class="modal-title">Exchange</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<form method="POST">
|
||||
<div class="modal-body">
|
||||
<input type="hidden" id="action" name="action">
|
||||
<input type="hidden" id="id" name="id">
|
||||
<div class="form-group">
|
||||
<label class="control-label">Name:</label>
|
||||
<input type="text" class="form-control" name="name">
|
||||
<div>
|
||||
<label for="input-name" class="form-label">Name:</label>
|
||||
<input id="input-name" type="text" class="form-control" name="name">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="input-type" class="form-label">Type:</label>
|
||||
<select id="input-type" class="form-control" name="type">
|
||||
{{#exchangeConfigClasses}}
|
||||
<option>{{.getName()}}</option>
|
||||
{{/exchangeConfigClasses}}
|
||||
</select>
|
||||
</div>
|
||||
<hr>
|
||||
<div id="exchange-conf-inputs">
|
||||
<!-- Dynamic form -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="reset" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||
<button type="reset" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
|
||||
<button type="submit" class="btn btn-primary">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
|
|
@ -96,3 +108,27 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="exchange-conf-template" class="hidden">
|
||||
{{#exchangeObjectConfigs}}
|
||||
<div id="{{.clazz.getName()}}">
|
||||
{{#.params}}
|
||||
<div class="form-group">
|
||||
<label for="input-{{.getName()}}" class="form-label">{{.getNiceName()}}:</label>
|
||||
|
||||
{{#.isTypeString()}}<input id="input-{{.getName()}}" type="text" class="form-control" name="{{.getName()}}">{{/#.isTypeString()}}
|
||||
{{#.isTypeInt()}}<input id="input-{{.getName()}}" type="number" class="form-control" name="{{.getName()}}">{{/#.isTypeInt()}}
|
||||
{{#.isTypeBoolean()}}<input id="input-{{.getName()}}" type="checkbox" name="{{.getName()}}" value="true">{{/#.isTypeBoolean()}}
|
||||
{{#.isTypeEnum()}}
|
||||
<select id="input-{{.getName()}}" class="form-control" name="{{.getName()}}">
|
||||
{{#.getPossibleValues()}}<option>{{.}}</option>{{/.getPossibleValues()}}
|
||||
</select>
|
||||
{{/#.isTypeEnum()}}
|
||||
|
||||
{{#.getDescription()}}
|
||||
<div class="form-text">{{.getDescription()}}</div>
|
||||
{{/#.getDescription()}}
|
||||
</div>
|
||||
{{/.params}}
|
||||
</div>
|
||||
{{/exchangeObjectConfigs}}
|
||||
</div>
|
||||
10881
src/main/resources/web/js/jquery.js
vendored
Normal file
10881
src/main/resources/web/js/jquery.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
2
src/main/resources/web/js/jquery.min.js
vendored
Normal file
2
src/main/resources/web/js/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -65,23 +65,24 @@ function initDynamicModalForm(modalId, formTemplateId = null, templateID = null)
|
|||
// read in all configurations into global variable (to skip naming issues)
|
||||
if (formTemplateId != null) {
|
||||
dynamicConf[formTemplateId] = [];
|
||||
$("#"+templateID+" div").each(function(){
|
||||
$("#" + templateID + " div").each(function(){
|
||||
dynamicConf[formTemplateId][$(this).attr("id")] = $(this).html();
|
||||
});
|
||||
// Update dynamic inputs
|
||||
$("#"+modalId+" select[name=type]").change(function(){
|
||||
$("#"+modalId+" #"+formTemplateId).html(dynamicConf[formTemplateId][$(this).val()]);
|
||||
$("#" + modalId + " select[name=type]").change(function(){
|
||||
$("#" + modalId + " #"+formTemplateId).html(dynamicConf[formTemplateId][$(this).val()]);
|
||||
});
|
||||
}
|
||||
|
||||
// click event
|
||||
$("#"+modalId).on('show.bs.modal', function (event) {
|
||||
// Listen to click event
|
||||
|
||||
$("#" + modalId).on('show.bs.modal', function (event) {
|
||||
var button = $(event.relatedTarget);
|
||||
var modal = $(this);
|
||||
|
||||
// Reset all inputs
|
||||
if (formTemplateId != null)
|
||||
modal.find("#"+formTemplateId).empty(); // clear form div
|
||||
modal.find("#" + formTemplateId).empty(); // clear form div
|
||||
|
||||
// select dynamic form
|
||||
var selector = modal.find("select[name=type]");
|
||||
|
|
@ -100,7 +101,7 @@ function initDynamicModalForm(modalId, formTemplateId = null, templateID = null)
|
|||
if (value=="true") input.attr("checked", "true");
|
||||
else input.removeAttr("checked");
|
||||
// Add default false value as a unchecked checkbox is not included in the post
|
||||
input.parent().prepend("<input type='hidden' name='"+input.attr("name")+"' value='false' />");
|
||||
input.parent().prepend("<input type='hidden' name='" + input.attr("name") + "' value='false' />");
|
||||
} else {
|
||||
input.val(value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
var echarts = require('echarts');
|
||||
|
||||
var ROOT_PATH = 'https://echarts.apache.org/examples';
|
||||
/*var ROOT_PATH = 'https://echarts.apache.org/examples';
|
||||
var UP_COLOR = '#00da3c';
|
||||
var DOWN_COLOR = '#ec0000';
|
||||
|
||||
|
|
@ -8,8 +6,8 @@ var DOWN_COLOR = '#ec0000';
|
|||
$.get(ROOT_PATH + '/data/asset/data/stock-DJI.json', function (rawData) {
|
||||
var data = splitData(rawData);
|
||||
initTradeChart(elementID, data)
|
||||
}
|
||||
|
||||
});
|
||||
*/
|
||||
|
||||
function splitData(rawData) {
|
||||
var categoryData = [];
|
||||
|
|
@ -223,4 +221,4 @@ function initTradeChart(elementID, data) {
|
|||
},
|
||||
]
|
||||
}, true);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
<link href="css/trader.css" rel="stylesheet">
|
||||
|
||||
<!-- Javascript -->
|
||||
<script src="js/jquery.min.js"></script>
|
||||
<script src="js/bootstrap.bundle.min.js"></script>
|
||||
<script src="js/bootstrap-switch.min.js"></script>
|
||||
<script src="js/echarts.min.js"></script>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
<th>Type</th>
|
||||
<th>Configuration</th>
|
||||
<th>
|
||||
<button class="btn btn-default btn-xs pull-right" data-toggle="modal"
|
||||
<button class="btn btn-default btn-sm pull-right" data-toggle="modal"
|
||||
data-target="#symbolModal"
|
||||
data-action="create_symbol">
|
||||
<span class="glyphicon glyphicon-plus"></span>
|
||||
|
|
@ -45,7 +45,7 @@
|
|||
<input type="hidden" name="id" value="{{.getId()}}">
|
||||
|
||||
<div class="btn-toolbar pull-right">
|
||||
<button type="button" class="btn btn-default btn-xs" data-toggle="modal"
|
||||
<button type="button" class="btn btn-default btn-sm" data-toggle="modal"
|
||||
data-target="#symbolModal"
|
||||
data-action="modify_symbol"
|
||||
data-id="{{.getId()}}"
|
||||
|
|
@ -58,7 +58,7 @@
|
|||
<span class="glyphicon glyphicon-pencil"></span>
|
||||
</button>
|
||||
|
||||
<button type="submit" class="btn btn-danger btn-xs" name="action" value="remove_symbol">
|
||||
<button type="submit" class="btn btn-danger btn-sm" name="action" value="remove_symbol">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue