Skip to content

Commit

Permalink
CB-5016 add disable import option to global config (#3058)
Browse files Browse the repository at this point in the history
* CB-5016 add disable import option to global config

* CB-5016 refactor: move logic from DataViewerSettingService to DataImportSettingsService

* CB-5016 refactor: simplify

* CB-5016 refactor: move disable import locale token to data-import-plugin

* CB-5016 refactor: ru locale

---------

Co-authored-by: Evgenia <[email protected]>
Co-authored-by: alex <[email protected]>
  • Loading branch information
3 people authored Nov 12, 2024
1 parent a23c2c2 commit cee8f00
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 2 deletions.
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', 'Отключить импорт данных для пользователей без прав администратора'],
];
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'],
];

0 comments on commit cee8f00

Please sign in to comment.