1
0
Fork 0
forked from lthn/blockchain

Merge branch 'frontend'

This commit is contained in:
wildkif 2019-04-23 18:00:35 +03:00
commit 7b0cdafaa7
8 changed files with 65 additions and 5 deletions

View file

@ -625,6 +625,10 @@ input[type='checkbox'].style-checkbox {
.ng-value-container {
padding: 0;
.ng-input {
top: auto;
}
}
}

View file

@ -2373,6 +2373,7 @@ var VariablesService = /** @class */ (function () {
this.enableAliasSearch = false;
this.maxWalletNameLength = 25;
this.maxCommentLength = 255;
this.getExpMedTsEvent = new rxjs__WEBPACK_IMPORTED_MODULE_1__["BehaviorSubject"](null);
this.getHeightAppEvent = new rxjs__WEBPACK_IMPORTED_MODULE_1__["BehaviorSubject"](null);
this.getRefreshStackingEvent = new rxjs__WEBPACK_IMPORTED_MODULE_1__["BehaviorSubject"](null);
this.getAliasChangedEvent = new rxjs__WEBPACK_IMPORTED_MODULE_1__["BehaviorSubject"](null);
@ -2387,6 +2388,12 @@ var VariablesService = /** @class */ (function () {
});
});
}
VariablesService.prototype.setExpMedTs = function (timestamp) {
if (timestamp !== this.exp_med_ts) {
this.exp_med_ts = timestamp;
this.getExpMedTsEvent.next(timestamp);
}
};
VariablesService.prototype.setHeightApp = function (height) {
if (height !== this.height_app) {
this.height_app = height;
@ -2839,7 +2846,8 @@ var AppComponent = /** @class */ (function () {
console.log('----------------- update_daemon_state -----------------');
console.log('DAEMON:' + data.daemon_network_state);
console.log(data);
_this.variablesService.exp_med_ts = data['expiration_median_timestamp'] + 600 + 1;
// this.variablesService.exp_med_ts = data['expiration_median_timestamp'] + 600 + 1;
_this.variablesService.setExpMedTs(data['expiration_median_timestamp'] + 600 + 1);
_this.variablesService.last_build_available = data.last_build_available;
_this.variablesService.setHeightApp(data.height);
_this.ngZone.run(function () {
@ -3143,6 +3151,22 @@ var AppComponent = /** @class */ (function () {
});
});
}, 30000);
_this.expMedTsEvent = _this.variablesService.getExpMedTsEvent.subscribe(function (newTimestamp) {
_this.variablesService.wallets.forEach(function (wallet) {
wallet.contracts.forEach(function (contract) {
if (contract.state === 1 && contract.expiration_time <= newTimestamp) {
contract.state = 110;
contract.is_new = true;
wallet.recountNewContracts();
}
else if (contract.state === 5 && contract.cancel_expiration_time <= newTimestamp) {
contract.state = 130;
contract.is_new = true;
wallet.recountNewContracts();
}
});
});
});
_this.backend.getAppData(function (status, data) {
if (data && Object.keys(data).length > 0) {
for (var key in data) {
@ -3306,6 +3330,7 @@ var AppComponent = /** @class */ (function () {
if (this.intervalUpdateContractsState) {
clearInterval(this.intervalUpdateContractsState);
}
this.expMedTsEvent.unsubscribe();
};
__decorate([
Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"])('allContextMenu'),

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -48,6 +48,7 @@ export class VariablesService {
public maxWalletNameLength = 25;
public maxCommentLength = 255;
getExpMedTsEvent = new BehaviorSubject(null);
getHeightAppEvent = new BehaviorSubject(null);
getRefreshStackingEvent = new BehaviorSubject(null);
getAliasChangedEvent = new BehaviorSubject(null);
@ -70,6 +71,13 @@ export class VariablesService {
constructor(private router: Router, private ngZone: NgZone, private contextMenuService: ContextMenuService) {
}
setExpMedTs(timestamp: number) {
if (timestamp !== this.exp_med_ts) {
this.exp_med_ts = timestamp;
this.getExpMedTsEvent.next(timestamp);
}
}
setHeightApp(height: number) {
if (height !== this.height_app) {
this.height_app = height;

View file

@ -17,6 +17,7 @@ import {ModalService} from './_helpers/services/modal.service';
export class AppComponent implements OnInit, OnDestroy {
intervalUpdateContractsState;
expMedTsEvent;
onQuitRequest = false;
firstOnlineState = false;
@ -154,7 +155,8 @@ export class AppComponent implements OnInit, OnDestroy {
console.log('----------------- update_daemon_state -----------------');
console.log('DAEMON:' + data.daemon_network_state);
console.log(data);
this.variablesService.exp_med_ts = data['expiration_median_timestamp'] + 600 + 1;
// this.variablesService.exp_med_ts = data['expiration_median_timestamp'] + 600 + 1;
this.variablesService.setExpMedTs(data['expiration_median_timestamp'] + 600 + 1);
this.variablesService.last_build_available = data.last_build_available;
this.variablesService.setHeightApp(data.height);
@ -472,6 +474,22 @@ export class AppComponent implements OnInit, OnDestroy {
});
}, 30000);
this.expMedTsEvent = this.variablesService.getExpMedTsEvent.subscribe((newTimestamp: number) => {
this.variablesService.wallets.forEach((wallet) => {
wallet.contracts.forEach((contract) => {
if (contract.state === 1 && contract.expiration_time <= newTimestamp) {
contract.state = 110;
contract.is_new = true;
wallet.recountNewContracts();
} else if (contract.state === 5 && contract.cancel_expiration_time <= newTimestamp) {
contract.state = 130;
contract.is_new = true;
wallet.recountNewContracts();
}
});
});
});
this.backend.getAppData((status, data) => {
if (data && Object.keys(data).length > 0) {
@ -642,6 +660,7 @@ export class AppComponent implements OnInit, OnDestroy {
if (this.intervalUpdateContractsState) {
clearInterval(this.intervalUpdateContractsState);
}
this.expMedTsEvent.unsubscribe();
}
}

View file

@ -625,6 +625,10 @@ input[type='checkbox'].style-checkbox {
.ng-value-container {
padding: 0;
.ng-input {
top: auto;
}
}
}