Skip to content

Commit 78f5cba

Browse files
committed
Merge branch 'develop' of github.com:devtron-labs/devtron-fe-common-lib into feat/new-layout
2 parents 9a48de0 + 5f36982 commit 78f5cba

File tree

25 files changed

+183
-298
lines changed

25 files changed

+183
-298
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "1.7.8",
3+
"version": "1.7.11",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Common/Common.service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ export const parseRuntimeParams = (response: RuntimeParamsAPIResponseType): Runt
270270
const runtimeParams = (response?.runtimePluginVariables ?? []).map<RuntimePluginVariables>((variable) => ({
271271
...variable,
272272
defaultValue: variable.value,
273+
stepVariableId: variable.stepVariableId || Math.floor(new Date().valueOf() * Math.random())
273274
}))
274275

275276
runtimeParams.push(...envVariables)

src/Common/Constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export const URLS = {
7474
DEPLOYMENT_HISTORY_CONFIGURATIONS: '/configuration',
7575
GLOBAL_CONFIG_SCOPED_VARIABLES: '/global-config/scoped-variables',
7676
GLOBAL_CONFIG_DEPLOYMENT_CHARTS_LIST: '/global-config/deployment-charts',
77+
GLOBAL_CONFIG_DEPLOYMENT_CHARTS_UPLOAD_CHART: '/global-config/deployment-charts/upload-chart',
7778
NETWORK_STATUS_INTERFACE: '/network-status-interface',
7879
RESOURCE_BROWSER: '/resource-browser',
7980
COMPARE_CLUSTERS: '/compare-clusters',
@@ -99,6 +100,7 @@ export const ROUTES = {
99100
TELEMETRY_EVENT: 'telemetry/event',
100101
SERVER_INFO_API: 'server',
101102
ATTRIBUTES_USER: 'attributes/user',
103+
GET: 'get',
102104
UPDATE: 'update',
103105
ENVIRONMENT_LIST_MIN: 'env/autocomplete',
104106
CLUSTER: 'cluster',

src/Common/SegmentedControl/SegmentedControl.component.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const SegmentedControl = ({
2929
name,
3030
variant = SegmentedControlVariant.WHITE_ON_GRAY,
3131
size = ComponentSizeType.medium,
32+
isControlled = false,
3233
}: SegmentedControlProps) => (
3334
<StyledRadioGroup
3435
className={`${variant} ${SEGMENTED_CONTROL_SIZE_TO_CLASS_MAP[size]} ${rootClassName}`}
@@ -45,6 +46,7 @@ const SegmentedControl = ({
4546
showTippy={!!tooltips?.[index]}
4647
tippyContent={tooltips?.[index] ?? ''}
4748
dataTestId={`${name}-${tab.value}`}
49+
canSelect={!isControlled}
4850
>
4951
{tab.label}
5052
</StyledRadioGroup.Radio>

src/Common/SegmentedControl/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,8 @@ export interface SegmentedControlProps {
3737
* @default ComponentSizeType.medium
3838
*/
3939
size?: ComponentSizeType.medium | ComponentSizeType.large
40+
/**
41+
* @default false
42+
*/
43+
isControlled?: boolean
4044
}

src/Common/TippyCustomized.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { ReactComponent as Help } from '../Assets/Icon/ic-help.svg'
2121
import { ReactComponent as ICHelpOutline } from '../Assets/Icon/ic-help-outline.svg'
2222
import { ReactComponent as ICOpenInNew } from '../Assets/Icon/ic-open-in-new.svg'
2323
import 'tippy.js/animations/shift-toward-subtle.css'
24+
import 'tippy.js/animations/shift-toward.css'
2425
import { TippyCustomizedProps, TippyTheme } from './Types'
2526
import { not, stopPropagation } from './Helper'
2627

src/Pages/GlobalConfigurations/DeploymentCharts/types.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@
1414
* limitations under the License.
1515
*/
1616

17-
export type DeploymentChartListDTO = Array<{
17+
interface DeploymentChartInfo {
1818
id: number
1919
chartDescription?: string
2020
isUserUploaded: boolean
2121
name: string
2222
version: string
23-
}>
23+
uploadedBy: string
24+
}
2425

25-
interface DeploymentChartVersionsType {
26-
id: number
27-
version: string
26+
export type DeploymentChartListDTO = DeploymentChartInfo[]
27+
28+
export interface DeploymentChartVersionsType
29+
extends Pick<DeploymentChartInfo, 'id' | 'version' | 'uploadedBy' | 'isUserUploaded'> {
2830
description: string
2931
}
3032

31-
export interface DeploymentChartType {
32-
name: string
33-
isUserUploaded: boolean
33+
export interface DeploymentChartType extends Pick<DeploymentChartInfo, 'name'> {
3434
versions: DeploymentChartVersionsType[]
3535
}
3636

src/Pages/GlobalConfigurations/DeploymentCharts/utils.ts

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,37 @@
1515
*/
1616

1717
import { versionComparatorBySortOrder } from '@Shared/Helpers'
18-
import { DeploymentChartListDTO, DeploymentChartType, DEVTRON_DEPLOYMENT_CHART_NAMES } from './types'
18+
import {
19+
DeploymentChartListDTO,
20+
DeploymentChartType,
21+
DeploymentChartVersionsType,
22+
DEVTRON_DEPLOYMENT_CHART_NAMES,
23+
} from './types'
1924
import fallbackGuiSchema from './basicViewSchema.json'
2025

2126
export const convertDeploymentChartListToChartType = (data: DeploymentChartListDTO): DeploymentChartType[] => {
2227
if (!data) {
2328
return []
2429
}
25-
const chartMap = data.reduce(
26-
(acc, { id, version, chartDescription: description = '', name, isUserUploaded = true }) => {
30+
const chartMap = data.reduce<Record<string, DeploymentChartType>>(
31+
(acc, { id, version, chartDescription, name, isUserUploaded, uploadedBy }) => {
2732
if (!name || !id || !version) {
2833
return acc
2934
}
35+
const currVersionDetail: DeploymentChartVersionsType = {
36+
id,
37+
version,
38+
description: chartDescription || '',
39+
uploadedBy: isUserUploaded ? uploadedBy || '' : 'Devtron',
40+
isUserUploaded,
41+
}
3042
const detail = acc[name]
3143
if (detail) {
32-
detail.versions.push({
33-
id,
34-
version,
35-
description,
36-
})
44+
detail.versions.push(currVersionDetail)
3745
} else {
3846
acc[name] = {
3947
name,
40-
isUserUploaded,
41-
versions: [{ id, version, description }],
48+
versions: [currVersionDetail],
4249
}
4350
}
4451
return acc

src/Shared/Components/InfoIconTippy/InfoIconTippy.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ const InfoIconTippy = ({
4747
documentationLink={documentationLink}
4848
documentationLinkText={documentationLinkText}
4949
additionalContent={additionalContent}
50+
animation="shift-toward"
51+
duration={400}
5052
>
5153
{children || (
5254
<button

0 commit comments

Comments
 (0)