-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #62 from tillias/dev
Delete dependency from dashboard screen #53
- Loading branch information
Showing
9 changed files
with
333 additions
and
151 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
src/main/webapp/app/dashboard/dependency-dashboard/delete-dialog.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,44 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { NgbModal, NgbModalOptions, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; | ||
import { DependencyDeleteDialogComponent } from '../../entities/dependency/dependency-delete-dialog.component'; | ||
import { IDependency } from '../../shared/model/dependency.model'; | ||
import { IMicroservice } from '../../shared/model/microservice.model'; | ||
import { MicroserviceDeleteDialogComponent } from '../../entities/microservice/microservice-delete-dialog.component'; | ||
|
||
@Injectable({ | ||
providedIn: 'root', | ||
}) | ||
export class DeleteDialogService { | ||
private isDependencyOpen = false; | ||
private isMicroserviceOpen = false; | ||
|
||
constructor(private modalService: NgbModal) {} | ||
|
||
openForDependency(dependency?: IDependency): void { | ||
if (this.isDependencyOpen) { | ||
return; | ||
} | ||
this.isDependencyOpen = true; | ||
|
||
const modalRef: NgbModalRef = this.modalService.open(DependencyDeleteDialogComponent, this.getOptions()); | ||
modalRef.componentInstance.dependency = dependency; | ||
modalRef.result.finally(() => (this.isDependencyOpen = false)); | ||
} | ||
|
||
openForMicroservice(microservice?: IMicroservice): void { | ||
if (this.isMicroserviceOpen) { | ||
return; | ||
} | ||
this.isMicroserviceOpen = true; | ||
|
||
const modalRef: NgbModalRef = this.modalService.open(MicroserviceDeleteDialogComponent, this.getOptions()); | ||
modalRef.componentInstance.microservice = microservice; | ||
modalRef.result.finally(() => (this.isMicroserviceOpen = false)); | ||
} | ||
|
||
getOptions(): NgbModalOptions { | ||
return { | ||
centered: true, | ||
}; | ||
} | ||
} |
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
Oops, something went wrong.