mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-17 23:45:59 +00:00
SYNC: disabled messages in new object modal
This commit is contained in:
committed by
Diflow
parent
d19851fc0c
commit
dcba319071
@@ -1,16 +1,30 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import FontIcon from '../icons/FontIcon.svelte';
|
import FontIcon from '../icons/FontIcon.svelte';
|
||||||
|
import { isProApp } from '../utility/proTools';
|
||||||
|
|
||||||
export let icon;
|
export let icon;
|
||||||
export let title;
|
export let title;
|
||||||
export let description;
|
export let description;
|
||||||
export let enabled;
|
export let enabled;
|
||||||
export let colorClass;
|
export let colorClass;
|
||||||
|
export let disabledMessage = undefined;
|
||||||
|
export let isProFeature;
|
||||||
|
|
||||||
$: disabled = !enabled;
|
$: disabled = !enabled;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="new-object-button" on:click class:enabled class:disabled data-testid={$$props['data-testid']}>
|
<div
|
||||||
|
class="new-object-button"
|
||||||
|
on:click
|
||||||
|
class:enabled
|
||||||
|
class:disabled
|
||||||
|
data-testid={$$props['data-testid']}
|
||||||
|
title={disabled
|
||||||
|
? isProFeature && !isProApp()
|
||||||
|
? 'This feature is available only in DbGate Premium'
|
||||||
|
: disabledMessage
|
||||||
|
: undefined}
|
||||||
|
>
|
||||||
<div class="icon">
|
<div class="icon">
|
||||||
<FontIcon {icon} colorClass={enabled ? colorClass : null} />
|
<FontIcon {icon} colorClass={enabled ? colorClass : null} />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import runCommand from '../commands/runCommand';
|
import runCommand from '../commands/runCommand';
|
||||||
import newQuery from '../query/newQuery';
|
import newQuery from '../query/newQuery';
|
||||||
import { commandsCustomized, selectedWidget } from '../stores';
|
import { commandsCustomized, selectedWidget } from '../stores';
|
||||||
|
import { isProApp } from '../utility/proTools';
|
||||||
import ModalBase from './ModalBase.svelte';
|
import ModalBase from './ModalBase.svelte';
|
||||||
import { closeCurrentModal } from './modalTools';
|
import { closeCurrentModal } from './modalTools';
|
||||||
|
|
||||||
@@ -27,6 +28,7 @@
|
|||||||
command: 'new.connection',
|
command: 'new.connection',
|
||||||
changeWidget: 'database',
|
changeWidget: 'database',
|
||||||
testid: 'NewObjectModal_connection',
|
testid: 'NewObjectModal_connection',
|
||||||
|
disabledMessage: 'You are not allowed to create new connections',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: 'icon cloud-connection',
|
icon: 'icon cloud-connection',
|
||||||
@@ -36,6 +38,7 @@
|
|||||||
command: 'new.connectionOnCloud',
|
command: 'new.connectionOnCloud',
|
||||||
changeWidget: 'cloud-private',
|
changeWidget: 'cloud-private',
|
||||||
testid: 'NewObjectModal_connectionOnCloud',
|
testid: 'NewObjectModal_connectionOnCloud',
|
||||||
|
disabledMessage: 'For creating connections on DbGate Cloud, you need to be logged in',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: 'icon query-design',
|
icon: 'icon query-design',
|
||||||
@@ -44,6 +47,8 @@
|
|||||||
description: 'Design SQL queries visually',
|
description: 'Design SQL queries visually',
|
||||||
command: 'new.queryDesign',
|
command: 'new.queryDesign',
|
||||||
testid: 'NewObjectModal_queryDesign',
|
testid: 'NewObjectModal_queryDesign',
|
||||||
|
disabledMessage: 'Query Designer is not available for current database',
|
||||||
|
isProFeature: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: 'icon diagram',
|
icon: 'icon diagram',
|
||||||
@@ -52,6 +57,7 @@
|
|||||||
description: 'Visualize database structure',
|
description: 'Visualize database structure',
|
||||||
command: 'new.diagram',
|
command: 'new.diagram',
|
||||||
testid: 'NewObjectModal_diagram',
|
testid: 'NewObjectModal_diagram',
|
||||||
|
disabledMessage: 'ER Diagram is not available for current database',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: 'icon perspective',
|
icon: 'icon perspective',
|
||||||
@@ -68,6 +74,7 @@
|
|||||||
description: 'Create table in the current database',
|
description: 'Create table in the current database',
|
||||||
command: 'new.table',
|
command: 'new.table',
|
||||||
testid: 'NewObjectModal_table',
|
testid: 'NewObjectModal_table',
|
||||||
|
disabledMessage: 'Table creation is not available for current database',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: 'icon sql-generator',
|
icon: 'icon sql-generator',
|
||||||
@@ -76,6 +83,7 @@
|
|||||||
description: 'Generate SQL scripts for database objects',
|
description: 'Generate SQL scripts for database objects',
|
||||||
command: 'sql.generator',
|
command: 'sql.generator',
|
||||||
testid: 'NewObjectModal_sqlGenerator',
|
testid: 'NewObjectModal_sqlGenerator',
|
||||||
|
disabledMessage: 'SQL Generator is not available for current database',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: 'icon export',
|
icon: 'icon export',
|
||||||
@@ -84,6 +92,7 @@
|
|||||||
description: 'Export to file like CSV, JSON, Excel, or other DB',
|
description: 'Export to file like CSV, JSON, Excel, or other DB',
|
||||||
command: 'database.export',
|
command: 'database.export',
|
||||||
testid: 'NewObjectModal_databaseExport',
|
testid: 'NewObjectModal_databaseExport',
|
||||||
|
disabledMessage: 'Export is not available for current database',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: 'icon compare',
|
icon: 'icon compare',
|
||||||
@@ -92,6 +101,7 @@
|
|||||||
description: 'Compare database schemas',
|
description: 'Compare database schemas',
|
||||||
command: 'database.compare',
|
command: 'database.compare',
|
||||||
testid: 'NewObjectModal_databaseCompare',
|
testid: 'NewObjectModal_databaseCompare',
|
||||||
|
disabledMessage: 'Database comparison is not available for current database',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
</script>
|
</script>
|
||||||
@@ -108,6 +118,8 @@
|
|||||||
{enabled}
|
{enabled}
|
||||||
colorClass={item.colorClass}
|
colorClass={item.colorClass}
|
||||||
data-testid={item.testid}
|
data-testid={item.testid}
|
||||||
|
disabledMessage={item.disabledMessage}
|
||||||
|
isProFeature={item.isProFeature}
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
if (!enabled) return;
|
if (!enabled) return;
|
||||||
closeCurrentModal();
|
closeCurrentModal();
|
||||||
|
|||||||
Reference in New Issue
Block a user