-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: delete resource templates #826
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
82b9f94
feat: endpoints for resource and resource type templates
llorentelemmc fc51594
feat: create resource templates model and service
llorentelemmc 6245596
refactor: prettier
llorentelemmc e41c84f
feat: templates-list component to list resource instance templates
llorentelemmc 8cdb3cf
feat: adjust resource template endpoint to include inherited resource…
llorentelemmc 9d5a69e
feat: adjust data structure to define template origin
llorentelemmc 1a91556
feat: adjust endpoint to define template origin
llorentelemmc caaca1f
chore: styling
llorentelemmc d679398
feat: templates-list component to list resource templates
llorentelemmc edd31e8
feat: add resource type templates signal
llorentelemmc cb15089
feat: templates-list component to list resource type templates
llorentelemmc 4ac5e6a
fix: description
llorentelemmc 885c19a
Merge branch 'development' into list-templates
llorentelemmc a5c46e2
chore: adjust naming
llorentelemmc c2b0190
chore: unit test for component
llorentelemmc 4b69eab
feat: delete template endpoint
llorentelemmc a150c0f
feat: resource template-delete component
llorentelemmc a4734e4
chore: remove repetition
llorentelemmc 32ed072
feat: delete functionality in resource templates-list component
llorentelemmc 7e8dc06
feat: delete functionality in resource type templates-list component
llorentelemmc 5a8fef3
Merge branch 'development' into delete-templates
llorentelemmc d6f5dcc
refactor: create error mapper for TemplateNotDeletableException
llorentelemmc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create a mapper for a more meaningful error message for TemplateNotDeletableException and add it to RESTApplication.