code refactor
This commit is contained in:
parent
62b678c914
commit
f8e3a7e424
|
@ -1,7 +1,7 @@
|
|||
(function () {
|
||||
'use strict';
|
||||
|
||||
angular.module('ariaNg').factory('ariaNgCommonService', ['$location', '$timeout', 'base64', 'SweetAlert', '$translate', 'ariaNgConstants', function ($location, $timeout, base64, SweetAlert, $translate, ariaNgConstants) {
|
||||
angular.module('ariaNg').factory('ariaNgCommonService', ['$location', '$timeout', 'base64', 'moment', 'SweetAlert', '$translate', 'ariaNgConstants', function ($location, $timeout, base64, moment, SweetAlert, $translate, ariaNgConstants) {
|
||||
return {
|
||||
generateUniqueId: function () {
|
||||
var sourceId = ariaNgConstants.appPrefix + '_' + Math.round(new Date().getTime() / 1000) + '_' + Math.random();
|
||||
|
@ -215,6 +215,12 @@
|
|||
|
||||
return obj;
|
||||
},
|
||||
getCurrentUnixTime: function () {
|
||||
return moment().format('X');
|
||||
},
|
||||
getLongTimeFronUnixTime: function (unixTime) {
|
||||
return moment(unixTime, 'X').format('HH:mm:ss');
|
||||
},
|
||||
getTimeOptions: function (timeList, withDisabled) {
|
||||
var options = [];
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
(function () {
|
||||
'use strict';
|
||||
|
||||
angular.module('ariaNg').factory('ariaNgLogService', ['$log', 'moment', 'ariaNgConstants', function ($log, moment, ariaNgConstants) {
|
||||
angular.module('ariaNg').factory('ariaNgLogService', ['$log', 'ariaNgConstants', function ($log, ariaNgConstants) {
|
||||
var enableDebugLog = false;
|
||||
var cachedDebugLogs = [];
|
||||
|
||||
var createNewCacheLogItem = function (msg, level, obj) {
|
||||
return {
|
||||
time: moment(),
|
||||
time: new Date(),
|
||||
level: level,
|
||||
content: msg,
|
||||
attachment: obj
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
(function () {
|
||||
'use strict';
|
||||
|
||||
angular.module('ariaNg').factory('ariaNgMonitorService', ['$filter', '$translate', 'moment', 'ariaNgConstants', function ($filter, $translate, moment, ariaNgConstants) {
|
||||
angular.module('ariaNg').factory('ariaNgMonitorService', ['$filter', '$translate', 'ariaNgConstants', 'ariaNgCommonService', function ($filter, $translate, ariaNgConstants, ariaNgCommonService) {
|
||||
var currentGlobalStat = {};
|
||||
var storagesInMemory = {};
|
||||
var globalStorageKey = 'global';
|
||||
|
@ -32,7 +32,7 @@
|
|||
return '<div>' + $translate.instant('No Data') + '</div>';
|
||||
}
|
||||
|
||||
var time = moment(params[0].name, 'X').format('HH:mm:ss');
|
||||
var time = ariaNgCommonService.getLongTimeFronUnixTime(params[0].name);
|
||||
var uploadSpeed = $filter('readableVolume')(params[0].value) + '/s';
|
||||
var downloadSpeed = $filter('readableVolume')(params[1].value) + '/s';
|
||||
|
||||
|
@ -132,7 +132,7 @@
|
|||
initStorage(key);
|
||||
}
|
||||
|
||||
stat.time = moment().format('X');
|
||||
stat.time = ariaNgCommonService.getCurrentUnixTime();
|
||||
pushToStorage(key, stat);
|
||||
},
|
||||
getStatsData: function (key) {
|
||||
|
|
Reference in a new issue