Implement dialog for resending local echo transactions
This commit is contained in:
parent
14b0def143
commit
c5574219bb
11 changed files with 289 additions and 9 deletions
|
@ -28,7 +28,6 @@ export enum ContextTransactionState {
|
|||
export abstract class EchoContext extends Whenable<ContextTransactionState> implements IDestroyable {
|
||||
private _transactions: EchoTransaction[] = [];
|
||||
private _state = ContextTransactionState.NotStarted;
|
||||
public readonly startTime: Date = new Date();
|
||||
|
||||
public get transactions(): EchoTransaction[] {
|
||||
return arrayFastClone(this._transactions);
|
||||
|
@ -38,6 +37,19 @@ export abstract class EchoContext extends Whenable<ContextTransactionState> impl
|
|||
return this._state;
|
||||
}
|
||||
|
||||
public get firstFailedTime(): Date {
|
||||
const failedTxn = this.transactions.find(t => t.didPreviouslyFail || t.status === TransactionStatus.DoneError);
|
||||
if (failedTxn) return failedTxn.startTime;
|
||||
return null;
|
||||
}
|
||||
|
||||
public disownTransaction(txn: EchoTransaction) {
|
||||
const idx = this._transactions.indexOf(txn);
|
||||
if (idx >= 0) this._transactions.splice(idx, 1);
|
||||
txn.destroy();
|
||||
this.checkTransactions();
|
||||
}
|
||||
|
||||
public beginTransaction(auditName: string, runFn: RunFn): EchoTransaction {
|
||||
const txn = new EchoTransaction(auditName, runFn);
|
||||
this._transactions.push(txn);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue