Skip to content

Commit

Permalink
CB-4960 remove data import button from query sources (#2529)
Browse files Browse the repository at this point in the history
* CB-4960 remove data import button from query sources

* CB-4960 show import button only in container data source

* CB-4960 show import button on json tab

---------

Co-authored-by: Evgenia Bezborodova <[email protected]>
  • Loading branch information
devnaumov and EvgeniaBzzz authored Apr 9, 2024
1 parent fec9e85 commit 433eaac
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions webapp/packages/plugin-data-import/src/DataImportBootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import { Bootstrap, injectable } from '@cloudbeaver/core-di';
import { CommonDialogService, DialogueStateResult } from '@cloudbeaver/core-dialogs';
import { ACTION_IMPORT, ActionService, DATA_CONTEXT_MENU, menuExtractItems, MenuService } from '@cloudbeaver/core-view';
import {
ContainerDataSource,
DATA_CONTEXT_DV_DDM,
DATA_CONTEXT_DV_DDM_RESULT_INDEX,
DATA_VIEWER_DATA_MODEL_ACTIONS_MENU,
DatabaseEditAction,
} from '@cloudbeaver/plugin-data-viewer';

import { DataImportDialogLazy } from './DataImportDialog/DataImportDialogLazy';
Expand Down Expand Up @@ -42,12 +42,8 @@ export class DataImportBootstrap extends Bootstrap {
}

if (action === ACTION_IMPORT) {
if (model.isReadonly(resultIndex)) {
return false;
}

const editor = model.source.getActionImplementation(resultIndex, DatabaseEditAction);
return editor?.hasFeature('add') === true;
const isContainer = model.source instanceof ContainerDataSource;
return !model.isReadonly(resultIndex) && isContainer;
}

return [ACTION_IMPORT].includes(action);
Expand Down

0 comments on commit 433eaac

Please sign in to comment.