-
Notifications
You must be signed in to change notification settings - Fork 2
Add new pipelines UI with promotion information #3510
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
Merged
Merged
Changes from 15 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
c6261d1
some structure
joshri d8b47cc
target and promotion info
joshri 395891d
import theme colors from oss
joshri cb854b4
update tests
joshri c36e351
workloads background and box sizing
joshri b6f7d58
add branch and url to pr strategies and test
joshri 8d6fb56
lint
joshri 7b25081
snapshots
joshri 03a80d2
promo button design
joshri 188490e
add no targets message
joshri f54341a
move url to new line
joshri 710a5ec
small v
joshri c8ed9b4
small v in tests
joshri d2d27d7
white bg for envs
joshri 3a87ac6
order
joshri 18443bf
full git url text
joshri File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -26,7 +26,7 @@ | |
"@types/styled-components": "^5.1.9", | ||
"@types/urijs": "^1.19.19", | ||
"@weaveworks/progressive-delivery": "0.0.0-rc13", | ||
"@weaveworks/weave-gitops": "npm:@weaveworks/[email protected]2-gd858858e", | ||
"@weaveworks/weave-gitops": "npm:@weaveworks/[email protected]8-gff77b2fb", | ||
"babel-jest": "^27.4.2", | ||
"babel-plugin-named-asset-import": "^0.3.8", | ||
"babel-preset-react-app": "^10.0.1", | ||
|
This file contains hidden or 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 hidden or 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 hidden or 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
48 changes: 48 additions & 0 deletions
48
ui/src/components/Pipelines/PipelineDetails/PromotionInfo.tsx
This file contains hidden or 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,48 @@ | ||
import { Flex, Text, computeReady } from '@weaveworks/weave-gitops'; | ||
import styled from 'styled-components'; | ||
import { PipelineTargetStatus } from '../../../api/pipelines/types.pb'; | ||
import { EnvironmentCard } from './styles'; | ||
|
||
type Props = { | ||
className?: string; | ||
targets: PipelineTargetStatus[]; | ||
}; | ||
|
||
const PromotionInfoContainer = styled(EnvironmentCard)` | ||
background: ${props => props.theme.colors.neutralGray}; | ||
border: 1px solid ${props => props.theme.colors.neutral40}; | ||
border-style: dashed; | ||
`; | ||
|
||
const gatherTargetStatus = (targets: PipelineTargetStatus[]) => { | ||
if (!targets.length) return 'No targets found.'; | ||
const reduced = targets.reduce( | ||
(obj, target) => { | ||
let ready = true; | ||
target.workloads?.forEach(workload => { | ||
if (computeReady(workload.conditions || []) !== 'Ready') ready = false; | ||
}); | ||
if (ready) obj.true += 1; | ||
else obj.false += 1; | ||
return obj; | ||
}, | ||
{ true: 0, false: 0 }, | ||
); | ||
return `${reduced['true']} out of ${targets.length} targets have successfully updated.`; | ||
}; | ||
|
||
function PromotionInfo({ className, targets }: Props) { | ||
return ( | ||
<PromotionInfoContainer className={className}> | ||
<Flex center align wide tall wrap> | ||
<Text color="neutral40">{gatherTargetStatus(targets)}</Text> | ||
</Flex> | ||
</PromotionInfoContainer> | ||
); | ||
} | ||
|
||
export default styled(PromotionInfo).attrs({ className: PromotionInfo.name })` | ||
${Text} { | ||
text-align: center; | ||
} | ||
`; |
This file contains hidden or 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,89 @@ | ||
import { | ||
Flex, | ||
Icon, | ||
IconType, | ||
KubeStatusIndicator, | ||
Link, | ||
Text, | ||
V2Routes, | ||
computeReady, | ||
formatURL, | ||
} from '@weaveworks/weave-gitops'; | ||
import _ from 'lodash'; | ||
import styled from 'styled-components'; | ||
import { PipelineTargetStatus } from '../../../api/pipelines/types.pb'; | ||
import { useListConfigContext } from '../../../contexts/ListConfig'; | ||
import { ClusterDashboardLink } from '../../Clusters/ClusterDashboardLink'; | ||
import { EnvironmentCard } from './styles'; | ||
|
||
type Props = { | ||
className?: string; | ||
target: PipelineTargetStatus; | ||
background: number; | ||
}; | ||
|
||
function Target({ className, target, background }: Props) { | ||
const configResponse = useListConfigContext(); | ||
const clusterName = target.clusterRef?.name | ||
? `${target.clusterRef?.namespace || 'default'}/${target.clusterRef?.name}` | ||
: configResponse?.data?.managementClusterName || null; | ||
|
||
return ( | ||
<EnvironmentCard | ||
className={className} | ||
background={background} | ||
column | ||
gap="8" | ||
> | ||
<Flex column> | ||
<Flex gap="4" align> | ||
<Icon type={IconType.ClustersIcon} size="medium" color="black" /> | ||
<Text>Cluster:</Text> | ||
</Flex> | ||
<ClusterDashboardLink clusterName={clusterName} /> | ||
</Flex> | ||
{_.map(target.workloads, (workload, index) => { | ||
jpellizzari marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const { lastAppliedRevision, version } = workload; | ||
return ( | ||
<Flex key={index} column gap="8"> | ||
<Flex column> | ||
<Text size="medium">Namespace/Name</Text> | ||
<Flex gap="4" align> | ||
<KubeStatusIndicator | ||
noText | ||
conditions={workload?.conditions || []} | ||
/> | ||
<Link | ||
to={formatURL(V2Routes.HelmRelease, { | ||
name: workload.name, | ||
namespace: target.namespace, | ||
clusterName: clusterName, | ||
})} | ||
> | ||
{target.namespace} / {workload.name} | ||
</Link> | ||
</Flex> | ||
</Flex> | ||
<Text | ||
bold | ||
size="small" | ||
color={ | ||
computeReady(workload?.conditions || []) === 'Ready' | ||
? 'successOriginal' | ||
: 'alertOriginal' | ||
} | ||
> | ||
LAST APPLIED VERSION:{' '} | ||
{lastAppliedRevision ? 'v' + lastAppliedRevision : '-'} | ||
</Text> | ||
<Text size="small"> | ||
SPECIFIED VERSION: {version ? 'v' + version : '-'} | ||
</Text> | ||
</Flex> | ||
); | ||
})} | ||
</EnvironmentCard> | ||
); | ||
} | ||
|
||
export default styled(Target).attrs({ className: Target.name })``; |
50 changes: 0 additions & 50 deletions
50
ui/src/components/Pipelines/PipelineDetails/WorkloadStatus.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.