From e836fa3d3811837511ccb3bcc62c4de84ce0194d Mon Sep 17 00:00:00 2001
From: "SPRINX0\\prochazka"
Date: Thu, 29 May 2025 12:44:31 +0200
Subject: [PATCH] show license - better UX
---
packages/api/src/utility/cloudIntf.js | 8 +++--
.../modals/LicenseLimitMessageModal.svelte | 29 ++++++++++++-------
packages/web/src/utility/api.ts | 1 +
3 files changed, 26 insertions(+), 12 deletions(-)
diff --git a/packages/api/src/utility/cloudIntf.js b/packages/api/src/utility/cloudIntf.js
index 78d28a53a..329a55fc0 100644
--- a/packages/api/src/utility/cloudIntf.js
+++ b/packages/api/src/utility/cloudIntf.js
@@ -266,9 +266,13 @@ async function callCloudApiPost(endpoint, body, signinHolder = null) {
},
validateStatus: status => status < 500,
});
- const { errorMessage, isLicenseLimit } = resp.data;
+ const { errorMessage, isLicenseLimit, limitedLicenseLimits } = resp.data;
if (errorMessage) {
- return { apiErrorMessage: errorMessage, apiErrorIsLicenseLimit: isLicenseLimit };
+ return {
+ apiErrorMessage: errorMessage,
+ apiErrorIsLicenseLimit: isLicenseLimit,
+ apiErrorLimitedLicenseLimits: limitedLicenseLimits,
+ };
}
return resp.data;
}
diff --git a/packages/web/src/modals/LicenseLimitMessageModal.svelte b/packages/web/src/modals/LicenseLimitMessageModal.svelte
index 624b632b5..4121159cc 100644
--- a/packages/web/src/modals/LicenseLimitMessageModal.svelte
+++ b/packages/web/src/modals/LicenseLimitMessageModal.svelte
@@ -3,17 +3,14 @@
import FormProvider from '../forms/FormProvider.svelte';
import FormSubmit from '../forms/FormSubmit.svelte';
import FontIcon from '../icons/FontIcon.svelte';
+ import { isProApp } from '../utility/proTools';
import { openWebLink } from '../utility/simpleTools';
import ModalBase from './ModalBase.svelte';
import { closeCurrentModal } from './modalTools';
export let message;
-
- function handlePurchase() {
- closeCurrentModal();
- openWebLink('https://dbgate.io/purchase/premium/', '_blank');
- }
+ export let licenseLimits;
@@ -31,20 +28,32 @@
- This is a limitation of the free version of DbGate. To continue using cloud operations, please purchase DbGate
- Premium.
+ This is a limitation of the free version of DbGate. To continue using cloud operations, please {#if !isProApp()}download
+ and{/if} purchase DbGate Premium.
Free version limit:
- - max 5 connections
- - plus max 5 files
+ {#each licenseLimits || [] as limit}
+ - {limit}
+ {/each}
-
+ {#if !isProApp()}
+ openWebLink('https://dbgate.io/download/')}
+ skipWidth
+ />
+ {/if}
+ openWebLink('https://dbgate.io/purchase/premium/')}
+ skipWidth
+ />
diff --git a/packages/web/src/utility/api.ts b/packages/web/src/utility/api.ts
index 96b88c060..043699ff0 100644
--- a/packages/web/src/utility/api.ts
+++ b/packages/web/src/utility/api.ts
@@ -125,6 +125,7 @@ async function processApiResponse(route, args, resp) {
if (resp?.apiErrorIsLicenseLimit) {
showModal(LicenseLimitMessageModal, {
message: resp.apiErrorMessage,
+ licenseLimits: resp.apiErrorLimitedLicenseLimits,
});
} else {
showSnackbarError('API error:' + resp?.apiErrorMessage);