Skip to content

Commit 26bae40

Browse files
committed
workflow editor tooltip fix
1 parent 53e2b2a commit 26bae40

File tree

4 files changed

+41
-25
lines changed

4 files changed

+41
-25
lines changed

src/components/workflowEditor/nodes/CDNode.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export class CDNode extends Component<CDNodeProps, CDNodeState> {
147147
content={
148148
<span className="add-cd-btn-tippy">
149149
{this.props.addNewPipelineBlocked
150-
? 'Not allowed with env filter'
150+
? 'Cannot add new workflow or deployment pipelines when environment filter is applied.'
151151
: 'Add deployment pipeline'}
152152
</span>
153153
}

src/components/workflowEditor/nodes/CINode.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export class CINode extends Component<CINodeProps> {
142142
content={
143143
<span style={{ display: 'block', width: '145px' }}>
144144
{this.props.addNewPipelineBlocked
145-
? 'Not allowed with env filter'
145+
? 'Cannot add new workflow or deployment pipelines when environment filter is applied.'
146146
: 'Add deployment pipeline'}
147147
</span>
148148
}

src/components/workflowEditor/nodes/WebhookNode.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export function WebhookNode({ x, y, width, height, id, to, configDiffView, toggl
4747
placement="top"
4848
content={
4949
<span style={{ display: 'block', width: '145px' }}>
50-
{addNewPipelineBlocked ? 'Not allowed with env filter' : 'Add deployment pipeline'}
50+
{addNewPipelineBlocked ? 'Cannot add new workflow or deployment pipelines when environment filter is applied.' : 'Add deployment pipeline'}
5151
</span>
5252
}
5353
>

src/components/workflowEditor/workflowEditor.tsx

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
ErrorScreenManager,
99
DeleteDialog,
1010
InfoColourBar,
11+
ConditionalWrap,
1112
} from '@devtron-labs/devtron-fe-common-lib'
1213
import { toast } from 'react-toastify'
1314
import { Workflow } from './Workflow'
@@ -32,6 +33,7 @@ import { WebhookDetailsModal } from '../ciPipeline/Webhook/WebhookDetailsModal'
3233
import DeprecatedWarningModal from './DeprecatedWarningModal'
3334
import nojobs from '../../assets/img/[email protected]'
3435
import NewCDPipeline from '../cdPipeline/NewCDPipeline'
36+
import Tippy from '@tippyjs/react'
3537

3638
export const pipelineContext = createContext<PipelineContext>(null)
3739

@@ -438,28 +440,42 @@ class WorkflowEdit extends Component<WorkflowEditProps, WorkflowEditState> {
438440
top = top + 40
439441
}
440442
return (
441-
<>
442-
<button
443-
type="button"
444-
className={`cta dc__no-decor flex mb-20 ${this.props.filteredEnvIds ? 'dc__disabled' : ''}`}
445-
data-testid="new-workflow-button"
446-
onClick={this.toggleCIMenu}
447-
>
448-
<img src={add} alt="add-worflow" className="icon-dim-18 mr-5" />
449-
New workflow
450-
</button>
451-
<PipelineSelect
452-
workflowId={0}
453-
showMenu={this.state.showCIMenu}
454-
addCIPipeline={this.addCIPipeline}
455-
addWebhookCD={this.addWebhookCD}
456-
toggleCIMenu={this.toggleCIMenu}
457-
styles={{
458-
left: `${left}px`,
459-
top: `${top}px`,
460-
}}
461-
/>
462-
</>
443+
<ConditionalWrap
444+
condition={!!this.props.filteredEnvIds}
445+
wrap={(children) => (
446+
<Tippy
447+
className="default-tt w-200"
448+
arrow={false}
449+
placement="top"
450+
content="Cannot add new workflow or deployment pipelines when environment filter is applied."
451+
>
452+
{children}
453+
</Tippy>
454+
)}
455+
>
456+
<div className="dc_max-width__max-content">
457+
<button
458+
type="button"
459+
className={`cta dc__no-decor flex mb-20 ${this.props.filteredEnvIds ? 'dc__disabled' : ''}`}
460+
data-testid="new-workflow-button"
461+
onClick={this.toggleCIMenu}
462+
>
463+
<img src={add} alt="add-worflow" className="icon-dim-18 mr-5" />
464+
New workflow
465+
</button>
466+
<PipelineSelect
467+
workflowId={0}
468+
showMenu={this.state.showCIMenu}
469+
addCIPipeline={this.addCIPipeline}
470+
addWebhookCD={this.addWebhookCD}
471+
toggleCIMenu={this.toggleCIMenu}
472+
styles={{
473+
left: `${left}px`,
474+
top: `${top}px`,
475+
}}
476+
/>
477+
</div>
478+
</ConditionalWrap>
463479
)
464480
}
465481

0 commit comments

Comments
 (0)