Skip to content

Commit c4727c0

Browse files
authored
Merge branch 'main' into tagging-implementation
2 parents d6da749 + deee00d commit c4727c0

33 files changed

+485
-494
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": "0.4.0-patch-1",
3+
"version": "0.5.0",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Common/ChartVersionAndTypeSelector.tsx

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

17-
import React, { useEffect, useState } from 'react'
18-
import ReactSelect from 'react-select'
17+
import { useEffect, useState } from 'react'
1918
import { fetchChartTemplateVersions } from './Common.service'
2019
import { ChartVersionAndTypeSelectorProps, DeploymentChartVersionType } from './Types'
21-
import { customStyles, getFilteredChartVersions, showError } from './Helper'
20+
import { getFilteredChartVersions, showError } from './Helper'
21+
import { SelectPicker, SelectPickerVariantType } from '@Shared/Components'
2222

2323
// @TODO: Generalize this component to be used in CodeEditor as Chart selector toolbar
2424
// when the Code Editor is moved to the fe-common-lib
@@ -71,20 +71,23 @@ const ChartVersionAndTypeSelector = ({ setSelectedChartRefId }: ChartVersionAndT
7171
<div className="flex">
7272
<div className="chart-type-options flex" data-testid="chart-type-options">
7373
<span className="cn-7 mr-4">Chart Type</span>
74-
<ReactSelect
74+
<SelectPicker
75+
inputId='chart-type-select'
76+
label='Chart Type'
7577
value={selectedChartType ?? chartTypeOptions[0]}
7678
options={chartTypeOptions}
7779
onChange={handleChartTypeChange}
78-
styles={customStyles}
80+
variant={SelectPickerVariantType.BORDER_LESS}
7981
/>
8082
</div>
8183
<div className="chart-version-options flex" data-testid="chart-version-options">
82-
<span className="cn-7 mr-4">Chart Version</span>
83-
<ReactSelect
84+
<span className="cn-7 mr-4">Chart Version</span>
85+
<SelectPicker
86+
inputId='chart-version-select'
8487
value={selectedChartVersion ?? chartVersionOptions[0]}
8588
options={chartVersionOptions}
8689
onChange={handleChartVersionChange}
87-
styles={customStyles}
90+
variant={SelectPickerVariantType.BORDER_LESS}
8891
/>
8992
</div>
9093
</div>

src/Common/CodeEditor/CodeEditor.tsx

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,6 @@ function useCodeEditorContext() {
5454
return context
5555
}
5656

57-
/**
58-
* TODO: can be removed with this new merge into react-monaco-editor :)
59-
* see: https://github.com/react-monaco-editor/react-monaco-editor/pull/955
60-
* */
61-
const _onChange = {
62-
onChange: null,
63-
}
64-
6557
const INITIAL_HEIGHT_WHEN_DYNAMIC_HEIGHT = 100
6658

6759
const CodeEditor: React.FC<CodeEditorInterface> & CodeEditorComposition = React.memo(
@@ -107,6 +99,12 @@ const CodeEditor: React.FC<CodeEditorInterface> & CodeEditorComposition = React.
10799
const [contentHeight, setContentHeight] = useState(
108100
adjustEditorHeightToContent ? INITIAL_HEIGHT_WHEN_DYNAMIC_HEIGHT : height,
109101
)
102+
/**
103+
* TODO: can be removed with this new merge into react-monaco-editor :)
104+
* see: https://github.com/react-monaco-editor/react-monaco-editor/pull/955
105+
* */
106+
const onChangeRef = useRef(onChange)
107+
onChangeRef.current = onChange
110108
monaco.editor.defineTheme(CodeEditorThemesKeys.vsDarkDT, {
111109
base: 'vs-dark',
112110
inherit: true,
@@ -257,14 +255,9 @@ const CodeEditor: React.FC<CodeEditorInterface> & CodeEditorComposition = React.
257255
editorRef.current.layout()
258256
}, [width, windowHeight])
259257

260-
/**
261-
* NOTE: Please see @_onChange variable
262-
*/
263-
_onChange.onChange = onChange
264-
265258
const setCode = (value: string) => {
266259
dispatch({ type: 'setCode', value })
267-
_onChange.onChange?.(value)
260+
onChangeRef.current?.(value)
268261
}
269262

270263
useEffect(() => {

src/Common/EmptyState/emptyState.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@
2727
max-height: 200px;
2828
width: auto;
2929
}
30+
.button svg {
31+
height: 100%;
32+
max-height: none;
33+
width: 100%;
34+
}
3035
h1,
3136
h2,
3237
h3,

src/Common/RJSF/widgets/Select.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const DropdownIndicator = (props) => (
3535
</components.DropdownIndicator>
3636
)
3737

38-
export const Select = (props: WidgetProps) => {
38+
export const SelectWidget = (props: WidgetProps) => {
3939
const {
4040
id,
4141
multiple = false,

src/Common/RJSF/widgets/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
*/
1616

1717
export { Checkbox as CheckboxWidget } from './Checkbox'
18-
export { Select as SelectWidget } from './Select'
18+
export { SelectWidget } from './Select'

src/Common/SortableTableHeaderCell/SortableTableHeaderCell.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const SortableTableHeaderCell = ({
6363
return (
6464
<button
6565
type="button"
66-
className={`dc__transparent p-0 bcn-0 cn-7 flex dc__content-start dc__gap-4 dc__select-text ${!isSortable ? 'cursor-default' : ''}`}
66+
className={`dc__transparent p-0 cn-7 flex dc__content-start dc__gap-4 dc__select-text ${!isSortable ? 'cursor-default' : ''}`}
6767
onClick={isSortable ? triggerSorting : noop}
6868
disabled={disabled}
6969
>

src/Common/Tooltip/Tooltip.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const Tooltip = ({
3737
maxWidth=""
3838
{...rest}
3939
{...(shortcutKeyCombo ? { content: <ShortcutKeyComboTooltipContent {...shortcutKeyCombo} /> } : {})}
40-
className={`${shortcutKeyCombo ? 'shortcut-keys__tippy' : 'default-tt'} ${wordBreak ? 'dc__word-break-all' : ''} dc__mxw-200 ${rest.className ?? ''}`}
40+
className={`${shortcutKeyCombo ? 'shortcut-keys__tippy' : 'default-tt'} ${wordBreak ? 'dc__word-break' : ''} dc__mxw-200 ${rest.className ?? ''}`}
4141
>
4242
{cloneElement(child, { ...child.props, onMouseEnter: handleMouseEnterEvent })}
4343
</TippyJS>

src/Pages/GlobalConfigurations/BuildInfra/BuildInfraFormAction.tsx

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

1717
import { FormEvent, FunctionComponent, useMemo } from 'react'
18-
import ReactSelect from 'react-select'
18+
import { SelectPicker } from '@Shared/Components/SelectPicker'
19+
import { ComponentSizeType } from '@Shared/constants'
1920
import { BuildInfraFormActionProps } from './types'
2021
import { OptionType } from '../../../Common'
21-
import { unitSelectorStyles } from './utils'
2222
import { BUILD_INFRA_INPUT_CONSTRAINTS } from './constants'
2323
import { ReactComponent as ErrorIcon } from '../../../Assets/Icon/ic-warning.svg'
2424

@@ -93,19 +93,16 @@ const BuildInfraFormAction: FunctionComponent<BuildInfraFormActionProps> = ({
9393
</div>
9494

9595
{profileUnitsMap && (
96-
<ReactSelect
96+
<SelectPicker
97+
inputId={`${actionType}-unit`}
9798
classNamePrefix="unit-dropdown"
9899
name={`${actionType}-unit`}
99-
className="bcn-0 dc__mxw-120"
100100
options={unitOptions}
101101
value={currentUnit}
102102
onChange={handleUnitChange}
103103
isSearchable={false}
104-
components={{
105-
IndicatorSeparator: null,
106-
ClearIndicator: null,
107-
}}
108-
styles={unitSelectorStyles()}
104+
size={ComponentSizeType.large}
105+
shouldMenuAlignRight
109106
/>
110107
)}
111108
</div>

0 commit comments

Comments
 (0)