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 10 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
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.6-beta-3",
"@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
@@ -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,43 @@ 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/remove 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

currentSearchParams.set(
'compareWithManifestChartRefId',
// NOTE: need to convert to string but leave null as is
_compareWithManifestChartRefId ? String(_compareWithManifestChartRefId) : null,
)

currentSearchParams.set('manifestChartRefId', _manifestChartRefId ? String(_manifestChartRefId) : null)

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
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
124 changes: 67 additions & 57 deletions src/components/app/list-new/AppList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,16 @@
*/

import React, { useState, useEffect, useMemo } from 'react'
import { Switch, Route, useHistory, useParams, useRouteMatch, useLocation } from 'react-router-dom'
import {
Switch,
Route,
useHistory,
useParams,
useRouteMatch,
useLocation,
Redirect,
RedirectProps,
} from 'react-router-dom'
import {
Progressing,
stopPropagation,
Expand Down Expand Up @@ -68,7 +77,7 @@ const AppList = ({ isArgoInstalled }: AppListPropType) => {
const location = useLocation()
const { url } = useRouteMatch()
const params = useParams<{ appType: string }>()
const { serverMode } = useMainContext()
const { serverMode, isSuperAdmin } = useMainContext()
const { setCurrentAppName } = useAppContext()

const [lastDataSyncTimeString, setLastDataSyncTimeString] = useState<React.ReactNode>('')
Expand Down Expand Up @@ -284,70 +293,70 @@ const AppList = ({ isArgoInstalled }: AppListPropType) => {
/>
)

const renderAppTabs = () => {
const tabs: TabProps[] = [
...(serverMode === SERVER_MODE.FULL
? [
{
id: 'devtron-apps',
label: 'Devtron Apps',
tabType: 'navLink' as const,
props: {
to: {
pathname: getChangeAppTabURL(AppListConstants.AppTabs.DEVTRON_APPS),
search: location.search,
},
'data-testid': 'devtron-app-list-button',
const tabs: TabProps[] = [
...(serverMode === SERVER_MODE.FULL
? [
{
id: AppListConstants.AppType.DEVTRON_APPS,
label: 'Devtron Apps',
tabType: 'navLink' as const,
props: {
to: {
pathname: getChangeAppTabURL(AppListConstants.AppTabs.DEVTRON_APPS),
search: location.search,
},
'data-testid': 'devtron-app-list-button',
},
]
: []),
{
id: 'helm-apps',
label: 'Helm Apps',
tabType: 'navLink',
props: {
to: {
pathname: getChangeAppTabURL(AppListConstants.AppTabs.HELM_APPS),
search: location.search,
},
'data-testid': 'helm-app-list-button',
},
]
: []),
{
id: AppListConstants.AppType.HELM_APPS,
label: 'Helm Apps',
tabType: 'navLink',
props: {
to: {
pathname: getChangeAppTabURL(AppListConstants.AppTabs.HELM_APPS),
search: location.search,
},
'data-testid': 'helm-app-list-button',
},
...(window._env_?.ENABLE_EXTERNAL_ARGO_CD
? [
{
id: 'argo-cd-apps',
label: AppListConstants.AppTabs.ARGO_APPS,
tabType: 'navLink' as const,
props: {
to: {
pathname: getChangeAppTabURL(AppListConstants.AppTabs.ARGO_APPS),
search: location.search,
},
'data-testid': 'argo-app-list-button',
},
...(window._env_?.ENABLE_EXTERNAL_ARGO_CD && isSuperAdmin
? [
{
id: AppListConstants.AppType.ARGO_APPS,
label: AppListConstants.AppTabs.ARGO_APPS,
tabType: 'navLink' as const,
props: {
to: {
pathname: getChangeAppTabURL(AppListConstants.AppTabs.ARGO_APPS),
search: location.search,
},
'data-testid': 'argo-app-list-button',
},
]
: []),
...(window._env_?.FEATURE_EXTERNAL_FLUX_CD_ENABLE
? [
{
id: 'flux-cd-apps',
label: AppListConstants.AppTabs.FLUX_APPS,
tabType: 'navLink' as const,
props: {
to: {
pathname: getChangeAppTabURL(AppListConstants.AppTabs.FLUX_APPS),
search: location.search,
},
'data-testid': 'flux-app-list-button',
},
]
: []),
...(window._env_?.FEATURE_EXTERNAL_FLUX_CD_ENABLE && isSuperAdmin
? [
{
id: AppListConstants.AppType.FLUX_APPS,
label: AppListConstants.AppTabs.FLUX_APPS,
tabType: 'navLink' as const,
props: {
to: {
pathname: getChangeAppTabURL(AppListConstants.AppTabs.FLUX_APPS),
search: location.search,
},
'data-testid': 'flux-app-list-button',
},
]
: []),
]
},
]
: []),
]

const renderAppTabs = () => {
const rightComponent = (
<div className="flex fs-13">
{lastDataSyncTimeString &&
Expand Down Expand Up @@ -503,6 +512,7 @@ const AppList = ({ isArgoInstalled }: AppListPropType) => {
setShowPulsatingDot={setShowPulsatingDot}
/>
)}
{tabs.every((tab) => tab.id !== params.appType) && <Redirect {...(tabs[0].props as RedirectProps)} />}
</div>
)
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/navigation/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ export default class Navigation extends Component<
return this.renderNavLink(item)
}
})}
{!window._env_.K8S_CLIENT && !this.props.isAirgapped && (
{!window._env_.K8S_CLIENT && !this.props.isAirgapped && this.props.serverMode !== SERVER_MODE.EA_ONLY && (
Elessar1802 marked this conversation as resolved.
Show resolved Hide resolved
<>
<div className="short-nav__divider" />
{this.renderNavLink(NavigationStack, 'short-nav__stack-manager')}
Expand Down
Loading
Loading