aboutsummaryrefslogtreecommitdiff
path: root/modern/src/settings/components
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-22 08:35:59 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-22 08:35:59 -0700
commit50a97b2ec3a3a22955cae8bfd6a766b3abb2cf27 (patch)
treef9966709ac4b6db0be873c9113843b02d1b7b1e0 /modern/src/settings/components
parentb1dd7bfd252278649622c99b4153e9cfa563cd9f (diff)
downloadtrackermap-web-50a97b2ec3a3a22955cae8bfd6a766b3abb2cf27.tar.gz
trackermap-web-50a97b2ec3a3a22955cae8bfd6a766b3abb2cf27.tar.bz2
trackermap-web-50a97b2ec3a3a22955cae8bfd6a766b3abb2cf27.zip
Login as another user
Diffstat (limited to 'modern/src/settings/components')
-rw-r--r--modern/src/settings/components/CollectionActions.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/modern/src/settings/components/CollectionActions.js b/modern/src/settings/components/CollectionActions.js
index e69553bd..e40b3eaa 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,
+ itemId, editPath, endpoint, setTimestamp, customAction,
}) => {
const theme = useTheme();
const classes = useStyles();
@@ -39,6 +39,11 @@ const CollectionActions = ({
setMenuAnchorEl(null);
};
+ const handleCustom = () => {
+ customAction.handler(itemId);
+ setMenuAnchorEl(null);
+ };
+
const handleRemoveResult = (removed) => {
setRemoving(false);
if (removed) {
@@ -54,12 +59,20 @@ const CollectionActions = ({
<MoreVertIcon fontSize="small" />
</IconButton>
<Menu open={!!menuAnchorEl} anchorEl={menuAnchorEl} onClose={() => setMenuAnchorEl(null)}>
+ {customAction && (
+ <MenuItem onClick={handleCustom}>{customAction.title}</MenuItem>
+ )}
<MenuItem onClick={handleEdit}>{t('sharedEdit')}</MenuItem>
<MenuItem onClick={handleRemove}>{t('sharedRemove')}</MenuItem>
</Menu>
</>
) : (
<div className={classes.row}>
+ {customAction && (
+ <IconButton size="small" onClick={handleCustom}>
+ {customAction.icon}
+ </IconButton>
+ )}
<IconButton size="small" onClick={handleEdit}>
<EditIcon fontSize="small" />
</IconButton>