diff --git a/console/src/app/modules/policies/private-labeling-policy/private-labeling-policy.component.html b/console/src/app/modules/policies/private-labeling-policy/private-labeling-policy.component.html
index 66f399683..df1c094e3 100644
--- a/console/src/app/modules/policies/private-labeling-policy/private-labeling-policy.component.html
+++ b/console/src/app/modules/policies/private-labeling-policy/private-labeling-policy.component.html
@@ -259,7 +259,7 @@
+ [(ngModel)]="previewData.disableWatermark" (change)="savePolicy()">
{{'POLICY.DATA.DISABLEWATERMARK' | translate}}
diff --git a/console/src/app/modules/policies/private-labeling-policy/private-labeling-policy.component.ts b/console/src/app/modules/policies/private-labeling-policy/private-labeling-policy.component.ts
index bf729b7ed..f1134e0fc 100644
--- a/console/src/app/modules/policies/private-labeling-policy/private-labeling-policy.component.ts
+++ b/console/src/app/modules/policies/private-labeling-policy/private-labeling-policy.component.ts
@@ -354,8 +354,6 @@ export class PrivateLabelingPolicyComponent implements OnDestroy {
this.authService.canUseFeature(['label_policy.private_label']).pipe(take(1)).subscribe((canUse) => {
this.getPreviewData().then(data => {
- console.log('preview', data);
-
if (data.policy) {
this.previewData = data.policy;
this.loading = false;
@@ -371,8 +369,6 @@ export class PrivateLabelingPolicyComponent implements OnDestroy {
});
this.getData().then(data => {
- console.log('data', data);
-
if (data.policy) {
this.data = data.policy;
this.loading = false;
@@ -506,7 +502,6 @@ export class PrivateLabelingPolicyComponent implements OnDestroy {
private loadAsset(imagekey: string, url: string): Promise {
return this.assetService.load(`${url}`, this.org.id).then(data => {
- console.log(data);
const objectURL = URL.createObjectURL(data);
this.images[imagekey] = this.sanitizer.bypassSecurityTrustUrl(objectURL);
this.refreshPreview.emit();
@@ -529,6 +524,18 @@ export class PrivateLabelingPolicyComponent implements OnDestroy {
}
public savePolicy(): Promise {
+ const reloadPolicy = () => {
+ setTimeout(() => {
+ this.loadingImages = true;
+ this.getData().then(data => {
+
+ if (data.policy) {
+ this.data = data.policy;
+ this.loadImages();
+ }
+ });
+ }, 500);
+ };
switch (this.serviceType) {
case PolicyComponentServiceType.MGMT:
if ((this.previewData as LabelPolicy.AsObject).isDefault) {
@@ -537,6 +544,8 @@ export class PrivateLabelingPolicyComponent implements OnDestroy {
return (this.service as ManagementService).addCustomLabelPolicy(req0).then(() => {
this.toast.showInfo('POLICY.TOAST.SET', true);
+
+ reloadPolicy();
}).catch((error: HttpErrorResponse) => {
this.toast.showError(error);
});
@@ -546,6 +555,8 @@ export class PrivateLabelingPolicyComponent implements OnDestroy {
return (this.service as ManagementService).updateCustomLabelPolicy(req1).then(() => {
this.toast.showInfo('POLICY.TOAST.SET', true);
+
+ reloadPolicy();
}).catch(error => {
this.toast.showError(error);
});
@@ -554,6 +565,7 @@ export class PrivateLabelingPolicyComponent implements OnDestroy {
const req = new UpdateLabelPolicyRequest();
this.overwriteValues(req);
return (this.service as AdminService).updateLabelPolicy(req).then(() => {
+ reloadPolicy();
this.toast.showInfo('POLICY.TOAST.SET', true);
}).catch(error => {
this.toast.showError(error);
@@ -561,42 +573,6 @@ export class PrivateLabelingPolicyComponent implements OnDestroy {
}
}
- public saveWatermark(): void {
- switch (this.serviceType) {
- case PolicyComponentServiceType.MGMT:
- if ((this.previewData as LabelPolicy.AsObject).isDefault) {
- const req0 = new AddCustomLabelPolicyRequest();
- req0.setDisableWatermark(this.previewData.disableWatermark);
-
- (this.service as ManagementService).addCustomLabelPolicy(req0).then(() => {
- this.toast.showInfo('POLICY.TOAST.SET', true);
- }).catch((error: HttpErrorResponse) => {
- this.toast.showError(error);
- });
- } else {
- const req1 = new UpdateCustomLabelPolicyRequest();
- req1.setDisableWatermark(this.previewData.disableWatermark);
-
- (this.service as ManagementService).updateCustomLabelPolicy(req1).then(() => {
- this.toast.showInfo('POLICY.TOAST.SET', true);
- }).catch(error => {
- this.toast.showError(error);
- });
- }
- break;
- case PolicyComponentServiceType.ADMIN:
- const req = new UpdateLabelPolicyRequest();
- req.setDisableWatermark(this.data.disableWatermark);
-
- (this.service as AdminService).updateLabelPolicy(req).then(() => {
- this.toast.showInfo('POLICY.TOAST.SET', true);
- }).catch(error => {
- this.toast.showError(error);
- });
- break;
- }
- }
-
public get isDefault(): boolean {
if (this.previewData && this.serviceType === PolicyComponentServiceType.MGMT) {
return (this.previewData as LabelPolicy.AsObject).isDefault;