Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit 662ac62f authored by Joze RIHTARSIC's avatar Joze RIHTARSIC
Browse files

small fixes

parent 213390f0
No related branches found
No related tags found
No related merge requests found
Showing
with 168 additions and 68 deletions
......@@ -77,9 +77,10 @@
href="javascript:void(0)"
title="Expand/Collapse Row"
(click)="toggleExpandRow(row)"> <mat-icon class="mat-icon-rtl-mirror">
{{expanded ? 'expand_more' : 'chevron_right'}}
</mat-icon>
(click)="toggleExpandRow(row)">
<mat-icon class="mat-icon-rtl-mirror">
{{expanded ? 'expand_more' : 'chevron_right'}}
</mat-icon>
</a>
</ng-template>
......@@ -99,40 +100,43 @@
</div>
</ng-template>
<div fxFlex="50px" *ngIf=showActionButtons>
<ng-container>
<button id="cancelButton" mat-raised-button (click)="onCancelButtonClicked()" color="primary"
[disabled]="!submitButtonsEnabled">
<mat-icon>cancel</mat-icon>
<span>Cancel</span>
</button>
<button id="saveButton" mat-raised-button (click)="onSaveButtonClicked(false)" color="primary"
[disabled]="!submitButtonsEnabled">
<mat-icon>save</mat-icon>
<span>Save</span>
</button>
<mat-toolbar fxFlex="50px" *ngIf=showActionButtons class="mat-elevation-z2" style="flex-grow: 0">
<mat-toolbar-row class="smp-toolbar-row">
<ng-container>
<tool-button-spacer *ngIf="allowNewItems || allowEditItems || allowDeleteItems"></tool-button-spacer>
<button id="cancelButton" mat-raised-button (click)="onCancelButtonClicked()" color="primary"
[disabled]="!submitButtonsEnabled">
<mat-icon>cancel</mat-icon>
<span>Cancel</span>
</button>
<button id="saveButton" mat-raised-button (click)="onSaveButtonClicked(false)" color="primary"
[disabled]="!submitButtonsEnabled">
<mat-icon>save</mat-icon>
<span>Save</span>
</button>
<!-- new button enabled -->
<button *ngIf="allowNewItems" id="newButton" mat-raised-button (click)="onNewButtonClicked()"
[disabled]="loading || !allowNewItems" color="primary">
<mat-icon>add</mat-icon>
<span>New</span>
</button>
<button *ngIf="allowEditItems" id="editButton" mat-raised-button (click)="onEditButtonClicked()"
[disabled]="!editButtonEnabled || loading" color="primary">
<mat-icon>edit</mat-icon>
<span>Edit</span>
</button>
<button *ngIf="allowDeleteItems" id="deleteButton" mat-raised-button (click)="onDeleteButtonClicked()"
[disabled]="!deleteButtonEnabled || loading || !allowDeleteItems" color="primary">
<mat-icon>delete</mat-icon>
<span>Delete</span>
</button>
</ng-container>
<ng-container *ngTemplateOutlet="additionalToolButtons"></ng-container>
</div>
<tool-button-spacer *ngIf="allowNewItems || allowEditItems || allowDeleteItems"></tool-button-spacer>
<!-- new button enabled -->
<button *ngIf="allowNewItems" id="newButton" mat-raised-button (click)="onNewButtonClicked()"
[disabled]="loading || !allowNewItems" color="primary">
<mat-icon>add</mat-icon>
<span>New</span>
</button>
<button *ngIf="allowEditItems" id="editButton" mat-raised-button (click)="onEditButtonClicked()"
[disabled]="!editButtonEnabled || loading" color="primary">
<mat-icon>edit</mat-icon>
<span>Edit</span>
</button>
<button *ngIf="allowDeleteItems" id="deleteButton" mat-raised-button (click)="onDeleteButtonClicked()"
[disabled]="!deleteButtonEnabled || loading || !allowDeleteItems" color="primary">
<mat-icon>delete</mat-icon>
<span>Delete</span>
</button>
</ng-container>
<ng-container *ngTemplateOutlet="additionalToolButtons"></ng-container>
</mat-toolbar-row>
</mat-toolbar>
</form>
</div>
......@@ -63,7 +63,7 @@
</tr>
</table>
<mat-paginator class="mat-elevation-z2" id="extension-paginator"
<mat-paginator class="mat-elevation-z2" id="domain-paginator"
[hidePageSize]="true"
[showFirstLastButtons]="true"
[pageSize]="5" aria-label="Select page"></mat-paginator>
......
......@@ -133,9 +133,9 @@
<mat-paginator class="mat-elevation-z2" [length]="resultsLength"
(page)="onPageChanged($event)"
[pageSize]="5"
[pageSizeOptions]="[5, 10, 25]"
[disabled]="disabledForm"
[hidePageSize]="true"
[showFirstLastButtons]="true"
[pageSize]="10"
aria-label="Select pages"></mat-paginator>
</div>
</div>
......
import {AfterViewInit, Component, Input, ViewChild} from '@angular/core';
import {BeforeLeaveGuard} from "../../window/sidenav/navigation-on-leave-guard";
import {MatPaginator} from "@angular/material/paginator";
import {MatPaginator, PageEvent} from "@angular/material/paginator";
import {AlertMessageService} from "../../common/alert-message/alert-message.service";
import {EditDomainService} from "../edit-domain/edit-domain.service";
import {DomainRo} from "../../common/model/domain-ro.model";
......@@ -174,4 +174,12 @@ export class EditResourceComponent implements AfterViewInit, BeforeLeaveGuard {
return false;
}
onPageChanged(page: PageEvent) {
this.refreshResources();
}
get disabledResourcePagination(): boolean {
return !this._selectedGroup;
}
}
......@@ -14,6 +14,7 @@
<button id="GenerateResource_id" mat-raised-button
color="primary"
matTooltip="Generate resource"
(click)="onGenerateButtonClicked()"
>
<mat-icon>add_circle</mat-icon>
......@@ -22,6 +23,7 @@
<button id="documentWizard_id" mat-raised-button
color="primary"
matTooltip="Show document wizard dialog"
*ngIf="showWizardDialog"
(click)="onShowDocumentWizardDialog()"
>
<mat-icon>code_block</mat-icon>
......@@ -90,7 +92,13 @@
></ngx-codemirror>
</div>
<mat-toolbar class="mat-elevation-z2" style="flex-grow: 0">
<mat-toolbar-row>
<mat-toolbar-row class="smp-toolbar-row">
<button d="cancel_id" mat-raised-button color="primary"
[disabled]="saveButtonDisabled"
(click)="onDocumentResetButtonClicked()">
<mat-icon>cancel</mat-icon>
<span>Cancel</span>
</button>
<button id="saveResource_id" mat-raised-button
color="primary"
matTooltip="Validate resource"
......
......@@ -12,6 +12,7 @@ import {CodemirrorComponent} from "@ctrl/ngx-codemirror";
import {DocumentRo} from "../../../common/model/document-ro.model";
import {NavigationService} from "../../../window/sidenav/navigation-model.service";
import {DocumentWizardDialogComponent} from "../document-wizard-dialog/document-wizard-dialog.component";
import {ConfirmationDialogComponent} from "../../../common/dialogs/confirmation-dialog/confirmation-dialog.component";
@Component({
moduleId: module.id,
......@@ -108,7 +109,7 @@ export class ResourceDocumentPanelComponent implements AfterViewInit, BeforeLeav
this.documentForm.controls['name'].setValue(value.name);
this.documentForm.controls['currentResourceVersion'].setValue(value.currentResourceVersion);
this.documentForm.controls['payloadVersion'].setValue(value.payloadVersion);
this.documentForm.controls['payload'].setValue(value.payload);
this.documentForm.controls['payload'].setValue(!value.payload?"":value.payload);
this.documentForm.controls['payload'].enable();
// the method documentVersionsExists already uses the current value to check if versions exists
if (!this.documentVersionsExists) {
......@@ -132,6 +133,32 @@ export class ResourceDocumentPanelComponent implements AfterViewInit, BeforeLeav
return doc;
}
onDocumentResetButtonClicked(): void {
this.dialog.open(ConfirmationDialogComponent, {
data: {
title: "Cancel changes",
description: "Do you want to cancel all changes on the document?"
}
}).afterClosed().subscribe(result => {
if (result) {
this.resetChanges()
}
});
}
resetChanges(){
let currentVersion = this._document?.payloadVersion;
if (!currentVersion) {
this.documentForm.controls['payload'].setValue("");
this.documentForm.markAsPristine();
} else {
this.loadDocumentForVersion(currentVersion);
}
}
onSaveButtonClicked(): void {
this.editResourceService.saveDocumentObservable(this._resource, this.document).subscribe((value: DocumentRo) => {
if (value) {
......@@ -223,7 +250,7 @@ export class ResourceDocumentPanelComponent implements AfterViewInit, BeforeLeav
}
get emptyDocument(): boolean{
return !this.documentForm.controls['payload'].value
return !this.documentForm.controls['payload']?.value
}
get documentVersionsExists(): boolean{
......@@ -232,12 +259,17 @@ export class ResourceDocumentPanelComponent implements AfterViewInit, BeforeLeav
get saveButtonDisabled(): boolean {
return !this.documentForm.dirty;
return !this.documentForm.dirty || !this.documentForm.controls['payload']?.value;
}
isDirty(): boolean {
return this.documentForm.dirty
}
get showWizardDialog(): boolean {
// in version DomiSMP 5.0 CR show only the wizard for edelivery-oasis-smp-1.0-servicegroup
return this._resource?.resourceTypeIdentifier === 'edelivery-oasis-smp-1.0-servicegroup';
}
}
......
......@@ -4,6 +4,7 @@
<mat-toolbar-row class="smp-toolbar-row">
<button id="validateResource_id" mat-raised-button
color="primary"
[disabled]="emptyDocument"
matTooltip="Validate resource"
(click)="onDocumentValidateButtonClicked()"
>
......@@ -21,6 +22,7 @@
<button id="documentWizard_id" mat-raised-button
color="primary"
matTooltip="Show document wizard dialog"
*ngIf="showWizardDialog"
(click)="onShowDocumentWizardDialog()"
>
<mat-icon>code_block</mat-icon>
......@@ -103,7 +105,13 @@
></ngx-codemirror>
</div>
<mat-toolbar class="mat-elevation-z2" style="flex-grow: 0">
<mat-toolbar-row>
<mat-toolbar-row class="smp-toolbar-row">
<button d="cancel_id" mat-raised-button color="primary"
[disabled]="saveButtonDisabled"
(click)="onDocumentResetButtonClicked()">
<mat-icon>cancel</mat-icon>
<span>Cancel</span>
</button>
<button id="saveResource_id" mat-raised-button
color="primary"
matTooltip="Validate resource"
......
......@@ -11,7 +11,6 @@ import {FormBuilder, FormControl, FormGroup} from "@angular/forms";
import {CodemirrorComponent} from "@ctrl/ngx-codemirror";
import {DocumentRo} from "../../../common/model/document-ro.model";
import {NavigationService} from "../../../window/sidenav/navigation-model.service";
import {DocumentWizardDialogComponent} from "../document-wizard-dialog/document-wizard-dialog.component";
import {SubresourceRo} from "../../../common/model/subresource-ro.model";
import {
SubresourceDocumentWizardComponent
......@@ -19,6 +18,7 @@ import {
import {
ServiceMetadataWizardRo
} from "../../../service-group-edit/service-metadata-wizard-dialog/service-metadata-wizard-edit-ro.model";
import {ConfirmationDialogComponent} from "../../../common/dialogs/confirmation-dialog/confirmation-dialog.component";
@Component({
moduleId: module.id,
......@@ -145,9 +145,15 @@ export class SubresourceDocumentPanelComponent implements AfterViewInit, BeforeL
this.documentForm.controls['name'].setValue(value.name);
this.documentForm.controls['currentResourceVersion'].setValue(value.currentResourceVersion);
this.documentForm.controls['payloadVersion'].setValue(value.payloadVersion);
this.documentForm.controls['payload'].setValue(value.payload);
this.documentForm.controls['payloadVersion'].enable();
this.documentForm.controls['payload'].setValue(!value.payload?"":value.payload);
this.documentForm.controls['payload'].enable();
if (!this.documentVersionsExists) {
this.documentForm.controls['payloadVersion'].disable();
} else {
this.documentForm.controls['payloadVersion'].enable();
}
} else {
this.documentForm.controls['name'].setValue("");
this.documentForm.controls['payload'].setValue("");
......@@ -268,14 +274,48 @@ export class SubresourceDocumentPanelComponent implements AfterViewInit, BeforeL
return !this._document?.allVersions ? [] : this._document?.allVersions;
}
get documentVersionsExists(): boolean{
return this.getDocumentVersions.length > 0
}
get emptyDocument(): boolean{
return !this.documentForm.controls['payload']?.value
}
get saveButtonDisabled(): boolean {
return !this.documentForm.dirty;
return !this.documentForm.dirty || !this.documentForm.controls['payload']?.value;
}
isDirty(): boolean {
return this.documentForm.dirty
}
onDocumentResetButtonClicked(): void {
this.dialog.open(ConfirmationDialogComponent, {
data: {
title: "Cancel changes",
description: "Do you want to cancel all changes on the document?"
}
}).afterClosed().subscribe(result => {
if (result) {
this.resetChanges()
}
});
}
resetChanges(){
let currentVersion = this._document?.payloadVersion;
if (!currentVersion) {
this.documentForm.controls['payload'].setValue("");
this.documentForm.markAsPristine();
} else {
this.loadDocumentForVersion(currentVersion);
}
}
get showWizardDialog(): boolean {
// in version DomiSMP 5.0 CR show only the wizard for edelivery-oasis-smp-1.0-servicemetadata
return this._subresource?.subresourceTypeIdentifier === 'edelivery-oasis-smp-1.0-servicemetadata';
}
}
......
......@@ -52,12 +52,10 @@
<td mat-cell *matCellDef="let row">{{row.identifierValue}}</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let odd = odd; let row; columns: displayedColumns;"
(click)="onResourceSelected(row)"
(dblclick)="showResourceEditDialog(row)"
(dblclick)="showSubresourceEditPanel(row)"
[ngClass]="{'datatable-row-selected': row==selected,'datatable-row-odd': odd}"
></tr>
......@@ -74,9 +72,9 @@
</div>
<mat-paginator class="mat-elevation-z2"
[pageSize]="5"
[pageSizeOptions]="[5, 10, 25]"
[hidePageSize]="true"
[showFirstLastButtons]="true"
[pageSize]="3"
[disabled]="disabledForm"
aria-label="Select pages"></mat-paginator>
</div>
......
import {Component, Input, OnInit, ViewChild,} from '@angular/core';
import {AfterViewInit, Component, Input, OnInit, ViewChild,} from '@angular/core';
import {MatDialog} from "@angular/material/dialog";
import {BeforeLeaveGuard} from "../../../window/sidenav/navigation-on-leave-guard";
import {MatPaginator} from "@angular/material/paginator";
......@@ -22,7 +22,7 @@ import {NavigationNode, NavigationService} from "../../../window/sidenav/navigat
templateUrl: './subresource-panel.component.html',
styleUrls: ['./subresource-panel.component.scss']
})
export class SubresourcePanelComponent implements OnInit, BeforeLeaveGuard {
export class SubresourcePanelComponent implements AfterViewInit, OnInit, BeforeLeaveGuard {
title: string = "Subresources";
......@@ -45,15 +45,11 @@ export class SubresourcePanelComponent implements OnInit, BeforeLeaveGuard {
}
ngOnInit(): void {
// filter predicate for search the domain
/*
this.dataSource.filterPredicate =
(data: SubresourceRo, filter: string) => {
return !filter || -1 != data.subresourceId.toLowerCase().indexOf(filter.trim().toLowerCase());
}
};
ngAfterViewInit() {
*/
this.dataSource.paginator = this.paginator;
}
@Input() set resource(resource: ResourceRo) {
......@@ -147,6 +143,10 @@ export class SubresourcePanelComponent implements OnInit, BeforeLeaveGuard {
}
public showSubresourceEditPanel(subresource: SubresourceRo) {
if (!this.navigationService.selected) {
this.navigationService.select(null);
return;
}
this.editResourceService.selectedResource = this.resource;
this.editResourceService.selectedSubresource = subresource;
......
......@@ -47,7 +47,7 @@
<ng-template #tableRowDetailContainer let-row="row">
<div *ngIf="row.serviceMetadata.length===0" style="padding-left:20px;">
No service metadata
No subresources
</div>
<div *ngIf="row.serviceMetadata.length !== 0">
<ngx-datatable
......
......@@ -57,7 +57,7 @@ export class ServiceGroupSearchComponent implements OnInit, AfterViewInit, After
initColumns(): void {
this.columnPicker.allColumns = [
{
name: 'Metadata size',
name: 'Subres. size',
prop: 'serviceMetadata.length',
showInitially: true,
width: 120,
......
......@@ -69,7 +69,7 @@ public enum ErrorCode {
MAIL_SUBMISSION_ERROR (500,"SMP:550",ErrorBusinessCode.TECHNICAL, "Mail submission error: %s!"),
RESOURCE_DOCUMENT_MISSING(500,"SMP:180",ErrorBusinessCode.TECHNICAL, "Missing document for the resource: [id: '%s', sch.: '%s']!"),
RESOURCE_DOCUMENT_MISSING(500,"SMP:180",ErrorBusinessCode.TECHNICAL, "Empty document for the resource: [id: '%s', sch.: '%s']!"),
RESOURCE_DOCUMENT_ERROR(500,"SMP:180",ErrorBusinessCode.TECHNICAL, "Error occurred while reading the resource document: [id: '%s', sch.: '%s']! Error [%s]"),
......
......@@ -88,13 +88,15 @@ public class AbstractResourceHandler {
*/
public RequestData buildRequestDataForResource(DBDomain domain, DBResource resource) {
byte[] content = resourceStorage.getDocumentContentForResource(resource);
if (content==null || content.length == 0) {
throw new SMPRuntimeException(ErrorCode.RESOURCE_DOCUMENT_MISSING, resource.getIdentifierValue(), resource.getIdentifierScheme());
}
ByteArrayInputStream inputStream = new ByteArrayInputStream(content);
return buildRequestDataForResource(domain,
resource,
inputStream);
}
public RequestData buildRequestDataForResource(DBDomain domain, DBResource resource, InputStream inputStream) {
return new SpiRequestData(domain.getDomainCode(),
SPIUtils.toUrlIdentifier(resource),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment