@@ -31,9 +31,19 @@ export interface CINodeProps {
3131 showPluginWarning ?: boolean
3232 envList ?: any [ ]
3333 filteredCIPipelines ?: any [ ]
34+ addNewBlocked ?: boolean
3435}
3536
3637export class CINode extends Component < CINodeProps > {
38+ onClickAddNode = ( event : any ) => {
39+ if ( this . props . addNewBlocked ) {
40+ return
41+ }
42+ event . stopPropagation ( )
43+ let { top, left } = event . target . getBoundingClientRect ( )
44+ top = top + 25
45+ this . props . toggleCDMenu ( )
46+ }
3747 renderNodeIcon = ( ) => {
3848 if ( this . props . showPluginWarning ) {
3949 return < Warning className = "icon-dim-18 warning-icon-y7" />
@@ -68,7 +78,9 @@ export class CINode extends Component<CINodeProps> {
6878 const _linkedBuildText = this . props . isLinkedCI ? 'Build: Linked' : _buildText
6979 const pipeline = this . props . isJobView ? 'Job' : _linkedBuildText
7080 const currPipeline = this . props . filteredCIPipelines . find ( ( pipeline ) => + pipeline . id === + this . props . id )
71- const env = currPipeline ?. environmentId ? this . props . envList . find ( ( env ) => + env . id === + currPipeline . environmentId ) : undefined
81+ const env = currPipeline ?. environmentId
82+ ? this . props . envList . find ( ( env ) => + env . id === + currPipeline . environmentId )
83+ : undefined
7284
7385 return (
7486 < >
@@ -103,9 +115,16 @@ export class CINode extends Component<CINodeProps> {
103115 >
104116 < div className = "dc__ellipsis-left" > { this . props . title } </ div >
105117 </ Tippy >
106- { this . props . isJobView && < >
107- < span className = "fw-4 fs-11" > Env: { env ? env . environment_name : DEFAULT_ENV } </ span >
108- < span className = "fw-4 fs-11 ml-4 dc__italic-font-style" > { ! env && "(Default)" } </ span > </ > }
118+ { this . props . isJobView && (
119+ < >
120+ < span className = "fw-4 fs-11" >
121+ Env: { env ? env . environment_name : DEFAULT_ENV }
122+ </ span >
123+ < span className = "fw-4 fs-11 ml-4 dc__italic-font-style" >
124+ { ! env && '(Default)' }
125+ </ span >
126+ </ >
127+ ) }
109128 </ div >
110129 { this . renderNodeIcon ( ) }
111130 </ div >
@@ -121,17 +140,16 @@ export class CINode extends Component<CINodeProps> {
121140 arrow = { false }
122141 placement = "top"
123142 content = {
124- < span style = { { display : 'block' , width : '145px' } } > Add deployment pipeline </ span >
143+ < span style = { { display : 'block' , width : '145px' } } >
144+ { this . props . addNewBlocked
145+ ? 'Not allowed with env filter'
146+ : 'Add deployment pipeline' }
147+ </ span >
125148 }
126149 >
127150 < Add
128- className = "icon-dim-18 fcb-5"
129- onClick = { ( event : any ) => {
130- event . stopPropagation ( )
131- let { top, left } = event . target . getBoundingClientRect ( )
132- top = top + 25
133- this . props . toggleCDMenu ( )
134- } }
151+ className = { `icon-dim-18 fcb-5 ${ this . props . addNewBlocked ? 'dc__disabled' : '' } ` }
152+ onClick = { this . onClickAddNode }
135153 />
136154 </ Tippy >
137155 </ button >
0 commit comments