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: misc enhancements #2244

Merged
merged 20 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
bee625b
feat: dont show devtron stack in EA mode
Elessar1802 Nov 27, 2024
fdec960
feat: hide argocd and fluxcd tabs if user is not superadmin
Elessar1802 Nov 27, 2024
f0a6f0c
feat: make rb default landing in ea mode
Elessar1802 Nov 27, 2024
aceb601
feat: add delete confirmation to resource delete dialog in rb
Elessar1802 Nov 27, 2024
a424e46
chore: common-lib version bump
Elessar1802 Nov 27, 2024
943d039
fix: ConfigMapSecret - Job - hide inherited tab - broken UI
RohitRaj011 Nov 28, 2024
31b79cd
Merge pull request #2242 from devtron-labs/fix/jobs-cm-cs-inherited-t…
RohitRaj011 Nov 28, 2024
9b31c36
Merge branch 'develop' of github.com:devtron-labs/dashboard into chor…
Elessar1802 Nov 28, 2024
5b3bc0d
feat: default to same env but prev deployment on initial compare view…
Elessar1802 Nov 28, 2024
9c35fd9
fix: retain compareWith selection on switch between manifest and conf…
Elessar1802 Nov 29, 2024
0c6bb20
Merge branch 'develop' of github.com:devtron-labs/dashboard into chor…
Elessar1802 Dec 2, 2024
435f472
fix: review comments
Elessar1802 Dec 2, 2024
9136060
fix: dont save nulls to url search params
Elessar1802 Dec 2, 2024
b66e3ca
fix: default landing to RB from login and bad url
Elessar1802 Dec 2, 2024
628f3f0
fix: only default to RB if in EA mode
Elessar1802 Dec 2, 2024
eafa252
chore: remove unused imports
Elessar1802 Dec 2, 2024
5c301ba
fix: show stack manager only to non-enterprise setups
Elessar1802 Dec 2, 2024
37dba29
Merge branch 'main' of github.com:devtron-labs/dashboard into chore/m…
Elessar1802 Dec 2, 2024
d2e966a
chore: update common-lib version
Elessar1802 Dec 2, 2024
979fa42
Update pr-issue-validator.yaml
tayalrishabh96 Dec 2, 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
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,4 @@ FEATURE_PROMO_EMBEDDED_BUTTON_TEXT=
FEATURE_PROMO_EMBEDDED_MODAL_TITLE=
FEATURE_PROMO_EMBEDDED_IFRAME_URL=
FEATURE_BULK_RESTART_WORKLOADS_FROM_RB=deployment,rollout,daemonset,statefulset
FEATURE_DEFAULT_LANDING_RB_ENABLE=false
1 change: 1 addition & 0 deletions .github/workflows/pr-issue-validator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
branches:
- 'main'
- 'release-**'
- 'develop'

jobs:
validate-PR-issue:
Expand Down
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.1.6",
"@devtron-labs/devtron-fe-common-lib": "1.1.7",
"@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 @@ -67,15 +67,13 @@ const ConfigHeader = ({
showNoOverride,
parsingError,
restoreLastSavedYAML,
hideDryRunTab = false,
hideTabs = {},
}: ConfigHeaderProps) => {
const validTabKeys = isOverridable
? CONFIG_HEADER_TAB_VALUES.OVERRIDE
: CONFIG_HEADER_TAB_VALUES.BASE_DEPLOYMENT_TEMPLATE

const filteredTabKeys = validTabKeys.filter(
(currentTab: ConfigHeaderTabType) => !hideDryRunTab || currentTab !== ConfigHeaderTabType.DRY_RUN,
)
const filteredTabKeys = validTabKeys.filter((tab) => !hideTabs[tab])

const activeTabIndex = filteredTabKeys.indexOf(configHeaderTab)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect, useMemo, useState } from 'react'
import { generatePath, useHistory, useRouteMatch } from 'react-router-dom'
import { useEffect, useMemo, useRef, useState } from 'react'
import { generatePath, useHistory, useLocation, useRouteMatch } from 'react-router-dom'

import {
useUrlFilters,
Expand Down Expand Up @@ -57,9 +57,11 @@ export const DeploymentConfigCompare = ({
const { push } = useHistory()
const { path, params } = useRouteMatch<DeploymentConfigParams>()
const { compareTo, resourceType, resourceName, appId, envId } = params
const location = useLocation()

// STATES
const [convertVariables, setConvertVariables] = useState(false)
const isDefaultLandingPreviousDeploymentSet = useRef<boolean>(false)

// GLOBAL CONSTANTS
const isManifestView = resourceType === EnvResourceType.Manifest
Expand Down Expand Up @@ -133,6 +135,32 @@ export const DeploymentConfigCompare = ({
[options, optionsLoader],
)

useEffect(() => {
if (!compareEnvOptions || isDefaultLandingPreviousDeploymentSet.current) {
return
}

isDefaultLandingPreviousDeploymentSet.current = true

if (!compareEnvOptions.previousDeployments?.length) {
updateSearchParams({
compareWith: null,
})

return
}

const previousDeploymentData = compareEnvOptions.previousDeployments[0]

updateSearchParams({
[AppEnvDeploymentConfigQueryParams.COMPARE_WITH_CONFIG_TYPE]:
AppEnvDeploymentConfigType.PREVIOUS_DEPLOYMENTS,
compareWithIdentifierId: previousDeploymentData.deploymentTemplateHistoryId,
compareWithPipelineId: previousDeploymentData.pipelineId,
compareWithManifestChartRefId: isManifestView ? previousDeploymentData.chartRefId : null,
})
}, [compareEnvOptions])

const fetchManifestData = async () => {
const [{ result: currentList }, { result: compareList }] = await Promise.all([
getDeploymentTemplateData({ type, appName, envName, configType, compareName: compareTo }),
Expand Down Expand Up @@ -480,13 +508,49 @@ export const DeploymentConfigCompare = ({
if (_isManifestView) {
setConvertVariables(false)
}
push(
generatePath(path, {

const currentSearchParams = new URLSearchParams(location.search)

// NOTE: need to find the corresponding chartRefId(s) for compareWith and compareTo
// and set/delete them based on _isManifestView
const _compareWithManifestChartRefId =
currentSearchParams.has('compareWithIdentifierId') && _isManifestView
? compareEnvOptions.previousDeployments.find(
(prev) =>
prev.deploymentTemplateHistoryId ===
Number(currentSearchParams.get('compareWithIdentifierId')),
)?.chartRefId ?? null
: null

const _manifestChartRefId =
currentSearchParams.has('identifierId') && _isManifestView
? currentEnvOptions.previousDeployments.find(
(prev) => prev.deploymentTemplateHistoryId === Number(currentSearchParams.get('identifierId')),
)?.chartRefId ?? null
: null

if (_compareWithManifestChartRefId) {
currentSearchParams.set('compareWithManifestChartRefId', String(_compareWithManifestChartRefId))
} else {
// NOTE: make sure to not set null as URLSearchParams will save the null as string
// i.e suppose we save 'hello' = null, we get ?hello=null as search param
currentSearchParams.delete('compareWithManifestChartRefId')
}

if (_manifestChartRefId) {
currentSearchParams.set('manifestChartRefId', String(_manifestChartRefId))
} else {
currentSearchParams.delete('manifestChartRefId')
}

push({
pathname: generatePath(path, {
...params,
resourceType: _isManifestView ? EnvResourceType.Manifest : EnvResourceType.DeploymentTemplate,
resourceName: null,
}),
)
search: currentSearchParams.toString(),
})
}

const tabConfig: DeploymentConfigDiffProps['tabConfig'] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export const parseCompareWithSearchParams =
// If `type` is 'app' (Application), set `compareWith` to the first environment if available,
// otherwise `null` (base configuration).
if (type === 'app') {
compareWith = environments.length && !compareTo ? environments[0].name : null
compareWith = compareTo || (environments.length ? environments[0].name : null)
} else {
// If `type` is 'appGroup' (Application Groups), set `compareWith` to the first application.
// If the application to compare (`compareTo`) is the same as the first application,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,8 @@ export interface ConfigHeaderProps {
showNoOverride: boolean
parsingError: string
restoreLastSavedYAML: () => void
/**
* This prop hides the dry run tab in the header
* This prop is meant to be removed after patch merge strategy is introduced
* @default - false
*/
hideDryRunTab?: boolean
/** A map indicating which tabs to hide, with their visibility as boolean values */
hideTabs?: Partial<Record<ConfigHeaderTabType, boolean>>
}

export interface ConfigHeaderTabProps
Expand Down
19 changes: 14 additions & 5 deletions src/Pages/Shared/ConfigMapSecret/ConfigMapSecretContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,10 @@ export const ConfigMapSecretContainer = ({
})
: null,
// Fetch Base Configuration (Inherited Tab Data)
cmSecretStateLabel === CM_SECRET_STATE.INHERITED ||
cmSecretStateLabel === CM_SECRET_STATE.OVERRIDDEN
// Skipped for jobs as API support is unavailable
!isJob &&
(cmSecretStateLabel === CM_SECRET_STATE.INHERITED ||
cmSecretStateLabel === CM_SECRET_STATE.OVERRIDDEN)
? getConfigMapSecretConfigData({
appId: +appId,
appName,
Expand Down Expand Up @@ -372,7 +374,7 @@ export const ConfigMapSecretContainer = ({

// TAB HANDLING
useEffect(() => {
if (cmSecretStateLabel === CM_SECRET_STATE.INHERITED && !draftData) {
if (!isJob && cmSecretStateLabel === CM_SECRET_STATE.INHERITED && !draftData) {
setConfigHeaderTab(ConfigHeaderTabType.INHERITED)
} else {
setConfigHeaderTab(ConfigHeaderTabType.VALUES)
Expand Down Expand Up @@ -430,7 +432,14 @@ export const ConfigMapSecretContainer = ({

const handleClearPopupNode = () => setPopupNodeType(null)

const handleViewInheritedConfig = () => setConfigHeaderTab(ConfigHeaderTabType.INHERITED)
const handleViewInheritedConfig = () => {
if (isJob) {
// Redirecting to the base config URL, since inherited tab is hidden
history.push(baseConfigurationURL)
} else {
setConfigHeaderTab(ConfigHeaderTabType.INHERITED)
}
}

const handleProtectionViewTabChange = (tab: ProtectConfigTabsType) => {
setSelectedProtectionViewTab(tab)
Expand Down Expand Up @@ -746,7 +755,7 @@ export const ConfigMapSecretContainer = ({
}
parsingError={parsingError}
restoreLastSavedYAML={restoreLastSavedYAML}
hideDryRunTab
hideTabs={{ dryRun: true, inherited: isJob }}
/>
{!hideConfigToolbar && (
<ConfigToolbar
Expand Down
8 changes: 7 additions & 1 deletion src/Pages/Shared/ConfigMapSecret/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ export const getConfigMapSecretFormInitialValues = ({
defaultMountPath,
subPath,
data,
defaultData,
filePermission,
roleARN,
esoSubPath,
Expand All @@ -242,7 +243,12 @@ export const getConfigMapSecretFormInitialValues = ({
selectedType: type ?? configMapSecretMountDataMap.environment.value,
isFilePermissionChecked: !!filePermission,
isSubPathChecked: !!subPath,
externalSubpathValues: processExternalSubPathValues({ data, external, subPath, esoSubPath }),
externalSubpathValues: processExternalSubPathValues({
data: data || defaultData,
external,
subPath,
esoSubPath,
}),
filePermission: filePermission ?? '',
volumeMountPath: mountPath ?? defaultMountPath ?? '',
roleARN: roleARN ?? '',
Expand Down
2 changes: 2 additions & 0 deletions src/components/ClusterNodes/NodeActions/DeleteNodeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ export default function DeleteNodeModal({ name, version, kind, closePopup }: Nod
delete={deleteAPI}
closeDelete={onClose}
deletePostfix={DELETE_NODE_MODAL_MESSAGING.deletePostfix}
showDeleteConfirmation
apiCallInProgress={apiCallInProgress}
deleteConfirmationText={name}
>
<InfoColourBar
classname="question-bar p-lr-12"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ const DeleteResourcePopup: React.FC<DeleteResourcePopupType> = ({
delete={handleDelete}
closeDelete={toggleDeleteDialog}
apiCallInProgress={apiCallInProgress}
showDeleteConfirmation
deleteConfirmationText={resourceData.name as string}
>
<DeleteDialog.Description>
<p className="mb-12">{DELETE_MODAL_MESSAGING.description}</p>
Expand Down
Loading
Loading