Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/server/src/enterprise/rbac/Permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export class Permissions {

const executionsCategory = new PermissionCategory('executions')
executionsCategory.addPermission(new Permission('executions:view', 'View', true, true, true))
executionsCategory.addPermission(new Permission('executions:update', 'Update', true, true, true))
executionsCategory.addPermission(new Permission('executions:delete', 'Delete', true, true, true))
this.categories.push(executionsCategory)

Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/routes/executions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ router.get('/', checkAnyPermission('executions:view'), executionController.getAl
router.get(['/', '/:id'], checkAnyPermission('executions:view'), executionController.getExecutionById)

// PUT
router.put(['/', '/:id'], executionController.updateExecution)
router.put(['/', '/:id'], checkAnyPermission('executions:update'), executionController.updateExecution)

// DELETE - single execution or multiple executions
router.delete('/:id', checkAnyPermission('executions:delete'), executionController.deleteExecutions)
Expand Down
67 changes: 37 additions & 30 deletions packages/ui/src/views/agentexecutions/ExecutionDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ import executionsApi from '@/api/executions'
// Hooks
import useApi from '@/hooks/useApi'

// RBAC
import { Available } from '@/ui-component/rbac/available'

const getIconColor = (status) => {
switch (status) {
case 'FINISHED':
Expand Down Expand Up @@ -768,39 +771,43 @@ export const ExecutionDetails = ({ open, isPublic, execution, metadata, onClose,
)}

{!isPublic && !localMetadata.isPublic && (
<Chip
sx={{ ml: 1, pl: 1 }}
icon={
updateExecutionApi.loading ? (
<IconLoader size={15} className='spin-animation' />
) : (
<IconShare size={15} />
)
}
variant='outlined'
label={updateExecutionApi.loading ? 'Updating...' : 'Share'}
className={'button'}
onClick={() => onSharePublicly()}
disabled={updateExecutionApi.loading}
/>
<Available permission='executions:update'>
<Chip
sx={{ ml: 1, pl: 1 }}
icon={
updateExecutionApi.loading ? (
<IconLoader size={15} className='spin-animation' />
) : (
<IconShare size={15} />
)
}
variant='outlined'
label={updateExecutionApi.loading ? 'Updating...' : 'Share'}
className={'button'}
onClick={() => onSharePublicly()}
disabled={updateExecutionApi.loading}
/>
</Available>
)}

{!isPublic && localMetadata.isPublic && (
<Chip
sx={{ ml: 1, pl: 1 }}
icon={
updateExecutionApi.loading ? (
<IconLoader size={15} className='spin-animation' />
) : (
<IconWorld size={15} />
)
}
variant='outlined'
label={updateExecutionApi.loading ? 'Updating...' : 'Public'}
className={'button'}
onClick={() => setShowShareDialog(true)}
disabled={updateExecutionApi.loading}
/>
<Available permission='executions:update'>
<Chip
sx={{ ml: 1, pl: 1 }}
icon={
updateExecutionApi.loading ? (
<IconLoader size={15} className='spin-animation' />
) : (
<IconWorld size={15} />
)
}
variant='outlined'
label={updateExecutionApi.loading ? 'Updating...' : 'Public'}
className={'button'}
onClick={() => setShowShareDialog(true)}
disabled={updateExecutionApi.loading}
/>
</Available>
Comment thread
0xi4o marked this conversation as resolved.
Outdated
)}

<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', alignContent: 'center' }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { enqueueSnackbar as enqueueSnackbarAction, closeSnackbar as closeSnackba
// API
import executionsApi from '@/api/executions'
import useApi from '@/hooks/useApi'
import { Available } from '@/ui-component/rbac/available'

const ShareExecutionDialog = ({ show, executionId, onClose, onUnshare }) => {
const portalElement = document.getElementById('portal')
Expand Down Expand Up @@ -104,9 +105,11 @@ const ShareExecutionDialog = ({ show, executionId, onClose, onUnshare }) => {

{/* Actions */}
<Box sx={{ display: 'flex', justifyContent: 'flex-end' }}>
<Button color='error' onClick={handleUnshare} sx={{ mr: 1 }}>
Unshare
</Button>
<Available permission='executions:update'>
<Button color='error' onClick={handleUnshare} sx={{ mr: 1 }}>
Unshare
</Button>
</Available>
<Button onClick={onClose}>Close</Button>
</Box>
</DialogContent>
Expand Down
Loading