11import React , { useState , useEffect , useMemo , useRef } from 'react'
22import { NavLink } from 'react-router-dom'
33import { Redirect , Route , Switch , useParams , useRouteMatch , useLocation } from 'react-router'
4- import { ButtonWithLoader , importComponentFromFELibrary , sortObjectArrayAlphabetically } from '../common'
4+ import {
5+ ButtonWithLoader ,
6+ FloatingVariablesSuggestions ,
7+ importComponentFromFELibrary ,
8+ sortObjectArrayAlphabetically ,
9+ } from '../common'
510import {
611 ServerErrors ,
712 showError ,
@@ -37,7 +42,7 @@ import {
3742import { toast } from 'react-toastify'
3843import { ValidationRules } from '../ciPipeline/validationRules'
3944import { CIBuildType , CIPipelineBuildType , CIPipelineDataType , CIPipelineType } from '../ciPipeline/types'
40- import { ReactComponent as Close } from '../../assets/icons/ic-close .svg'
45+ import { ReactComponent as Close } from '../../assets/icons/ic-cross .svg'
4146import Tippy from '@tippyjs/react'
4247import { PreBuild } from './PreBuild'
4348import { Sidebar } from './Sidebar'
@@ -201,6 +206,7 @@ export default function CIPipeline({
201206 list . push ( {
202207 id : 0 ,
203208 clusterName : '' ,
209+ clusterId : null ,
204210 name : DEFAULT_ENV ,
205211 active : false ,
206212 isClusterActive : false ,
@@ -211,6 +217,7 @@ export default function CIPipeline({
211217 list . push ( {
212218 id : env . id ,
213219 clusterName : env . cluster_name ,
220+ clusterId : env . cluster_id ,
214221 name : env . environment_name ,
215222 active : false ,
216223 isClusterActive : env . isClusterActive ,
@@ -524,7 +531,7 @@ export default function CIPipeline({
524531 }
525532
526533 let _ciPipeline = ciPipeline
527- if ( selectedEnv && selectedEnv . id !== 0 ) {
534+ if ( selectedEnv && selectedEnv . id !== 0 ) {
528535 _ciPipeline . environmentId = selectedEnv . id
529536 } else {
530537 _ciPipeline . environmentId = undefined
@@ -712,6 +719,7 @@ export default function CIPipeline({
712719 < h2 className = "fs-16 fw-6 lh-1-43 m-0" data-testid = "build-pipeline-heading" >
713720 { title }
714721 </ h2 >
722+
715723 < button
716724 type = "button"
717725 className = "dc__transparent flex icon-dim-24"
@@ -722,6 +730,7 @@ export default function CIPipeline({
722730 < Close className = "icon-dim-24" />
723731 </ button >
724732 </ div >
733+
725734 { isAdvanced && (
726735 < ul className = "ml-20 tab-list w-90" >
727736 { isJobCard ? (
@@ -739,9 +748,7 @@ export default function CIPipeline({
739748 </ ul >
740749 ) }
741750 < hr className = "divider m-0" />
742- < pipelineContext . Provider
743- value = { contextValue }
744- >
751+ < pipelineContext . Provider value = { contextValue } >
745752 < div className = { `ci-pipeline-advance ${ isAdvanced ? 'pipeline-container' : '' } ` } >
746753 { isAdvanced && (
747754 < div className = "sidebar-container" >
@@ -829,10 +836,31 @@ export default function CIPipeline({
829836 )
830837 }
831838
839+ const renderFloatingVariablesWidget = ( ) => {
840+ if ( ! window . _env_ . ENABLE_SCOPED_VARIABLES || activeStageName === BuildStageVariable . Build ) return < > </ >
841+
842+ return (
843+ < div className = "flexbox" >
844+ < div className = "floating-scoped-variables-widget" >
845+ < FloatingVariablesSuggestions
846+ zIndex = { 21 }
847+ appId = { appId }
848+ envId = { selectedEnv ?. id ? String ( selectedEnv . id ) : null }
849+ clusterId = { selectedEnv ?. clusterId }
850+ />
851+ </ div >
852+ </ div >
853+ )
854+ }
855+
832856 return ciPipelineId || isAdvanced ? (
833- < Drawer position = "right" width = "75%" minWidth = "1024px" maxWidth = "1200px" >
834- { renderCIPipelineModal ( ) }
835- </ Drawer >
857+ < >
858+ { renderFloatingVariablesWidget ( ) }
859+
860+ < Drawer position = "right" width = "75%" minWidth = "1024px" maxWidth = "1200px" >
861+ { renderCIPipelineModal ( ) }
862+ </ Drawer >
863+ </ >
836864 ) : (
837865 < VisibleModal className = "" > { renderCIPipelineModal ( ) } </ VisibleModal >
838866 )
0 commit comments