Skip to content

Commit

Permalink
Merge branch 'develop' into feat/notification-configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
shivani170 committed Jan 6, 2025
2 parents 35aae80 + 770557c commit 63d43a1
Show file tree
Hide file tree
Showing 20 changed files with 113 additions and 72 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ FEATURE_EXTERNAL_FLUX_CD_ENABLE=false
FEATURE_SCOPED_VARIABLE_ENVIRONMENT_LIST_ENABLE=false
HIDE_NETWORK_STATUS_INTERFACE=true
SYSTEM_CONTROLLER_LISTING_TIMEOUT=300000
FEATURE_STEP_WISE_LOGS_ENABLE=true
FEATURE_IMAGE_PROMOTION_ENABLE=false
FEATURE_CD_MANDATORY_PLUGINS_ENABLE=true
FEATURE_HIDE_USER_DIRECT_PERMISSIONS_FOR_NON_SUPER_ADMINS=false
FEATURE_CONFIG_DRIFT_ENABLE=false
FEATURE_PROMO_EMBEDDED_BUTTON_TEXT=
FEATURE_PROMO_EMBEDDED_MODAL_TITLE=
FEATURE_PROMO_EMBEDDED_IFRAME_URL=
FEATURE_SWAP_TRAFFIC_ENABLE=false
FEATURE_RB_SYNC_CLUSTER_ENABLE=false
FEATURE_BULK_RESTART_WORKLOADS_FROM_RB=deployment,rollout,daemonset,statefulset
FEATURE_DEFAULT_MERGE_STRATEGY=
Expand Down
1 change: 1 addition & 0 deletions .github/semantic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ types:
- doc
- release
- misc
- sync
32 changes: 21 additions & 11 deletions .github/workflows/pr-issue-validator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
run: |
set -x
# Skip validation for documentation or chore PRs
if [[ "$TITLE" =~ ^(doc:|docs:|chore:|misc:|release:) ]]; then
if [[ "$TITLE" =~ ^(doc:|docs:|chore:|misc:|release:|sync:) ]]; then
echo "Skipping validation for docs/chore PR."
echo "PR NUMBER-: $PRNUM "
gh pr edit $PRNUM --remove-label "PR:Issue-verification-failed"
Expand Down Expand Up @@ -106,21 +106,31 @@ jobs:
--header "authorization: Bearer ${{ secrets.GH_PR_VALIDATOR_TOKEN }}" \
"$issue_api_url" | jq '.state'|tr -d \")
# Check if the issue is still open.
if [[ "$issue_status" == open ]]; then
echo "Issue #$issue_num is opened."
# if [[ "$issue_status" == open ]]; then
# echo "Issue #$issue_num is opened."
if [[ $forked == true ]]; then
echo "PR:Ready-to-Review, exiting gracefully"
exit 0
fi
# Remove the 'Issue-verification-failed' label (if present) and add 'Ready-to-Review'.
gh pr edit $PRNUM --remove-label "PR:Issue-verification-failed"
gh pr edit $PRNUM --add-label "PR:Ready-to-Review"
else
echo "Issue #$issue_num is closed. Please link an open issue to proceed."
echo "PR:Ready-to-Review, exiting gracefully"
exit 0
# else
# echo "Issue #$issue_num is closed. Please link an open issue to proceed."
# if [[ $forked == true ]]; then
# echo "PR:Ready-to-Review, exiting gracefully"
# exit 0
# fi
# Add a comment to the PR indicating the issue is not linked correctly.
gh pr comment $PRNUM --body "PR is linked to a closed issue. Please link an open issue to proceed."
# gh pr comment $PRNUM --body "PR is linked to a closed issue. Please link an open issue to proceed."

# Add the 'Issue-verification-failed' label and remove 'Ready-to-Review'.
gh pr edit $PRNUM --add-label "PR:Issue-verification-failed"
gh pr edit $PRNUM --remove-label "PR:Ready-to-Review"
exit 1
fi
# gh pr edit $PRNUM --add-label "PR:Issue-verification-failed"
# gh pr edit $PRNUM --remove-label "PR:Ready-to-Review"
# exit 1
#fi
else
echo "Issue not found. Invalid URL or issue number."
# Add a comment to the PR indicating the issue is not linked correctly.
Expand All @@ -130,4 +140,4 @@ jobs:
gh pr edit $PRNUM --add-label "PR:Issue-verification-failed"
gh pr edit $PRNUM --remove-label "PR:Ready-to-Review"
exit 1
fi
fi
1 change: 0 additions & 1 deletion config.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
| SIDEBAR_DT_LOGO | "" | Devtron logo for sidebar (would work if ORGANIZATION_NAME is not given) |
| SERVICE_WORKER_TIMEOUT | "1" | Timeout value (in minutes) to fetch update for dashboard, change it cautiously as might hamper your update cycle |
| TRIGGER_API_TIMEOUT | 60000 | Default timeout for all API requests for Trigger calls (Deploy artifacts, charts) in DASHBOARD |
| FEATURE_STEP_WISE_LOGS_ENABLE | true | Would segregate logs into tasks |
| FEATURE_HIDE_USER_DIRECT_PERMISSIONS_FOR_NON_SUPER_ADMINS | "true" | Would hide the user direct permissions for non-super admin users in User Permissions |
| FEATURE_ACTION_AUDIOS_ENABLE | true | Would enable audios in dashboard |

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "dashboard",
"version": "1.3.0",
"version": "1.4.0",
"private": true,
"homepage": "/dashboard",
"dependencies": {
"@devtron-labs/devtron-fe-common-lib": "1.3.11",
"@devtron-labs/devtron-fe-common-lib": "1.4.0-patch-1",
"@esbuild-plugins/node-globals-polyfill": "0.2.3",
"@rjsf/core": "^5.13.3",
"@rjsf/utils": "^5.13.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export interface EnvironmentOptionType {
id: number
}

export interface EnvConfigurationsNavProps extends Pick<AppConfigState, 'envIdToEnvApprovalConfigurationMap'> {
export interface EnvConfigurationsNavProps {
envConfig: EnvConfigurationState
fetchEnvConfig: (envId: number) => void
environments: EnvironmentOptionType[]
Expand All @@ -221,6 +221,7 @@ export interface EnvConfigurationsNavProps extends Pick<AppConfigState, 'envIdTo
showDeploymentTemplate?: boolean
isCMSecretLocked?: boolean
hideEnvSelector?: boolean
appOrEnvIdToResourceApprovalConfigurationMap: AppConfigState['envIdToEnvApprovalConfigurationMap']
}

export interface EnvConfigRouteParams {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export const AppNavigation = () => {
compareWithURL={`${path}/:envId(\\d+)?`}
showComparison={!isJobView && isUnlocked.workflowEditor}
isCMSecretLocked={!isUnlocked.workflowEditor}
envIdToEnvApprovalConfigurationMap={envIdToEnvApprovalConfigurationMap}
appOrEnvIdToResourceApprovalConfigurationMap={envIdToEnvApprovalConfigurationMap}
/>
)}
</Route>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,21 @@ export const EnvConfigurationsNav = ({
showDeploymentTemplate,
envConfig,
fetchEnvConfig,
environments,
environments: resourceList,
goBackURL,
paramToCheck = 'envId',
showComparison,
isCMSecretLocked,
hideEnvSelector,
compareWithURL,
envIdToEnvApprovalConfigurationMap,
appOrEnvIdToResourceApprovalConfigurationMap,
}: EnvConfigurationsNavProps) => {
// HOOKS
const history = useHistory()
const { pathname } = useLocation()
const { path, params } = useRouteMatch<EnvConfigRouteParams>()
const { envId } = params
const parsedResourceId = +params[paramToCheck]

// STATES
const [expandedIds, setExpandedIds] =
Expand All @@ -71,8 +72,8 @@ export const EnvConfigurationsNav = ({
// CONSTANTS
const { isLoading, config } = envConfig
/** Current Environment Data. */
const environmentData =
environments.find((environment) => environment.id === +params[paramToCheck]) ||
const resourceData =
resourceList.find((resource) => resource.id === parsedResourceId) ||
(showBaseConfigurations
? {
name: BASE_CONFIGURATIONS.name,
Expand Down Expand Up @@ -106,12 +107,12 @@ export const EnvConfigurationsNav = ({
}

useEffect(() => {
if (environmentData.id === BASE_CONFIGURATIONS.id && envId) {
if (resourceData.id === BASE_CONFIGURATIONS.id && envId) {
// Removing `/env-override/:envId` from pathname, resulting path will be base configuration path.
const [basePath, resourcePath] = pathname.split(`/${URLS.APP_ENV_OVERRIDE_CONFIG}/${envId}`)
history.push(`${basePath}${resourcePath}`)
}
}, [environmentData, envId])
}, [resourceData, envId])

useEffect(() => {
// Fetch the env configuration
Expand All @@ -124,18 +125,17 @@ export const EnvConfigurationsNav = ({

useEffect(() => {
if (!isLoading && config) {
// For base configurations, the env id is undefined
const environmentId = +envId || BASE_CONFIGURATION_ENV_ID

const newEnvConfig = getEnvConfiguration(
config,
path,
params,
envIdToEnvApprovalConfigurationMap?.[environmentId]?.approvalConfigurationMap,
// For base configurations, the resource id is undefined
appOrEnvIdToResourceApprovalConfigurationMap?.[parsedResourceId || BASE_CONFIGURATION_ENV_ID]
?.approvalConfigurationMap,
)
setUpdatedEnvConfig(isCreate ? addUnnamedNavLink(newEnvConfig) : newEnvConfig)
}
}, [isLoading, config, pathname, isCreate, envIdToEnvApprovalConfigurationMap])
}, [isLoading, config, pathname, isCreate, appOrEnvIdToResourceApprovalConfigurationMap])

useEffect(() => {
if (!isLoading && config) {
Expand Down Expand Up @@ -259,7 +259,7 @@ export const EnvConfigurationsNav = ({
...baseEnvOption,
{
label: paramToCheck === 'envId' ? 'Environments' : 'Applications',
options: environments.map(({ name, id }) => ({
options: resourceList.map(({ name, id }) => ({
label: name,
value: id,
})),
Expand All @@ -268,7 +268,7 @@ export const EnvConfigurationsNav = ({

const onEnvSelect = ({ value }: SelectPickerOptionType<number>) => {
// Exit early if the selected environment is the current one
if (environmentData.id === value) {
if (resourceData.id === value) {
return
}

Expand Down Expand Up @@ -314,7 +314,7 @@ export const EnvConfigurationsNav = ({
classNamePrefix="env-config-selector"
variant={SelectPickerVariantType.BORDER_LESS}
isClearable={false}
value={getSelectPickerOptionByValue(envOptions, +params[paramToCheck], baseEnvOption[0])}
value={getSelectPickerOptionByValue(envOptions, parsedResourceId, baseEnvOption[0])}
options={envOptions}
onChange={onEnvSelect}
placeholder="Select Environment"
Expand All @@ -325,7 +325,7 @@ export const EnvConfigurationsNav = ({
)

const renderCompareWithBtn = () => {
const { name: compareTo } = environmentData
const { name: compareTo } = resourceData

// Extract the resource name from the current pathname based on resourceType
const resourceName = pathname.split(`/${resourceType}/`)[1]
Expand Down Expand Up @@ -362,7 +362,7 @@ export const EnvConfigurationsNav = ({
{!hideEnvSelector && renderEnvSelector()}
{showComparison && renderCompareWithBtn()}
<div className="mw-none p-8 flex-grow-1 dc__overflow-auto">
{isLoading || !environmentData ? (
{isLoading || !resourceData ? (
['90', '70', '50'].map((item) => <ShimmerText key={item} width={item} />)
) : (
<>
Expand Down
4 changes: 2 additions & 2 deletions src/Pages/Releases/Detail/Configurations/Configurations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const Configurations = () => {
() => (environments ? environments.find(({ id }) => +envId === id) : null),
[environments, envId, isEnvListLoading],
)
const approvalConfigForEnv = envIdToEnvApprovalConfigurationMap[selectedEnv?.id]?.approvalConfigurationMap
const approvalConfigForEnv = envIdToEnvApprovalConfigurationMap?.[selectedEnv?.id]?.approvalConfigurationMap
const showConfig = !!selectedApp && !!selectedEnv

// RENDERERS
Expand All @@ -85,7 +85,7 @@ export const Configurations = () => {
showDeploymentTemplate
showComparison
hideEnvSelector
envIdToEnvApprovalConfigurationMap={envIdToEnvApprovalConfigurationMap}
appOrEnvIdToResourceApprovalConfigurationMap={envIdToEnvApprovalConfigurationMap}
/>
</Route>
</Switch>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const EnvironmentOverride = ({
const environmentsMap = mapByKey(environments || [], 'environmentId')
const appMap = mapByKey(appList || [], 'id')
const approvalConfigMap =
appOrEnvIdToResourceApprovalConfigurationMap[+(isAppGroupView ? params.appId : params.envId)]
appOrEnvIdToResourceApprovalConfigurationMap?.[+(isAppGroupView ? params.appId : params.envId)]
?.approvalConfigurationMap
const isDeploymentOverride = !!location.pathname.includes(URLS.APP_DEPLOYMENT_CONFIG)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const ApplicationRoute = ({
paramToCheck="appId"
compareWithURL={path}
showComparison
envIdToEnvApprovalConfigurationMap={appIdToAppApprovalConfigMap}
appOrEnvIdToResourceApprovalConfigurationMap={appIdToAppApprovalConfigMap}
/>
</Route>
<Route key="default-navigation">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,7 @@ const BulkCITrigger = ({
const getRuntimeParamsData = async (_materialListMap: Record<string, any[]>): Promise<void> => {
const runtimeParamsServiceList = appList.map((appDetails) => {
if (getIsAppUnorthodox(appDetails) || !_materialListMap[appDetails.appId]) {
return () => ({
[appDetails.ciPipelineId]: [],
})
return () => ([])
}
return () => getRuntimeParams(appDetails.ciPipelineId)
})
Expand Down
53 changes: 28 additions & 25 deletions src/components/CIPipelineN/VariableDataTable/ValueConfigOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
SelectPicker,
SelectPickerOptionType,
Tooltip,
validateRequiredPositiveNumber,
VariableTypeFormat,
} from '@devtron-labs/devtron-fe-common-lib'

Expand Down Expand Up @@ -64,7 +65,7 @@ export const ValueConfigOverlay = ({ row, handleRowUpdateAction }: ConfigOverlay
id: choiceId,
value: choiceValue,
error:
isFormatNumber && !PATTERNS.NATURAL_NUMBERS.test(choiceValue)
isFormatNumber && !PATTERNS.DECIMAL_NUMBERS.test(choiceValue)
? 'Choice is not a number'
: '',
}
Expand Down Expand Up @@ -116,7 +117,7 @@ export const ValueConfigOverlay = ({ row, handleRowUpdateAction }: ConfigOverlay
}: Partial<Pick<typeof fileInfo, 'maxUploadSize' | 'sizeUnit'>>) => {
setFileSize({
value: maxUploadSize,
error: maxUploadSize && !PATTERNS.DECIMAL_NUMBERS.test(maxUploadSize) ? 'File size must be a number' : '',
error: maxUploadSize ? validateRequiredPositiveNumber(maxUploadSize).message : '',
})
handleRowUpdateAction({
actionType: VariableDataTableActionType.UPDATE_FILE_MAX_SIZE,
Expand Down Expand Up @@ -183,30 +184,32 @@ export const ValueConfigOverlay = ({ row, handleRowUpdateAction }: ConfigOverlay
onChange={handleFileAllowedExtensionsChange}
/>
</div>
<div className="flexbox dc__align-items-center">
<div className="flex-grow-1">
<CustomInput
name="fileMaxSize"
onChange={handleFileMaxSizeChange}
value={fileSize.value}
label="Restrict file size"
placeholder="Enter size"
error={fileSize.error}
/>
</div>
<div className={`${fileSize.error ? 'mt-2 dc__align-self-center' : 'dc__align-self-end'}`}>
<SelectPicker
inputId="file-max-size-unit-selector"
classNamePrefix="file-max-size-unit-selector"
value={fileInfo.sizeUnit}
onChange={handleFileSizeUnitChange}
options={FILE_UPLOAD_SIZE_UNIT_OPTIONS}
size={ComponentSizeType.large}
menuSize={ComponentSizeType.xs}
isDisabled={!!fileSize.error}
menuPortalTarget={document.getElementById('visible-modal')}
/>
<div>
<div className="flexbox dc__align-items-center">
<div className="flex-grow-1">
<CustomInput
name="fileMaxSize"
onChange={handleFileMaxSizeChange}
value={fileSize.value}
label="Restrict file size"
placeholder="Enter size"
/>
</div>
<div className="dc__align-self-end">
<SelectPicker
inputId="file-max-size-unit-selector"
classNamePrefix="file-max-size-unit-selector"
value={fileInfo.sizeUnit}
onChange={handleFileSizeUnitChange}
options={FILE_UPLOAD_SIZE_UNIT_OPTIONS}
size={ComponentSizeType.large}
menuSize={ComponentSizeType.xs}
isDisabled={!!fileSize.error}
menuPortalTarget={document.getElementById('visible-modal')}
/>
</div>
</div>
{!!fileSize.error && <div className="form__error">{fileSize.error}</div>}
</div>
</div>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
ButtonVariantType,
ComponentSizeType,
stopPropagation,
Tooltip,
} from '@devtron-labs/devtron-fe-common-lib'

import { ReactComponent as ICClose } from '@Icons/ic-close.svg'
Expand Down Expand Up @@ -87,7 +88,9 @@ export const VariableDataTablePopupMenu = ({
<div className="px-12 py-8 flexbox dc__align-items-center dc__content-space dc__gap-8 dc__border-bottom-n1">
<div className="flexbox dc__align-items-center dc__gap-8">
{showHeaderIcon && <ICSlidersVertical className="icon-dim-16" />}
<p className="m-0 fw-6 fs-13 lh-20">{heading}</p>
<Tooltip content={heading}>
<p className="m-0 fw-6 fs-13 lh-20 dc__truncate">{heading}</p>
</Tooltip>
</div>
<Button
size={ComponentSizeType.small}
Expand Down
Loading

0 comments on commit 63d43a1

Please sign in to comment.