Skip to content

Commit

Permalink
Merge branch 'main' into tagging-implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
kirandevtn authored Oct 12, 2024
2 parents d6da749 + deee00d commit c4727c0
Show file tree
Hide file tree
Showing 33 changed files with 485 additions and 494 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@devtron-labs/devtron-fe-common-lib",
"version": "0.4.0-patch-1",
"version": "0.5.0",
"description": "Supporting common component library",
"type": "module",
"main": "dist/index.js",
Expand Down
19 changes: 11 additions & 8 deletions src/Common/ChartVersionAndTypeSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
* limitations under the License.
*/

import React, { useEffect, useState } from 'react'
import ReactSelect from 'react-select'
import { useEffect, useState } from 'react'
import { fetchChartTemplateVersions } from './Common.service'
import { ChartVersionAndTypeSelectorProps, DeploymentChartVersionType } from './Types'
import { customStyles, getFilteredChartVersions, showError } from './Helper'
import { getFilteredChartVersions, showError } from './Helper'
import { SelectPicker, SelectPickerVariantType } from '@Shared/Components'

// @TODO: Generalize this component to be used in CodeEditor as Chart selector toolbar
// when the Code Editor is moved to the fe-common-lib
Expand Down Expand Up @@ -71,20 +71,23 @@ const ChartVersionAndTypeSelector = ({ setSelectedChartRefId }: ChartVersionAndT
<div className="flex">
<div className="chart-type-options flex" data-testid="chart-type-options">
<span className="cn-7 mr-4">Chart Type</span>
<ReactSelect
<SelectPicker
inputId='chart-type-select'
label='Chart Type'
value={selectedChartType ?? chartTypeOptions[0]}
options={chartTypeOptions}
onChange={handleChartTypeChange}
styles={customStyles}
variant={SelectPickerVariantType.BORDER_LESS}
/>
</div>
<div className="chart-version-options flex" data-testid="chart-version-options">
<span className="cn-7 mr-4">Chart Version</span>
<ReactSelect
<span className="cn-7 mr-4">Chart Version</span>
<SelectPicker
inputId='chart-version-select'
value={selectedChartVersion ?? chartVersionOptions[0]}
options={chartVersionOptions}
onChange={handleChartVersionChange}
styles={customStyles}
variant={SelectPickerVariantType.BORDER_LESS}
/>
</div>
</div>
Expand Down
21 changes: 7 additions & 14 deletions src/Common/CodeEditor/CodeEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,6 @@ function useCodeEditorContext() {
return context
}

/**
* TODO: can be removed with this new merge into react-monaco-editor :)
* see: https://github.com/react-monaco-editor/react-monaco-editor/pull/955
* */
const _onChange = {
onChange: null,
}

const INITIAL_HEIGHT_WHEN_DYNAMIC_HEIGHT = 100

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

/**
* NOTE: Please see @_onChange variable
*/
_onChange.onChange = onChange

const setCode = (value: string) => {
dispatch({ type: 'setCode', value })
_onChange.onChange?.(value)
onChangeRef.current?.(value)
}

useEffect(() => {
Expand Down
5 changes: 5 additions & 0 deletions src/Common/EmptyState/emptyState.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
max-height: 200px;
width: auto;
}
.button svg {
height: 100%;
max-height: none;
width: 100%;
}
h1,
h2,
h3,
Expand Down
2 changes: 1 addition & 1 deletion src/Common/RJSF/widgets/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const DropdownIndicator = (props) => (
</components.DropdownIndicator>
)

export const Select = (props: WidgetProps) => {
export const SelectWidget = (props: WidgetProps) => {
const {
id,
multiple = false,
Expand Down
2 changes: 1 addition & 1 deletion src/Common/RJSF/widgets/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
*/

export { Checkbox as CheckboxWidget } from './Checkbox'
export { Select as SelectWidget } from './Select'
export { SelectWidget } from './Select'
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const SortableTableHeaderCell = ({
return (
<button
type="button"
className={`dc__transparent p-0 bcn-0 cn-7 flex dc__content-start dc__gap-4 dc__select-text ${!isSortable ? 'cursor-default' : ''}`}
className={`dc__transparent p-0 cn-7 flex dc__content-start dc__gap-4 dc__select-text ${!isSortable ? 'cursor-default' : ''}`}
onClick={isSortable ? triggerSorting : noop}
disabled={disabled}
>
Expand Down
2 changes: 1 addition & 1 deletion src/Common/Tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const Tooltip = ({
maxWidth=""
{...rest}
{...(shortcutKeyCombo ? { content: <ShortcutKeyComboTooltipContent {...shortcutKeyCombo} /> } : {})}
className={`${shortcutKeyCombo ? 'shortcut-keys__tippy' : 'default-tt'} ${wordBreak ? 'dc__word-break-all' : ''} dc__mxw-200 ${rest.className ?? ''}`}
className={`${shortcutKeyCombo ? 'shortcut-keys__tippy' : 'default-tt'} ${wordBreak ? 'dc__word-break' : ''} dc__mxw-200 ${rest.className ?? ''}`}
>
{cloneElement(child, { ...child.props, onMouseEnter: handleMouseEnterEvent })}
</TippyJS>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
*/

import { FormEvent, FunctionComponent, useMemo } from 'react'
import ReactSelect from 'react-select'
import { SelectPicker } from '@Shared/Components/SelectPicker'
import { ComponentSizeType } from '@Shared/constants'
import { BuildInfraFormActionProps } from './types'
import { OptionType } from '../../../Common'
import { unitSelectorStyles } from './utils'
import { BUILD_INFRA_INPUT_CONSTRAINTS } from './constants'
import { ReactComponent as ErrorIcon } from '../../../Assets/Icon/ic-warning.svg'

Expand Down Expand Up @@ -93,19 +93,16 @@ const BuildInfraFormAction: FunctionComponent<BuildInfraFormActionProps> = ({
</div>

{profileUnitsMap && (
<ReactSelect
<SelectPicker
inputId={`${actionType}-unit`}
classNamePrefix="unit-dropdown"
name={`${actionType}-unit`}
className="bcn-0 dc__mxw-120"
options={unitOptions}
value={currentUnit}
onChange={handleUnitChange}
isSearchable={false}
components={{
IndicatorSeparator: null,
ClearIndicator: null,
}}
styles={unitSelectorStyles()}
size={ComponentSizeType.large}
shouldMenuAlignRight
/>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { getArtifactInfo, getCITriggerInfo } from '../../Services/app.service'
import { APIResponseHandler } from '../APIResponseHandler'
import { ReactComponent as ICClose } from '../../../Assets/Icon/ic-close.svg'
import { ReactComponent as ICArrowDown } from '../../../Assets/Icon/ic-arrow-down.svg'
import { Artifacts, HistoryComponentType } from '../CICDHistory'
import { Artifacts } from '../CICDHistory'
import MaterialHistory from '../MaterialHistory/MaterialHistory.component'
import { ArtifactInfoModalProps } from './types'

Expand Down Expand Up @@ -118,8 +118,6 @@ const ArtifactInfoModal = ({
artifact={artifactInfo.image}
blobStorageEnabled
isArtifactUploaded={false}
isJobView={false}
type={HistoryComponentType.CI}
imageReleaseTags={artifactInfo.imageReleaseTags}
imageComment={artifactInfo.imageComment}
ciPipelineId={artifactInfo.ciPipelineId}
Expand Down
2 changes: 1 addition & 1 deletion src/Shared/Components/Button/Button.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ const Button = ({
) : (
<>
{startIcon && <span className={iconClass}>{startIcon}</span>}
<span className="dc__mxw-150 dc__align-left dc__truncate">{text}</span>
<span className="dc__align-left">{text}</span>
{endIcon && <span className={iconClass}>{endIcon}</span>}
</>
)}
Expand Down
Loading

0 comments on commit c4727c0

Please sign in to comment.