[WIP]Adds some exchange settings in the settings page

This commit is contained in:
Scott
2016-07-27 19:43:06 +10:00
parent df295a122c
commit df7de76b05
6 changed files with 67 additions and 35 deletions

View File

@@ -5,6 +5,7 @@ angular.module('myApp', [
'ngRoute',
'myApp.home',
'myApp.about',
'myApp.settings',
'myApp.version'
]).
config(['$locationProvider', '$routeProvider', function($locationProvider, $routeProvider) {

0
web/app/controllers.js Normal file
View File

View File

@@ -54,6 +54,7 @@
<script src="/bower_components/angular/angular.js"></script>
<script src="/bower_components/angular-route/angular-route.js"></script>
<script src="/app.js"></script>
<script src="/views/settings/settings.js"></script>
<script src="/views/home/home.js"></script>
<script src="/views/about/about.js"></script>
<script src="/components/version/version.js"></script>

View File

@@ -1,28 +1,51 @@
<h2>Settings</h2>
<h3>All enabled currencies</h3>
<div ng-repeat="exchange in exchanges">
<h4>{{exchange.exchangeName}}</h4>
<table class="table table-striped">
<tr>
<th>Currency</th>
<th>Last</th>
<th>High</th>
<th>Low</th>
<th>Volume</th>
<th>Bid</th>
<th>Ask</th>
</tr>
<tr ng-repeat="value in exchange.exchangeValues">
<td>{{value.CryptoCurrency}}</td>
<td>{{value.Last}}</td>
<td>{{value.High}}</td>
<td>{{value.Low}}</td>
<td>{{value.Volume}}</td>
<td>{{value.Bid}}</td>
<td>{{value.Ask}}</td>
</tr>
</table>
<div ng-repeat="value in exchange.exchangeValues">
<div class="col-md-12">
<h4>Exchange config</h4>
<div ng-repeat="exchange in config.Exchanges">
<div class="row">
<h3>{{exchange.Name}}</h3>
</div>
<div class="row">
<div class="col-md-2">
<label class="input-form">Enabled:</label>
</div>
<div class="col-md-10">
<input type="checkbox" class="input-form" ng-model="exchange.Enabled"/>
</div>
</div>
<div ng-show="exchange.Enabled">
<div class="row">
<div class="col-md-2">
<label class="input-form">API Key:</label>
</div>
<div class="col-md-10">
<input type="text" class="input-form" ng-model="exchange.APIKey"/>
</div>
</div>
<div class="row">
<div class="col-md-2">
<label class="input-form">API Secret:</label>
</div>
<div class="col-md-10">
<input type="text" class="input-form" ng-model="exchange.APISecret"/>
</div>
</div>
<div class="row">
<div class="col-md-2">
<label class="input-form">Client ID:</label>
</div>
<div class="col-md-10">
<input type="text" class="input-form" ng-model="exchange.ClientID"/>
</div>
</div>
<div class="row">
<div class="col-md-2">
<label class="input-form">Available Currencies:</label>
</div>
<div class="col-md-10">
</div>
</div>
</div>
</div>
</div>

View File

@@ -1,28 +1,28 @@
'use strict';
angular.module('myApp.home', ['ngRoute'])
angular.module('myApp.settings', ['ngRoute'])
.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/', {
templateUrl: '/views/home/home.html',
controller: 'HomeController'
$routeProvider.when('/settings', {
templateUrl: '/views/settings/settings.html',
controller: 'SettingsController'
});
}])
.controller('HomeController', function ($scope, $http) {
$scope.getDashboardData = function() {
.controller('SettingsController', function ($scope, $http) {
$scope.getconfigData = function() {
$http({
method: 'GET',
url: '/data/all-enabled-currencies'
url: '/config/all'
}).
success(function (data, status, headers, config) {
$scope.exchanges = data.data;
$scope.config = data;
}).
error(function (data, status, headers, config) {
console.log('error');
});
};
$scope.getDashboardData();
$scope.getconfigData();
});

View File

@@ -17,7 +17,14 @@ app.get('/data/all-enabled-currencies', function (req, res) {
},function(err, resp, body){
res.send(body);
})
});
app.get('/config/all', function (req, res) {
request({
url :'http://localhost:9050/config/all'
},function(err, resp, body){
res.send(body);
})
});