Skip to content

Commit

Permalink
Merge pull request #553 from assimbly/tjutten/issue-521
Browse files Browse the repository at this point in the history
added queue management page
  • Loading branch information
assimbly authored Jul 2, 2021
2 parents 7cb5aeb + 398debf commit 7153556
Show file tree
Hide file tree
Showing 17 changed files with 420 additions and 283 deletions.
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()">&times;</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>&nbsp;<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 src/main/webapp/app/entities/queue/queue-clear-dialog.component.ts
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)
);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<form *ngIf="queue" name="deleteForm" (ngSubmit)="confirmDelete(queue.id!)">
<form *ngIf="address" name="deleteForm" (ngSubmit)="confirmDelete(address.name!)">
<div class="modal-header">
<h4 class="modal-title">Confirm delete operation</h4>

Expand All @@ -9,15 +9,15 @@ <h4 class="modal-title">Confirm delete operation</h4>
<div class="modal-body">
<jhi-alert-error></jhi-alert-error>

<p id="jhi-delete-queue-heading">Are you sure you want to delete this Queue?</p>
<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>&nbsp;<span>Cancel</span>
</button>

<button id="jhi-confirm-delete-queue" type="submit" class="btn btn-danger">
<button id="jhi-confirm-delete-queue" type="submit" class="btn btn-danger" [disabled]="disableDelete">
<fa-icon icon="times"></fa-icon>&nbsp;<span>Delete</span>
</button>
</div>
Expand Down
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)
);
}
}
68 changes: 34 additions & 34 deletions src/main/webapp/app/entities/queue/queue-row.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,45 +13,45 @@
</button>

<button type="submit"
class="btn btn-primary btn-sm">
class="btn btn-primary btn-sm"
*jhiHasAnyAuthority="'ROLE_ADMIN'"
[routerLink]="['../flow', 'message-sender' ]">
<span class="fa fa-envelope"></span>
<span class="d-none d-md-inline">Send</span>
</button>

<div ngbDropdown class="d-inline-block" placement="bottom-left">
<a class="btn" id="dropdownBasic1" ngbDropdownToggle>Other<i class="fa fa-angle-down"></i></a>
<div ngbDropdownMenu aria-labelledby="dropdownBasic1">
<!-- <a ngbDropdownItem role="button" href="{{componentTypeCamelLinks[index]}}" [ngClass]="{'disabled': !componentTypeCamelLinks[index]}" target="_blank" title="Apache Camel online documentation on the component used for scheme: {{endpoint?.componentType}}.">-->
<!-- <span>Camel Documentation</span>-->
<!-- </a>-->
<!-- <a ngbDropdownItem role="button" href="{{componentTypeAssimblyLinks[index]}}" target="_blank" title="Assimbly Gateway online documentation on the component used for scheme: {{endpoint?.componentType}}.">-->
<!-- <span>Assimbly Documentation</span>-->
<!-- </a>-->
<!-- <a ngbDropdownItem role="button" (click)="openTestConnectionModal(testConnectionModal)" title="Test if connection is available">-->
<!-- <span>Test Connection</span>-->
<!-- </a>-->
<a ngbDropdownItem role="button">
<span><i class="fa fa-times"></i> Delete</span>
</a>
<a ngbDropdownItem role="button">
<span><i class="fa fa-trash"></i> Clear</span>
</a>
<a ngbDropdownItem role="button">
<span><i class="fa fa-save"></i> Save</span>
</a>
<a ngbDropdownItem role="button">
<span><i class="fa fa-info"></i> Details</span>
</a>
</div>
</div>
<button type="submit"
class="btn btn-danger btn-sm"
*jhiHasAnyAuthority="'ROLE_ADMIN'"
(click)="delete(address)">
<span class="fa fa-times"></span>
<span class="d-none d-md-inline">Delete</span>
</button>

<!-- <button type="submit" (click)="delete(queue)"-->
<!-- class="btn btn-danger btn-sm">-->
<!-- <fa-icon icon="times"></fa-icon>-->
<!-- <span class="d-none d-md-inline">Delete</span>-->
<!-- </button>-->
</div>
<div class="">
<button type="submit"
class="btn btn-warning btn-sm"
*jhiHasAnyAuthority="'ROLE_ADMIN'"
(click)="clear(address)">
<span class="fa fa-trash"></span>
<span class="d-none d-md-inline">Clear</span>
</button>

<!-- <div ngbDropdown class="d-inline-block" placement="bottom-left" [hidden]="true">-->
<!-- <a class="btn" id="dropdownBasic1" ngbDropdownToggle>Other<i class="fa fa-angle-down"></i></a>-->
<!-- <div ngbDropdownMenu aria-labelledby="dropdownBasic1">-->
<!-- <a ngbDropdownItem role="button" (click)="delete(address)">-->
<!-- <span><i class="fa fa-times"></i> Delete</span>-->
<!-- </a>-->
<!-- <a ngbDropdownItem role="button">-->
<!-- <span><i class="fa fa-trash"></i> Clear</span>-->
<!-- </a>-->
<!-- <a ngbDropdownItem role="button" [hidden]="true">-->
<!-- <span><i class="fa fa-save"></i> Save</span>-->
<!-- </a>-->
<!-- <a ngbDropdownItem role="button" [hidden]="true">-->
<!-- <span><i class="fa fa-info"></i> Details</span>-->
<!-- </a>-->
<!-- </div>-->
<!-- </div>-->
</div>
</td>
Loading

0 comments on commit 7153556

Please sign in to comment.