Skip to content

feat: bulk edit v1beta2 support #824

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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": "1.18.0-pre-0",
"version": "1.18.0-alpha-1",
"description": "Supporting common component library",
"type": "module",
"main": "dist/index.js",
Expand Down
9 changes: 9 additions & 0 deletions src/Assets/IconV2/ic-resize-handle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion src/Common/RJSF/widgets/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const SelectWidget = (props: WidgetProps) => {
onBlur,
onFocus,
placeholder,
schema,
} = props
const { enumOptions: selectOptions = [] } = options
const emptyValue = multiple ? [] : null
Expand All @@ -57,7 +58,7 @@ export const SelectWidget = (props: WidgetProps) => {
options={selectOptions}
onBlur={() => onBlur(id, value)}
onFocus={() => onFocus(id, value)}
placeholder={placeholder || PLACEHOLDERS.SELECT}
placeholder={schema.placeholder || placeholder || PLACEHOLDERS.SELECT}
isDisabled={disabled || readonly}
menuPortalTarget={document.getElementById(RJSF_FORM_SELECT_PORTAL_TARGET_ID)}
menuPosition='fixed'
Expand Down
1 change: 1 addition & 0 deletions src/Pages/BulkEdit/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './types'
59 changes: 59 additions & 0 deletions src/Pages/BulkEdit/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
export interface BulkEditConfigV2Type {
gvk: string
readme: string
schema: Record<string, any>
}

export interface AppEnvDetail {
appName: string
envName?: string
message: string
}

export interface ObjectsWithAppEnvDetail extends AppEnvDetail {
names: string[]
}

export interface DeploymentTemplateResponse {
message: string[]
failure: AppEnvDetail[]
successful: AppEnvDetail[]
}

export interface CmCsResponse {
message: string[]
failure: ObjectsWithAppEnvDetail[]
successful: ObjectsWithAppEnvDetail[]
}

export interface BulkEditResponseType {
deploymentTemplate?: DeploymentTemplateResponse
configMap?: CmCsResponse
secret?: CmCsResponse
}

export interface ImpactedDeploymentTemplate {
appId?: number
envId?: number
appName: string
envName?: string
}

export interface ImpactedCmCs {
appId?: number
envId?: number
appName: string
envName?: string
names: string[]
}

export interface ImpactedObjectsType {
deploymentTemplate?: ImpactedDeploymentTemplate[]
configMap?: ImpactedCmCs[]
secret?: ImpactedCmCs[]
}

export enum BulkEditVersion {
v1 = 'batch/v1beta1',
v2 = 'batch/v1beta2',
}
1 change: 1 addition & 0 deletions src/Pages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
*/

export * from './Applications'
export * from './BulkEdit'
export * from './GlobalConfigurations'
export * from './ResourceBrowser'
25 changes: 16 additions & 9 deletions src/Shared/Components/FilterChips/FilterChips.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,15 @@
* limitations under the License.
*/

import { ReactComponent as CloseIcon } from '../../../Assets/Icon/ic-close.svg'
import { ComponentSizeType } from '@Shared/constants'

import { noop, Tooltip } from '../../../Common'
import { Button, ButtonStyleType, ButtonVariantType } from '../Button'
import { Icon } from '../Icon'
import { FilterChipProps, FilterChipsProps } from './types'

import './styles.scss'

const FilterChip = ({
label,
value,
Expand All @@ -38,7 +43,7 @@ const FilterChip = ({
return (
(labelToDisplay || shouldHideLabel) &&
valueToDisplay && (
<div className="flexbox flex-align-center br-4 dc__border bg__secondary pl-6 pr-6 pt-2 pb-2 dc__user-select-none h-24 dc__gap-6 fs-12 lh-20 cn-9 fw-4 dc__ellipsis-right">
<div className="flexbox flex-align-center br-4 dc__border bg__secondary pl-6 dc__user-select-none h-24 dc__gap-6 fs-12 lh-20 cn-9 fw-4 dc__ellipsis-right">
{!shouldHideLabel && (
<>
<span className="fw-6 dc__capitalize">{labelToDisplay}</span>
Expand All @@ -49,14 +54,16 @@ const FilterChip = ({
<span className="dc__ellipsis-right dc__word-break dc__mxw-150">{valueToDisplay}</span>
</Tooltip>
{showRemoveIcon && (
<button
type="button"
className="flex p-0 dc__transparent dc__hover-remove-btn"
<Button
variant={ButtonVariantType.borderLess}
style={ButtonStyleType.negativeGrey}
dataTestId="filter-chip__remove-btn"
showAriaLabelInTippy={false}
ariaLabel="Remove filter"
icon={<Icon name="ic-close-small" color={null} />}
size={ComponentSizeType.xs}
onClick={removeFilter}
aria-label="Remove filter"
>
<CloseIcon className="icon-dim-12 icon-use-fill-n6" />
</button>
/>
)}
</div>
)
Expand Down
4 changes: 4 additions & 0 deletions src/Shared/Components/FilterChips/styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
button[data-testid="filter-chip__remove-btn"] {
border-radius: 0;
margin-right: -1px; // to make the border part of the button
}
2 changes: 2 additions & 0 deletions src/Shared/Components/Icon/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ import { ReactComponent as ICPencil } from '@IconsV2/ic-pencil.svg'
import { ReactComponent as ICPlayOutline } from '@IconsV2/ic-play-outline.svg'
import { ReactComponent as ICQuay } from '@IconsV2/ic-quay.svg'
import { ReactComponent as ICQuote } from '@IconsV2/ic-quote.svg'
import { ReactComponent as ICResizeHandle } from '@IconsV2/ic-resize-handle.svg'
import { ReactComponent as ICRocketGear } from '@IconsV2/ic-rocket-gear.svg'
import { ReactComponent as ICRocketLaunch } from '@IconsV2/ic-rocket-launch.svg'
import { ReactComponent as ICSelected } from '@IconsV2/ic-selected.svg'
Expand Down Expand Up @@ -391,6 +392,7 @@ export const iconMap = {
'ic-play-outline': ICPlayOutline,
'ic-quay': ICQuay,
'ic-quote': ICQuote,
'ic-resize-handle': ICResizeHandle,
'ic-rocket-gear': ICRocketGear,
'ic-rocket-launch': ICRocketLaunch,
'ic-selected': ICSelected,
Expand Down