Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Runtime Params #2248

Merged
merged 44 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
fefc9f5
feat: VariableDataTable - component integration
RohitRaj011 Dec 2, 2024
69f304e
feat: CI/CD Pipeline - Pre/Post Custom Task & Plugin Integration
RohitRaj011 Dec 5, 2024
4119dcd
chore: common-lib version bump
RohitRaj011 Dec 5, 2024
3cffbbc
Merge branch 'develop' of github.com:devtron-labs/dashboard into feat…
RohitRaj011 Dec 5, 2024
584cc74
chore: common-lib version bump
RohitRaj011 Dec 5, 2024
ef580e1
feat: Build CI - Runtime Params Integration
RohitRaj011 Dec 5, 2024
a400ecd
fix: VariableDataTable - showError bool -> true
RohitRaj011 Dec 5, 2024
ebfe434
feat: CD Pipeline - Runtime Params Integration
RohitRaj011 Dec 6, 2024
80aaeaa
feat: VariableDataTable - validation schema update, CI / CD Pipeline …
RohitRaj011 Dec 6, 2024
df86d53
chore: common-lib version bump
RohitRaj011 Dec 6, 2024
aead12b
refactor: VariableDataTable - code refactor
RohitRaj011 Dec 8, 2024
05aff25
refactor: VariableDataTable - update validations, date type formats u…
RohitRaj011 Dec 9, 2024
870be7f
chore: common-lib version bump
RohitRaj011 Dec 9, 2024
b95146a
feat: CI/CD Custom Task - remove value validations for SaveAsPlugin &…
RohitRaj011 Dec 9, 2024
3d41085
fix: VariableDataTable - number validation fix, value update fix
RohitRaj011 Dec 9, 2024
a0c90ac
fix: VariableDataTable - payload conversion incorrect data fix
RohitRaj011 Dec 9, 2024
1a9df27
refactor: VariableDataTable code refactor, replace PopupMenu with Tip…
RohitRaj011 Dec 10, 2024
d8d6946
refactor: VariableDataTable - common code moved to common-lib, feat: …
RohitRaj011 Dec 10, 2024
a84f8a3
feat: VariableDataTable - choices validations update, filter global v…
RohitRaj011 Dec 10, 2024
4889c59
refactor: TaskDetailComponent - add heading for IO Variables
RohitRaj011 Dec 10, 2024
3eebba5
chore: common-lib version bump
RohitRaj011 Dec 10, 2024
3f21fc3
feat: VariableDataTable - CI/CD Pipeline - validations functionality …
RohitRaj011 Dec 12, 2024
5333918
chore: common-lib version bump
RohitRaj011 Dec 12, 2024
8baba09
fix: VariableDataTable - undefined error fix, refactor
RohitRaj011 Dec 12, 2024
f01a4f6
chore: common-lib version bump
RohitRaj011 Dec 12, 2024
c083799
Merge pull request #2274 from devtron-labs/feat/runtime-params-global…
RohitRaj011 Dec 12, 2024
d817ac7
fix: VariableDataTable - duplicate variable name validation fix, rest…
RohitRaj011 Dec 12, 2024
a5927fd
refactor: VariableDataTable - removed component level state - using p…
RohitRaj011 Dec 13, 2024
2e3e4ee
chore: replace old runtime parameters with new one
RohitRaj011 Dec 13, 2024
b60d0ca
feat: Runtime Parameters - add validations - CI/CD Single & Bulk Pipe…
RohitRaj011 Dec 14, 2024
cce646a
Merge branch 'develop' of github.com:devtron-labs/dashboard into fix/…
RohitRaj011 Dec 14, 2024
698aa31
chore: common-lib version bump
RohitRaj011 Dec 14, 2024
f6a3b72
fix: VariableDataTable - not able to add multiple rows without any va…
RohitRaj011 Dec 16, 2024
57bfd12
refactor: VariableDataTable - UAT changes
RohitRaj011 Dec 16, 2024
2f1f8fe
Merge branch 'develop' of github.com:devtron-labs/dashboard into feat…
RohitRaj011 Dec 16, 2024
47a0638
Merge branch 'feat/runtime-params' of github.com:devtron-labs/dashboa…
RohitRaj011 Dec 16, 2024
2af3819
refactor: VariableDataTable - refactor handleRowUpdateAction method, …
RohitRaj011 Dec 16, 2024
7adcd90
chore: common-lib version bump
RohitRaj011 Dec 16, 2024
739f9aa
feat: Dot Icon - add support to add dot icon position via class, Vari…
RohitRaj011 Dec 16, 2024
7a14763
Merge pull request #2289 from devtron-labs/fix/runtime-params
RohitRaj011 Dec 16, 2024
2398c82
Merge branch 'develop' of github.com:devtron-labs/dashboard into feat…
RohitRaj011 Dec 16, 2024
7e6f6ed
fix: VariableDataTable - incorrect check for payload fix
RohitRaj011 Dec 16, 2024
821e8c7
Merge pull request #2291 from devtron-labs/fix/runtime-params-1
RohitRaj011 Dec 16, 2024
8ba5395
chore: common-lib version bump
RohitRaj011 Dec 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"homepage": "/dashboard",
"dependencies": {
"@devtron-labs/devtron-fe-common-lib": "1.2.4",
"@devtron-labs/devtron-fe-common-lib": "1.2.4-beta-11",
"@esbuild-plugins/node-globals-polyfill": "0.2.3",
"@rjsf/core": "^5.13.3",
"@rjsf/utils": "^5.13.3",
Expand Down
20 changes: 20 additions & 0 deletions src/assets/icons/ic-choices-dropdown.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/icons/ic-sliders-vertical.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions src/components/ApplicationGroup/AppGroup.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import {
WorkflowType,
AppInfoListType,
GVKType,
RuntimeParamsListItemType,
UseUrlFiltersReturnType,
CommonNodeAttr,
RuntimePluginVariables,
} from '@devtron-labs/devtron-fe-common-lib'
import { CDMaterialProps } from '../app/details/triggerView/types'
import { EditDescRequest, NodeType, Nodes, OptionType } from '../app/types'
Expand Down Expand Up @@ -103,8 +103,8 @@ export interface ResponseRowType {
}

interface BulkRuntimeParamsType {
runtimeParams: Record<string, RuntimeParamsListItemType[]>
setRuntimeParams: React.Dispatch<React.SetStateAction<Record<string, RuntimeParamsListItemType[]>>>
runtimeParams: Record<string, RuntimePluginVariables[]>
setRuntimeParams: React.Dispatch<React.SetStateAction<Record<string, RuntimePluginVariables[]>>>
runtimeParamsErrorState: Record<string, boolean>
setRuntimeParamsErrorState: React.Dispatch<React.SetStateAction<Record<string, boolean>>>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ import {
SelectPicker,
CDMaterialSidebarType,
CD_MATERIAL_SIDEBAR_TABS,
RuntimeParamsListItemType,
ToastManager,
ToastVariantType,
CommonNodeAttr,
RuntimePluginVariables,
uploadCDPipelineFile,
UploadFileProps,
} from '@devtron-labs/devtron-fe-common-lib'
import { useHistory, useLocation } from 'react-router-dom'
import { ReactComponent as Close } from '../../../../assets/icons/ic-cross.svg'
Expand Down Expand Up @@ -166,12 +168,21 @@ export default function BulkCDTrigger({
}))
}

const handleRuntimeParamChange = (currentAppRuntimeParams: RuntimeParamsListItemType[]) => {
const handleRuntimeParamChange = (currentAppRuntimeParams: RuntimePluginVariables[]) => {
const clonedRuntimeParams = structuredClone(runtimeParams)
clonedRuntimeParams[selectedApp.appId] = currentAppRuntimeParams
setRuntimeParams(clonedRuntimeParams)
}

const bulkUploadFile = ({ file, allowedExtensions, maxUploadSize }: UploadFileProps) =>
uploadCDPipelineFile({
file,
allowedExtensions,
maxUploadSize,
appId: selectedApp.appId,
envId: selectedApp.envId,
})

const getDeploymentWindowData = async (_cdMaterialResponse) => {
const currentEnv = appList[0].envId
const appEnvMap = []
Expand Down Expand Up @@ -429,13 +440,9 @@ export default function BulkCDTrigger({
if (tagNotFoundWarningsMap.has(app.appId)) {
return (
<div className="flex left top dc__gap-4">
<Error
className="icon-dim-12 dc__no-shrink mt-5 alert-icon-r5-imp"
/>
<Error className="icon-dim-12 dc__no-shrink mt-5 alert-icon-r5-imp" />

<span className="fw-4 fs-12 cr-5 dc__truncate">
{tagNotFoundWarningsMap.get(app.appId)}
</span>
<span className="fw-4 fs-12 cr-5 dc__truncate">{tagNotFoundWarningsMap.get(app.appId)}</span>
</div>
)
}
Expand All @@ -454,13 +461,9 @@ export default function BulkCDTrigger({
if (!!warningMessage && !app.showPluginWarning) {
return (
<div className="flex left top dc__gap-4">
<Error
className="icon-dim-12 dc__no-shrink mt-5 warning-icon-y7"
/>
<Error className="icon-dim-12 dc__no-shrink mt-5 warning-icon-y7" />

<span className="fw-4 fs-12 cy-7 dc__truncate">
{warningMessage}
</span>
<span className="fw-4 fs-12 cy-7 dc__truncate">{warningMessage}</span>
</div>
)
}
Expand All @@ -473,7 +476,7 @@ export default function BulkCDTrigger({
nodeType={commonNodeAttrType}
shouldRenderAdditionalInfo={isAppSelected}
/>
)
)
}

return null
Expand Down Expand Up @@ -795,6 +798,7 @@ export default function BulkCDTrigger({
bulkRuntimeParams={runtimeParams[selectedApp.appId] || []}
handleBulkRuntimeParamChange={handleRuntimeParamChange}
handleBulkRuntimeParamError={handleRuntimeParamError}
bulkUploadFile={bulkUploadFile}
bulkSidebarTab={currentSidebarTab}
selectedAppName={selectedApp.name}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import {
GenericEmptyState,
CIMaterialSidebarType,
ApiQueuingWithBatch,
RuntimeParamsListItemType,
ModuleNameMap,
SourceTypeMap,
ToastManager,
Expand All @@ -40,6 +39,10 @@ import {
ButtonVariantType,
ComponentSizeType,
ButtonStyleType,
noop,
RuntimePluginVariables,
uploadCIPipelineFile,
UploadFileProps,
} from '@devtron-labs/devtron-fe-common-lib'
import Tippy from '@tippyjs/react'
import { getCIPipelineURL, getParsedBranchValuesForPlugin, importComponentFromFELibrary } from '../../../common'
Expand Down Expand Up @@ -168,14 +171,14 @@ const BulkCITrigger = ({
[appDetails.ciPipelineId]: [],
})
}
return () => getRuntimeParams(appDetails.ciPipelineId)
return () => getRuntimeParams(appDetails.ciPipelineId, true)
})

if (runtimeParamsServiceList.length) {
try {
// Appending any for legacy code, since we did not had generics in APIQueuingWithBatch
const responses: any[] = await ApiQueuingWithBatch(runtimeParamsServiceList, true)
const _runtimeParams: Record<string, RuntimeParamsListItemType[]> = {}
const _runtimeParams: Record<string, RuntimePluginVariables[]> = {}
responses.forEach((res, index) => {
_runtimeParams[appList[index]?.ciPipelineId] = res.value || []
})
Expand Down Expand Up @@ -248,6 +251,15 @@ const BulkCITrigger = ({
setRuntimeParams(updatedRuntimeParams)
}

const uploadFile = ({ file, allowedExtensions, maxUploadSize }: UploadFileProps) =>
uploadCIPipelineFile({
file,
allowedExtensions,
maxUploadSize,
appId: selectedApp.appId,
ciPipelineId: +selectedApp.ciPipelineId,
})

const handleSidebarTabChange = (e: React.ChangeEvent<HTMLInputElement>) => {
if (runtimeParamsErrorState[selectedApp.ciPipelineId]) {
ToastManager.showToast({
Expand Down Expand Up @@ -519,6 +531,7 @@ const BulkCITrigger = ({
runtimeParams={runtimeParams[selectedApp.ciPipelineId] || []}
handleRuntimeParamChange={handleRuntimeParamChange}
handleRuntimeParamError={handleRuntimeParamError}
uploadFile={uploadFile}
appName={selectedApp?.name}
isBulkCIWebhook={isWebhookBulkCI}
setIsWebhookBulkCI={setIsWebhookBulkCI}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@ import {
ApiQueuingWithBatch,
usePrompt,
SourceTypeMap,
RuntimeParamsListItemType,
preventBodyScroll,
ToastManager,
ToastVariantType,
BlockedStateData,
RuntimePluginVariables,
uploadCIPipelineFile,
} from '@devtron-labs/devtron-fe-common-lib'
import Tippy from '@tippyjs/react'
import {
Expand Down Expand Up @@ -185,7 +186,7 @@ export default function EnvTriggerView({ filteredAppIds, isVirtualEnv }: AppGrou
const [isConfigPresent, setConfigPresent] = useState<boolean>(false)
const [isDefaultConfigPresent, setDefaultConfig] = useState<boolean>(false)
// Mapping pipelineId (in case of CI) and appId (in case of CD) to runtime params
const [runtimeParams, setRuntimeParams] = useState<Record<string, RuntimeParamsListItemType[]>>({})
const [runtimeParams, setRuntimeParams] = useState<Record<string, RuntimePluginVariables[]>>({})
const [runtimeParamsErrorState, setRuntimeParamsErrorState] = useState<Record<string, boolean>>({})
const [isBulkTriggerLoading, setIsBulkTriggerLoading] = useState<boolean>(false)

Expand Down Expand Up @@ -872,7 +873,7 @@ export default function EnvTriggerView({ filteredAppIds, isVirtualEnv }: AppGrou
_appName,
)
: null,
getRuntimeParams ? getRuntimeParams(ciNodeId) : null,
getRuntimeParams ? getRuntimeParams(ciNodeId, true) : null,
])
.then((resp) => {
// need to set result for getCIBlockState call only as for updateCIMaterialList
Expand Down Expand Up @@ -1982,9 +1983,7 @@ export default function EnvTriggerView({ filteredAppIds, isVirtualEnv }: AppGrou
if (selectedCINode?.id) {
return (
<Switch>
<Route
path={`${url}${URLS.BUILD}/:ciNodeId/${URLS.WEBHOOK_MODAL}`}
>
<Route path={`${url}${URLS.BUILD}/:ciNodeId/${URLS.WEBHOOK_MODAL}`}>
<WebhookReceivedPayloadModal
workflowId={workflowID}
webhookPayloads={webhookPayloads}
Expand Down
14 changes: 13 additions & 1 deletion src/components/CIPipelineN/CIPipeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import {
ToastManager,
ProcessPluginDataParamsType,
ResourceKindType,
uploadCIPipelineFile,
} from '@devtron-labs/devtron-fe-common-lib'
import Tippy from '@tippyjs/react'
import {
Expand Down Expand Up @@ -783,6 +784,16 @@ export default function CIPipeline({
}
}

const uploadFile: PipelineContext['uploadFile'] = ({ allowedExtensions, file, maxUploadSize }) =>
uploadCIPipelineFile({
appId: +appId,
envId: isJobView ? selectedEnv?.id : null,
ciPipelineId: +ciPipelineId,
file,
allowedExtensions,
maxUploadSize,
})

const contextValue = useMemo(
() => ({
formData,
Expand Down Expand Up @@ -810,6 +821,7 @@ export default function CIPipeline({
handleDisableParentModalCloseUpdate,
handleValidateMandatoryPlugins,
mandatoryPluginData,
uploadFile,
}),
[
formData,
Expand Down Expand Up @@ -977,7 +989,7 @@ export default function CIPipeline({
<>
{renderFloatingVariablesWidget()}

<Drawer position="right" width="75%" minWidth="1024px" maxWidth="1200px">
<Drawer position="right" width="75%" minWidth="1024px" maxWidth="1200px" onEscape={handleClose}>
{renderCIPipelineModal()}
</Drawer>
</>
Expand Down
2 changes: 2 additions & 0 deletions src/components/CIPipelineN/CreatePluginModal/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ const parseInputVariablesIntoCreatePluginPayload = (
valueType: variable.variableType,
referenceVariableName: variable.refVariableName,
isExposed: true,
fileMountDir: variable.fileMountDir,
fileReferenceId: variable.fileReferenceId,
})) || []

export const getCreatePluginPayload = ({
Expand Down
2 changes: 1 addition & 1 deletion src/components/CIPipelineN/InputPluginSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export const InputPluginSelection = ({
placeholder={placeholder}
refVar={refVar}
tabIndex={selectedVariableIndex}
handleKeyDown={handleOnKeyDown}
onKeyDown={handleOnKeyDown}
/>
{(variableData.refVariableStage ||
(variableData?.variableType && variableData.variableType !== 'NEW')) && (
Expand Down
8 changes: 4 additions & 4 deletions src/components/CIPipelineN/TaskDetailComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ import {
PluginDataStoreType,
getUpdatedPluginStore,
} from '@devtron-labs/devtron-fe-common-lib'
import CustomInputOutputVariables from './CustomInputOutputVariables'
import { PluginDetailHeader } from './PluginDetailHeader'
import { TaskTypeDetailComponent } from './TaskTypeDetailComponent'
import { ValidationRules } from '../ciPipeline/validationRules'
import { pipelineContext } from '../workflowEditor/workflowEditor'
import { PluginDetailHeaderProps, TaskDetailComponentParamsType } from './types'
import { filterInvalidConditionDetails } from '@Components/cdPipeline/cdpipeline.util'
import { VariableDataTable } from './VariableDataTable'

export const TaskDetailComponent = () => {
const {
Expand Down Expand Up @@ -273,10 +273,10 @@ export const TaskDetailComponent = () => {
</div>
<hr />
{selectedStep.stepType === PluginType.INLINE ? (
<CustomInputOutputVariables type={PluginVariableType.INPUT} />
<VariableDataTable key={selectedTaskIndex} type={PluginVariableType.INPUT} isCustomTask />
) : (
<VariableContainer type={PluginVariableType.INPUT} />
)}{' '}
)}
<hr />
{selectedStep[currentStepTypeVariable]?.inputVariables?.length > 0 && (
<>
Expand All @@ -289,7 +289,7 @@ export const TaskDetailComponent = () => {
<TaskTypeDetailComponent />
{formData[activeStageName].steps[selectedTaskIndex][currentStepTypeVariable].scriptType !==
ScriptType.CONTAINERIMAGE && (
<CustomInputOutputVariables type={PluginVariableType.OUTPUT} />
<VariableDataTable key={selectedTaskIndex} type={PluginVariableType.OUTPUT} isCustomTask />
)}
</>
) : (
Expand Down
Loading
Loading