Skip to content

Commit 6bc8341

Browse files
committed
Merge branch 'release-candidate-v0.39.0' of https://github.com/devtron-labs/dashboard into feat/tree-view
2 parents ed0b92d + d6f4c15 commit 6bc8341

21 files changed

+120
-106
lines changed

Dockerfile

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,48 @@
1-
FROM node:20-alpine AS builder
2-
3-
RUN apk add --no-cache git
1+
FROM node:22-alpine AS builder
42

53
WORKDIR /app
4+
5+
RUN corepack enable yarn && \
6+
yarn set version 4.9.2
7+
68
COPY package.json .
79
COPY yarn.lock .
10+
COPY .yarn/ .yarn/
11+
COPY .yarnrc.yml ./
812

9-
RUN yarn install --frozen-lockfile --network-timeout 600000
13+
RUN apk add --no-cache git
14+
RUN yarn install --immutable --network-timeout 600000
1015

11-
COPY src/ src
12-
COPY nginx.conf .
13-
COPY tsconfig.json .
14-
COPY vite.config.mts .
1516
COPY . .
1617

1718
RUN echo `git rev-parse --short=9 HEAD` > health.html && \
1819
echo "" >> .env && \
19-
echo "SENTRY_RELEASE_VERSION=dashboard@$(git rev-parse --short=9 HEAD)" >> .env
20-
21-
RUN yarn build
20+
echo "SENTRY_RELEASE_VERSION=dashboard@$(git rev-parse --short=9 HEAD)" >> .env && \
21+
yarn build
2222

2323
FROM fholzer/nginx-brotli:v1.26.2
2424

25-
RUN useradd -ms /bin/bash devtron
25+
# Install bash
26+
RUN apk add --no-cache bash shadow
27+
28+
RUN useradd -m -s /bin/bash devtron
29+
2630
COPY --from=builder /app/dist/ /usr/share/nginx/html
2731
COPY ./nginx.conf /etc/nginx/nginx.conf
2832
COPY ./nginx-default.conf /etc/nginx/conf.d/default.conf
33+
2934
WORKDIR /usr/share/nginx/html
30-
COPY --from=builder /app/./env.sh .
31-
COPY --from=builder /app/.env .
32-
COPY --from=builder /app/health.html .
3335

34-
# Make our shell script executable
36+
COPY --from=builder /app/env.sh .
37+
COPY --from=builder /app/.env .
38+
COPY --from=builder /app/health.html .
39+
3540
RUN chown -R devtron:devtron /usr/share/nginx/html && \
36-
chmod +x env.sh
41+
chmod +x env.sh
42+
3743
USER devtron
38-
CMD ["/bin/bash", "-c", "/usr/share/nginx/html/env.sh && nginx -g \"daemon off;\""]
44+
45+
# Override the default ENTRYPOINT to allow shell scripting as fholzer/nginx-brotli has by-default entrypoint of nginx
46+
ENTRYPOINT ["/bin/bash", "-c"]
47+
48+
CMD ["./env.sh && nginx -g 'daemon off;'"]

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"homepage": "/dashboard",
66
"dependencies": {
7-
"@devtron-labs/devtron-fe-common-lib": "1.16.0-pre-7",
7+
"@devtron-labs/devtron-fe-common-lib": "1.16.0-pre-10",
88
"@esbuild-plugins/node-globals-polyfill": "0.2.3",
99
"@rjsf/core": "^5.13.3",
1010
"@rjsf/utils": "^5.13.3",

src/Pages/App/CreateAppModal/ProjectSelector.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ const ProjectSelector = ({ selectedProjectId, handleProjectIdChange, error }: Pr
6161
onChange={handleChange}
6262
error={error}
6363
autoFocus
64-
defaultMenuIsOpen
6564
/>
6665
</div>
6766
)

src/components/ClusterNodes/ClusterOverview.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import React, { useEffect, useRef, useState } from 'react'
1818
import { generatePath, useHistory, useParams } from 'react-router-dom'
1919

2020
import {
21-
DUMMY_RESOURCE_GVK_VERSION,
2221
EditableTextArea,
2322
ErrorScreenManager,
2423
getRandomColor,
@@ -216,7 +215,6 @@ function ClusterOverview({ selectedCluster, addTab }: ClusterOverviewProps) {
216215
clusterId,
217216
kind: 'node',
218217
group: K8S_EMPTY_GROUP,
219-
version: DUMMY_RESOURCE_GVK_VERSION,
220218
})}?${queryParam}=${encodeURIComponent(filterText)}`
221219
history.push(newUrl)
222220
}

src/components/ClusterNodes/NodeDetails.tsx

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,11 @@ import {
4141
Button,
4242
ButtonVariantType,
4343
ButtonStyleType,
44+
RESOURCE_BROWSER_ROUTES,
45+
getUrlWithSearchParams,
46+
ResourceBrowserActionMenuEnum,
4447
} from '@devtron-labs/devtron-fe-common-lib'
45-
import { useParams, useLocation, useHistory } from 'react-router-dom'
48+
import { useParams, useLocation, useHistory, generatePath } from 'react-router-dom'
4649
import YAML from 'yaml'
4750
import * as jsonpatch from 'fast-json-patch'
4851
import { applyPatch } from 'fast-json-patch'
@@ -78,7 +81,7 @@ import { importComponentFromFELibrary } from '@Components/common'
7881

7982
const REDFISH_NODE_UI_TABS = importComponentFromFELibrary('REDFISH_NODE_UI_TABS', [], 'function')
8083

81-
const NodeDetails = ({ addTab, lowercaseKindToResourceGroupMap, updateTabUrl }: ClusterListType) => {
84+
const NodeDetails = ({ lowercaseKindToResourceGroupMap, updateTabUrl }: ClusterListType) => {
8285
const { clusterId, name } = useParams<{ clusterId: string; nodeType: string; name: string }>()
8386
const [loader, setLoader] = useState(true)
8487
const [apiInProgress, setApiInProgress] = useState(false)
@@ -673,9 +676,13 @@ const NodeDetails = ({ addTab, lowercaseKindToResourceGroupMap, updateTabUrl }:
673676
const openDebugTerminal = () => {
674677
const queryParams = new URLSearchParams(location.search)
675678
queryParams.set('node', nodeDetail.name)
676-
const url = location.pathname
677679
push(
678-
`${url.split('/').slice(0, -3).join('/')}/${AppDetailsTabs.terminal}/${K8S_EMPTY_GROUP}?${queryParams.toString()}`,
680+
getUrlWithSearchParams(
681+
generatePath(RESOURCE_BROWSER_ROUTES.TERMINAL, {
682+
clusterId,
683+
}),
684+
{ node: nodeDetail.name },
685+
),
679686
)
680687
}
681688

@@ -711,17 +718,19 @@ const NodeDetails = ({ addTab, lowercaseKindToResourceGroupMap, updateTabUrl }:
711718
}
712719

713720
const handleResourceClick = (e) => {
714-
const { name, tab, namespace } = e.currentTarget.dataset
715-
let _nodeSelectionData
716-
let _group
717-
_group = selectedResource?.gvk.Group.toLowerCase() || K8S_EMPTY_GROUP
718-
_nodeSelectionData = { name: `pod` + `_${name}`, namespace, isFromNodeDetails: true }
719-
const _url = `${URLS.RESOURCE_BROWSER}/${clusterId}/${namespace}/pod/${_group}/${name}${
720-
tab ? `/${tab.toLowerCase()}` : ''
721-
}`
722-
addTab({ idPrefix: `${_group}_${namespace}`, kind: 'pod', name, url: _url }).then(() => {
723-
push(_url)
724-
})
721+
const { name, tab = ResourceBrowserActionMenuEnum.manifest, namespace } = e.currentTarget.dataset
722+
push(
723+
getUrlWithSearchParams(
724+
generatePath(RESOURCE_BROWSER_ROUTES.K8S_RESOURCE_DETAIL, {
725+
clusterId,
726+
group: selectedResource?.gvk.Group.toLowerCase() || K8S_EMPTY_GROUP,
727+
kind: 'pod',
728+
name,
729+
namespace,
730+
}),
731+
{ tab },
732+
),
733+
)
725734
}
726735

727736
const getTriggerSortingHandler =

src/components/ClusterNodes/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ export interface ColumnMetadataType {
135135
}
136136

137137
export interface ClusterListType extends Pick<K8SResourceListType, 'lowercaseKindToResourceGroupMap'> {
138-
addTab?: UseTabsReturnType['addTab']
139138
updateTabUrl: (params: Omit<UpdateTabUrlParamsType, 'id'>) => void
140139
}
141140

src/components/ResourceBrowser/Constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ export const AI_BUTTON_CONFIG_MAP: Record<string, ShowAIButtonConfig> = Object.f
397397
export const ResourceBrowserRouteToTabIdMap: Partial<
398398
Record<(typeof RESOURCE_BROWSER_ROUTES)[keyof typeof RESOURCE_BROWSER_ROUTES], ResourceBrowserTabsId | string>
399399
> = {
400-
'/resource-browser/:clusterId/:kind/:group/:version': ResourceBrowserTabsId.k8s_Resources,
400+
'/resource-browser/:clusterId/:kind/:group': ResourceBrowserTabsId.k8s_Resources,
401401
'/resource-browser/:clusterId/overview': ResourceBrowserTabsId.cluster_overview,
402402
'/resource-browser/:clusterId/monitoring-dashboard': MONITORING_DASHBOARD_TAB_ID,
403403
'/resource-browser/:clusterId/terminal': ResourceBrowserTabsId.terminal,

src/components/ResourceBrowser/ResourceList/ClusterSelector.tsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import React, { useRef, useState } from 'react'
17+
import React, { useEffect, useRef, useState } from 'react'
1818
import { useHistory } from 'react-router-dom'
1919
import ReactSelect, { Props as SelectProps, SelectInstance } from 'react-select'
2020

@@ -29,6 +29,7 @@ import {
2929
PopupMenu,
3030
ToastManager,
3131
ToastVariantType,
32+
useRegisterShortcut,
3233
ValueContainerWithLoadingShimmer,
3334
} from '@devtron-labs/devtron-fe-common-lib'
3435

@@ -66,6 +67,22 @@ const ClusterSelector: React.FC<ClusterSelectorType> = ({
6667

6768
const selectRef = useRef<SelectInstance>(null)
6869

70+
const { registerShortcut, unregisterShortcut } = useRegisterShortcut()
71+
72+
useEffect(() => {
73+
registerShortcut({
74+
keys: ['S'],
75+
callback: () => {
76+
selectRef.current?.focus()
77+
selectRef.current?.openMenu('first')
78+
},
79+
})
80+
81+
return () => {
82+
unregisterShortcut(['S'])
83+
}
84+
}, [])
85+
6986
let filteredClusterList = clusterList
7087
if (window._env_.HIDE_DEFAULT_CLUSTER) {
7188
filteredClusterList = clusterList.filter((item) => Number(item.value) !== DEFAULT_CLUSTER_ID)

src/components/ResourceBrowser/ResourceList/ClusterUpgradeCompatibilityInfoTableCellComponent.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import DOMPurify from 'dompurify'
55
import {
66
ALL_NAMESPACE_OPTION,
77
ClipboardButton,
8-
DUMMY_RESOURCE_GVK_VERSION,
98
GVKType,
109
highlightSearchText,
1110
K8sResourceDetailDataType,
@@ -49,7 +48,6 @@ const ClusterUpgradeCompatibilityInfoTableCellComponent = ({
4948
name,
5049
kind: kind.toLowerCase(),
5150
group,
52-
version: DUMMY_RESOURCE_GVK_VERSION,
5351
})
5452

5553
push(`${url}/${tab}`)

src/components/ResourceBrowser/ResourceList/K8SResourceList.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ export const K8SResourceList = ({
161161
[selectedResource, clusterId, selectedNamespace, JSON.stringify(resourceFilters)],
162162
)
163163

164-
const isResourceListLoading = resourceListLoader || getIsRequestAborted(resourceListError)
164+
const isResourceListLoadingWithoutNullState = resourceListLoader || getIsRequestAborted(resourceListError)
165+
const isResourceListLoading = !resourceList || isResourceListLoadingWithoutNullState
165166

166167
useEffect(
167168
() => () => {
@@ -237,7 +238,7 @@ export const K8SResourceList = ({
237238
return columns.some(({ field }) => field === 'namespace') ? 'namespace' : 'name'
238239
}
239240

240-
if (resourceListError && !isResourceListLoading) {
241+
if (resourceListError && !isResourceListLoadingWithoutNullState) {
241242
return (
242243
<div className="flexbox-col flex-grow-1 border__primary--left">
243244
<ErrorScreenManager

0 commit comments

Comments
 (0)