diff --git a/smp-angular/src/app/common/services/sml-integration.service.ts b/smp-angular/src/app/common/services/sml-integration.service.ts index 2f3e36067206c234d3a92ba498bfb291e26d12ad..f0d693a3bb6ab63666cb4cf38a1bf61277e4aa9d 100644 --- a/smp-angular/src/app/common/services/sml-integration.service.ts +++ b/smp-angular/src/app/common/services/sml-integration.service.ts @@ -6,6 +6,7 @@ import {SmpConstants} from "../../smp.constants"; import {SecurityService} from "../../security/security.service"; import {User} from "../../security/user.model"; import {SMLResult} from "../model/sml-result.model"; +import {DomainRo} from "../model/domain-ro.model"; @Injectable() export class SmlIntegrationService { @@ -15,13 +16,17 @@ export class SmlIntegrationService { private securityService: SecurityService) { } - registerDomainToSML$(domainCode): Observable<SMLResult> { + registerDomainToSML$(domain: DomainRo): Observable<SMLResult> { const currentUser: User = this.securityService.getCurrentUser(); - return this.http.put<SMLResult>(`${SmpConstants.REST_INTERNAL_DOMAIN_MANAGE_DEPRECATED}/${currentUser.userId}/sml-register/${domainCode}`, {}); + return this.http.put<SMLResult>(SmpConstants.REST_INTERNAL_DOMAIN_SML_REGISTER + .replace(SmpConstants.PATH_PARAM_ENC_USER_ID, currentUser.userId) + .replace(SmpConstants.PATH_PARAM_ENC_DOMAIN_ID, domain.domainId), {}); } - unregisterDomainToSML$(domainCode): Observable<SMLResult> { + unregisterDomainToSML$(domain: DomainRo): Observable<SMLResult> { const currentUser: User = this.securityService.getCurrentUser(); - return this.http.put<SMLResult>(`${SmpConstants.REST_INTERNAL_DOMAIN_MANAGE_DEPRECATED}/${currentUser.userId}/sml-unregister/${domainCode}`, {}); + return this.http.put<SMLResult>(SmpConstants.REST_INTERNAL_DOMAIN_SML_UNREGISTER + .replace(SmpConstants.PATH_PARAM_ENC_USER_ID, currentUser.userId) + .replace(SmpConstants.PATH_PARAM_ENC_DOMAIN_ID, domain.domainId), {}); } } diff --git a/smp-angular/src/app/smp.constants.ts b/smp-angular/src/app/smp.constants.ts index a377c1173e7b4a2b41f2660c4ec3326dcb15c4c2..1cd984cfc84483aeb05915432bf6824e265bb58a 100644 --- a/smp-angular/src/app/smp.constants.ts +++ b/smp-angular/src/app/smp.constants.ts @@ -19,6 +19,8 @@ export class SmpConstants { public static readonly PATH_ACTION_UPDATE_RESOURCE_TYPES: string = 'update-resource-types'; public static readonly PATH_ACTION_UPDATE_SML_INTEGRATION: string = 'update-sml-integration-data'; public static readonly PATH_ACTION_GENERATE_DNS_QUERY: string = 'generate-dns-query'; + public static readonly PATH_ACTION_SML_REGISTER: string = 'sml-register'; + public static readonly PATH_ACTION_SML_UNREGISTER: string = 'sml-unregister'; /* URL variables */ public static readonly PATH_PARAM_ENC_USER_ID: string = '{user-id}'; public static readonly PATH_PARAM_ENC_DOMAIN_ID: string = '{domain-id}'; @@ -188,6 +190,11 @@ export class SmpConstants { public static readonly REST_INTERNAL_DOMAIN_MANAGE_CREATE = SmpConstants.REST_INTERNAL_DOMAIN_MANAGE + '/' + SmpConstants.PATH_ACTION_CREATE; + public static readonly REST_INTERNAL_DOMAIN_SML_REGISTER = SmpConstants.REST_INTERNAL_DOMAIN_MANAGE + + '/' + SmpConstants.PATH_PARAM_ENC_DOMAIN_ID + '/' + SmpConstants.PATH_ACTION_SML_REGISTER; + public static readonly REST_INTERNAL_DOMAIN_SML_UNREGISTER = SmpConstants.REST_INTERNAL_DOMAIN_MANAGE + + '/' + SmpConstants.PATH_PARAM_ENC_DOMAIN_ID + '/' + SmpConstants.PATH_ACTION_SML_UNREGISTER; + public static readonly REST_INTERNAL_DOMAIN_MANAGE_UPDATE_SML_INTEGRATION = SmpConstants.REST_INTERNAL_DOMAIN_MANAGE + '/' + SmpConstants.PATH_PARAM_ENC_DOMAIN_ID + '/' + SmpConstants.PATH_ACTION_UPDATE_SML_INTEGRATION; diff --git a/smp-angular/src/app/system-settings/admin-domain/domain-sml-panel/domain-sml-integration-panel.component.ts b/smp-angular/src/app/system-settings/admin-domain/domain-sml-panel/domain-sml-integration-panel.component.ts index fc1b7e508a321aadf297124508af8c6c891f70d3..4477384b121a22cce8c7fdbb9a3126d827858825 100644 --- a/smp-angular/src/app/system-settings/admin-domain/domain-sml-panel/domain-sml-integration-panel.component.ts +++ b/smp-angular/src/app/system-settings/admin-domain/domain-sml-panel/domain-sml-integration-panel.component.ts @@ -161,10 +161,8 @@ export class DomainSmlIntegrationPanelComponent implements BeforeLeaveGuard { } if (!this._domain.smlClientKeyAlias ) { - console.log("enableSMLRegister 4") return false; } - console.log("enableSMLRegister 5") // entity must be first persisted in order to be enabled to register to SML return !this._domain.smlRegistered; } @@ -222,10 +220,7 @@ export class DomainSmlIntegrationPanelComponent implements BeforeLeaveGuard { } smlRegisterDomain(domain: DomainRo) { - //this.searchTable.showSpinner = true; - - this.smlIntegrationService.registerDomainToSML$(domain.domainCode).toPromise().then(async (res: SMLResult) => { - // this.searchTable.showSpinner = false; + this.smlIntegrationService.registerDomainToSML$(domain).toPromise().then(async (res: SMLResult) => { if (res) { if (res.success) { this.alertService.success(await lastValueFrom(this.translateService.get("domain.sml.integration.panel.success.register", {domainCode: domain.domainCode}))); @@ -243,16 +238,14 @@ export class DomainSmlIntegrationPanelComponent implements BeforeLeaveGuard { if (this.httpErrorHandlerService.logoutOnInvalidSessionError(err)) { return; } - // this.searchTable.showSpinner = false; this.alertService.exception(await lastValueFrom(this.translateService.get("domain.sml.integration.panel.error.register", {domainCode: domain.domainCode})), err); } ) } smlUnregisterDomain(domain: DomainRo) { - // this.searchTable.showSpinner = true; - this.smlIntegrationService.unregisterDomainToSML$(domain.domainCode).toPromise().then(async (res: SMLResult) => { - // this.searchTable.showSpinner = false; + + this.smlIntegrationService.unregisterDomainToSML$(domain).toPromise().then(async (res: SMLResult) => { if (res) { if (res.success) { this.alertService.success(await lastValueFrom(this.translateService.get("domain.sml.integration.panel.success.unregister", {domainCode: domain.domainCode}))); @@ -271,7 +264,6 @@ export class DomainSmlIntegrationPanelComponent implements BeforeLeaveGuard { if (this.httpErrorHandlerService.logoutOnInvalidSessionError(err)) { return; } - // this.searchTable.showSpinner = false; this.alertService.exception(await lastValueFrom(this.translateService.get("domain.sml.integration.panel.error.unregister", {domainCode: domain.domainCode})), err); } )