mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-22 23:56:00 +00:00
show license - better UX
This commit is contained in:
@@ -266,9 +266,13 @@ async function callCloudApiPost(endpoint, body, signinHolder = null) {
|
|||||||
},
|
},
|
||||||
validateStatus: status => status < 500,
|
validateStatus: status => status < 500,
|
||||||
});
|
});
|
||||||
const { errorMessage, isLicenseLimit } = resp.data;
|
const { errorMessage, isLicenseLimit, limitedLicenseLimits } = resp.data;
|
||||||
if (errorMessage) {
|
if (errorMessage) {
|
||||||
return { apiErrorMessage: errorMessage, apiErrorIsLicenseLimit: isLicenseLimit };
|
return {
|
||||||
|
apiErrorMessage: errorMessage,
|
||||||
|
apiErrorIsLicenseLimit: isLicenseLimit,
|
||||||
|
apiErrorLimitedLicenseLimits: limitedLicenseLimits,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
return resp.data;
|
return resp.data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,17 +3,14 @@
|
|||||||
import FormProvider from '../forms/FormProvider.svelte';
|
import FormProvider from '../forms/FormProvider.svelte';
|
||||||
import FormSubmit from '../forms/FormSubmit.svelte';
|
import FormSubmit from '../forms/FormSubmit.svelte';
|
||||||
import FontIcon from '../icons/FontIcon.svelte';
|
import FontIcon from '../icons/FontIcon.svelte';
|
||||||
|
import { isProApp } from '../utility/proTools';
|
||||||
import { openWebLink } from '../utility/simpleTools';
|
import { openWebLink } from '../utility/simpleTools';
|
||||||
|
|
||||||
import ModalBase from './ModalBase.svelte';
|
import ModalBase from './ModalBase.svelte';
|
||||||
import { closeCurrentModal } from './modalTools';
|
import { closeCurrentModal } from './modalTools';
|
||||||
|
|
||||||
export let message;
|
export let message;
|
||||||
|
export let licenseLimits;
|
||||||
function handlePurchase() {
|
|
||||||
closeCurrentModal();
|
|
||||||
openWebLink('https://dbgate.io/purchase/premium/', '_blank');
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<FormProvider>
|
<FormProvider>
|
||||||
@@ -31,20 +28,32 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
This is a limitation of the free version of DbGate. To continue using cloud operations, please purchase DbGate
|
This is a limitation of the free version of DbGate. To continue using cloud operations, please {#if !isProApp()}download
|
||||||
Premium.
|
and{/if} purchase DbGate Premium.
|
||||||
</p>
|
</p>
|
||||||
<p>Free version limit:</p>
|
<p>Free version limit:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>max 5 connections</li>
|
{#each licenseLimits || [] as limit}
|
||||||
<li>plus max 5 files</li>
|
<li>{limit}</li>
|
||||||
|
{/each}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div slot="footer">
|
<div slot="footer">
|
||||||
<FormSubmit value="Close" on:click={closeCurrentModal} data-testid="LicenseLimitMessageModal_closeButton" />
|
<FormSubmit value="Close" on:click={closeCurrentModal} data-testid="LicenseLimitMessageModal_closeButton" />
|
||||||
<FormStyledButton value="Purchase DbGate Premium" on:click={handlePurchase} skipWidth />
|
{#if !isProApp()}
|
||||||
|
<FormStyledButton
|
||||||
|
value="Download DbGate Premium"
|
||||||
|
on:click={() => openWebLink('https://dbgate.io/download/')}
|
||||||
|
skipWidth
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
|
<FormStyledButton
|
||||||
|
value="Purchase DbGate Premium"
|
||||||
|
on:click={() => openWebLink('https://dbgate.io/purchase/premium/')}
|
||||||
|
skipWidth
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</ModalBase>
|
</ModalBase>
|
||||||
</FormProvider>
|
</FormProvider>
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ async function processApiResponse(route, args, resp) {
|
|||||||
if (resp?.apiErrorIsLicenseLimit) {
|
if (resp?.apiErrorIsLicenseLimit) {
|
||||||
showModal(LicenseLimitMessageModal, {
|
showModal(LicenseLimitMessageModal, {
|
||||||
message: resp.apiErrorMessage,
|
message: resp.apiErrorMessage,
|
||||||
|
licenseLimits: resp.apiErrorLimitedLicenseLimits,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
showSnackbarError('API error:' + resp?.apiErrorMessage);
|
showSnackbarError('API error:' + resp?.apiErrorMessage);
|
||||||
|
|||||||
Reference in New Issue
Block a user