Skip to content

Commit 16bf29d

Browse files
Merge pull request #1315 from devtron-labs/stable-dt19-v1
fix: DT19 bug fixes V1
2 parents 04f3a63 + 4c0633d commit 16bf29d

File tree

29 files changed

+307
-77
lines changed

29 files changed

+307
-77
lines changed

src/components/ClusterNodes/ClusterSelectionList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ export default function ClusterSelectionList({
145145
/>
146146
</div>
147147
<div>
148-
{clusterData.errorInNodeListing ? (
148+
{errorCount > 0 ? (
149149
<Tippy className="default-tt w-200" arrow={false} content={clusterData.errorInNodeListing}>
150150
<div className="flexbox">
151151
<Error className="mt-2 mb-2 mr-8 icon-dim-18" />

src/components/CodeEditor/CodeEditor.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ interface CodeEditorInterface {
6666
validatorSchema?: any;
6767
isKubernetes?: boolean;
6868
cleanData?: boolean;
69+
chartVersion?: any;
6970
}
7071

7172
interface CodeEditorHeaderInterface {
@@ -115,7 +116,7 @@ interface CodeEditorState {
115116
code: string;
116117
noParsing: boolean;
117118
}
118-
const CodeEditor: React.FC<CodeEditorInterface> & CodeEditorComposition = React.memo(function Editor({ value, mode = "json", noParsing = false, defaultValue = "", children, tabSize = 2, lineDecorationsWidth = 0, height = 450, inline = false, shebang = "", minHeight, maxHeight, onChange, readOnly, diffView, theme="", loading, customLoader, focus, validatorSchema ,isKubernetes = true, cleanData = false, onBlur, onFocus}) {
119+
const CodeEditor: React.FC<CodeEditorInterface> & CodeEditorComposition = React.memo(function Editor({ value, mode = "json", noParsing = false, defaultValue = "", children, tabSize = 2, lineDecorationsWidth = 0, height = 450, inline = false, shebang = "", minHeight, maxHeight, onChange, readOnly, diffView, theme="", loading, customLoader, focus, validatorSchema, chartVersion ,isKubernetes = true, cleanData = false, onBlur, onFocus}) {
119120
if (cleanData) {
120121
value = cleanKubeManifest(value);
121122
defaultValue = cleanKubeManifest(defaultValue);
@@ -220,14 +221,13 @@ const CodeEditor: React.FC<CodeEditorInterface> & CodeEditorComposition = React.
220221
format: true,
221222
schemas:[
222223
{
223-
uri: 'https://devtron.ai/schema.json', // id of the first schema
224+
uri: `https://github.com/devtron-labs/devtron/tree/main/scripts/devtron-reference-helm-charts/reference-chart_${chartVersion}/schema.json`, // id of the first schema
224225
fileMatch: ['*'], // associate with our model
225226
schema: validatorSchema,
226227
}]
227228
});
228229
// eslint-disable-next-line react-hooks/exhaustive-deps
229-
}, [validatorSchema]);
230-
230+
}, [validatorSchema, chartVersion]);
231231
useEffect(() => {
232232
if (!editorRef.current) return
233233
editorRef.current.updateOptions({ readOnly })

src/components/ResourceBrowser/ResourceList/ResourceList.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {
2424
getResourceList,
2525
namespaceListByClusterId,
2626
} from '../ResourceBrowser.service'
27-
import { OptionType } from '../../app/types'
27+
import { Nodes, OptionType } from '../../app/types'
2828
import {
2929
ALL_NAMESPACE_OPTION,
3030
EVENT_LIST,
@@ -57,6 +57,7 @@ import {
5757
getParentAndChildNodes,
5858
getUpdatedNodeSelectionData,
5959
getUpdatedResourceSelectionData,
60+
removeDefaultForStorageClass,
6061
sortEventListData,
6162
} from '../Utils'
6263
import '../ResourceBrowser.scss'
@@ -658,6 +659,9 @@ export default function ResourceList() {
658659
if (selectedResource?.gvk.Kind === SIDEBAR_KEYS.eventGVK.Kind && result.data.length) {
659660
result.data = sortEventListData(result.data)
660661
}
662+
if (selectedResource?.gvk.Kind === Nodes.StorageClass) {
663+
result.data = removeDefaultForStorageClass(result.data)
664+
}
661665
setResourceList(result)
662666

663667
if (retainSearched) {

src/components/ResourceBrowser/Utils.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,15 @@ export const sortEventListData = (eventList: Record<string, any>[]): Record<stri
141141
]
142142
}
143143

144+
export const removeDefaultForStorageClass = (storageList: Record<string, any>[]): Record<string, any>[] => {
145+
for (let iterator of storageList) {
146+
if (iterator.name.includes("(default)")) {
147+
iterator.name = iterator.name.split(" (default)")[0]
148+
}
149+
}
150+
return storageList
151+
}
152+
144153
export const getParentAndChildNodes = (_k8SObjectList: K8SObjectType[], nodeType: string, group: string) => {
145154
const parentNode = _k8SObjectList?.[0]
146155
const childNode = parentNode?.child?.find((_ch) => _ch.gvk.Kind === Nodes.Pod) ?? parentNode?.child?.[0]

src/components/apiTokens/authorization.utils.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import React from 'react'
22
import { ACCESS_TYPE_MAP, SERVER_MODE } from '../../config'
33
import {
4+
ActionTypes,
45
ChartGroupPermissionsFilter,
56
CreateUser,
67
DirectPermissionsRoleFilter,
78
EntityTypes,
89
OptionType,
10+
ViewChartGroupPermission,
911
} from '../userGroups/userGroups.types'
1012

1113
export function getOptions(customDate) {
@@ -110,6 +112,13 @@ export const createUserPermissionPayload = (
110112
environment: '',
111113
entityName: chartPermission.entityName.map((entity) => entity.value).join(','),
112114
})
115+
if (chartPermission.action != ActionTypes.VIEW) {
116+
userPermissionPayload.roleFilters.push({
117+
...ViewChartGroupPermission,
118+
team: '',
119+
environment: '',
120+
})
121+
}
113122
}
114123

115124
return userPermissionPayload

src/components/app/Overview/Overview.tsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -462,17 +462,19 @@ export default function AppOverview({ appMetaInfo, getAppMetaInfoRes, isJobOverv
462462

463463
function renderAppDescription() {
464464
return (
465-
<GenericDescription
466-
isClusterTerminal={false}
467-
isSuperAdmin={true}
468-
appId={Number(appId)}
469-
descriptionId={descriptionId}
470-
initialDescriptionText={newDescription}
471-
initialDescriptionUpdatedBy={newUpdatedBy}
472-
initialDescriptionUpdatedOn={newUpdatedOn}
473-
initialEditDescriptionView={true}
474-
appMetaInfo={appMetaInfo}
475-
/>
465+
<div className='pl-16 pr-16 pt-16 dc__border-bottom-n1' >
466+
<GenericDescription
467+
isClusterTerminal={false}
468+
isSuperAdmin={true}
469+
appId={Number(appId)}
470+
descriptionId={descriptionId}
471+
initialDescriptionText={newDescription}
472+
initialDescriptionUpdatedBy={newUpdatedBy}
473+
initialDescriptionUpdatedOn={newUpdatedOn}
474+
initialEditDescriptionView={true}
475+
appMetaInfo={appMetaInfo}
476+
/>
477+
</div>
476478
)
477479
}
478480

src/components/app/details/appConfig/appConfig.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@
4040
&.config-protection__side-nav {
4141
grid-template-rows: 110px repeat(6, 32px) 54px 32px 1fr auto;
4242
&.hide-external-links {
43-
grid-template-rows: 110px repeat(6, 32px) 54px 1fr auto;
43+
grid-template-rows: 110px repeat(6, 32px) 16px 32px 1fr auto;
4444
}
4545
&.hide-app-config-help {
4646
grid-template-rows: repeat(6, 32px) 54px 32px 1fr auto;
4747

4848
&.hide-external-links {
49-
grid-template-rows: repeat(6, 32px) 54px 1fr auto;
49+
grid-template-rows: repeat(6, 32px) 16px 32px 1fr auto;
5050
}
5151
}
5252
}
@@ -205,4 +205,4 @@
205205
.repo-configured-icon {
206206
width: 96px;
207207
}
208-
}
208+
}

src/components/app/list-new/AppList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ export default function AppList({ isSuperAdmin, appListCount, isArgoInstalled }:
645645
clusterName: _env.clusterName || '-',
646646
namespaceId: _env.namespace && _clusterId ? `${_clusterId}_${_env.namespace}` : '-',
647647
namespace: _env.namespace || '-',
648-
status: _env.status || '-',
648+
status: _env.appStatus || '-',
649649
lastDeployedTime: _env.lastDeployedTime
650650
? moment(_env.lastDeployedTime).format(Moment12HourFormat)
651651
: '-',

src/components/app/list-new/HelmAppList.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import {
4646
import { LEARN_MORE } from '../../../config/constantMessaging'
4747
import { HELM_GUIDED_CONTENT_CARDS_TEXTS } from '../../onboardingGuide/OnboardingGuide.constants'
4848
import AppStatus from '../AppStatus'
49+
import { AppListColumnSort } from '../types'
4950

5051
export default function HelmAppList({
5152
serverMode,
@@ -295,14 +296,15 @@ export default function HelmAppList({
295296
app.chartName.toLowerCase().includes(_search.toLowerCase()),
296297
)
297298
}
298-
299+
300+
const dynamicSortBy = AppListColumnSort[_sortBy];
301+
299302
// handle sort
300303
if (_sortOrder == OrderBy.ASC) {
301-
_filteredHelmAppsList = _filteredHelmAppsList.sort((a, b) => a.appName.localeCompare(b.appName))
304+
_filteredHelmAppsList = _filteredHelmAppsList.sort((a, b) => a[dynamicSortBy].localeCompare(b[dynamicSortBy]))
302305
} else {
303-
_filteredHelmAppsList = _filteredHelmAppsList.sort((a, b) => b.appName.localeCompare(a.appName))
306+
_filteredHelmAppsList = _filteredHelmAppsList.sort((a, b) => b[dynamicSortBy].localeCompare(a[dynamicSortBy]))
304307
}
305-
306308
setSortBy(_sortBy)
307309
setSortOrder(_sortOrder)
308310
setFilteredHelmAppsList(_filteredHelmAppsList)

src/components/app/types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,11 @@ export interface GenericNode<T> {
308308
namespace?: string
309309
}
310310

311+
export enum AppListColumnSort {
312+
appNameSort = 'appName',
313+
lastDeployedSort = 'lastDeployedAt'
314+
}
315+
311316
export enum Nodes {
312317
Service = 'Service',
313318
Alertmanager = 'Alertmanager',

0 commit comments

Comments
 (0)