0.0.8 loading emitter.
This commit is contained in:
parent
85db43327b
commit
311e520427
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@poweredsoft/ngx-bootstrap",
|
"name": "@poweredsoft/ngx-bootstrap",
|
||||||
"version": "0.0.5",
|
"version": "0.0.6",
|
||||||
"description": "an internal use libary for handling data souces grid filtering sorting, add commands etc",
|
"description": "an internal use libary for handling data souces grid filtering sorting, add commands etc",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"angular",
|
"angular",
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { Directive, Input, TemplateRef, HostListener, Output, EventEmitter } from '@angular/core';
|
import { Directive, Input, TemplateRef, HostListener, Output, EventEmitter } from '@angular/core';
|
||||||
import { IDataSource } from '@poweredsoft/data';
|
import { IDataSource } from '@poweredsoft/data';
|
||||||
|
import { finalize } from 'rxjs/operators';
|
||||||
import { ConfirmModalService } from '../../confirm-modal/confirm-modal.service';
|
import { ConfirmModalService } from '../../confirm-modal/confirm-modal.service';
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
@ -25,13 +26,19 @@ export class CommandDirective {
|
|||||||
|
|
||||||
@Output() success: EventEmitter<any> = new EventEmitter<any>();
|
@Output() success: EventEmitter<any> = new EventEmitter<any>();
|
||||||
@Output() failure: EventEmitter<any> = new EventEmitter<any>();
|
@Output() failure: EventEmitter<any> = new EventEmitter<any>();
|
||||||
|
@Output() loading: EventEmitter<boolean> = new EventEmitter<boolean>();
|
||||||
|
|
||||||
private doCommand() {
|
private doCommand() {
|
||||||
this.dataSource.resolveCommandModelByName({
|
this.dataSource.resolveCommandModelByName({
|
||||||
command: this.command,
|
command: this.command,
|
||||||
model: this.model
|
model: this.model
|
||||||
}).subscribe(commandModel => {
|
}).subscribe(commandModel => {
|
||||||
this.dataSource.executeCommandByName(this.command, commandModel).subscribe(
|
this.loading.emit(true);
|
||||||
|
this.dataSource.executeCommandByName(this.command, commandModel)
|
||||||
|
.pipe(
|
||||||
|
finalize(() => this.loading.emit(false))
|
||||||
|
)
|
||||||
|
.subscribe(
|
||||||
commandResult => {
|
commandResult => {
|
||||||
if (this.refreshOnSuccess !== false)
|
if (this.refreshOnSuccess !== false)
|
||||||
this.dataSource.refresh();
|
this.dataSource.refresh();
|
||||||
|
Loading…
Reference in New Issue
Block a user