-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix issue with command modal showing success command error message publish new version
- Loading branch information
Mathias Beaulieu-Duncan
committed
Mar 1, 2023
1 parent
0bf06fd
commit d46e97f
Showing
8 changed files
with
79 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
projects/poweredsoft/ngx-bootstrap/src/lib/command-modal/command-modal.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import {CommandModalComponent} from './command-modal/command-modal.component'; | ||
import {EventEmitter, Injectable, TemplateRef} from '@angular/core'; | ||
import {IDataSource} from '@poweredsoft/data'; | ||
import {BsModalService} from 'ngx-bootstrap/modal'; | ||
|
||
@Injectable() | ||
export class CommandModalService { | ||
constructor(private modalService: BsModalService) { | ||
} | ||
|
||
spawn<TModel>(options: { | ||
dataSource: IDataSource<TModel> | ||
command: string, | ||
model: TModel, | ||
template: TemplateRef<any>, | ||
commandTitle?: string, | ||
refreshOnSuccess?: boolean, | ||
commandText?: string, | ||
cancelText?: string, | ||
animated?: boolean, | ||
btnClass?: string, | ||
modalSize?: string, | ||
disableValidationSummary?: boolean, | ||
backdrop?: boolean, | ||
ignoreBackdropClick?: boolean, | ||
params?: any, | ||
success?: EventEmitter<any> | ||
}) { | ||
options.dataSource.resolveCommandModelByName({ | ||
command: options.command, | ||
model: options.model, | ||
params: options.params | ||
}).subscribe(commandModel => { | ||
const initialState = { | ||
dataSource: options.dataSource, | ||
command: options.command, | ||
commandModel, | ||
template: options.template, | ||
title: options.commandTitle, | ||
disableValidationSummary: options.disableValidationSummary === undefined ? false : options.disableValidationSummary, | ||
refreshOnSuccess: options.refreshOnSuccess === undefined ? true : options.refreshOnSuccess, | ||
commandText: options.commandText || 'OK', | ||
cancelText: options.cancelText || 'Cancel', | ||
successEmitter: options.success, | ||
btnClass: options.btnClass || 'primary' | ||
}; | ||
this.modalService.show(CommandModalComponent, { | ||
animated: options.animated === undefined ? true : options.animated, | ||
class: options.modalSize, | ||
initialState, | ||
backdrop: options.backdrop === undefined ? true : options.backdrop, | ||
ignoreBackdropClick: options.ignoreBackdropClick === undefined ? false : options.ignoreBackdropClick | ||
}); | ||
}, error => { | ||
|
||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 6 additions & 12 deletions
18
projects/poweredsoft/ngx-bootstrap/src/lib/confirm-modal/confirm-modal.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,16 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { ConfirmModalComponent } from './confirm-modal-components/confirm-modal/confirm-modal.component'; | ||
import { ModalModule } from 'ngx-bootstrap/modal'; | ||
import { ConfirmModalService } from './confirm-modal.service'; | ||
import { CommandModule } from '../command/command.module'; | ||
|
||
|
||
|
||
import {NgModule} from '@angular/core'; | ||
import {CommonModule} from '@angular/common'; | ||
import {ConfirmModalComponent} from './confirm-modal-components/confirm-modal/confirm-modal.component'; | ||
import {ModalModule} from 'ngx-bootstrap/modal'; | ||
import {ConfirmModalService} from './confirm-modal.service'; | ||
|
||
@NgModule({ | ||
declarations: [ConfirmModalComponent], | ||
imports: [ | ||
CommonModule, | ||
//CommandModule, | ||
ModalModule.forRoot(), | ||
|
||
], | ||
exports:[], | ||
exports: [], | ||
providers: [ConfirmModalService] | ||
}) | ||
export class ConfirmModalModule { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters