-
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.
Create dependency from dependencies dashboard #27
- Loading branch information
tillias
committed
Oct 15, 2020
1 parent
bbcdf16
commit fa18010
Showing
12 changed files
with
173 additions
and
44 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
26 changes: 26 additions & 0 deletions
26
...ard/dependency-dashboard/create-dependency-dialog/create-dependency-dialog.component.html
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,26 @@ | ||
<div class="modal-header"> | ||
<h4 class="modal-title">Create dependency</h4> | ||
</div> | ||
|
||
<div class="modal-body"> | ||
<div class="form-group"> | ||
<label>Name: </label> | ||
<p class="text-primary">{{name}}</p> | ||
</div> | ||
<div class="form-group"> | ||
<label>Source: </label> | ||
<div> | ||
<jhi-microservice-search (itemSelected)="onSourceSelected($event)"></jhi-microservice-search> | ||
</div> | ||
</div> | ||
<div class="form-group"> | ||
<label>Target: </label> | ||
<div> | ||
<jhi-microservice-search (itemSelected)="onTargetSelected($event)"></jhi-microservice-search> | ||
</div> | ||
</div> | ||
<div> | ||
<button type="submit" class="btn btn-primary" [disabled]="!(source && target) || isSaving" (click)="createDependency()">Create</button> | ||
<button type="submit" class="btn btn-secondary" (click)="cancel()">Cancel</button> | ||
</div> | ||
</div> |
File renamed without changes.
66 changes: 66 additions & 0 deletions
66
...board/dependency-dashboard/create-dependency-dialog/create-dependency-dialog.component.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,66 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; | ||
import { IMicroservice } from '../../../shared/model/microservice.model'; | ||
import { DependencyService } from '../../../entities/dependency/dependency.service'; | ||
import { Dependency } from '../../../shared/model/dependency.model'; | ||
import { JhiEventManager } from 'ng-jhipster'; | ||
import { finalize } from 'rxjs/operators'; | ||
|
||
@Component({ | ||
selector: 'jhi-create-dependency-dialog', | ||
templateUrl: './create-dependency-dialog.component.html', | ||
styleUrls: ['./create-dependency-dialog.component.scss'], | ||
}) | ||
export class CreateDependencyDialogComponent implements OnInit { | ||
source?: IMicroservice; | ||
target?: IMicroservice; | ||
name: string; | ||
isSaving = false; | ||
|
||
constructor(public eventManager: JhiEventManager, public activeModal: NgbActiveModal, public dependencyService: DependencyService) { | ||
this.name = 'Please specify source & target'; | ||
} | ||
|
||
ngOnInit(): void {} | ||
|
||
createDependency(): void { | ||
if (this.source && this.target) { | ||
this.isSaving = true; | ||
|
||
this.dependencyService | ||
.create({ | ||
...new Dependency(), | ||
name: this.name, | ||
source: this.source, | ||
target: this.target, | ||
}) | ||
.pipe( | ||
finalize(() => { | ||
this.isSaving = false; | ||
this.activeModal.close(); | ||
}) | ||
) | ||
.subscribe(() => { | ||
this.eventManager.broadcast('dependencyListModification'); | ||
}); | ||
} | ||
} | ||
|
||
cancel(): void { | ||
this.activeModal.dismiss('closed'); | ||
} | ||
|
||
onSourceSelected(payload: IMicroservice): void { | ||
this.source = payload; | ||
this.updateName(); | ||
} | ||
|
||
onTargetSelected(payload: IMicroservice): void { | ||
this.target = payload; | ||
this.updateName(); | ||
} | ||
|
||
updateName(): void { | ||
this.name = `${this.source?.name} -> ${this.target?.name}`; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...ashboard/dependency-dashboard/create-dependency-dialog/create-dependency-dialog.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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { CreateDependencyDialogComponent } from './create-dependency-dialog.component'; | ||
import { MicrocatalogSharedModule } from '../../../shared/shared.module'; | ||
import { MicroserviceSearchModule } from '../../../entities/microservice/microservice-dashboard/microservice-search/microservice-search.module'; | ||
|
||
@NgModule({ | ||
imports: [MicroserviceSearchModule, MicrocatalogSharedModule], | ||
declarations: [CreateDependencyDialogComponent], | ||
}) | ||
export class CreateDependencyDialogModule {} |
24 changes: 24 additions & 0 deletions
24
...shboard/dependency-dashboard/create-dependency-dialog/create-dependency-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,24 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { NgbModal, NgbModalOptions, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; | ||
import { CreateDependencyDialogComponent } from './create-dependency-dialog.component'; | ||
|
||
@Injectable({ providedIn: 'root' }) | ||
export class CreateDependencyDialogService { | ||
private isOpen = false; | ||
|
||
constructor(private modalService: NgbModal) {} | ||
|
||
open(): void { | ||
if (this.isOpen) { | ||
return; | ||
} | ||
this.isOpen = true; | ||
|
||
const options: NgbModalOptions = { | ||
centered: true, | ||
}; | ||
|
||
const modalRef: NgbModalRef = this.modalService.open(CreateDependencyDialogComponent, options); | ||
modalRef.result.finally(() => (this.isOpen = false)); | ||
} | ||
} |
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
9 changes: 0 additions & 9 deletions
9
...p/app/dashboard/dependency-dashboard/graph-actions-menu/graph-actions-menu.component.html
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
...app/app/dashboard/dependency-dashboard/graph-actions-menu/graph-actions-menu.component.ts
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
...webapp/app/dashboard/dependency-dashboard/graph-actions-menu/graph-actions-menu.module.ts
This file was deleted.
Oops, something went wrong.