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

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

Pull request #208: Fix the domain refresh issue

Merge in EDELIVERY/smp from bugfix/EDELIVERY-9337-page-is-not-getting-refreshing-immediately to development

* commit '694058205ad99afd8fe117d481fd2c263c598cc3':
  Fix the domain refresh issue
parents 3475eeff 4be507ad
No related branches found
No related tags found
No related merge requests found
......@@ -66,6 +66,7 @@
<jackson.version>2.13.2</jackson.version>
<javaee-api.version>7.0</javaee-api.version>
<javax.annotation.version>1.3.2</javax.annotation.version>
<javax.mail.version>1.6.2</javax.mail.version>
<jaxb.version>2.2.11</jaxb.version>
<jaxb2-basics.version>1.11.1</jaxb2-basics.version>
<jstl.version>1.2</jstl.version>
......@@ -388,7 +389,7 @@
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.6.2</version>
<version>${javax.mail.version}</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
......
import {AfterViewInit, Component, OnInit, TemplateRef, ViewChild} from '@angular/core';
import {AfterViewInit, Component, TemplateRef, ViewChild} from '@angular/core';
import {ColumnPicker} from '../common/column-picker/column-picker.model';
import {MatDialog, MatDialogRef} from '@angular/material/dialog';
......@@ -14,7 +14,6 @@ import {ConfirmationDialogComponent} from "../common/confirmation-dialog/confirm
import {SearchTableEntityStatus} from "../common/search-table/search-table-entity-status.model";
import {KeystoreEditDialogComponent} from "./keystore-edit-dialog/keystore-edit-dialog.component";
import {SmpInfoService} from "../app-info/smp-info.service";
import {SmpInfo} from "../app-info/smp-info.model";
import {SmlIntegrationService} from "./sml-integration.service";
import {SMLResult} from "./sml-result.model";
......@@ -36,8 +35,6 @@ export class DomainComponent implements AfterViewInit {
columnPicker: ColumnPicker = new ColumnPicker();
domainController: DomainController;
filter: any = {};
isSMPIntegrationOn: boolean = false;
constructor(public securityService: SecurityService,
protected smpInfoService: SmpInfoService,
......@@ -48,11 +45,8 @@ export class DomainComponent implements AfterViewInit {
public dialog: MatDialog) {
// check application settings
this.isSMPIntegrationOn = this.lookups.cachedApplicationConfig.smlIntegrationOn
// if system admin refresh certificate list!
if (this.securityService.isCurrentUserSystemAdmin()) {
this.lookups.refreshCertificateLookup();
}
}
ngAfterViewInit() {
......@@ -112,6 +106,12 @@ export class DomainComponent implements AfterViewInit {
];
this.searchTable.tableColumnInit();
this.columnPicker.selectedColumns = this.columnPicker.allColumns.filter(col => col.showInitially);
// if system admin refresh certificate list!
if (this.securityService.isCurrentUserSystemAdmin()) {
this.lookups.refreshCertificateLookup();
}
}
certificateAliasExists(alias: string): boolean {
......@@ -146,14 +146,15 @@ export class DomainComponent implements AfterViewInit {
return 'deleted';
}
}
getDomainConfigurationWarning(domain: DomainRo) {
let msg =null;
let msg = null;
if (!domain.signatureKeyAlias) {
msg = "The domain should have a defined signature CertAlias."
}
if (this.lookups.cachedApplicationConfig.smlIntegrationOn) {
if( !domain.smlSmpId || !domain.smlClientCertHeader){
msg = (!msg?"": msg+" ") + "For SML integration the SMP SMP ID and SML client certificate must be defined!"
if (!domain.smlSmpId || !domain.smlClientCertHeader) {
msg = (!msg ? "" : msg + " ") + "For SML integration the SMP SMP ID and SML client certificate must be defined!"
}
}
return msg;
......@@ -167,6 +168,9 @@ export class DomainComponent implements AfterViewInit {
isDirty(): boolean {
return this.searchTable.isDirty();
}
get isSMPIntegrationOn(){
return this.lookups.cachedApplicationConfig?.smlIntegrationOn
}
enableSMLRegister(): boolean {
if (!this.selectedOneRow || !this.isSMPIntegrationOn) {
......@@ -189,7 +193,7 @@ export class DomainComponent implements AfterViewInit {
}
enableSMLUnregister(): boolean {
if ( !this.selectedOneRow || !this.isSMPIntegrationOn) {
if (!this.selectedOneRow || !this.isSMPIntegrationOn) {
return false;
}
let domainRo = (this.searchTable.selected[0] as DomainRo);
......@@ -209,7 +213,7 @@ export class DomainComponent implements AfterViewInit {
return domainRo.smlRegistered;
}
get selectedOneRow() : boolean{
get selectedOneRow(): boolean {
return this.searchTable?.selected.length === 1
}
......@@ -252,9 +256,9 @@ export class DomainComponent implements AfterViewInit {
}
smlRegisterDomain(domain: DomainRo) {
this.searchTable.showSpinner=true;
this.searchTable.showSpinner = true;
this.smlIntegrationService.registerDomainToSML$(domain.domainCode).toPromise().then((res: SMLResult) => {
this.searchTable.showSpinner=false;
this.searchTable.showSpinner = false;
if (res) {
if (res.success) {
this.alertService.success("Domain " + domain.domainCode + " registered to sml!");
......@@ -268,16 +272,16 @@ export class DomainComponent implements AfterViewInit {
}
},
err => {
this.searchTable.showSpinner=false;
this.searchTable.showSpinner = false;
this.alertService.exception('Error occurred while registering domain:' + domain.domainCode, err);
}
)
}
smlUnregisterDomain(domain: DomainRo) {
this.searchTable.showSpinner=true;
this.searchTable.showSpinner = true;
this.smlIntegrationService.unregisterDomainToSML$(domain.domainCode).toPromise().then((res: SMLResult) => {
this.searchTable.showSpinner=false;
this.searchTable.showSpinner = false;
if (res) {
if (res.success) {
this.alertService.success("Domain " + domain.domainCode + " unregistered from sml!");
......@@ -292,7 +296,7 @@ export class DomainComponent implements AfterViewInit {
}
,
err => {
this.searchTable.showSpinner=false;
this.searchTable.showSpinner = false;
this.alertService.exception('Error occurred while unregistering domain:' + domain.domainCode, err);
}
)
......
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