Skip to content

Commit

Permalink
Merge pull request #85 from tillias/dev
Browse files Browse the repository at this point in the history
Swap nodes in create dependency dialog #84
  • Loading branch information
tillias authored Oct 31, 2020
2 parents 15a7f56 + a20655b commit 26f1989
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ <h4 class="modal-title">Create dependency</h4>
<div class="form-group">
<label>Source: </label>
<div>
<jhi-microservice-search [initialValue]="source"
<jhi-microservice-search [initialValue]="source!"
(itemSelected)="onSourceSelected($event)"></jhi-microservice-search>
</div>
</div>
<div class="form-group">
<label>Target: </label>
<div>
<jhi-microservice-search [initialValue]="target"
<jhi-microservice-search [initialValue]="target!"
(itemSelected)="onTargetSelected($event)"></jhi-microservice-search>
</div>
</div>
Expand All @@ -26,5 +26,6 @@ <h4 class="modal-title">Create dependency</h4>
(click)="createDependency()">Create
</button>
<button type="submit" class="btn btn-secondary" (click)="cancel()">Cancel</button>
<button type="submit" class="btn btn-warning float-right" (click)="swap()">Swap</button>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,12 @@ export class CreateDependencyDialogComponent implements OnInit {
updateName(): void {
this.name = `${this.source?.name} -> ${this.target?.name}`;
}

swap(): void {
const tmp = this.target;
this.target = this.source;
this.source = tmp;

this.updateName();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ export class MicroserviceSearchComponent implements OnInit {
* Enables advanced search capabilities. Default: false
*/
@Input() advanced = false;
@Input() initialValue?: IMicroservice;
@Output() itemSelected = new EventEmitter<IMicroservice>();
@Output() groupFilterChanged = new EventEmitter<IMicroserviceGroupFilter>();

constructor(protected microserviceService: MicroserviceService) {}

ngOnInit(): void {
if (this.initialValue) {
this.model = this.initialValue;
}
ngOnInit(): void {}

@Input()
set initialValue(value: IMicroservice) {
this.model = value;
}

search = (text$: Observable<string>) =>
Expand Down

0 comments on commit 26f1989

Please sign in to comment.