-
-
Notifications
You must be signed in to change notification settings - Fork 9
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 #553 from assimbly/tjutten/issue-521
added queue management page
- Loading branch information
Showing
17 changed files
with
420 additions
and
283 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
src/main/webapp/app/entities/queue/queue-clear-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,24 @@ | ||
<form *ngIf="address" name="deleteForm" (ngSubmit)="confirmClear(address.name!)"> | ||
<div class="modal-header"> | ||
<h4 class="modal-title">Confirm clear operation</h4> | ||
|
||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" | ||
(click)="cancel()">×</button> | ||
</div> | ||
|
||
<div class="modal-body"> | ||
<jhi-alert-error></jhi-alert-error> | ||
|
||
<p id="jhi-delete-queue-heading">{{message}}</p> | ||
</div> | ||
|
||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-secondary" data-dismiss="modal" (click)="cancel()"> | ||
<fa-icon icon="ban"></fa-icon> <span>Cancel</span> | ||
</button> | ||
|
||
<button id="jhi-confirm-delete-queue" type="submit" class="btn btn-warning" [disabled]="disableDelete"> | ||
<span class="fa fa-trash"></span><span>Clear</span> | ||
</button> | ||
</div> | ||
</form> |
69 changes: 69 additions & 0 deletions
69
src/main/webapp/app/entities/queue/queue-clear-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,69 @@ | ||
import { Component } from '@angular/core'; | ||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; | ||
import { JhiEventManager, JhiAlertService } from 'ng-jhipster'; | ||
import { ActivatedRoute, Router } from '@angular/router'; | ||
|
||
import { IQueue } from 'app/shared/model/queue.model'; | ||
import { QueueService } from './queue.service'; | ||
import { IAddress } from 'app/shared/model/address.model'; | ||
import { IBroker } from 'app/shared/model/broker.model'; | ||
|
||
@Component({ | ||
templateUrl: './queue-clear-dialog.component.html' | ||
}) | ||
export class QueueClearDialogComponent { | ||
queue?: IQueue; | ||
address?: IAddress; | ||
|
||
brokerType: string = ''; | ||
brokers: IBroker[]; | ||
|
||
message = 'Are you sure you want to clear this queue?'; | ||
disableDelete: boolean; | ||
|
||
constructor( | ||
protected queueService: QueueService, | ||
public activeModal: NgbActiveModal, | ||
protected eventManager: JhiEventManager, | ||
protected jhiAlertService: JhiAlertService, | ||
protected router: Router | ||
) { | ||
this.brokers = []; | ||
this.getBrokerType(); | ||
this.disableDelete = false; | ||
} | ||
|
||
cancel(): void { | ||
this.activeModal.dismiss(); | ||
} | ||
|
||
confirmClear(name: string): void { | ||
if (this.address.numberOfConsumers > 0) { | ||
this.message = 'Cannot clear queue because there is at least one active consumer'; | ||
this.disableDelete = true; | ||
} else { | ||
this.queueService.clearQueue(name, this.brokerType).subscribe(() => { | ||
this.eventManager.broadcast('queueListModification'); | ||
this.router.navigate(['/queue']).then(() => { | ||
window.location.reload(); | ||
}); | ||
// this.activeModal.close(); | ||
this.activeModal.close(); | ||
}); | ||
} | ||
} | ||
|
||
getBrokerType(): void { | ||
this.queueService.getBrokers().subscribe( | ||
data => { | ||
if (data) { | ||
for (let i = 0; i < data.body.length; i++) { | ||
this.brokers.push(data.body[i]); | ||
this.brokerType = this.brokers[0].type; | ||
} | ||
} | ||
}, | ||
error => console.log(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
60 changes: 53 additions & 7 deletions
60
src/main/webapp/app/entities/queue/queue-delete-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 |
---|---|---|
@@ -1,26 +1,72 @@ | ||
import { Component } from '@angular/core'; | ||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; | ||
import { JhiEventManager } from 'ng-jhipster'; | ||
import { JhiEventManager, JhiAlertService } from 'ng-jhipster'; | ||
import { ActivatedRoute, Router } from '@angular/router'; | ||
|
||
import { IQueue } from 'app/shared/model/queue.model'; | ||
import { QueueService } from './queue.service'; | ||
import { IAddress } from 'app/shared/model/address.model'; | ||
import { IBroker } from 'app/shared/model/broker.model'; | ||
|
||
@Component({ | ||
templateUrl: './queue-delete-dialog.component.html' | ||
}) | ||
export class QueueDeleteDialogComponent { | ||
queue?: IQueue; | ||
address?: IAddress; | ||
|
||
constructor(protected queueService: QueueService, public activeModal: NgbActiveModal, protected eventManager: JhiEventManager) {} | ||
brokerType: string = ''; | ||
brokers: IBroker[]; | ||
|
||
message = 'Are you sure you want to delete this queue?'; | ||
disableDelete: boolean; | ||
|
||
constructor( | ||
protected queueService: QueueService, | ||
public activeModal: NgbActiveModal, | ||
protected eventManager: JhiEventManager, | ||
protected jhiAlertService: JhiAlertService, | ||
protected router: Router | ||
) { | ||
this.brokers = []; | ||
this.getBrokerType(); | ||
this.disableDelete = false; | ||
} | ||
|
||
cancel(): void { | ||
this.activeModal.dismiss(); | ||
} | ||
|
||
confirmDelete(id: number): void { | ||
this.queueService.delete(id).subscribe(() => { | ||
this.eventManager.broadcast('queueListModification'); | ||
this.activeModal.close(); | ||
}); | ||
confirmDelete(name: string): void { | ||
if (this.address.numberOfConsumers > 0) { | ||
this.message = 'Cannot delete queue because there is at least one active consumer'; | ||
this.disableDelete = true; | ||
} else if (this.address.numberOfMessages > 0) { | ||
this.message = 'Cannot delete queue because there is at least one message on the queue. Please purge the queue before deleting'; | ||
this.disableDelete = true; | ||
} else { | ||
this.queueService.deleteQueue(name, this.brokerType).subscribe(() => { | ||
this.eventManager.broadcast('queueListModification'); | ||
this.router.navigate(['/queue']).then(() => { | ||
window.location.reload(); | ||
}); | ||
// this.activeModal.close(); | ||
this.activeModal.close(); | ||
}); | ||
} | ||
} | ||
|
||
getBrokerType(): void { | ||
this.queueService.getBrokers().subscribe( | ||
data => { | ||
if (data) { | ||
for (let i = 0; i < data.body.length; i++) { | ||
this.brokers.push(data.body[i]); | ||
this.brokerType = this.brokers[0].type; | ||
} | ||
} | ||
}, | ||
error => console.log(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
Oops, something went wrong.