-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
No create permissions dialog (#1934)
Co-authored-by: GitHub Release <> Co-authored-by: datalens-weblate-robot <[email protected]> Co-authored-by: Weblate <[email protected]> Co-authored-by: Darya Tikhonova <[email protected]> Co-authored-by: Matthew Casserly <[email protected]>
- Loading branch information
1 parent
351a407
commit c482663
Showing
17 changed files
with
179 additions
and
41 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
src/i18n-keysets/component.dialog-collection-no-create-permission.view/en.json
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,5 @@ | ||
{ | ||
"button_ok": "Ok", | ||
"label_title": "Insufficient permissions", | ||
"section_message": "To create collections and workbooks, you need the <code>datalens.editor</code> role. Please contact your administrator." | ||
} |
5 changes: 5 additions & 0 deletions
5
src/i18n-keysets/component.dialog-collection-no-create-permission.view/ru.json
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,5 @@ | ||
{ | ||
"button_ok": "Понятно", | ||
"label_title": "Недостаточно прав", | ||
"section_message": "Для создания коллекций и воркбуков необходима роль <code>datalens.editor</code>, обратитесь к администратору." | ||
} |
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
51 changes: 51 additions & 0 deletions
51
...ctionsStructure/CollectionNoCreatePermissionDialog/CollectionNoCreatePermissionDialog.tsx
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,51 @@ | ||
import React from 'react'; | ||
|
||
import {I18n} from 'i18n'; | ||
import DialogWarning from 'ui/components/DialogWarning/DialogWarning'; | ||
|
||
import {registry} from '../../../registry'; | ||
import DialogManager from '../../DialogManager/DialogManager'; | ||
import {YfmWrapperContent as YfmWrapper} from '../../YfmWrapper/YfmWrapperContent'; | ||
|
||
const i18n = I18n.keyset('component.dialog-collection-no-create-permission.view'); | ||
|
||
export const DIALOG_NO_CREATE_COLLECTION_PERMISSION = Symbol( | ||
'DIALOG_NO_CREATE_COLLECTION_PERMISSION', | ||
); | ||
|
||
export type Props = { | ||
visible: boolean; | ||
onClose: () => void; | ||
}; | ||
|
||
export type OpenDialogCollectionNoCreatePermissionArgs = { | ||
id: typeof DIALOG_NO_CREATE_COLLECTION_PERMISSION; | ||
props: Props; | ||
}; | ||
|
||
export const CollectionNoCreatePermissionDialog = ({visible, onClose}: Props) => { | ||
const {customizeNoCreatePermissionDialog} = registry.collections.functions.getAll(); | ||
|
||
const {message} = customizeNoCreatePermissionDialog({ | ||
message: <YfmWrapper content={i18n('section_message')} setByInnerHtml={true} />, | ||
}); | ||
|
||
return ( | ||
<DialogWarning | ||
visible={visible} | ||
onApply={onClose} | ||
showIcon={false} | ||
closeOnEnterPress={true} | ||
headerText={i18n('label_title')} | ||
buttonText={i18n('button_ok')} | ||
message={message} | ||
/> | ||
); | ||
}; | ||
|
||
CollectionNoCreatePermissionDialog.displayName = 'CollectionNoCreatePermissionDialog'; | ||
|
||
DialogManager.registerDialog( | ||
DIALOG_NO_CREATE_COLLECTION_PERMISSION, | ||
CollectionNoCreatePermissionDialog, | ||
); |
1 change: 1 addition & 0 deletions
1
src/ui/components/CollectionsStructure/CollectionNoCreatePermissionDialog/index.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 @@ | ||
export * from './CollectionNoCreatePermissionDialog'; |
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
5 changes: 5 additions & 0 deletions
5
src/ui/registry/units/collections/types/customizeNoCreatePermissionDialog.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,5 @@ | ||
import type React from 'react'; | ||
|
||
export type CustomizeNoCreatePermissionDialog = (args: {message?: React.ReactNode}) => { | ||
message?: React.ReactNode; | ||
}; |
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './customizeEmptyPlaceholder'; | ||
export * from './customizeNoCreatePermissionDialog'; |
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
Oops, something went wrong.