Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add enhancements to GitOpsDetailsPage
- Loading branch information
1 parent
d2be105
commit d44db04
Showing
18 changed files
with
529 additions
and
350 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 15 additions & 11 deletions
26
frontend/packages/gitops-plugin/src/components/details/CommitDetails.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
.odc-gitops-commit { | ||
padding-top: 3px; | ||
padding-right: 0px; | ||
|
||
&__item { | ||
font-size: 12px; | ||
width: 100%; | ||
.pf-c-label__text { | ||
max-width: 22ch; | ||
min-width: 22ch; | ||
} | ||
} | ||
&__commit-author-sha { | ||
margin-bottom: 'var(--pf-global--spacer--sm)'; | ||
margin-right: 'var(--pf-global--spacer--sm)'; | ||
display: flex; | ||
align-items: flex-end; | ||
color: var(--pf-global--palette--black-600); | ||
} | ||
&__commit-label { | ||
left: -6px; | ||
font-size: 12px; | ||
background-color: inherit; | ||
color: var(--pf-global--link--Color); | ||
width: 25ch; | ||
border-color: var(--pf-c-label--m-blue__content--before--BorderColor) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
frontend/packages/gitops-plugin/src/components/details/GitOpsDeploymentSuccessSection.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
.odc-gitops-deployment-success { | ||
&__header { | ||
padding: 1.5rem 1.5rem 0rem; | ||
margin: 0px; | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
} | ||
&__title { | ||
font-weight: 400; | ||
font-size: 16px; | ||
margin: 0px; | ||
} | ||
&__timespan { | ||
color: var(--pf-global--palette--black-600); | ||
font-size: 14px; | ||
font-weight: 400; | ||
margin: 0px; | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
frontend/packages/gitops-plugin/src/components/details/GitOpsDeploymentSuccessSection.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import * as React from 'react'; | ||
import * as _ from 'lodash'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { truncateMiddle } from '@console/internal/components/utils'; | ||
import { StackItem, Card, CardBody, Split, SplitItem, Tooltip } from '@patternfly/react-core'; | ||
import { ChartDonut, ChartThemeColor } from '@patternfly/react-charts'; | ||
import { global_danger_color_100 as dangerColor } from '@patternfly/react-tokens/dist/js/global_danger_color_100'; | ||
import './GitOpsDeploymentSuccessSection.scss'; | ||
|
||
const GitOpsDeploymentSuccessSection: React.FC = () => { | ||
const { t } = useTranslation(); | ||
|
||
const synced = 35; | ||
const outOfSync = 55; | ||
const unknown = 10; | ||
const totalValue = synced + outOfSync + unknown; | ||
|
||
const title = synced ? `${((synced * 100) / totalValue).toFixed(1)}%` : ''; | ||
const subTitle = synced | ||
? t('gitops-plugin~{{synced}} of {{totalValue}} succeeded', { | ||
synced, | ||
totalValue, | ||
}) | ||
: ''; | ||
|
||
return ( | ||
<> | ||
<StackItem> | ||
<Card> | ||
<Split className="odc-gitops-deployment-success__header"> | ||
<SplitItem> | ||
<h3 className="odc-gitops-deployment-success__title co-nowrap"> | ||
{t('gitops-plugin~Deployment success ratio')} | ||
</h3> | ||
</SplitItem> | ||
<SplitItem> | ||
<p className="odc-gitops-deployment-success__timespan co-nowrap"> | ||
{t('gitops-plugin~Last 30 days')} | ||
</p> | ||
</SplitItem> | ||
</Split> | ||
<CardBody style={{ height: '216px', paddingBottom: '0px' }}> | ||
<Tooltip content={t('gitops-plugin~Synced {{title}}', title)}> | ||
<ChartDonut | ||
ariaDesc={t('gitops-plugin~Success Ratio of Deployments')} | ||
ariaTitle={''} | ||
constrainToVisibleArea | ||
data={[ | ||
{ x: t('gitops-plugin~Synced'), y: synced }, | ||
{ x: t('OutOfSync'), y: outOfSync + unknown }, | ||
]} | ||
sortKey={synced ? ['success', 'failed'] : ['failed']} | ||
labels={({ datum }) => `${_.capitalize(datum.x)}: ${datum.y}%`} | ||
colorScale={ | ||
synced ? [ChartThemeColor.green, dangerColor.value] : [dangerColor.value] | ||
} | ||
radius={85} | ||
innerRadius={75} | ||
subTitle={truncateMiddle(subTitle, { length: 20 })} | ||
title={truncateMiddle(title, { length: 10 })} | ||
/> | ||
</Tooltip> | ||
</CardBody> | ||
</Card> | ||
</StackItem> | ||
</> | ||
); | ||
}; | ||
|
||
export default GitOpsDeploymentSuccessSection; |
Oops, something went wrong.