Skip to content

Commit b767c4e

Browse files
committed
fix: css for runtime params
1 parent b2379fa commit b767c4e

File tree

6 files changed

+65
-48
lines changed

6 files changed

+65
-48
lines changed

src/components/ApplicationGroup/AppGroup.types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ export interface BulkCITriggerType {
8888
setLoading: React.Dispatch<React.SetStateAction<boolean>>
8989
runtimeParams: Record<string, KeyValueListType[]>
9090
setRuntimeParams: React.Dispatch<React.SetStateAction<Record<string, KeyValueListType[]>>>
91+
setPageViewType: React.Dispatch<React.SetStateAction<string>>
9192
}
9293

9394
export interface BulkCDTriggerType {

src/components/ApplicationGroup/Details/TriggerView/BulkCITrigger.tsx

Lines changed: 42 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ import { importComponentFromFELibrary } from '../../../common'
2020
import { ReactComponent as Close } from '../../../../assets/icons/ic-cross.svg'
2121
import { ReactComponent as PlayIcon } from '../../../../assets/icons/misc/arrow-solid-right.svg'
2222
import { ReactComponent as Warning } from '../../../../assets/icons/ic-warning.svg'
23-
import { ReactComponent as Error } from '../../../../assets/icons/ic-alert-triangle.svg'
23+
import { ReactComponent as ICError } from '../../../../assets/icons/ic-alert-triangle.svg'
2424
import { ReactComponent as Storage } from '../../../../assets/icons/ic-storage.svg'
2525
import { ReactComponent as OpenInNew } from '../../../../assets/icons/ic-open-in-new.svg'
2626
import { ReactComponent as InfoIcon } from '../../../../assets/icons/info-filled.svg'
2727
import externalCiImg from '../../../../assets/img/external-ci.png'
2828
import linkedCDBuildCIImg from '../../../../assets/img/linked-cd-bulk-ci.png'
2929
import linkedCiImg from '../../../../assets/img/linked-ci.png'
3030
import { getModuleConfigured } from '../../../app/details/appDetails/appDetails.service'
31-
import { DOCUMENTATION, ModuleNameMap, SourceTypeMap, SOURCE_NOT_CONFIGURED, URLS } from '../../../../config'
31+
import { DOCUMENTATION, ModuleNameMap, SourceTypeMap, SOURCE_NOT_CONFIGURED, URLS, ViewType } from '../../../../config'
3232
import MaterialSource from '../../../app/details/triggerView/MaterialSource'
3333
import { TriggerViewContext } from '../../../app/details/triggerView/config'
3434
import { getCIMaterialList } from '../../../app/service'
@@ -49,7 +49,7 @@ const getCIBlockState = importComponentFromFELibrary('getCIBlockState', null, 'f
4949
const getRuntimeParams = importComponentFromFELibrary('getRuntimeParams', null, 'function')
5050
const GitInfoMaterialTabs = importComponentFromFELibrary('GitInfoMaterialTabs', null, 'function')
5151

52-
export default function BulkCITrigger({
52+
const BulkCITrigger = ({
5353
appList,
5454
closePopup,
5555
updateBulkInputMaterial,
@@ -65,7 +65,8 @@ export default function BulkCITrigger({
6565
setLoading,
6666
runtimeParams,
6767
setRuntimeParams,
68-
}: BulkCITriggerType) {
68+
setPageViewType,
69+
}: BulkCITriggerType) => {
6970
const [showRegexModal, setShowRegexModal] = useState(false)
7071
const [isChangeBranchClicked, setChangeBranchClicked] = useState(false)
7172
const [regexValue, setRegexValue] = useState<Record<number, RegexValueType>>({})
@@ -130,6 +131,33 @@ export default function BulkCITrigger({
130131
getMaterialData()
131132
}, [])
132133

134+
135+
const getRunTimeParamsData = (_materialListMap: Record<string, any[]>): void => {
136+
const runTimeParamsPromiseList = appList.map((appDetails) => {
137+
if (getIsAppUnorthodox(appDetails) || !_materialListMap[appDetails.appId]) {
138+
return {
139+
[appDetails.ciPipelineId]: [],
140+
}
141+
}
142+
return getRuntimeParams(appDetails.ciPipelineId)
143+
})
144+
145+
if (runTimeParamsPromiseList?.length) {
146+
Promise.all(runTimeParamsPromiseList)
147+
.then((responses) => {
148+
const _runtimeParams: Record<string, KeyValueListType[]> = {}
149+
responses.forEach((res, index) => {
150+
_runtimeParams[appList[index]?.ciPipelineId] = res || []
151+
})
152+
setRuntimeParams(_runtimeParams)
153+
})
154+
.catch((error) => {
155+
setPageViewType(ViewType.ERROR)
156+
showError(error)
157+
})
158+
}
159+
}
160+
133161
const getMaterialData = (): void => {
134162
abortControllerRef.current = new AbortController()
135163
const _CIMaterialPromiseList = appList.map((appDetails) =>
@@ -197,6 +225,8 @@ export default function BulkCITrigger({
197225
case KeyValueListActionType.DELETE:
198226
_runtimeParams = _runtimeParams.filter((_, index) => index !== data.index)
199227
break
228+
default:
229+
throw new Error(`Invalid action ${action}`)
200230
}
201231

202232
setRuntimeParams({
@@ -209,37 +239,6 @@ export default function BulkCITrigger({
209239
setCurrentSidebarTab(e.target.value as CIMaterialSidebarType)
210240
}
211241

212-
const getRunTimeParamsData = (_materialListMap: Record<string, any[]>): void => {
213-
const runTimeParamsPromiseList = appList.map((appDetails) => {
214-
if (getIsAppUnorthodox(appDetails) || !_materialListMap[appDetails.appId]) {
215-
return {
216-
[appDetails.ciPipelineId]: [],
217-
}
218-
}
219-
return getRuntimeParams(appDetails.ciPipelineId)
220-
})
221-
222-
if (runTimeParamsPromiseList?.length) {
223-
Promise.allSettled(runTimeParamsPromiseList)
224-
.then((responses) => {
225-
const _runtimeParams: Record<string, KeyValueListType[]> = {}
226-
responses.forEach((res, index) => {
227-
if (res.status === 'fulfilled') {
228-
_runtimeParams[appList[index]?.ciPipelineId] = res?.['value'] || []
229-
}
230-
else {
231-
// TODO: Add null
232-
_runtimeParams[appList[index]?.ciPipelineId] = []
233-
}
234-
})
235-
setRuntimeParams(_runtimeParams)
236-
})
237-
.catch((error) => {
238-
showError(error)
239-
})
240-
}
241-
}
242-
243242
const getPolicyEnforcementData = (_materialListMap: Record<string, any[]>): void => {
244243
const policyPromiseList = appList.map((appDetails) => {
245244
if (getIsAppUnorthodox(appDetails) || !_materialListMap[appDetails.appId]) {
@@ -284,6 +283,7 @@ export default function BulkCITrigger({
284283
className="dc__transparent flex icon-dim-24"
285284
disabled={isLoading}
286285
onClick={closeBulkCIModal}
286+
aria-label="Close modal"
287287
>
288288
<Close className="icon-dim-24" />
289289
</button>
@@ -411,10 +411,10 @@ export default function BulkCITrigger({
411411
savingRegexValue={isLoading}
412412
/>
413413
<div className="flex right pr-20 pb-20">
414-
<button className="cta cancel h-28 lh-28-imp mr-16" onClick={hideBranchEditModal}>
414+
<button className="cta cancel h-28 lh-28-imp mr-16" onClick={hideBranchEditModal} type="button">
415415
Cancel
416416
</button>
417-
<button className="cta h-28 lh-28-imp" onClick={saveBranchName}>
417+
<button className="cta h-28 lh-28-imp" onClick={saveBranchName} type="button">
418418
Save
419419
</button>
420420
</div>
@@ -588,7 +588,7 @@ export default function BulkCITrigger({
588588
)}
589589
{app.appId !== selectedApp.appId && app.errorMessage && (
590590
<span className="flex left cr-5 fw-4 fs-12">
591-
<Error className="icon-dim-12 mr-4 mw-14" />
591+
<ICError className="icon-dim-12 mr-4 mw-14" />
592592
<span className="dc__block dc__ellipsis-right">{app.errorMessage}</span>
593593
</span>
594594
)}
@@ -604,7 +604,7 @@ export default function BulkCITrigger({
604604
return <Progressing pageLoader />
605605
}
606606
const selectedMaterialList = appList.find((app) => app.appId === selectedApp.appId)?.material || []
607-
const sidebarTabs = Object.values(CIMaterialSidebarType).map((tabValue)=>({
607+
const sidebarTabs = Object.values(CIMaterialSidebarType).map((tabValue) => ({
608608
value: tabValue,
609609
label: tabValue,
610610
}))
@@ -702,6 +702,7 @@ export default function BulkCITrigger({
702702
data-testid="start-build"
703703
onClick={onClickStartBuild}
704704
disabled={isStartBuildDisabled()}
705+
type="button"
705706
>
706707
{isLoading ? (
707708
<Progressing />
@@ -737,3 +738,5 @@ export default function BulkCITrigger({
737738
</Drawer>
738739
)
739740
}
741+
742+
export default BulkCITrigger

src/components/ApplicationGroup/Details/TriggerView/EnvTriggerView.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,7 @@ export default function EnvTriggerView({ filteredAppIds, isVirtualEnv }: AppGrou
796796
}
797797

798798
if (resp[2]) {
799+
// Not handling error state since we are change viewType to error in catch block
799800
setRuntimeParams({
800801
[ciNodeId]: resp[2],
801802
})
@@ -1727,6 +1728,8 @@ export default function EnvTriggerView({ filteredAppIds, isVirtualEnv }: AppGrou
17271728
case KeyValueListActionType.DELETE:
17281729
_runtimeParams = _runtimeParams.filter((_, index) => index !== data.index)
17291730
break
1731+
default:
1732+
throw new Error(`Invalid action type: ${action}`)
17301733
}
17311734

17321735
if (selectedCINode?.id) {
@@ -1947,6 +1950,7 @@ export default function EnvTriggerView({ filteredAppIds, isVirtualEnv }: AppGrou
19471950
setLoading={setCILoading}
19481951
runtimeParams={runtimeParams}
19491952
setRuntimeParams={setRuntimeParams}
1953+
setPageViewType={setPageViewType}
19501954
/>
19511955
)
19521956
}

src/components/app/details/triggerView/TriggerView.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ import {
4646
} from '../../../../config'
4747
import { AppNotConfigured } from '../appDetails/AppDetails'
4848
import { getEnvironmentListMinPublic, getHostURLConfiguration } from '../../../../services/service'
49-
import { ReactComponent as Error } from '../../../../assets/icons/ic-error-exclamation.svg'
49+
import { ReactComponent as ICError } from '../../../../assets/icons/ic-error-exclamation.svg'
5050
import { ReactComponent as CloseIcon } from '../../../../assets/icons/ic-close.svg'
5151
import { getCIWebhookRes } from './ciWebhook.service'
5252
import { CIMaterialType } from './MaterialHistory'
@@ -686,6 +686,7 @@ class TriggerView extends Component<TriggerViewProps, TriggerViewState> {
686686
}
687687

688688
if (resp[2]) {
689+
// Not saving as null since page ViewType is set as Error in case of error
689690
this.setState({
690691
runtimeParams: resp[2],
691692
})
@@ -1094,6 +1095,8 @@ class TriggerView extends Component<TriggerViewProps, TriggerViewState> {
10941095
case KeyValueListActionType.DELETE:
10951096
_runtimeParams = _runtimeParams.filter((_, index) => index !== data.index)
10961097
break
1098+
default:
1099+
throw new Error(`Invalid action: ${action}`)
10971100
}
10981101

10991102
this.setState({ runtimeParams: _runtimeParams })
@@ -1332,7 +1335,7 @@ class TriggerView extends Component<TriggerViewProps, TriggerViewState> {
13321335
if (!this.state.hostURLConfig || this.state.hostURLConfig.value !== window.location.origin) {
13331336
return (
13341337
<div className="br-4 bw-1 er-2 pt-10 pb-10 pl-16 pr-16 bcr-1 mb-16 flex left">
1335-
<Error className="icon-dim-20 mr-8" />
1338+
<ICError className="icon-dim-20 mr-8" />
13361339
<div className="cn-9 fs-13">
13371340
{HOST_ERROR_MESSAGE.NotConfigured}
13381341
&nbsp;

src/components/common/GitInfoMaterial.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export default function GitInfoMaterial({
116116
refresh: triggerViewContext.refreshMaterial,
117117
pipelineId,
118118
}
119-
const sidebarTabs = Object.values(CIMaterialSidebarType).map((tabValue)=>({
119+
const sidebarTabs = Object.values(CIMaterialSidebarType).map((tabValue) => ({
120120
value: tabValue,
121121
label: tabValue,
122122
}))
@@ -375,13 +375,13 @@ export default function GitInfoMaterial({
375375
}
376376

377377
if (currentSidebarTab === CIMaterialSidebarType.PARAMETERS) {
378-
if (!RuntimeParameters || isJobCI || isJobView) {
378+
if (!RuntimeParameters || isJobView) {
379379
return null
380380
}
381381

382382
return (
383383
<RuntimeParameters
384-
heading={`Pass parameters ${appName ? `for ${appName}` : ''}`}
384+
heading={`Pass parameters ${appName ? `for '${appName}'` : ''}`}
385385
parameters={runtimeParams}
386386
handleKeyValueChange={handleRuntimeParametersChange}
387387
isJobCI={isJobCI}

src/css/base.scss

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,8 +1321,8 @@ button.anchor {
13211321
}
13221322

13231323
&:last-child input + .radio__item-label {
1324-
border-top-right-radius: 4px;
1325-
border-bottom-right-radius: 4px;
1324+
border-top-right-radius: 4px !important;
1325+
border-bottom-right-radius: 4px !important;
13261326
border: 1px solid var(--N200);
13271327
}
13281328
}
@@ -1387,8 +1387,8 @@ button.anchor {
13871387
}
13881388

13891389
&:last-child input + .radio__item-label {
1390-
border-top-right-radius: 4px;
1391-
border-bottom-right-radius: 4px;
1390+
border-top-right-radius: 4px !important;
1391+
border-bottom-right-radius: 4px !important;
13921392
border: 1px solid var(--N200);
13931393
}
13941394
}
@@ -4206,3 +4206,9 @@ textarea::placeholder {
42064206
outline-offset: 1px;
42074207
}
42084208
}
4209+
4210+
.last-child-mb-90 {
4211+
&:last-child {
4212+
margin-bottom: 90px;
4213+
}
4214+
}

0 commit comments

Comments
 (0)