mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-02 00:54:00 +00:00
SYNC: settings permissions
This commit is contained in:
committed by
Diflow
parent
3ca514c85b
commit
8ced6aa205
@@ -70,7 +70,7 @@ registerCommand({
|
|||||||
category: 'Theme',
|
category: 'Theme',
|
||||||
name: 'Change',
|
name: 'Change',
|
||||||
toolbarName: 'Change theme',
|
toolbarName: 'Change theme',
|
||||||
onClick: () => showModal(SettingsModal, { selectedTab: 2 }),
|
onClick: () => showModal(SettingsModal, { selectedTab: 'theme' }),
|
||||||
// getSubCommands: () => get(extensions).themes.map(themeCommand),
|
// getSubCommands: () => get(extensions).themes.map(themeCommand),
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -692,8 +692,8 @@ if (isProApp()) {
|
|||||||
icon: 'icon compare',
|
icon: 'icon compare',
|
||||||
testEnabled: () =>
|
testEnabled: () =>
|
||||||
getCurrentDatabase() != null &&
|
getCurrentDatabase() != null &&
|
||||||
findEngineDriver(getCurrentDatabase()?.connection, getExtensions())?.databaseEngineTypes?.includes('sql')
|
findEngineDriver(getCurrentDatabase()?.connection, getExtensions())?.databaseEngineTypes?.includes('sql') &&
|
||||||
&& hasPermission(`dbops/export`),
|
hasPermission(`dbops/export`),
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
openNewTab(
|
openNewTab(
|
||||||
{
|
{
|
||||||
@@ -754,6 +754,7 @@ if (hasPermission('settings/change')) {
|
|||||||
props: {},
|
props: {},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
testEnabled: () => hasPermission('settings/change'),
|
||||||
});
|
});
|
||||||
|
|
||||||
registerCommand({
|
registerCommand({
|
||||||
@@ -762,6 +763,7 @@ if (hasPermission('settings/change')) {
|
|||||||
name: 'Change',
|
name: 'Change',
|
||||||
toolbarName: 'Settings',
|
toolbarName: 'Settings',
|
||||||
onClick: () => showModal(SettingsModal),
|
onClick: () => showModal(SettingsModal),
|
||||||
|
testEnabled: () => hasPermission('settings/change'),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,10 +8,11 @@
|
|||||||
component?: any;
|
component?: any;
|
||||||
props?: any;
|
props?: any;
|
||||||
testid?: string;
|
testid?: string;
|
||||||
|
identifier?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export let tabs: TabDef[];
|
export let tabs: TabDef[];
|
||||||
export let value = 0;
|
export let value: string | number = 0;
|
||||||
export let menu = null;
|
export let menu = null;
|
||||||
export let isInline = false;
|
export let isInline = false;
|
||||||
export let containerMaxWidth = undefined;
|
export let containerMaxWidth = undefined;
|
||||||
@@ -36,10 +37,10 @@
|
|||||||
{#each _.compact(tabs) as tab, index}
|
{#each _.compact(tabs) as tab, index}
|
||||||
<div
|
<div
|
||||||
class="tab-item"
|
class="tab-item"
|
||||||
class:selected={value == index}
|
class:selected={value == (tab.identifier ?? index)}
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
value = index;
|
value = tab.identifier ?? index;
|
||||||
onUserChange?.(index);
|
onUserChange?.(tab.identifier ?? index);
|
||||||
}}
|
}}
|
||||||
data-testid={tab.testid}
|
data-testid={tab.testid}
|
||||||
>
|
>
|
||||||
@@ -60,14 +61,14 @@
|
|||||||
class:flexColContainer
|
class:flexColContainer
|
||||||
class:maxHeight100
|
class:maxHeight100
|
||||||
class:isInline
|
class:isInline
|
||||||
class:tabVisible={index == value}
|
class:tabVisible={(tab.identifier ?? index) == value}
|
||||||
style:max-width={containerMaxWidth}
|
style:max-width={containerMaxWidth}
|
||||||
>
|
>
|
||||||
<svelte:component
|
<svelte:component
|
||||||
this={tab.component}
|
this={tab.component}
|
||||||
{...tab.props}
|
{...tab.props}
|
||||||
tabVisible={index == value}
|
tabVisible={(tab.identifier ?? index) == value}
|
||||||
tabControlHiddenTab={index != value}
|
tabControlHiddenTab={(tab.identifier ?? index) != value}
|
||||||
/>
|
/>
|
||||||
{#if tab.slot != null}
|
{#if tab.slot != null}
|
||||||
{#if tab.slot == 0}<slot name="0" />
|
{#if tab.slot == 0}<slot name="0" />
|
||||||
|
|||||||
@@ -41,15 +41,14 @@
|
|||||||
import { derived } from 'svelte/store';
|
import { derived } from 'svelte/store';
|
||||||
import { safeFormatDate } from 'dbgate-tools';
|
import { safeFormatDate } from 'dbgate-tools';
|
||||||
import FormDefaultActionField from './FormDefaultActionField.svelte';
|
import FormDefaultActionField from './FormDefaultActionField.svelte';
|
||||||
import { _t, getSelectedLanguage } from '../translations';
|
import { _t } from '../translations';
|
||||||
import { internalRedirectTo } from '../clientAuth';
|
import hasPermission from '../utility/hasPermission';
|
||||||
import ConfirmModal from '../modals/ConfirmModal.svelte';
|
|
||||||
|
|
||||||
const electron = getElectron();
|
const electron = getElectron();
|
||||||
let restartWarning = false;
|
let restartWarning = false;
|
||||||
let licenseKeyCheckResult = null;
|
let licenseKeyCheckResult = null;
|
||||||
|
|
||||||
export let selectedTab = 0;
|
export let selectedTab = 'general';
|
||||||
|
|
||||||
const sqlPreview = `-- example query
|
const sqlPreview = `-- example query
|
||||||
SELECT
|
SELECT
|
||||||
@@ -100,14 +99,14 @@ ORDER BY
|
|||||||
bind:value={selectedTab}
|
bind:value={selectedTab}
|
||||||
isInline
|
isInline
|
||||||
tabs={[
|
tabs={[
|
||||||
{ label: 'General', slot: 1 },
|
hasPermission('settings/change') && { identifier: 'general', label: 'General', slot: 1 },
|
||||||
isProApp() && electron && { label: 'License', slot: 7 },
|
isProApp() && electron && { identifier: 'license', label: 'License', slot: 7 },
|
||||||
{ label: 'Connection', slot: 2 },
|
hasPermission('settings/change') && { identifier: 'connection', label: 'Connection', slot: 2 },
|
||||||
{ label: 'Themes', slot: 3 },
|
{ identifier: 'theme', label: 'Themes', slot: 3 },
|
||||||
{ label: 'Default Actions', slot: 4 },
|
hasPermission('settings/change') && { identifier: 'default-actions', label: 'Default Actions', slot: 4 },
|
||||||
{ label: 'Behaviour', slot: 5 },
|
hasPermission('settings/change') && { identifier: 'behaviour', label: 'Behaviour', slot: 5 },
|
||||||
{ label: 'External tools', slot: 8 },
|
hasPermission('settings/change') && { identifier: 'external-tools', label: 'External tools', slot: 8 },
|
||||||
{ label: 'Other', slot: 6 },
|
hasPermission('settings/change') && { identifier: 'other', label: 'Other', slot: 6 },
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<svelte:fragment slot="1">
|
<svelte:fragment slot="1">
|
||||||
|
|||||||
@@ -107,9 +107,9 @@
|
|||||||
const left = rect.right;
|
const left = rect.right;
|
||||||
const top = rect.bottom;
|
const top = rect.bottom;
|
||||||
const items = [
|
const items = [
|
||||||
{ command: 'settings.show' },
|
hasPermission('settings/change') && { command: 'settings.show' },
|
||||||
{ command: 'theme.changeTheme' },
|
{ command: 'theme.changeTheme' },
|
||||||
{ command: 'settings.commands' },
|
hasPermission('settings/change') && { command: 'settings.commands' },
|
||||||
hasPermission('widgets/app') && {
|
hasPermission('widgets/app') && {
|
||||||
text: 'View applications',
|
text: 'View applications',
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user