view logs in UX
This commit is contained in:
parent
6723cba56a
commit
f47d6b0564
16 changed files with 188 additions and 47 deletions
|
|
@ -1,5 +1,4 @@
|
||||||
<span ng-controller="versionController as v">
|
<span ng-controller="versionController as v">
|
||||||
<small>v{{v.version}}</small>
|
<small>v{{v.version}}</small>
|
||||||
<small>#{{v.commitHash}}</small>
|
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
<ul class="no-bullet m0 size-14">
|
<ul class="no-bullet m0 size-14">
|
||||||
<h4 class="title m0" translate>{{index.walletName}} settings</h4>
|
<h4 class="title m0" translate>{{index.walletName}} settings</h4>
|
||||||
|
|
||||||
<li class="line-b p20" ng-click="$root.go('preferencesColor')">
|
<li class="line-b p20" ng-click="$root.go('preferencesColor')">
|
||||||
<span translate>Color</span>
|
<span translate>Color</span>
|
||||||
<span class="right text-gray">
|
<span class="right text-gray">
|
||||||
|
|
@ -58,6 +59,11 @@
|
||||||
{{preferences.bwsurl}}
|
{{preferences.bwsurl}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="line-b p20" ng-click="$root.go('about')">
|
||||||
|
<i class="icon-arrow-right3 size-24 right text-gray"></i>
|
||||||
|
<span translate>About Copay</span>
|
||||||
|
</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
34
public/views/preferencesAbout.html
Normal file
34
public/views/preferencesAbout.html
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
<div class="content p20v" ng-controller="preferencesAbout as about">
|
||||||
|
<ul class="no-bullet m0 size-14">
|
||||||
|
<div class="m20t m20b text-center">
|
||||||
|
<img src="img/logo.svg" alt="Copay" width="120">
|
||||||
|
</div>
|
||||||
|
<h4 class="title m0" translate>Release Information</h4>
|
||||||
|
|
||||||
|
<div ng-controller="versionController as v">
|
||||||
|
<li class="line-b p20" ng-conf>
|
||||||
|
<span translate>Version</span>
|
||||||
|
<span class="right text-gray">
|
||||||
|
v{{v.version}}
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
<li class="line-b p20" ng-conf ng-click="$root.openExternalLink('https://github.com/bitpay/copay/tree/'+v.commitHash)">
|
||||||
|
<span translate>Commit hash</span>
|
||||||
|
<span class="right text-gray">
|
||||||
|
#{{v.commitHash}}
|
||||||
|
<i class="icon-arrow-right3 size-24 right text-gray"></i>
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h4 class="title m0" translate> </h4>
|
||||||
|
<li class="line-b p20" ng-conf ng-click="$root.go('logs')">
|
||||||
|
<span translate>View session logs</span>
|
||||||
|
<span class="right text-gray">
|
||||||
|
<i class="icon-arrow-right3 size-24 right text-gray"></i>
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
10
public/views/preferencesLogs.html
Normal file
10
public/views/preferencesLogs.html
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
<div class="content p20v" ng-controller="preferencesLogs as logs">
|
||||||
|
<ul class="no-bullet m0 size-14">
|
||||||
|
<li class="line-b" ng-repeat="l in logs.logs">
|
||||||
|
|
||||||
|
<span ng-class="{'text-warning': l.level=='warn', 'text-secondary': l.level=='debug', 'text-primary': l.level=='info', 'text-alert': l.level=='error' }">
|
||||||
|
{{l.msg}}
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
@ -881,6 +881,7 @@ input.ng-invalid-match, input.ng-invalid-match:focus {
|
||||||
.text-secondary {color: #3498DB;}
|
.text-secondary {color: #3498DB;}
|
||||||
.text-white {color: #fff;}
|
.text-white {color: #fff;}
|
||||||
.text-warning {color: #ED4A43;}
|
.text-warning {color: #ED4A43;}
|
||||||
|
.text-alert {color: red;}
|
||||||
.text-success {color: #1ABC9C;}
|
.text-success {color: #1ABC9C;}
|
||||||
|
|
||||||
.panel {
|
.panel {
|
||||||
|
|
|
||||||
|
|
@ -534,11 +534,16 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
self.updateColor();
|
self.updateColor();
|
||||||
});
|
});
|
||||||
|
|
||||||
$rootScope.$on('Local/ConfigurationUpdated', function(event) {
|
$rootScope.$on('Local/UnitSettingUpdated', function(event) {
|
||||||
self.updateAll();
|
self.updateAll();
|
||||||
self.updateTxHistory();
|
self.updateTxHistory();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$rootScope.$on('Local/BWSUpdated', function(event) {
|
||||||
|
profileService.applyConfig();
|
||||||
|
});
|
||||||
|
|
||||||
$rootScope.$on('Local/WalletCompleted', function(event) {
|
$rootScope.$on('Local/WalletCompleted', function(event) {
|
||||||
self.setFocusedWallet();
|
self.setFocusedWallet();
|
||||||
go.walletHome();
|
go.walletHome();
|
||||||
|
|
|
||||||
4
src/js/controllers/preferencesAbout.js
Normal file
4
src/js/controllers/preferencesAbout.js
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('copayApp.controllers').controller('preferencesAbout',
|
||||||
|
function() {});
|
||||||
|
|
@ -49,7 +49,7 @@ angular.module('copayApp.controllers').controller('preferencesAltCurrencyControl
|
||||||
|
|
||||||
configService.set(opts, function(err) {
|
configService.set(opts, function(err) {
|
||||||
if (err) console.log(err);
|
if (err) console.log(err);
|
||||||
$scope.$emit('Local/ConfigurationUpdated');
|
$scope.$emit('Local/UnitSettingUpdated');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,9 @@ angular.module('copayApp.controllers').controller('preferencesBwsUrlController',
|
||||||
|
|
||||||
configService.set(opts, function(err) {
|
configService.set(opts, function(err) {
|
||||||
if (err) console.log(err);
|
if (err) console.log(err);
|
||||||
|
$scope.$emit('Local/BWSUpdated');
|
||||||
applicationService.restart(true);
|
applicationService.restart(true);
|
||||||
go.walletHome();
|
go.walletHome();
|
||||||
$scope.$emit('Local/ConfigurationUpdated');
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
7
src/js/controllers/preferencesLogs.js
Normal file
7
src/js/controllers/preferencesLogs.js
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('copayApp.controllers').controller('preferencesLogs',
|
||||||
|
function(historicLog) {
|
||||||
|
this.logs = historicLog.get();
|
||||||
|
console.log('[preferencesLogs.js.5:historicLog:]',this.logs); //TODO
|
||||||
|
});
|
||||||
|
|
@ -52,7 +52,7 @@ angular.module('copayApp.controllers').controller('preferencesUnitController',
|
||||||
|
|
||||||
configService.set(opts, function(err) {
|
configService.set(opts, function(err) {
|
||||||
if (err) console.log(err);
|
if (err) console.log(err);
|
||||||
$scope.$emit('Local/ConfigurationUpdated');
|
$scope.$emit('Local/UnitSettingUpdated');
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,30 @@ if (window && window.navigator) {
|
||||||
//Setting up route
|
//Setting up route
|
||||||
angular
|
angular
|
||||||
.module('copayApp')
|
.module('copayApp')
|
||||||
.config(function(bwcServiceProvider, $stateProvider, $urlRouterProvider) {
|
.config(function(historicLogProvider, $provide, $logProvider, $stateProvider, $urlRouterProvider) {
|
||||||
$urlRouterProvider.otherwise('/');
|
$urlRouterProvider.otherwise('/');
|
||||||
|
|
||||||
|
$logProvider.debugEnabled(true);
|
||||||
|
$provide.decorator('$log', ['$delegate',
|
||||||
|
function($delegate) {
|
||||||
|
var historicLog = historicLogProvider.$get();
|
||||||
|
|
||||||
|
['debug', 'info', 'warn', 'error', 'log'].forEach(function(level) {
|
||||||
|
var orig = $delegate[level];
|
||||||
|
$delegate[level] = function() {
|
||||||
|
var args = [].slice.call(arguments).map(function(v){
|
||||||
|
if (typeof v == 'undefined') return 'undefined';
|
||||||
|
if (typeof v == 'object') return JSON.stringify(v).substr(0,200)+'...';
|
||||||
|
return v;
|
||||||
|
});
|
||||||
|
historicLog.add(level, args.join(' '));
|
||||||
|
orig.apply(null, args)
|
||||||
|
};
|
||||||
|
});
|
||||||
|
return $delegate;
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
$stateProvider
|
$stateProvider
|
||||||
.state('splash', {
|
.state('splash', {
|
||||||
url: '/splash',
|
url: '/splash',
|
||||||
|
|
@ -305,6 +326,42 @@ angular
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.state('about', {
|
||||||
|
url: '/about',
|
||||||
|
templateUrl: 'views/preferencesAbout.html',
|
||||||
|
walletShouldBeComplete: true,
|
||||||
|
needProfile: true,
|
||||||
|
views: {
|
||||||
|
'main': {
|
||||||
|
templateUrl: 'views/preferencesAbout.html'
|
||||||
|
},
|
||||||
|
'topbar': {
|
||||||
|
templateUrl: 'views/includes/topbar.html',
|
||||||
|
controller: function($scope) {
|
||||||
|
$scope.titleSection = 'About';
|
||||||
|
$scope.goBackToState = 'preferences';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.state('logs', {
|
||||||
|
url: '/logs',
|
||||||
|
templateUrl: 'views/preferencesLogs.html',
|
||||||
|
walletShouldBeComplete: true,
|
||||||
|
needProfile: true,
|
||||||
|
views: {
|
||||||
|
'main': {
|
||||||
|
templateUrl: 'views/preferencesLogs.html'
|
||||||
|
},
|
||||||
|
'topbar': {
|
||||||
|
templateUrl: 'views/includes/topbar.html',
|
||||||
|
controller: function($scope) {
|
||||||
|
$scope.titleSection = 'Logs';
|
||||||
|
$scope.goBackToState = 'about';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
.state('backup', {
|
.state('backup', {
|
||||||
url: '/backup',
|
url: '/backup',
|
||||||
templateUrl: 'views/backup.html',
|
templateUrl: 'views/backup.html',
|
||||||
|
|
@ -361,9 +418,9 @@ angular
|
||||||
case 'resume':
|
case 'resume':
|
||||||
$scope.$emit('Local/Resume');
|
$scope.$emit('Local/Resume');
|
||||||
break;
|
break;
|
||||||
// case 'online':
|
// case 'online':
|
||||||
// // $scope.$emit('Local/Online');
|
// // $scope.$emit('Local/Online');
|
||||||
// break;
|
// break;
|
||||||
case 'offline':
|
case 'offline':
|
||||||
$scope.$emit('Local/Offline');
|
$scope.$emit('Local/Offline');
|
||||||
break;
|
break;
|
||||||
|
|
@ -376,10 +433,10 @@ angular
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.run(function($rootScope, $state, $log, gettextCatalog, uriHandler, isCordova, amMoment, profileService) {
|
.run(function($rootScope, $state, $log, gettextCatalog, uriHandler, isCordova, amMoment, profileService) {
|
||||||
|
|
||||||
console.log('Attaching FastClick');
|
$log.debug('Attaching FastClick');
|
||||||
FastClick.attach(document.body);
|
FastClick.attach(document.body);
|
||||||
|
|
||||||
|
|
||||||
// Auto-detect browser language
|
// Auto-detect browser language
|
||||||
var userLang, androidLang;
|
var userLang, androidLang;
|
||||||
|
|
@ -413,6 +470,8 @@ angular
|
||||||
preferencesUnit: 12,
|
preferencesUnit: 12,
|
||||||
preferencesAltCurrency: 12,
|
preferencesAltCurrency: 12,
|
||||||
preferencesBwsUrl: 12,
|
preferencesBwsUrl: 12,
|
||||||
|
about: 12,
|
||||||
|
logs: 13,
|
||||||
add: 0,
|
add: 0,
|
||||||
create: 12,
|
create: 12,
|
||||||
join: 12,
|
join: 12,
|
||||||
|
|
@ -435,7 +494,7 @@ angular
|
||||||
if (!profileService.profile && toState.needProfile) {
|
if (!profileService.profile && toState.needProfile) {
|
||||||
|
|
||||||
// Give us time to open / create the profile
|
// Give us time to open / create the profile
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
// Try to open local profile
|
// Try to open local profile
|
||||||
profileService.loadAndBindProfile(function(err) {
|
profileService.loadAndBindProfile(function(err) {
|
||||||
|
|
@ -447,8 +506,8 @@ angular
|
||||||
throw new Error(err); // TODO
|
throw new Error(err); // TODO
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log('Profile loaded ... resuming transition');
|
$log.debug('Profile loaded ... Starting UX.');
|
||||||
$state.transitionTo('walletHome');
|
$state.transitionTo(toState, toParams);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.services').factory('configService', function(localStorageService, fileStorageService, isCordova, lodash, bwcService) {
|
angular.module('copayApp.services').factory('configService', function(storageService, lodash) {
|
||||||
var root = {};
|
var root = {};
|
||||||
|
|
||||||
var storage = isCordova ? fileStorageService : localStorageService;
|
|
||||||
|
|
||||||
var defaultConfig = {
|
var defaultConfig = {
|
||||||
// wallet limits
|
// wallet limits
|
||||||
limits: {
|
limits: {
|
||||||
|
|
@ -17,18 +15,6 @@ angular.module('copayApp.services').factory('configService', function(localStora
|
||||||
url: 'https://bws.bitpay.com/bws/api',
|
url: 'https://bws.bitpay.com/bws/api',
|
||||||
},
|
},
|
||||||
|
|
||||||
// insight
|
|
||||||
insight: {
|
|
||||||
testnet: {
|
|
||||||
url: 'https://test-insight.bitpay.com:443',
|
|
||||||
transports: ['polling'],
|
|
||||||
},
|
|
||||||
livenet: {
|
|
||||||
url: 'https://insight.bitpay.com:443',
|
|
||||||
transports: ['polling'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
// wallet default config
|
// wallet default config
|
||||||
wallet: {
|
wallet: {
|
||||||
requiredCopayers: 2,
|
requiredCopayers: 2,
|
||||||
|
|
@ -46,12 +32,6 @@ angular.module('copayApp.services').factory('configService', function(localStora
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// local encryption/security config
|
|
||||||
passphraseConfig: {
|
|
||||||
iterations: 5000,
|
|
||||||
storageSalt: 'mjuBtGybi/4=',
|
|
||||||
},
|
|
||||||
|
|
||||||
rates: {
|
rates: {
|
||||||
url: 'https://insight.bitpay.com:443/api/rates',
|
url: 'https://insight.bitpay.com:443/api/rates',
|
||||||
},
|
},
|
||||||
|
|
@ -68,7 +48,7 @@ angular.module('copayApp.services').factory('configService', function(localStora
|
||||||
};
|
};
|
||||||
|
|
||||||
root.get = function(cb) {
|
root.get = function(cb) {
|
||||||
storage.get('config', function(err, localConfig) {
|
storageService.getConfig(function(err, localConfig) {
|
||||||
if (localConfig) {
|
if (localConfig) {
|
||||||
configCache = JSON.parse(localConfig);
|
configCache = JSON.parse(localConfig);
|
||||||
|
|
||||||
|
|
@ -90,7 +70,7 @@ angular.module('copayApp.services').factory('configService', function(localStora
|
||||||
|
|
||||||
root.set = function(newOpts, cb) {
|
root.set = function(newOpts, cb) {
|
||||||
var config = defaultConfig;
|
var config = defaultConfig;
|
||||||
storage.get('config', function(err, oldOpts) {
|
storageService.getConfig(function(err, oldOpts) {
|
||||||
if (lodash.isString(oldOpts)) {
|
if (lodash.isString(oldOpts)) {
|
||||||
oldOpts = JSON.parse(oldOpts);
|
oldOpts = JSON.parse(oldOpts);
|
||||||
}
|
}
|
||||||
|
|
@ -103,23 +83,19 @@ angular.module('copayApp.services').factory('configService', function(localStora
|
||||||
lodash.merge(config, oldOpts, newOpts);
|
lodash.merge(config, oldOpts, newOpts);
|
||||||
configCache = config;
|
configCache = config;
|
||||||
|
|
||||||
storage.set('config', JSON.stringify(config), cb);
|
storageService.setConfig(JSON.stringify(config), cb);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
root.reset = function(cb) {
|
root.reset = function(cb) {
|
||||||
storage.remove('config', cb);
|
configCache = lodash.clone(defaultConfig);
|
||||||
|
storageService.removeConfig(cb);
|
||||||
};
|
};
|
||||||
|
|
||||||
root.getDefaults = function() {
|
root.getDefaults = function() {
|
||||||
return defaultConfig;
|
return lodash.clone(defaultConfig);
|
||||||
};
|
};
|
||||||
|
|
||||||
root.get(function(err, c) {
|
|
||||||
if (err) throw Error(err);
|
|
||||||
bwcService.setBaseUrl(c.bws.url);
|
|
||||||
bwcService.setTransports(['polling']);
|
|
||||||
});
|
|
||||||
|
|
||||||
return root;
|
return root;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
19
src/js/services/historicLog.js
Normal file
19
src/js/services/historicLog.js
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
'use strict';
|
||||||
|
var logs = [];
|
||||||
|
angular.module('copayApp.services')
|
||||||
|
.factory('historicLog', function historicLog() {
|
||||||
|
var root = {};
|
||||||
|
|
||||||
|
root.add = function(level, msg) {
|
||||||
|
logs.push({
|
||||||
|
level: level,
|
||||||
|
msg: msg,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
root.get = function() {
|
||||||
|
return logs;
|
||||||
|
};
|
||||||
|
|
||||||
|
return root;
|
||||||
|
});
|
||||||
|
|
@ -110,11 +110,20 @@ angular.module('copayApp.services')
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
root.applyConfig = function() {
|
||||||
|
var config = configService.getSync();
|
||||||
|
$log.debug('Applying preferences');
|
||||||
|
bwcService.setBaseUrl(config.bws.url);
|
||||||
|
bwcService.setTransports(['polling']);
|
||||||
|
};
|
||||||
|
|
||||||
root.bindProfile = function(profile, cb) {
|
root.bindProfile = function(profile, cb) {
|
||||||
root.profile = profile;
|
root.profile = profile;
|
||||||
|
|
||||||
configService.get(function(err) {
|
configService.get(function(err) {
|
||||||
|
$log.debug('Preferences read');
|
||||||
if (err) return cb(err);
|
if (err) return cb(err);
|
||||||
|
root.applyConfig();
|
||||||
$rootScope.$emit('Local/DefaultLanguage');
|
$rootScope.$emit('Local/DefaultLanguage');
|
||||||
root.setWalletClients();
|
root.setWalletClients();
|
||||||
storageService.getFocusedWalletId(function(err, focusedWalletId) {
|
storageService.getFocusedWalletId(function(err, focusedWalletId) {
|
||||||
|
|
@ -124,7 +133,6 @@ angular.module('copayApp.services')
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
root.loadAndBindProfile = function(cb) {
|
root.loadAndBindProfile = function(cb) {
|
||||||
storageService.getProfile(function(err, profile) {
|
storageService.getProfile(function(err, profile) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
@ -132,6 +140,7 @@ angular.module('copayApp.services')
|
||||||
return cb(err);
|
return cb(err);
|
||||||
}
|
}
|
||||||
if (!profile) return cb(new Error('NOPROFILE: No profile'));
|
if (!profile) return cb(new Error('NOPROFILE: No profile'));
|
||||||
|
$log.debug('Profile read');
|
||||||
|
|
||||||
return root.bindProfile(profile, cb);
|
return root.bindProfile(profile, cb);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -111,5 +111,17 @@ angular.module('copayApp.services')
|
||||||
storage.get('backup-' + walletId, cb);
|
storage.get('backup-' + walletId, cb);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
root.getConfig = function(cb) {
|
||||||
|
storage.get('config', cb);
|
||||||
|
};
|
||||||
|
|
||||||
|
root.storeConfig = function(val, cb) {
|
||||||
|
storage.set('config', val, cb);
|
||||||
|
};
|
||||||
|
|
||||||
|
root.clearConfig = function(cb) {
|
||||||
|
storage.remove('config', cb);
|
||||||
|
};
|
||||||
|
|
||||||
return root;
|
return root;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue