Skip to content

Commit ece00a8

Browse files
committed
Merge branch 'main' of github.com:devtron-labs/dashboard into feat/catalog-framework
2 parents c46f54d + 0988ee6 commit ece00a8

File tree

18 files changed

+531
-478
lines changed

18 files changed

+531
-478
lines changed

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ DEFAULT_CI_TRIGGER_TYPE_MANUAL=false
3737
ANNOUNCEMENT_BANNER_MSG=
3838
LOGIN_PAGE_IMAGE=
3939
LOGIN_PAGE_IMAGE_BG=
40+
HIDE_DEFAULT_CLUSTER=false

src/components/ClusterNodes/ClusterSelectionList.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@ import { ClusterSelectionType } from '../ResourceBrowser/Types'
1414
import { AppDetailsTabs } from '../v2/appDetails/appDetails.store'
1515
import { K8S_EMPTY_GROUP } from '../ResourceBrowser/Constants'
1616
import './clusterNodes.scss'
17+
import { DEFAULT_CLUSTER_ID } from '../cluster/cluster.type'
1718

1819
export default function ClusterSelectionList({
1920
clusterOptions,
2021
onChangeCluster,
2122
isSuperAdmin,
2223
clusterListLoader,
2324
refreshData,
24-
initTabsBasedOnRole
25+
initTabsBasedOnRole,
2526
}: ClusterSelectionType) {
2627
const location = useLocation()
2728
const history = useHistory()
@@ -35,11 +36,15 @@ export default function ClusterSelectionList({
3536
const [searchApplied, setSearchApplied] = useState(false)
3637

3738
useEffect(() => {
39+
let filteredClusterOptions = clusterOptions
40+
if (window._env_.HIDE_DEFAULT_CLUSTER) {
41+
filteredClusterOptions = clusterOptions.filter((item) => item.id !== DEFAULT_CLUSTER_ID)
42+
}
3843
setClusterList([])
3944
setFilteredClusterList([])
4045
setLastDataSync(!lastDataSync)
41-
setClusterList(clusterOptions)
42-
setFilteredClusterList(clusterOptions)
46+
setClusterList(filteredClusterOptions)
47+
setFilteredClusterList(filteredClusterOptions)
4348
setMinLoader(false)
4449
}, [clusterOptions])
4550

src/components/ResourceBrowser/ResourceList/ClusterSelector.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
SIDEBAR_KEYS,
1111
} from '../Constants'
1212
import { ClusterOptionType } from '../Types'
13+
import { DEFAULT_CLUSTER_ID } from '../../cluster/cluster.type'
1314

1415
interface ClusterSelectorType {
1516
onChange: ({ label, value }) => void
@@ -18,12 +19,16 @@ interface ClusterSelectorType {
1819
}
1920

2021
export default function ClusterSelector({ onChange, clusterList, clusterId }: ClusterSelectorType) {
21-
const defaultOption = clusterList.find((item) => item.value == clusterId)
22+
let filteredClusterList = clusterList
23+
if (window._env_.HIDE_DEFAULT_CLUSTER) {
24+
filteredClusterList = clusterList.filter((item) => Number(item.value) !== DEFAULT_CLUSTER_ID)
25+
}
26+
const defaultOption = filteredClusterList.find((item) => item.value == clusterId)
2227

2328
return (
2429
<ReactSelect
2530
classNamePrefix="cluster-select-header"
26-
options={clusterList}
31+
options={filteredClusterList}
2732
onChange={onChange}
2833
components={{
2934
IndicatorSeparator: null,

src/components/ResourceBrowser/ResourceList/ResourceList.tsx

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,9 @@ import {
6363
sortEventListData,
6464
} from '../Utils'
6565
import '../ResourceBrowser.scss'
66-
import {
67-
ClusterCapacityType,
68-
ClusterDetail,
69-
ClusterErrorType,
70-
ClusterImageList,
71-
ERROR_TYPE,
72-
} from '../../ClusterNodes/types'
66+
import { ClusterCapacityType, ClusterDetail, ClusterImageList } from '../../ClusterNodes/types'
7367
import { getHostURLConfiguration } from '../../../services/service'
74-
import {
75-
clusterNamespaceList,
76-
getClusterCapacity,
77-
getClusterList,
78-
getClusterListMin,
79-
} from '../../ClusterNodes/clusterNodes.service'
68+
import { clusterNamespaceList, getClusterList, getClusterListMin } from '../../ClusterNodes/clusterNodes.service'
8069
import ClusterSelectionList from '../../ClusterNodes/ClusterSelectionList'
8170
import ClusterSelector from './ClusterSelector'
8271
import ClusterOverview from '../../ClusterNodes/ClusterOverview'
@@ -85,6 +74,7 @@ import ClusterTerminal from '../../ClusterNodes/ClusterTerminal'
8574
import { createTaintsList } from '../../cluster/cluster.util'
8675
import NodeDetailsList from '../../ClusterNodes/NodeDetailsList'
8776
import NodeDetails from '../../ClusterNodes/NodeDetails'
77+
import { DEFAULT_CLUSTER_ID } from '../../cluster/cluster.type'
8878

8979
export default function ResourceList() {
9080
const { clusterId, namespace, nodeType, node, group } = useParams<{
@@ -699,6 +689,12 @@ export default function ResourceList() {
699689
setSelectedCluster(selected)
700690
getNamespaceList(selected.value)
701691

692+
if (selected.value === DEFAULT_CLUSTER_ID && window._env_.HIDE_DEFAULT_CLUSTER) {
693+
replace({
694+
pathname: URLS.RESOURCE_BROWSER,
695+
})
696+
return
697+
}
702698
if (!skipRedirection) {
703699
const path = `${URLS.RESOURCE_BROWSER}/${selected.value}/${
704700
ALL_NAMESPACE_OPTION.value

src/components/charts/list/ChartListPopUp.tsx

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useContext, useState } from 'react'
1+
import React, { useState } from 'react'
22
import { ChartListPopUpType } from '../charts.types'
33
import {
44
showError,
@@ -16,15 +16,14 @@ import { toast } from 'react-toastify'
1616
import { EMPTY_STATE_STATUS, TOAST_INFO } from '../../../config/constantMessaging'
1717
import { reSyncChartRepo } from '../../chartRepo/chartRepo.service'
1818
import { ReactComponent as Help } from '../../../assets/icons/ic-help.svg'
19-
import { NavLink, useHistory } from 'react-router-dom'
20-
import { SERVER_MODE, URLS } from '../../../config'
19+
import { NavLink } from 'react-router-dom'
20+
import { URLS } from '../../../config'
2121
import { ReactComponent as Add } from '../../../assets/icons/ic-add.svg'
2222
import EmptyFolder from '../../../assets/img/Empty-folder.png'
2323
import NoResults from '../../../assets/img/[email protected]'
2424
import AddChartSource from './AddChartSource'
2525
import ChartListPopUpRow from './ChartListPopUpRow'
2626
import { ReactComponent as SyncIcon } from '../../../assets/icons/ic-arrows_clockwise.svg'
27-
import { mainContext } from '../../common/navigation/NavigationRoutes'
2827

2928
function ChartListPopUp({
3029
onClose,
@@ -34,13 +33,11 @@ function ChartListPopUp({
3433
setFilteredChartList,
3534
setShowSourcePopoUp,
3635
}: ChartListPopUpType) {
37-
const { serverMode } = useContext(mainContext)
3836
const [searchApplied, setSearchApplied] = useState<boolean>(false)
3937
const [searchText, setSearchText] = useState<string>('')
4038
const [fetching, setFetching] = useState<boolean>(false)
4139
const [showAddPopUp, setShowAddPopUp] = useState<boolean>(false)
4240
const isEmpty = chartList.length && !filteredChartList.length
43-
const history = useHistory()
4441

4542
const setStore = (event): void => {
4643
setSearchText(event.target.value)
@@ -60,20 +57,12 @@ function ChartListPopUp({
6057
setShowAddPopUp(!showAddPopUp)
6158
}
6259

63-
const onClickAddSource = (e) => {
64-
if (serverMode === SERVER_MODE.EA_ONLY) {
65-
history.push(URLS.GLOBAL_CONFIG_CHART)
66-
} else {
67-
toggleAddPopUp(e)
68-
}
69-
}
70-
7160
const renderChartListHeaders = () => {
7261
return (
7362
<div className="pt-12 pb-12 pl-16 flex dc__content-space dc__border-bottom fw-6">
7463
<span>Helm chart sources</span>
7564
<div className="flex">
76-
<div className="flex cb-5 fw-6 cursor mr-12" onClick={onClickAddSource}>
65+
<div className="flex cb-5 fw-6 cursor mr-12" onClick={toggleAddPopUp}>
7766
<Add className="icon-dim-20 fcb-5 mr-8" />
7867
Add
7968
</div>

src/components/common/Accordian/Accordian.tsx

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,20 @@
1-
import React, { useContext, useState } from 'react'
1+
import React, { useState } from 'react'
22
import { ReactComponent as Dropdown } from '../../../assets/icons/ic-chevron-down.svg'
33
import { CHECKBOX_VALUE, Checkbox } from '@devtron-labs/devtron-fe-common-lib'
44
import { ReactComponent as AddIcon } from '../../../assets/icons/ic-add.svg'
55
import AddChartSource from '../../charts/list/AddChartSource'
6-
import { mainContext } from '../../common/navigation/NavigationRoutes'
7-
import { SERVER_MODE, URLS } from '../../../config'
8-
import { useHistory } from 'react-router-dom'
96

107
export function Accordian({ header, options, value, onChange, onClickViewChartButton,dataTestId }) {
11-
const { serverMode } = useContext(mainContext)
128
const [collapsed, setCollapse] = useState<boolean>(true)
139
const [showAddSource, toggleAddSource] = useState<boolean>(false)
1410
const toggleDropdown = (): void => {
1511
setCollapse(!collapsed)
1612
}
17-
const history = useHistory()
1813

1914
const handleTogleAddSource = () => {
2015
toggleAddSource(!showAddSource)
2116
}
2217

23-
const onClickAddSource = (e) => {
24-
if (serverMode === SERVER_MODE.EA_ONLY) {
25-
history.push(URLS.GLOBAL_CONFIG_CHART)
26-
} else {
27-
handleTogleAddSource()
28-
}
29-
}
30-
3118
return (
3219
<div>
3320
<div
@@ -47,7 +34,7 @@ export function Accordian({ header, options, value, onChange, onClickViewChartBu
4734
<button
4835
type="button"
4936
className="dc__position-rel dc__transparent dc__hover-n50 cursor flex left cb-5 fs-13 fw-6 lh-20 h-32 pl-10 w-100"
50-
onClick={onClickAddSource}
37+
onClick={handleTogleAddSource}
5138
>
5239
<AddIcon className="icon-dim-16 fcb-5 mr-8" />
5340
Add chart source

src/components/deploymentConfig/DeploymentTemplateView/DeploymentTemplateEditorView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ export default function DeploymentTemplateEditorView({
339339
<div className="code-editor__header flex left w-100 p-0-imp">
340340
<div className="flex left fs-12 fw-6 cn-9 dc__border-right h-32 pl-12 pr-12">
341341
<span className="fw-n" style={{ width: '85px' }}>
342-
Compare with:{' '}
342+
Compare with:
343343
</span>
344344
<CompareWithDropdown
345345
envId={envId}

0 commit comments

Comments
 (0)