dbeaver/pro#10061 disable default profile deletion (#4526)

Co-authored-by: Evgenia <139753579+EvgeniaBzzz@users.noreply.github.com>
This commit is contained in:
alex
2026-08-06 10:59:16 +02:00
committed by GitHub
co-authored by Evgenia
parent ad26e0e849
commit 5170fa7dfc
7 changed files with 31 additions and 4 deletions
@@ -55,7 +55,7 @@ export const AIProfilesPanel = observer<Props>(function AIProfilesPanel({ formSt
const profiles = profilesLoader.data.filter(isDefined);
const defaultProfileId = settingsInfoPart.initialState.defaultConfiguration;
const selection = useTableSelection(profiles.map(p => p.id));
const selection = useTableSelection(profiles.filter(p => p.id !== defaultProfileId).map(p => p.id));
const table = useAIProfilesTable(selection);
return (
@@ -51,8 +51,16 @@ export const AIProfilesTable = observer<Props>(function AIProfilesTable({ profil
return null;
}
const isDefault = profile.id === defaultProfileId;
if (column.key === SELECT_COLUMN.key) {
return <TableRowSelect id={profile.id} />;
return (
<TableRowSelect
id={profile.id}
disabled={isDefault}
title={isDefault ? translate('plugin_ai_administration_profile_default_delete_info') : undefined}
/>
);
}
if (column.key === NAME_COLUMN.key) {
@@ -65,7 +73,7 @@ export const AIProfilesTable = observer<Props>(function AIProfilesTable({ profil
onClick={() => aiProfileFormService.open(profile.id, profile.name)}
>
<Link truncate>{profile.name}</Link>
{profile.id === defaultProfileId && (
{isDefault && (
<span className="tw:text-xs tw:opacity-60 tw:whitespace-nowrap">{translate('plugin_ai_administration_profile_default_badge')}</span>
)}
</Command>
@@ -43,4 +43,8 @@ export default [
['plugin_ai_administration_profile_form_tab_options', 'Profil'],
['plugin_ai_administration_profile_name_max_length', 'Der Profilname darf {arg:length} Zeichen nicht überschreiten'],
['plugin_ai_administration_profile_name_min_length', 'Der Profilname muss mindestens {arg:length} Zeichen lang sein'],
[
'plugin_ai_administration_profile_default_delete_info',
'Das Standardprofil kann nicht gelöscht werden. Bitte wählen Sie ein anderes Profil als Standard aus, bevor Sie dieses Profil löschen.',
],
];
@@ -43,4 +43,8 @@ export default [
['plugin_ai_administration_profile_form_tab_options', 'Profile'],
['plugin_ai_administration_profile_name_max_length', 'Profile name must not exceed {arg:length} characters'],
['plugin_ai_administration_profile_name_min_length', 'Profile name must be at least {arg:length} characters'],
[
'plugin_ai_administration_profile_default_delete_info',
'The default profile cannot be deleted. Please select another profile as the default before deleting this profile.',
],
];
@@ -43,4 +43,8 @@ export default [
['plugin_ai_administration_profile_form_tab_options', 'Profil'],
['plugin_ai_administration_profile_name_max_length', 'Le nom du profil ne doit pas dépasser {arg:length} caractères'],
['plugin_ai_administration_profile_name_min_length', 'Le nom du profil doit contenir au moins {arg:length} caractères'],
[
'plugin_ai_administration_profile_default_delete_info',
'Le profil par défaut ne peut pas être supprimé. Veuillez sélectionner un autre profil comme profil par défaut avant de supprimer ce profil.',
],
];
@@ -43,4 +43,8 @@ export default [
['plugin_ai_administration_profile_form_tab_options', 'Профиль'],
['plugin_ai_administration_profile_name_max_length', 'Название профиля не должно превышать {arg:length} символов'],
['plugin_ai_administration_profile_name_min_length', 'Название профиля должно содержать не менее {arg:length} символов'],
[
'plugin_ai_administration_profile_default_delete_info',
'Профиль по умолчанию нельзя удалить. Перед удалением этого профиля выберите другой профиль по умолчанию.',
],
];
@@ -15,6 +15,7 @@ import { TableSelectionContext } from './TableSelectionContext.js';
interface BaseProps {
disabled?: boolean;
title?: string;
}
export interface ITableRowRootSelectProps extends BaseProps {
@@ -29,7 +30,7 @@ export interface ITableRowSelectProps extends BaseProps {
const CELL_CLASS_NAME = 'tw:flex tw:w-full tw:h-full tw:items-center tw:justify-center';
export const TableRowSelect = observer<ITableRowRootSelectProps | ITableRowSelectProps>(function TableRowSelect({ isRoot, id, disabled }) {
export const TableRowSelect = observer<ITableRowRootSelectProps | ITableRowSelectProps>(function TableRowSelect({ isRoot, id, disabled, title }) {
const selection = use(TableSelectionContext);
const translate = useTranslate();
@@ -47,6 +48,7 @@ export const TableRowSelect = observer<ITableRowRootSelectProps | ITableRowSelec
className={CELL_CLASS_NAME}
aria-label={translate('ui_select_all')}
tabIndex={0}
title={title}
checked={checked}
indeterminate={indeterminate}
disabled={rootDisabled}
@@ -61,6 +63,7 @@ export const TableRowSelect = observer<ITableRowRootSelectProps | ITableRowSelec
<Checkbox
className={CELL_CLASS_NAME}
aria-label={translate('plugin_data_grid_table_row_select')}
title={title}
tabIndex={0}
checked={checked}
disabled={disabled}