-
Notifications
You must be signed in to change notification settings - Fork 6
feat: expose the write permission on shared modifications #1261
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
Open
flomillot
wants to merge
26
commits into
main
Choose a base branch
from
florent/poc-shared-modifications-permissions
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
d44e112
feat: expose the write permission on shared modifications
flomillot f7d407a
feat: expose the write permission on shared modifications
flomillot 03b3ddc
Merge remote-tracking branch 'origin/florent/poc-shared-modifications…
flomillot f7e95c1
Merge remote-tracking branch 'origin/main' into florent/poc-shared-mo…
flomillot b6d78a8
Drop the shared modification permission guard on drag and drop
flomillot 9ea99ed
Merge remote-tracking branch 'origin/main' into florent/poc-shared-mo…
flomillot 2c3931f
Keep honouring the external rename trigger on a locked row
flomillot 7f75ed1
Share the directory notification types with the apps
flomillot 406d8b7
Add the case export notification type and expose the value type
flomillot 82992de
Tell the reference modifications from the shared ones they point at
flomillot 4c072c4
Clarify comment on replacing hook with Redux for permissions handling
flomillot 68cedce
Hide the description button when there is nothing to read nor write
flomillot 5b79a23
Turn the directory notification types into an enum
flomillot b1197fb
clarify: update description cell logic to skip rendering when empty a…
flomillot b62a185
Code review shared modifications permission (#1313)
ghazwarhili a1922e1
Re-emit the selection when the permissions resolve
flomillot 7d99dd0
Treat an unresolved permission as denied
flomillot a757f67
Resolve the permissions from the unfolded tree, not from the node's list
flomillot ad4ca5a
Merge remote-tracking branch 'origin/main' into florent/poc-shared-mo…
flomillot 3165e34
Resolve the shared modification permissions in a single call
flomillot f16d063
Merge remote-tracking branch 'origin/main' into florent/poc-shared-mo…
flomillot f264c34
Merge remote-tracking branch 'origin/main' into florent/poc-shared-mo…
flomillot d947377
Lock drag-and-drop interactions for read-only shared modifications
flomillot 1944832
Retry the shared modification permissions after a failed resolution
flomillot d87b44e
Merge remote-tracking branch 'origin/main' into florent/poc-shared-mo…
flomillot fe59ef9
Follow the batch permission endpoint rename
flomillot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -37,9 +37,10 @@ interface NameCellProps { | |
| row: Row<ComposedModificationMetadata>; | ||
| table: Table<ComposedModificationMetadata>; | ||
| onChange?: (modification: ComposedModificationMetadata, newValue: string) => Promise<unknown>; | ||
| isRenameDisabled?: boolean; | ||
| } | ||
|
|
||
| export function NameCell({ row, table, onChange }: Readonly<NameCellProps>) { | ||
| export function NameCell({ row, table, onChange, isRenameDisabled = false }: Readonly<NameCellProps>) { | ||
| const { meta } = table.options; | ||
| const intl = useIntl(); | ||
| const theme = useTheme(); | ||
|
|
@@ -49,6 +50,7 @@ export function NameCell({ row, table, onChange }: Readonly<NameCellProps>) { | |
| const { depth } = row; | ||
|
|
||
| const isComposite = isCompositeModification(row.original); | ||
| const isCompositeAndRenamable = isComposite && !isRenameDisabled; | ||
|
|
||
| const getModificationLabel = useCallback( | ||
| (modification: ComposedModificationMetadata, formatBold: boolean = true) => { | ||
|
|
@@ -157,6 +159,7 @@ export function NameCell({ row, table, onChange }: Readonly<NameCellProps>) { | |
| const defaultCompositeName: string = useMemo(() => intl.formatMessage({ id: 'CompositeModification' }), [intl]); | ||
|
|
||
| // triggers composite name editing from outside the component | ||
| // i.e., when a composite is being created | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unnecessary comment !
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think it is. The only purpose of this use effect is when we create a new composite which was not mentioned. |
||
| useEffect(() => { | ||
| const modificationToEditLabel = meta?.interaction.modificationToEditLabel.current; | ||
| if (isComposite && !isEditingRef.current && modificationToEditLabel === row.original.uuid) { | ||
|
|
@@ -198,7 +201,7 @@ export function NameCell({ row, table, onChange }: Readonly<NameCellProps>) { | |
| <DepthBox key={i} firstLevel={i === 0} displayAsFolder={isComposite && i === depthLevelCount - 1} /> | ||
| )); | ||
| }; | ||
| const compositeReadModeProps = isComposite | ||
| const renamableCompositeModeProps = isCompositeAndRenamable | ||
| ? { | ||
| ref: labelRef, | ||
| onClick: handleLabelClick, | ||
|
|
@@ -274,11 +277,11 @@ export function NameCell({ row, table, onChange }: Readonly<NameCellProps>) { | |
| /* Read mode */ | ||
| <CustomTooltip disableFocusListener disableTouchListener title={label}> | ||
| <Box | ||
| {...compositeReadModeProps} | ||
| {...renamableCompositeModeProps} | ||
| sx={mergeSx( | ||
| networkModificationTableStyles.modificationLabel, | ||
| createModificationNameCellStyle(row.original.activated), | ||
| compositeReadModeProps.sx | ||
| renamableCompositeModeProps.sx | ||
| )} | ||
| > | ||
| {label} | ||
|
|
||
This file contains hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and if openDescModificationDialog = true
(component is already mounted)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand what you want to change exactly. Can you suggest the code here ?