aboutsummaryrefslogtreecommitdiff
path: root/modern/src/settings/components/CollectionActions.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-02-23 11:53:36 -0800
committerAnton Tananaev <anton@traccar.org>2023-02-23 11:53:36 -0800
commit0ca058f1c69827b41fa3a414917ab1cbebfb84e6 (patch)
treec617a73afeececac75371c2b6d6225d7b1cf00d6 /modern/src/settings/components/CollectionActions.js
parent5f65762c67aacc9a621983fcb06107b982792c3f (diff)
downloadtrackermap-web-0ca058f1c69827b41fa3a414917ab1cbebfb84e6.tar.gz
trackermap-web-0ca058f1c69827b41fa3a414917ab1cbebfb84e6.tar.bz2
trackermap-web-0ca058f1c69827b41fa3a414917ab1cbebfb84e6.zip
Allow device readonly linking
Diffstat (limited to 'modern/src/settings/components/CollectionActions.js')
-rw-r--r--modern/src/settings/components/CollectionActions.js26
1 files changed, 17 insertions, 9 deletions
diff --git a/modern/src/settings/components/CollectionActions.js b/modern/src/settings/components/CollectionActions.js
index b84d8f0f..177295b1 100644
--- a/modern/src/settings/components/CollectionActions.js
+++ b/modern/src/settings/components/CollectionActions.js
@@ -17,7 +17,7 @@ const useStyles = makeStyles(() => ({
}));
const CollectionActions = ({
- itemId, editPath, endpoint, setTimestamp, customActions,
+ itemId, editPath, endpoint, setTimestamp, customActions, readonly,
}) => {
const theme = useTheme();
const classes = useStyles();
@@ -62,8 +62,12 @@ const CollectionActions = ({
{customActions && customActions.map((action) => (
<MenuItem onClick={() => handleCustom(action)} key={action.key}>{action.title}</MenuItem>
))}
- <MenuItem onClick={handleEdit}>{t('sharedEdit')}</MenuItem>
- <MenuItem onClick={handleRemove}>{t('sharedRemove')}</MenuItem>
+ {!readonly && (
+ <>
+ <MenuItem onClick={handleEdit}>{t('sharedEdit')}</MenuItem>
+ <MenuItem onClick={handleRemove}>{t('sharedRemove')}</MenuItem>
+ </>
+ )}
</Menu>
</>
) : (
@@ -73,12 +77,16 @@ const CollectionActions = ({
{action.icon}
</IconButton>
))}
- <IconButton size="small" onClick={handleEdit}>
- <EditIcon fontSize="small" />
- </IconButton>
- <IconButton size="small" onClick={handleRemove}>
- <DeleteIcon fontSize="small" />
- </IconButton>
+ {!readonly && (
+ <>
+ <IconButton size="small" onClick={handleEdit}>
+ <EditIcon fontSize="small" />
+ </IconButton>
+ <IconButton size="small" onClick={handleRemove}>
+ <DeleteIcon fontSize="small" />
+ </IconButton>
+ </>
+ )}
</div>
)}
<RemoveDialog style={{ transform: 'none' }} open={removing} endpoint={endpoint} itemId={itemId} onResult={handleRemoveResult} />