fix: remove no-op status ternary, dead code, and redundant calls
- Fix copy-paste bug in ivantiFpWorkflow.js where both ternary branches returned 'partial'; simplified to direct assignment - Remove unused shouldShowFpButton() from ReportingPage.js (canWrite from useAuth() is used instead) - Hoist repeated isCreateFpButtonEnabled() calls into a single variable in QueuePanel render
This commit is contained in:
@@ -1493,26 +1493,29 @@ function QueuePanel({ open, items, onClose, onUpdate, onDelete, onDeleteMany, on
|
||||
display: 'flex', gap: '0.5rem',
|
||||
}}>
|
||||
{/* Create FP Workflow — visible for editor/admin only */}
|
||||
{canWrite && (
|
||||
<button
|
||||
onClick={() => onCreateFpWorkflow([...selectedIds])}
|
||||
disabled={!isCreateFpButtonEnabled(items, selectedIds)}
|
||||
title={!isCreateFpButtonEnabled(items, selectedIds) ? 'Select pending FP items to create a workflow' : ''}
|
||||
style={{
|
||||
flex: 1, padding: '0.45rem',
|
||||
background: isCreateFpButtonEnabled(items, selectedIds) ? 'rgba(245,158,11,0.12)' : 'transparent',
|
||||
border: `1px solid ${isCreateFpButtonEnabled(items, selectedIds) ? 'rgba(245,158,11,0.35)' : 'rgba(255,255,255,0.05)'}`,
|
||||
borderRadius: '0.375rem',
|
||||
color: isCreateFpButtonEnabled(items, selectedIds) ? '#F59E0B' : '#334155',
|
||||
fontFamily: 'monospace', fontSize: '0.72rem', fontWeight: '600',
|
||||
cursor: isCreateFpButtonEnabled(items, selectedIds) ? 'pointer' : 'not-allowed',
|
||||
textTransform: 'uppercase', letterSpacing: '0.05em',
|
||||
transition: 'all 0.12s',
|
||||
}}
|
||||
>
|
||||
Create FP Workflow
|
||||
</button>
|
||||
)}
|
||||
{canWrite && (() => {
|
||||
const fpEnabled = isCreateFpButtonEnabled(items, selectedIds);
|
||||
return (
|
||||
<button
|
||||
onClick={() => onCreateFpWorkflow([...selectedIds])}
|
||||
disabled={!fpEnabled}
|
||||
title={!fpEnabled ? 'Select pending FP items to create a workflow' : ''}
|
||||
style={{
|
||||
flex: 1, padding: '0.45rem',
|
||||
background: fpEnabled ? 'rgba(245,158,11,0.12)' : 'transparent',
|
||||
border: `1px solid ${fpEnabled ? 'rgba(245,158,11,0.35)' : 'rgba(255,255,255,0.05)'}`,
|
||||
borderRadius: '0.375rem',
|
||||
color: fpEnabled ? '#F59E0B' : '#334155',
|
||||
fontFamily: 'monospace', fontSize: '0.72rem', fontWeight: '600',
|
||||
cursor: fpEnabled ? 'pointer' : 'not-allowed',
|
||||
textTransform: 'uppercase', letterSpacing: '0.05em',
|
||||
transition: 'all 0.12s',
|
||||
}}
|
||||
>
|
||||
Create FP Workflow
|
||||
</button>
|
||||
);
|
||||
})()}
|
||||
{/* Delete selected — only shown when items are selected */}
|
||||
{selectedIds.size > 0 && (
|
||||
<button
|
||||
@@ -1570,9 +1573,7 @@ function filterFpItems(items) {
|
||||
return items.filter(item => item.workflow_type === 'FP');
|
||||
}
|
||||
|
||||
function shouldShowFpButton(role) {
|
||||
return role === 'editor' || role === 'admin';
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// FpWorkflowModal — submit FP workflows to Ivanti API
|
||||
|
||||
Reference in New Issue
Block a user