From ab88d311f3f5cf0f8e29803f1eddb21c85c99d3b Mon Sep 17 00:00:00 2001 From: Livio Amstutz Date: Fri, 18 Jun 2021 10:12:40 +0200 Subject: [PATCH] fix: create label policy if not exists on font upload (#1898) --- .../private-labeling-policy.component.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 66594e6a9c..5ed19aace9 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 @@ -309,7 +309,7 @@ export class PrivateLabelingPolicyComponent implements OnDestroy { } private handleFontUploadPromise(task: Promise): Promise { - return task.then(() => { + const enhTask = task.then(() => { this.toast.showInfo('POLICY.TOAST.UPLOADSUCCESS', true); setTimeout(() => { this.getPreviewData().then(data => { @@ -319,6 +319,12 @@ export class PrivateLabelingPolicyComponent implements OnDestroy { }); }, 1000); }).catch(error => this.toast.showError(error)); + + if (this.serviceType === PolicyComponentServiceType.MGMT && ((this.previewData as LabelPolicy.AsObject).isDefault)) { + return this.savePolicy().then(() => enhTask); + } else { + return enhTask; + } } private handleUploadPromise(task: Promise): Promise {