Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CB-5016 add disable import option to global config #3058

Merged
merged 9 commits into from
Nov 12, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
* you may not use this file except in compliance with the License.
*/
import { injectable } from '@cloudbeaver/core-di';
import { SettingsProvider, SettingsProviderService } from '@cloudbeaver/core-settings';
import { ESettingsValueType, SettingsManagerService, SettingsProvider, SettingsProviderService } from '@cloudbeaver/core-settings';
import { schema, schemaExtra } from '@cloudbeaver/core-utils';
import { DATA_EDITOR_SETTINGS_GROUP } from '@cloudbeaver/plugin-data-viewer';

const defaultSettings = schema.object({
'plugin.data-import.disabled': schemaExtra.stringedBoolean().default(false),
Expand All @@ -22,7 +23,23 @@ export class DataImportSettingsService {
}
readonly settings: SettingsProvider<typeof defaultSettings>;

constructor(private readonly settingsProviderService: SettingsProviderService) {
constructor(
private readonly settingsProviderService: SettingsProviderService,
private readonly settingsManagerService: SettingsManagerService,
) {
this.settings = this.settingsProviderService.createSettings(defaultSettings);

this.settingsManagerService.registerSettings(this.settings, () => [
{
group: DATA_EDITOR_SETTINGS_GROUP,
key: 'plugin.data-import.disabled',
type: ESettingsValueType.Checkbox,
name: 'plugin_data_import_disable_data_import_name',
description: 'plugin_data_import_disable_data_import_description',
access: {
scope: ['server'],
},
},
]);
}
}
2 changes: 2 additions & 0 deletions webapp/packages/plugin-data-import/src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ export default [
['plugin_data_import_process_success', 'Data imported successfully'],
['plugin_data_import_process_fail', 'Data import failed'],
['plugin_data_import_process_file_processing_step_message', 'File uploaded, processing...'],
['plugin_data_import_disable_data_import_name', 'Disable Import'],
['plugin_data_import_disable_data_import_description', 'Disable importing of data in Data Viewer for non-admin users'],
];
2 changes: 2 additions & 0 deletions webapp/packages/plugin-data-import/src/locales/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ export default [
['plugin_data_import_process_success', 'Données importées avec succès'],
['plugin_data_import_process_fail', "Échec de l'importation des données"],
['plugin_data_import_process_file_processing_step_message', 'Fichier téléchargé, en cours de traitement...'],
['plugin_data_import_disable_data_import_name', 'Disable Import'],
['plugin_data_import_disable_data_import_description', 'Disable importing of data in Data Viewer for non-admin users'],
];
2 changes: 2 additions & 0 deletions webapp/packages/plugin-data-import/src/locales/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ export default [
['plugin_data_import_process_success', 'Data imported successfully'],
['plugin_data_import_process_fail', 'Data import failed'],
['plugin_data_import_process_file_processing_step_message', 'File uploaded, processing...'],
['plugin_data_import_disable_data_import_name', 'Disable Import'],
['plugin_data_import_disable_data_import_description', 'Disable importing of data in Data Viewer for non-admin users'],
];
2 changes: 2 additions & 0 deletions webapp/packages/plugin-data-import/src/locales/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ export default [
['plugin_data_import_process_success', 'Данные успешно импортированы'],
['plugin_data_import_process_fail', 'Ошибка импорта данных'],
['plugin_data_import_process_file_processing_step_message', 'Файл загружен, обработка...'],
['plugin_data_import_disable_data_import_name', 'Отключить загрузку данных'],
['plugin_data_import_disable_data_import_description', 'Отключить загрузку данных для пользователей без прав администратора'],
devnaumov marked this conversation as resolved.
Show resolved Hide resolved
];
2 changes: 2 additions & 0 deletions webapp/packages/plugin-data-import/src/locales/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ export default [
['plugin_data_import_process_success', '数据导入成功'],
['plugin_data_import_process_fail', '数据导入失败'],
['plugin_data_import_process_file_processing_step_message', '文件已上传,正在处理...'],
['plugin_data_import_disable_data_import_name', 'Disable Import'],
['plugin_data_import_disable_data_import_description', 'Disable importing of data in Data Viewer for non-admin users'],
];
Loading