1
0
mirror of https://github.com/mattermost/focalboard.git synced 2024-12-21 13:38:56 +02:00

check readonly flag before displaying row menu (#3611)

* check readonly flag before displaying row menu

* reverse check

* update snapshots
This commit is contained in:
Scott Bishel 2022-08-10 06:58:47 -06:00 committed by GitHub
parent 8e2bd22a75
commit e76559080a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 285 deletions

View File

@ -2433,44 +2433,6 @@ exports[`components/centerPanel return centerPanel and press touch 1 with readon
draggable="true"
style="opacity: 1;"
>
<div
class="action-cell octo-table-cell-btn"
>
<div
aria-label="menuwrapper"
class="MenuWrapper optionsMenu"
role="button"
>
<button
aria-label="MenuBtn"
class="IconButton"
title="MenuBtn"
type="button"
>
<i
class="CompassIcon icon-dots-horizontal OptionsIcon"
/>
</button>
</div>
<button
class="IconButton"
type="button"
>
<svg
class="GripIcon Icon"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M0 0h24v24H0V0z"
fill="none"
/>
<path
d="M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"
/>
</svg>
</button>
</div>
<div
class="octo-table-cell title-cell"
id="mainBoardHeader"
@ -2512,44 +2474,6 @@ exports[`components/centerPanel return centerPanel and press touch 1 with readon
draggable="true"
style="opacity: 1;"
>
<div
class="action-cell octo-table-cell-btn"
>
<div
aria-label="menuwrapper"
class="MenuWrapper optionsMenu"
role="button"
>
<button
aria-label="MenuBtn"
class="IconButton"
title="MenuBtn"
type="button"
>
<i
class="CompassIcon icon-dots-horizontal OptionsIcon"
/>
</button>
</div>
<button
class="IconButton"
type="button"
>
<svg
class="GripIcon Icon"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M0 0h24v24H0V0z"
fill="none"
/>
<path
d="M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"
/>
</svg>
</button>
</div>
<div
class="octo-table-cell title-cell"
id="mainBoardHeader"

View File

@ -1960,44 +1960,6 @@ exports[`components/table/Table limited card in table view 1`] = `
draggable="true"
style="opacity: 1;"
>
<div
class="action-cell octo-table-cell-btn"
>
<div
aria-label="menuwrapper"
class="MenuWrapper optionsMenu"
role="button"
>
<button
aria-label="MenuBtn"
class="IconButton"
title="MenuBtn"
type="button"
>
<i
class="CompassIcon icon-dots-horizontal OptionsIcon"
/>
</button>
</div>
<button
class="IconButton"
type="button"
>
<svg
class="GripIcon Icon"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M0 0h24v24H0V0z"
fill="none"
/>
<path
d="M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"
/>
</svg>
</button>
</div>
<div
class="octo-table-cell title-cell"
id="mainBoardHeader"
@ -2077,44 +2039,6 @@ exports[`components/table/Table limited card in table view 1`] = `
draggable="true"
style="opacity: 1;"
>
<div
class="action-cell octo-table-cell-btn"
>
<div
aria-label="menuwrapper"
class="MenuWrapper optionsMenu"
role="button"
>
<button
aria-label="MenuBtn"
class="IconButton"
title="MenuBtn"
type="button"
>
<i
class="CompassIcon icon-dots-horizontal OptionsIcon"
/>
</button>
</div>
<button
class="IconButton"
type="button"
>
<svg
class="GripIcon Icon"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M0 0h24v24H0V0z"
fill="none"
/>
<path
d="M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"
/>
</svg>
</button>
</div>
<div
class="octo-table-cell title-cell"
id="mainBoardHeader"
@ -2886,44 +2810,6 @@ exports[`components/table/Table should match snapshot without permissions 1`] =
draggable="true"
style="opacity: 1;"
>
<div
class="action-cell octo-table-cell-btn"
>
<div
aria-label="menuwrapper"
class="MenuWrapper optionsMenu"
role="button"
>
<button
aria-label="MenuBtn"
class="IconButton"
title="MenuBtn"
type="button"
>
<i
class="CompassIcon icon-dots-horizontal OptionsIcon"
/>
</button>
</div>
<button
class="IconButton"
type="button"
>
<svg
class="GripIcon Icon"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M0 0h24v24H0V0z"
fill="none"
/>
<path
d="M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"
/>
</svg>
</button>
</div>
<div
class="octo-table-cell title-cell"
id="mainBoardHeader"
@ -3159,44 +3045,6 @@ exports[`components/table/Table should match snapshot, read-only 1`] = `
draggable="true"
style="opacity: 1;"
>
<div
class="action-cell octo-table-cell-btn"
>
<div
aria-label="menuwrapper"
class="MenuWrapper optionsMenu"
role="button"
>
<button
aria-label="MenuBtn"
class="IconButton"
title="MenuBtn"
type="button"
>
<i
class="CompassIcon icon-dots-horizontal OptionsIcon"
/>
</button>
</div>
<button
class="IconButton"
type="button"
>
<svg
class="GripIcon Icon"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M0 0h24v24H0V0z"
fill="none"
/>
<path
d="M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"
/>
</svg>
</button>
</div>
<div
class="octo-table-cell title-cell"
id="mainBoardHeader"

View File

@ -377,44 +377,6 @@ exports[`components/table/TableRow should match snapshot, read-only 1`] = `
draggable="true"
style="opacity: 1;"
>
<div
class="action-cell octo-table-cell-btn"
>
<div
aria-label="menuwrapper"
class="MenuWrapper optionsMenu"
role="button"
>
<button
aria-label="MenuBtn"
class="IconButton"
title="MenuBtn"
type="button"
>
<i
class="CompassIcon icon-dots-horizontal OptionsIcon"
/>
</button>
</div>
<button
class="IconButton"
type="button"
>
<svg
class="GripIcon Icon"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M0 0h24v24H0V0z"
fill="none"
/>
<path
d="M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"
/>
</svg>
</button>
</div>
<div
class="octo-table-cell title-cell"
id="mainBoardHeader"

View File

@ -140,26 +140,28 @@ const TableRow = (props: Props) => {
style={{opacity: isDragging ? 0.5 : 1}}
>
<div className='action-cell octo-table-cell-btn'>
<MenuWrapper
className='optionsMenu'
stopPropagationOnToggle={true}
>
<IconButton
title='MenuBtn'
icon={<OptionsIcon/>}
/>
<Menu>
<Menu.Text
icon={<DeleteIcon/>}
id='delete'
name={intl.formatMessage({id: 'TableRow.delete', defaultMessage: 'Delete'})}
onClick={handleDeleteButtonOnClick}
{!props.readonly && (
<div className='action-cell octo-table-cell-btn'>
<MenuWrapper
className='optionsMenu'
stopPropagationOnToggle={true}
>
<IconButton
title='MenuBtn'
icon={<OptionsIcon/>}
/>
</Menu>
</MenuWrapper>
<IconButton icon={<GripIcon/>}/>
</div>
<Menu>
<Menu.Text
icon={<DeleteIcon/>}
id='delete'
name={intl.formatMessage({id: 'TableRow.delete', defaultMessage: 'Delete'})}
onClick={handleDeleteButtonOnClick}
/>
</Menu>
</MenuWrapper>
<IconButton icon={<GripIcon/>}/>
</div>
)}
{/* Name / title */}
<div