Skip to content
Merged
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": "0.5.0-beta-1",
"version": "0.5.0-beta-10",
"description": "Supporting common component library",
"type": "module",
"main": "dist/index.js",
Expand Down
20 changes: 20 additions & 0 deletions src/Assets/Icon/ic-file-code.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const DeploymentConfigDiff = ({
navHeading,
navHelpText,
tabConfig,
errorConfig,
...resProps
}: DeploymentConfigDiffProps) => (
<div className="deployment-config-diff">
Expand All @@ -23,7 +24,13 @@ export const DeploymentConfigDiff = ({
navHeading={navHeading}
navHelpText={navHelpText}
tabConfig={tabConfig}
errorConfig={errorConfig}
/>
<DeploymentConfigDiffMain
isLoading={isLoading}
configList={configList}
errorConfig={errorConfig}
{...resProps}
/>
<DeploymentConfigDiffMain isLoading={isLoading} configList={configList} {...resProps} />
</div>
)
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

&__tab-list {
label {
flex-grow: 1
flex-grow: 1;
}

.radio__item-label {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export type DeploymentConfigDiffSelectPickerProps =
}

export interface DeploymentConfigDiffNavigationItem extends Pick<CollapsibleListItem, 'href' | 'title' | 'onClick'> {
Icon?: React.FunctionComponent<React.SVGProps<SVGSVGElement>>
hasDiff?: boolean
}

Expand Down Expand Up @@ -84,7 +85,14 @@ export interface DeploymentConfigDiffProps {
export interface DeploymentConfigDiffNavigationProps
extends Pick<
DeploymentConfigDiffProps,
'isLoading' | 'navList' | 'collapsibleNavList' | 'goBackURL' | 'navHeading' | 'navHelpText' | 'tabConfig'
| 'isLoading'
| 'navList'
| 'collapsibleNavList'
| 'goBackURL'
| 'navHeading'
| 'navHelpText'
| 'tabConfig'
| 'errorConfig'
> {}

export interface DeploymentConfigDiffMainProps
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ReactComponent as ICCheck } from '@Icons/ic-check.svg'
import { ReactComponent as ICStamp } from '@Icons/ic-stamp.svg'
import { ReactComponent as ICEditFile } from '@Icons/ic-edit-file.svg'
import { ReactComponent as ICFileCode } from '@Icons/ic-file-code.svg'
import { stringComparatorBySortOrder, yamlComparatorBySortOrder } from '@Shared/Helpers'
import { DEPLOYMENT_HISTORY_CONFIGURATION_LIST_MAP } from '@Shared/constants'
import { YAMLStringify } from '@Common/Helper'
Expand Down Expand Up @@ -507,6 +508,7 @@ export const getAppEnvDeploymentConfigList = <ManifestView extends boolean = fal
const element = document.querySelector(`#${deploymentTemplateData.id}`)
element?.scrollIntoView({ block: 'start' })
},
Icon: ICFileCode,
},
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,18 @@ export const DeploymentConfigDiffMain = ({
)
})

const renderContent = () => {
if (isLoading) {
return <Progressing fullHeight pageLoader />
}

if (errorConfig?.error) {
return <ErrorScreenManager code={errorConfig.code} reload={errorConfig.reload} />
}

return <div className="flexbox-col dc__gap-12 p-12">{renderDiffs()}</div>
}

return (
<div className="bcn-0 deployment-config-diff__main-top">
<div className="dc__border-bottom-n1 flexbox dc__align-items-center dc__position-sticky dc__top-0 bcn-0 w-100 dc__zi-11">
Expand All @@ -183,15 +195,7 @@ export const DeploymentConfigDiffMain = ({
{renderSortButton()}
</div>
</div>
<div className="deployment-config-diff__main-content">
{errorConfig?.error && <ErrorScreenManager code={errorConfig.code} reload={errorConfig.reload} />}
{!errorConfig?.error &&
(isLoading ? (
<Progressing fullHeight size={48} />
) : (
<div className="flexbox-col dc__gap-12 p-12">{renderDiffs()}</div>
))}
</div>
<div className="deployment-config-diff__main-content">{renderContent()}</div>
</div>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const DeploymentConfigDiffNavigation = ({
navHeading,
navHelpText,
tabConfig,
errorConfig,
}: DeploymentConfigDiffNavigationProps) => {
// STATES
const [expandedIds, setExpandedIds] = useState<Record<string, boolean>>({})
Expand Down Expand Up @@ -101,17 +102,18 @@ export const DeploymentConfigDiffNavigation = ({
)
}

const renderContent = () => (
const renderNavigation = () => (
<>
{navList.map(({ title, href, onClick, hasDiff }) => (
{navList.map(({ title, href, onClick, hasDiff, Icon }) => (
<NavLink
key={title}
data-testid="env-deployment-template"
className="dc__nav-item cursor dc__gap-8 fs-13 lh-32 cn-7 w-100 br-4 px-8 flexbox dc__align-items-center dc__content-space dc__no-decor"
className="dc__nav-item cursor dc__gap-8 fs-13 lh-32 cn-7 w-100 br-4 px-8 flexbox dc__align-items-center dc__no-decor"
to={href}
onClick={onClick}
>
<span className="dc__truncate">{title}</span>
{Icon && <Icon className="icon-dim-16 dc__nav-item__start-icon dc__no-shrink" />}
<span className="dc__truncate flex-grow-1">{title}</span>
{hasDiff && (
<Tippy className="default-tt" content="File has difference" arrow={false} placement="right">
<div className="flex">
Expand All @@ -125,21 +127,40 @@ export const DeploymentConfigDiffNavigation = ({
{navHelpText && (
<div className="mt-8 py-6 px-8 flexbox dc__align-items-center dc__gap-8">
<span className="flex p-2 dc__align-self-start">
<ICInfoOutlined className="icon-dim-16 fcn-6" />
<ICInfoOutlined className="icon-dim-16 fcn-7" />
</span>
<p className="m-0 fs-12 lh-1-5 cn-9">{navHelpText}</p>
</div>
)}
</>
)

const renderLoading = () => ['90', '70', '50'].map((item) => <ShimmerText key={item} width={item} />)
const renderContent = () => {
if (isLoading) {
return ['90', '70', '50'].map((item) => <ShimmerText key={item} width={item} />)
}

if (errorConfig?.error) {
return (
<div className="mt-8 py-6 px-8 flexbox dc__align-items-center dc__gap-8">
<span className="flex p-2 dc__align-self-start">
<ICInfoOutlined className="icon-dim-16 fcn-7" />
</span>
<p className="m-0 fs-12 lh-1-5 cn-9">
Failed to load files. Please reload or select a different reference to compare with.
</p>
</div>
)
}

return renderNavigation()
}

return (
<div className="bcn-0 dc__border-right">
<div className="bcn-0 dc__border-right flexbox-col dc__overflow-hidden">
{renderTopContent()}
{!!tabConfig?.tabs.length && renderTabConfig()}
<div className="mw-none p-8">{isLoading ? renderLoading() : renderContent()}</div>
<div className="mw-none p-8 flex-grow-1 dc__overflow-auto">{renderContent()}</div>
</div>
)
}