-
Notifications
You must be signed in to change notification settings - Fork 392
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CB-5181 Display User Notification Pop-up When Copy/Paste Functionalit…
…y is Disabled by Administrator (#2730) * CB-5181 adds copy event handler for data viewer (cells, value panel) * CB-5181 makes edit/copy settings independent from each other * CB-5181 adds disable copy case for read state JsonLine (pre) * CB-5181 changes message text for popup * CB-5181 changes message text for popup 2 * СB-5181 fixes rus locale for copy message --------- Co-authored-by: Evgenia Bezborodova <[email protected]>
- Loading branch information
1 parent
4078b6a
commit 4842cba
Showing
13 changed files
with
73 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
webapp/packages/plugin-data-viewer/src/useDataViewerCopyHandler.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* CloudBeaver - Cloud Database Manager | ||
* Copyright (C) 2020-2024 DBeaver Corp and others | ||
* | ||
* Licensed under the Apache License, Version 2.0. | ||
* you may not use this file except in compliance with the License. | ||
*/ | ||
import type React from 'react'; | ||
|
||
import { useService } from '@cloudbeaver/core-di'; | ||
import { NotificationService } from '@cloudbeaver/core-events'; | ||
|
||
import { DataViewerService } from './DataViewerService'; | ||
|
||
export function useDataViewerCopyHandler() { | ||
const notificationService = useService(NotificationService); | ||
const dataViewerService = useService(DataViewerService); | ||
|
||
return function (event?: ClipboardEvent | React.KeyboardEvent | React.ClipboardEvent) { | ||
if (!dataViewerService.canCopyData) { | ||
event?.preventDefault(); | ||
|
||
notificationService.logError({ | ||
title: 'data_viewer_copy_not_allowed', | ||
message: 'data_viewer_copy_not_allowed_message', | ||
}); | ||
} | ||
|
||
return !dataViewerService.canCopyData; | ||
}; | ||
} |