-
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.
feature: delete resource templates (#826)
- Loading branch information
1 parent
5e7e672
commit 290d496
Showing
10 changed files
with
165 additions
and
14 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
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
14 changes: 14 additions & 0 deletions
14
...rc/app/resources/resource-edit/resource-templates/resource-template-delete.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,14 @@ | ||
<div class="container"> | ||
<app-modal-header [title]="'Delete Template'" (cancel)="cancel()"></app-modal-header> | ||
<div class="modal-body"> | ||
<div class="form-horizontal mx-2"> | ||
<div class="mb-3"> | ||
<div class="text-body">Do you really want to delete the selected template?</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="modal-footer"> | ||
<app-button [variant]="'light'" (click)="cancel()">Cancel</app-button> | ||
<app-button [variant]="'primary'" (click)="delete()">Delete</app-button> | ||
</div> | ||
</div> |
23 changes: 23 additions & 0 deletions
23
...app/resources/resource-edit/resource-templates/resource-template-delete.component.spec.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,23 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { ResourceTemplateDeleteComponent } from './resource-template-delete.component'; | ||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; | ||
|
||
describe('ResourceTemplateDeleteComponent', () => { | ||
let component: ResourceTemplateDeleteComponent; | ||
let fixture: ComponentFixture<ResourceTemplateDeleteComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [ResourceTemplateDeleteComponent], | ||
providers: [NgbActiveModal], | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(ResourceTemplateDeleteComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
25 changes: 25 additions & 0 deletions
25
.../src/app/resources/resource-edit/resource-templates/resource-template-delete.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,25 @@ | ||
import { Component, EventEmitter, inject, Input, Output } from '@angular/core'; | ||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; | ||
import { ModalHeaderComponent } from '../../../shared/modal-header/modal-header.component'; | ||
import { ButtonComponent } from '../../../shared/button/button.component'; | ||
|
||
@Component({ | ||
selector: 'app-resource-template-delete', | ||
standalone: true, | ||
templateUrl: './resource-template-delete.component.html', | ||
imports: [ModalHeaderComponent, ButtonComponent], | ||
}) | ||
export class ResourceTemplateDeleteComponent { | ||
activeModal = inject(NgbActiveModal); | ||
@Input() templateId: number; | ||
@Output() deleteTemplateId: EventEmitter<number> = new EventEmitter<number>(); | ||
|
||
cancel() { | ||
this.activeModal.close(); | ||
} | ||
|
||
delete() { | ||
this.deleteTemplateId.emit(this.templateId); | ||
this.activeModal.close(); | ||
} | ||
} |
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
35 changes: 35 additions & 0 deletions
35
...c/main/java/ch/mobi/itc/mobiliar/rest/exceptions/TemplateNotDeletableExceptionMapper.java
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,35 @@ | ||
/* | ||
* AMW - Automated Middleware allows you to manage the configurations of | ||
* your Java EE applications on an unlimited number of different environments | ||
* with various versions, including the automated deployment of those apps. | ||
* Copyright (C) 2013-2016 by Puzzle ITC | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package ch.mobi.itc.mobiliar.rest.exceptions; | ||
|
||
import ch.puzzle.itc.mobiliar.common.exception.TemplateNotDeletableException; | ||
|
||
import javax.ws.rs.core.Response; | ||
import javax.ws.rs.ext.ExceptionMapper; | ||
import javax.ws.rs.ext.Provider; | ||
|
||
@Provider | ||
public class TemplateNotDeletableExceptionMapper implements ExceptionMapper<TemplateNotDeletableException> { | ||
@Override | ||
public Response toResponse(TemplateNotDeletableException exception) { | ||
return Response.status(Response.Status.BAD_REQUEST).entity(new ExceptionDto(exception)).build(); | ||
} | ||
} |
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