Code development platform for open source projects from the European Union institutions

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

Pull request #99: EDELIVERY-12743 implement domain properties configuration for the ui

Merge in EDELIVERY/smp from feature/EDELIVERY-12743-ui-domain-configuration to development

* commit 'c889dc08':
  Fix the PR comments
  fix unit test build
  EDELIVERY-12743 implement domain properties configuration for the ui
parents 3dfe4474 c889dc08
Branches feature/EDELIVERY-11674-alerts-ui-improvements
No related tags found
No related merge requests found
Pipeline #173504 failed
Showing
with 349 additions and 170 deletions
...@@ -7,7 +7,12 @@ eDelivery SMP 5.1 ...@@ -7,7 +7,12 @@ eDelivery SMP 5.1
smp.sso.cas.registration.enabled: Enable/Disable automatic user registration from CAS at first login. smp.sso.cas.registration.enabled: Enable/Disable automatic user registration from CAS at first login.
smp.sso.cas.registration.confirmation.mandatory: Enable/Disable user confirmation after registration from CAS at first login. smp.sso.cas.registration.confirmation.mandatory: Enable/Disable user confirmation after registration from CAS at first login.
smp.sso.cas.registration.mapping: The CAS property mapping to user data. Ex: 'EMAIL:${email}|FULL_NAME:${firstName} ${lastName}' smp.sso.cas.registration.mapping: The CAS property mapping to user data. Ex: 'EMAIL:${email}|FULL_NAME:${firstName} ${lastName}'
bdmsl.integration.dns.zone: The DNS zone/top domain of the SML server. The DNS zone is used to generate DNS queries. bdmsl.integration.dns.zone: The DNS zone/top domain of the SML server.
bdmsl.participants.manage.max-count: The maximum number of participants that can be managed by the SMP.
- deprecated properties:
identifiersBehaviour.ParticipantIdentifierScheme.ebCoreId.concatenate: based on eDelivery SMP 2.0 no need to concatenate ebCore party id in XML responses
authentication.blueCoat.enabled - deprecated and replaced with smp.automation.authentication.external.tls.clientCert.enabled
eDelivery SMP 5.0 eDelivery SMP 5.0
- removed: bdmsl.participant.multidomain.enabled - removed: bdmsl.participant.multidomain.enabled
......
version: '3.8'
services: services:
## ##
## UI Tests ## UI Tests
...@@ -12,5 +11,5 @@ services: ...@@ -12,5 +11,5 @@ services:
- test-network - test-network
networks: networks:
test-network: test-network:
external: name: ${DOCKER_NETWORK_NAME:-domismp-springboot-mysql_default}
name: ${DOCKER_NETWORK_NAME:-domismp-springboot-mysql_default} external: true
version: '3.8'
services: services:
smp-springboot: smp-springboot:
image: ${IMAGE_TAG:-edeliverytest}/${IMAGE_SMP_SPRINGBOOT_MYSQL}:${SMP_VERSION} image: ${IMAGE_TAG:-edeliverytest}/${IMAGE_SMP_SPRINGBOOT_MYSQL}:${SMP_VERSION}
......
# #
# The intention of the compose file is to override the default configuration of the docker-compose.yml file, # The intention of the compose file is to override the default configuration of the docker-compose.yml file,
# such as the ports to be exposed, to be used in the local development/test environment. # such as the ports to be exposed, to be used in the local development/test environment.
version: "3.8"
services: services:
domismp-service: domismp-service:
ports: ports:
......
version: '3.8'
services: services:
## ##
## API Tests ## API Tests
...@@ -12,5 +11,5 @@ services: ...@@ -12,5 +11,5 @@ services:
- test-network - test-network
networks: networks:
test-network: test-network:
external: name: ${DOCKER_NETWORK_NAME:-domismp-tomcat-mysql_default}
name: ${DOCKER_NETWORK_NAME:-domismp-tomcat-mysql_default} external: true
version: '3.8'
services: services:
## ##
## UI Tests ## UI Tests
...@@ -13,5 +12,5 @@ services: ...@@ -13,5 +12,5 @@ services:
- test-network - test-network
networks: networks:
test-network: test-network:
external: name: ${DOCKER_NETWORK_NAME:-domismp-tomcat-mysql_default}
name: ${DOCKER_NETWORK_NAME:-domismp-tomcat-mysql_default} external: true
version: "3.8"
services: services:
domismp-service: domismp-service:
image: ${IMAGE_TAG:-edeliverytest}/${IMAGE_SMP_TOMCAT_MYSQL}:${SMP_VERSION} image: ${IMAGE_TAG:-edeliverytest}/${IMAGE_SMP_TOMCAT_MYSQL}:${SMP_VERSION}
......
version: '3.8'
services: services:
## ##
## API Tests ## API Tests
...@@ -12,5 +11,5 @@ services: ...@@ -12,5 +11,5 @@ services:
- test-network - test-network
networks: networks:
test-network: test-network:
external: name: ${DOCKER_NETWORK_NAME:-domismp-tomcat-mysql_default}
name: ${DOCKER_NETWORK_NAME:-domismp-tomcat-mysql_default} external: true
version: "3.8"
services: services:
smp-oracle-db: smp-oracle-db:
image: ${IMAGE_TAG:-edeliverytest}/${IMAGE_SMP_DB_ORACLE}-${ORA_VERSION}-${ORA_EDITION}:${SMP_VERSION} image: ${IMAGE_TAG:-edeliverytest}/${IMAGE_SMP_DB_ORACLE}-${ORA_VERSION}-${ORA_EDITION}:${SMP_VERSION}
......
version: '3.8'
services: services:
## ##
## API Tests ## API Tests
...@@ -12,5 +11,5 @@ services: ...@@ -12,5 +11,5 @@ services:
- test-network - test-network
networks: networks:
test-network: test-network:
external: name: ${DOCKER_NETWORK_NAME:-domismp-tomcat-mysql_default}
name: ${DOCKER_NETWORK_NAME:-domismp-tomcat-mysql_default} external: true
version: "3.8"
services:
smp-oracle-db: smp-oracle-db:
image: ${IMAGE_TAG:-edeliverytest}/${IMAGE_SMP_DB_ORACLE}-${ORA_VERSION}-${ORA_EDITION}:${SMP_VERSION} # image: ${IMAGE_TAG:-edeliverytest}/${IMAGE_SMP_DB_ORACLE}-${ORA_VERSION}-${ORA_EDITION}:${SMP_VERSION}
image: container-registry.oracle.com/database/express:21.3.0-xe
hostname: smp-oracle-db hostname: smp-oracle-db
shm_size: '1gb' shm_size: '1gb'
environment: environment:
......
...@@ -65,6 +65,7 @@ function initOracleDatabaseConfiguration() { ...@@ -65,6 +65,7 @@ function initOracleDatabaseConfiguration() {
if [ -n "$ORACLE_PDB" ]; then if [ -n "$ORACLE_PDB" ]; then
echo "ALTER SESSION SET CONTAINER=$ORACLE_PDB;" echo "ALTER SESSION SET CONTAINER=$ORACLE_PDB;"
fi fi
echo 'alter session set "_oracle_script"=true;'
# magic with double quotes - first end " then put '"' and then add variable to "$Var" and repeat the stuff :) # magic with double quotes - first end " then put '"' and then add variable to "$Var" and repeat the stuff :)
echo "CREATE USER $1 IDENTIFIED BY "'"'"$2"'"'" DEFAULT TABLESPACE users QUOTA UNLIMITED ON users; " echo "CREATE USER $1 IDENTIFIED BY "'"'"$2"'"'" DEFAULT TABLESPACE users QUOTA UNLIMITED ON users; "
echo "GRANT CREATE SESSION TO $1;" echo "GRANT CREATE SESSION TO $1;"
......
...@@ -82,6 +82,7 @@ See the Licence for the specific language governing permissions and limitations ...@@ -82,6 +82,7 @@ See the Licence for the specific language governing permissions and limitations
<commons-validator.version>1.8.0</commons-validator.version> <commons-validator.version>1.8.0</commons-validator.version>
<cxf-xjc-runtime.version>3.3.2</cxf-xjc-runtime.version> <cxf-xjc-runtime.version>3.3.2</cxf-xjc-runtime.version>
<cxf.version>3.5.8</cxf.version> <cxf.version>3.5.8</cxf.version>
<ehcache.version>3.10.8</ehcache.version>
<h2.version>2.2.224</h2.version> <h2.version>2.2.224</h2.version>
<hamcrest.version>2.2</hamcrest.version> <hamcrest.version>2.2</hamcrest.version>
<hibernate-jpa.version>1.0.2.Final</hibernate-jpa.version> <hibernate-jpa.version>1.0.2.Final</hibernate-jpa.version>
...@@ -216,6 +217,13 @@ See the Licence for the specific language governing permissions and limitations ...@@ -216,6 +217,13 @@ See the Licence for the specific language governing permissions and limitations
<artifactId>cxf-rt-frontend-jaxws</artifactId> <artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf.version}</version> <version>${cxf.version}</version>
</dependency> </dependency>
<!-- Ehcache -->
<dependency>
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>${ehcache.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.apache.cxf</groupId> <groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId> <artifactId>cxf-rt-transports-http</artifactId>
......
This diff is collapsed.
...@@ -136,9 +136,6 @@ import {UserDetailsService} from "./common/services/user-details.service"; ...@@ -136,9 +136,6 @@ import {UserDetailsService} from "./common/services/user-details.service";
import {UserService} from "./common/services/user.service"; import {UserService} from "./common/services/user.service";
import {SmlIntegrationService} from "./common/services/sml-integration.service"; import {SmlIntegrationService} from "./common/services/sml-integration.service";
import {PropertyComponent} from "./system-settings/admin-properties/property.component"; import {PropertyComponent} from "./system-settings/admin-properties/property.component";
import {
PropertyDetailsDialogComponent
} from "./system-settings/admin-properties/property-details-dialog/property-details-dialog.component";
import {UserAlertsComponent} from "./user-settings/user-alerts/user-alerts.component"; import {UserAlertsComponent} from "./user-settings/user-alerts/user-alerts.component";
import {SmpEditorComponent} from "./common/components/smp-editor/smp-editor.component"; import {SmpEditorComponent} from "./common/components/smp-editor/smp-editor.component";
import {ResetCredentialComponent} from "./security/reset-credential/reset-credential.component"; import {ResetCredentialComponent} from "./security/reset-credential/reset-credential.component";
...@@ -147,6 +144,15 @@ import {DnsToolsService} from "./tools/dns-tools/dns-tools.service"; ...@@ -147,6 +144,15 @@ import {DnsToolsService} from "./tools/dns-tools/dns-tools.service";
import { import {
DnsQueryPanelComponent DnsQueryPanelComponent
} from "./tools/dns-tools/dns-query-panel/dns-query-panel.component"; } from "./tools/dns-tools/dns-query-panel/dns-query-panel.component";
import {
DomainPropertiesPanelComponent
} from "./system-settings/admin-domain/domain-properties-panel/domain-properties-panel.component";
import {
PropertyController
} from "./system-settings/admin-properties/property-controller";
import {
PropertyDetailsDialogComponent
} from "./common/dialogs/property-details-dialog/property-details-dialog.component";
import {ResourceFilterOptionsService} from "./common/services/resource-filter-options.service"; import {ResourceFilterOptionsService} from "./common/services/resource-filter-options.service";
import {HttpSessionInterceptor} from "./http/http-session-interceptor"; import {HttpSessionInterceptor} from "./http/http-session-interceptor";
import { import {
...@@ -188,6 +194,7 @@ import { ...@@ -188,6 +194,7 @@ import {
DomainPanelComponent, DomainPanelComponent,
DomainResourceTypePanelComponent, DomainResourceTypePanelComponent,
DomainSelectorComponent, DomainSelectorComponent,
DomainPropertiesPanelComponent,
DomainSmlIntegrationPanelComponent, DomainSmlIntegrationPanelComponent,
EditDomainComponent, EditDomainComponent,
EditGroupComponent, EditGroupComponent,
...@@ -291,17 +298,18 @@ import { ...@@ -291,17 +298,18 @@ import {
DatePipe, DatePipe,
DnsToolsService, DnsToolsService,
DomainService, DomainService,
MembershipService,
DownloadService, DownloadService,
EditDomainService, EditDomainService,
EditGroupService, EditGroupService,
EditResourceController, EditResourceController,
EditResourceService, EditResourceService,
HttpErrorHandlerService,
ExtensionService, ExtensionService,
GlobalLookups, GlobalLookups,
HttpErrorHandlerService,
HttpEventService, HttpEventService,
MembershipService,
NavigationService, NavigationService,
PropertyController,
ResourceFilterOptionsService, ResourceFilterOptionsService,
SecurityEventService, SecurityEventService,
SecurityService, SecurityService,
......
.mat-form-field {
width: 100%;
}
.property-title {
font-size: 1em;
word-wrap: break-word;
font-weight: bold
}
<h2 mat-dialog-title>{{formTitle}}</h2> <h2 mat-dialog-title>{{formTitle}}</h2>
<mat-dialog-content style="min-height:100px;width:580px"> <mat-dialog-content style="min-height:100px;width:780px">
<form [formGroup]="propertyForm"> <form [formGroup]="propertyForm">
<mat-card> <mat-card>
<mat-card-content> <mat-card-content>
<mat-card-title
style="font-size: 1.1em">{{ propertyForm.controls['property'].value}}</mat-card-title> <mat-expansion-panel>
<fieldset style="border: solid gray 1px;"> <mat-expansion-panel-header>
<legend>Description:</legend> <mat-panel-title class="property-title">
<label>{{ propertyForm.controls['desc'].value}}</label> {{propertyForm.controls['property'].value}}
</fieldset> </mat-panel-title>
</mat-expansion-panel-header>
<fieldset style="border: solid gray 1px;">
<legend>Description:</legend>
<label>{{ propertyForm.controls['desc'].value}}</label>
</fieldset>
</mat-expansion-panel>
<!-- Only for domain property-->
<mat-checkbox *ngIf="isDomainProperty"
formControlName="systemDefault"
(change)="updateValueState()"
style="width: 100%">
Use System default value
</mat-checkbox>
<mat-form-field *ngIf="propertyForm.controls['type'].value !== 'BOOLEAN'" appearance="fill" style="width: 100%"> <mat-form-field *ngIf="propertyForm.controls['type'].value !== 'BOOLEAN'" appearance="fill" style="width: 100%">
<mat-label>Property value:</mat-label> <mat-label>Property value:</mat-label>
<input <input style="width: 100%;padding: 5px"
matInput type="{{ getInputType(propertyForm.controls['type'].value) }}" style="width: 100%;padding: 5px" matInput [type]="getInputType(propertyForm.controls['type'].value)"
formControlName="value" [pattern]="propertyForm.controls['valuePattern'].value"/> formControlName="value"
[pattern]="propertyForm.controls['valuePattern'].value" />
</mat-form-field> </mat-form-field>
<mat-checkbox *ngIf="propertyForm.controls['type'].value === 'BOOLEAN'" <mat-checkbox *ngIf="propertyForm.controls['type'].value === 'BOOLEAN'"
formControlName="value" style="width: 100%"> formControlName="value"
style="width: 100%">
{{ propertyForm.controls['property'].value }} {{ propertyForm.controls['property'].value }}
</mat-checkbox> </mat-checkbox>
<div *ngIf="propertyForm.controls['errorMessage'].value" class="alert-message-error"> <div *ngIf="propertyForm.controls['errorMessage'].value" class="alert-message-error">
...@@ -28,11 +44,13 @@ ...@@ -28,11 +44,13 @@
</mat-dialog-content> </mat-dialog-content>
<mat-dialog-actions> <mat-dialog-actions>
<button id="updatePropertyButton" mat-raised-button color="primary" (click)="submitForm()" [disabled]="!propertyForm.valid"> <button id="updatePropertyButton" mat-raised-button color="primary" (click)="submitForm()"
[disabled]="!isDirty || !propertyForm.valid">
<mat-icon>check_circle</mat-icon> <mat-icon>check_circle</mat-icon>
<span>OK</span> <span>OK</span>
</button> </button>
<button mat-raised-button color="primary" mat-dialog-close> <button mat-raised-button color="primary" mat-dialog-close
[disabled]="!isDirty" >
<mat-icon>cancel</mat-icon> <mat-icon>cancel</mat-icon>
<span>Cancel</span> <span>Cancel</span>
</button> </button>
......
import {Component, Inject, OnInit} from '@angular/core'; import {Component, Inject, OnInit} from '@angular/core';
import {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from '@angular/material/dialog'; import {
import {UntypedFormBuilder, UntypedFormControl, UntypedFormGroup} from "@angular/forms"; MAT_DIALOG_DATA,
import {PropertyRo} from "../property-ro.model"; MatDialog,
import {AlertMessageService} from "../../../common/alert-message/alert-message.service"; MatDialogRef
} from '@angular/material/dialog';
import {
UntypedFormBuilder,
UntypedFormControl,
UntypedFormGroup
} from "@angular/forms";
import {
AlertMessageService
} from "../../../common/alert-message/alert-message.service";
import {EntityStatus} from "../../../common/enums/entity-status.enum"; import {EntityStatus} from "../../../common/enums/entity-status.enum";
import {SmpConstants} from "../../../smp.constants"; import {SmpConstants} from "../../../smp.constants";
import {PropertyValidationRo} from "../property-validate-ro.model";
import {HttpClient} from "@angular/common/http"; import {HttpClient} from "@angular/common/http";
import {HttpErrorHandlerService} from "../../../common/error/http-error-handler.service"; import {
HttpErrorHandlerService
} from "../../../common/error/http-error-handler.service";
import {
PropertyRo
} from "../../../system-settings/admin-properties/property-ro.model";
import {
PropertyValidationRo
} from "../../../system-settings/admin-properties/property-validate-ro.model";
import {PropertyTypeEnum} from "../../enums/property-type.enum";
import {firstValueFrom} from "rxjs";
@Component({ @Component({
selector: 'property-details-dialog', selector: 'property-details-dialog',
...@@ -16,16 +34,17 @@ import {HttpErrorHandlerService} from "../../../common/error/http-error-handler. ...@@ -16,16 +34,17 @@ import {HttpErrorHandlerService} from "../../../common/error/http-error-handler.
}) })
export class PropertyDetailsDialogComponent implements OnInit { export class PropertyDetailsDialogComponent implements OnInit {
static readonly NEW_MODE = 'New Property'; static readonly NEW_MODE: string = 'New {TYPE} Property';
static readonly EDIT_MODE = 'Property Edit'; static readonly EDIT_MODE: string = '{TYPE} Property Edit';
editMode: boolean; editMode: boolean;
formTitle: string; formTitle: string;
current: PropertyRo & { confirmation?: string }; current: PropertyRo & { confirmation?: string, systemDefault?: boolean };
propertyForm: UntypedFormGroup; propertyForm: UntypedFormGroup;
disabled: true; disabled: true;
showSpinner: boolean = false; showSpinner: boolean = false;
propertyType: PropertyTypeEnum = PropertyTypeEnum.SYSTEM;
constructor( constructor(
...@@ -38,7 +57,11 @@ export class PropertyDetailsDialogComponent implements OnInit { ...@@ -38,7 +57,11 @@ export class PropertyDetailsDialogComponent implements OnInit {
private fb: UntypedFormBuilder) { private fb: UntypedFormBuilder) {
this.editMode = data.edit; this.editMode = data.edit;
this.formTitle = this.editMode ? PropertyDetailsDialogComponent.EDIT_MODE : PropertyDetailsDialogComponent.NEW_MODE; this.propertyType = data.propertyType;
this.propertyType = !data.propertyType ? PropertyTypeEnum.SYSTEM : data.propertyType;
this.formTitle = (this.editMode ? PropertyDetailsDialogComponent.EDIT_MODE : PropertyDetailsDialogComponent.NEW_MODE)
.replace('{TYPE}', this.capitalize(this.propertyType));
this.current = this.editMode this.current = this.editMode
? { ? {
...data.row, ...data.row,
...@@ -50,6 +73,7 @@ export class PropertyDetailsDialogComponent implements OnInit { ...@@ -50,6 +73,7 @@ export class PropertyDetailsDialogComponent implements OnInit {
desc: '', desc: '',
readonly: false, readonly: false,
status: EntityStatus.NEW, status: EntityStatus.NEW,
systemDefault: false,
}; };
this.propertyForm = fb.group({ this.propertyForm = fb.group({
...@@ -59,7 +83,7 @@ export class PropertyDetailsDialogComponent implements OnInit { ...@@ -59,7 +83,7 @@ export class PropertyDetailsDialogComponent implements OnInit {
'value': new UntypedFormControl({value: ''}), 'value': new UntypedFormControl({value: ''}),
'valuePattern': new UntypedFormControl({value: ''}), 'valuePattern': new UntypedFormControl({value: ''}),
'errorMessage': new UntypedFormControl({value: ''}), 'errorMessage': new UntypedFormControl({value: ''}),
'systemDefault': new UntypedFormControl({value: 'true'}),
}); });
this.propertyForm.controls['property'].setValue(this.current.property); this.propertyForm.controls['property'].setValue(this.current.property);
...@@ -67,39 +91,57 @@ export class PropertyDetailsDialogComponent implements OnInit { ...@@ -67,39 +91,57 @@ export class PropertyDetailsDialogComponent implements OnInit {
this.propertyForm.controls['type'].setValue(this.current.type); this.propertyForm.controls['type'].setValue(this.current.type);
this.propertyForm.controls['value'].setValue(this.valueFromPropertyStringValue(this.current.value, this.current.type)); this.propertyForm.controls['value'].setValue(this.valueFromPropertyStringValue(this.current.value, this.current.type));
this.propertyForm.controls['valuePattern'].setValue(this.current.valuePattern); this.propertyForm.controls['valuePattern'].setValue(this.current.valuePattern);
this.propertyForm.controls['systemDefault'].setValue(this.current.systemDefault);
this.propertyForm.controls['errorMessage'].setValue(''); this.propertyForm.controls['errorMessage'].setValue('');
this.updateValueState();
} }
ngOnInit() { ngOnInit() {
} }
submitForm() { /**
* Methods validates the property with server validator. If property value is ok
* it closes the dialog else writes the errorMessage.
*/
async submitForm() {
this.checkValidity(this.propertyForm); this.checkValidity(this.propertyForm);
let request = this.getCurrent(); let request: PropertyRo = this.getCurrent();
//
let validationObservable = this.http.post<PropertyValidationRo>(SmpConstants.REST_INTERNAL_PROPERTY_VALIDATE, request); // if domain property we do not need to validate
if (this.propertyType == PropertyTypeEnum.DOMAIN) {
this.propertyForm.controls['errorMessage'].setValue("");
// we can close the dialog
this.closeDialog();
return;
}
// if system property validate property
let validationObservable = this.http
.post<PropertyValidationRo>(SmpConstants.REST_INTERNAL_PROPERTY_VALIDATE, request);
this.showSpinner = true; this.showSpinner = true;
validationObservable.toPromise().then((res: PropertyValidationRo) => {
this.showSpinner = false;
if (!res.propertyValid) { try {
this.propertyForm.controls['errorMessage'].setValue(res.errorMessage?res.errorMessage:'Invalid property'); const result: PropertyValidationRo = await firstValueFrom(validationObservable);
this.showSpinner = false;
if (!result.propertyValid) {
this.propertyForm.controls['errorMessage'].setValue(result.errorMessage ? result.errorMessage : 'Invalid property');
} else { } else {
this.propertyForm.controls['errorMessage'].setValue(""); this.propertyForm.controls['errorMessage'].setValue("");
// we can close the dialog // we can close the dialog
this.closeDialog(); this.closeDialog();
} }
}).catch((err) => { } catch (err) {
if (this.httpErrorHandlerService.logoutOnInvalidSessionError(err)){ if (this.httpErrorHandlerService.logoutOnInvalidSessionError(err)) {
this.closeDialog(); this.closeDialog();
return; return;
} }
this.alertService.error("Error occurred on Validation the property", err) this.alertService.error("Error occurred on Validation the property", err)
console.log("Error occurred on Validation the property: " + err); console.log("Error occurred on Validation the property: " + err);
}); }
} }
checkValidity(g: UntypedFormGroup) { checkValidity(g: UntypedFormGroup) {
...@@ -161,6 +203,7 @@ export class PropertyDetailsDialogComponent implements OnInit { ...@@ -161,6 +203,7 @@ export class PropertyDetailsDialogComponent implements OnInit {
return 'text'; return 'text';
} }
} }
getInputPatternType(propertyType: string) { getInputPatternType(propertyType: string) {
console.log("Get input pattern for row " + this.current.type) console.log("Get input pattern for row " + this.current.type)
switch (propertyType) { switch (propertyType) {
...@@ -186,11 +229,43 @@ export class PropertyDetailsDialogComponent implements OnInit { ...@@ -186,11 +229,43 @@ export class PropertyDetailsDialogComponent implements OnInit {
} }
public getCurrent(): PropertyRo { public getCurrent(): PropertyRo {
this.current.status = EntityStatus.UPDATED;
this.current.value = this.propertyForm.value['value']; this.current.value = this.propertyForm.value['value'];
this.current.systemDefault = this.propertyForm.value['systemDefault'];
return this.current; return this.current;
} }
closeDialog() { closeDialog() {
this.dialogRef.close(true); this.dialogRef.close(true);
} }
get isSystemDefault(): boolean {
let systemDefault = this.propertyForm.value['systemDefault'];
return systemDefault;
}
/**
* Method updates the state of the value field based on the system default checkbox.
*/
updateValueState(): void {
if (!this.isDomainProperty || !this.isSystemDefault) {
this.propertyForm.controls['value'].enable();
this.propertyForm.controls['value'].setValue(this.current.value);
} else {
this.propertyForm.controls['value'].setValue(this.current.systemDefaultValue);
this.propertyForm.controls['value'].disable();
}
}
get isDomainProperty(): boolean {
return this.propertyType == PropertyTypeEnum.DOMAIN;
}
capitalize<T extends string>(str: T): string {
return (str.charAt(0).toUpperCase() + str.slice(1).toLowerCase()) as Capitalize<T>;
}
get isDirty(): boolean {
return this.propertyForm.dirty;
}
} }
import {Component, OnInit, Input} from '@angular/core'; import {Component, Input} from '@angular/core';
import {SecurityService} from '../../security/security.service'; import {SecurityService} from '../../security/security.service';
import {DomainService} from '../../security/domain.service'; import {DomainService} from '../../security/domain.service';
import {Domain} from '../../security/domain.model'; import {Domain} from '../../security/domain.model';
...@@ -11,7 +11,7 @@ import {firstValueFrom} from "rxjs"; ...@@ -11,7 +11,7 @@ import {firstValueFrom} from "rxjs";
templateUrl: './domain-selector.component.html', templateUrl: './domain-selector.component.html',
styleUrls: ['./domain-selector.component.css'] styleUrls: ['./domain-selector.component.css']
}) })
export class DomainSelectorComponent implements OnInit { export class DomainSelectorComponent {
showDomains: boolean; showDomains: boolean;
currentDomainCode: string; currentDomainCode: string;
...@@ -24,20 +24,9 @@ export class DomainSelectorComponent implements OnInit { ...@@ -24,20 +24,9 @@ export class DomainSelectorComponent implements OnInit {
constructor (private domainService: DomainService, private securityService: SecurityService, private dialog: MatDialog) { constructor (private domainService: DomainService, private securityService: SecurityService, private dialog: MatDialog) {
} }
ngOnInit () {
/*
this.domainService.isMultiDomain().subscribe((isMultiDomain: boolean) => {
if (isMultiDomain && this.securityService.isCurrentUserSuperAdmin()) {
this.showDomains = true;
this.domainService.getCurrentDomain().subscribe((domain: Domain) => this.domainCode = this.currentDomainCode = domain ? domain.code : null);
this.domainService.getDomains().subscribe((domains: Domain[]) => this.domains = domains);
}
});*/
}
changeDomain () { changeDomain () {
let canChangeDomain = Promise.resolve(true); let canChangeDomain = Promise.resolve(true);
if (this.currentComponent && this.currentComponent.isDirty && this.currentComponent.isDirty()) { if (this.currentComponent?.isDirty && this.currentComponent.isDirty()) {
canChangeDomain = firstValueFrom(this.dialog.open(CancelDialogComponent).afterClosed()); canChangeDomain = firstValueFrom(this.dialog.open(CancelDialogComponent).afterClosed());
} }
......
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