Skip to content
This repository was archived by the owner on May 30, 2025. It is now read-only.

commit visualization in commit details page #254

Merged

Conversation

karthikjeeyar
Copy link
Contributor

@karthikjeeyar karthikjeeyar commented Nov 9, 2022

Fixes

https://issues.redhat.com/browse/HACBS-826

Description

Adds commit visualization in commit details page.

Type of change

  • Feature

Screen shots / Gifs for design review

image

image

How to test or reproduce?

Yamls to create test setup:

Test and Environments are here - https://gist.github.com/karthikjeeyar/ce5a1038209565e5ecf0f3a9719609be
Release Setup yamls - https://github.com/karthikjeeyar/hacbs-demos/tree/main/m7/release

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 9, 2022
@karthikjeeyar karthikjeeyar changed the title WIP: commit visualization in details page WIP: commit visualization in commit details page Nov 9, 2022
@karthikjeeyar
Copy link
Contributor Author

cc: @christianvogt @jeff-phillips-18

@karthikjeeyar karthikjeeyar changed the title WIP: commit visualization in commit details page commit visualization in commit details page Nov 14, 2022
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 14, 2022
@karthikjeeyar
Copy link
Contributor Author

cc: @Ranelim @MariaLeonova

@MariaLeonova
Copy link

@Ranelim @andrew-ronaldson let's update the icons as part of this PR?
@karthikjeeyar what format would you want them in? I think we're good with the github icons, while the other two (pipeline, environment) need to be updated.

@karthikjeeyar
Copy link
Contributor Author

@MariaLeonova If it is not a patternfly icons, you can provide me in SVG format.

@MariaLeonova
Copy link

MariaLeonova commented Nov 15, 2022

@karthikjeeyar this one is for pipelines (attached)
pipelineIcon

this one is for Environments

Octokitty can stay the same.

Thank you!

@jeff-phillips-18
Copy link
Member

jeff-phillips-18 commented Nov 15, 2022

@karthikjeeyar I have added the pipeline SVG as part of #248
I use the PF ServerIcon for environments.

@christianvogt
Copy link
Contributor

When testing this change the sizing of other visualizations seems broken. At the same time I cannot reproduce this on console.dev:

image
image

@karthikjeeyar karthikjeeyar force-pushed the commit-visualization branch 4 times, most recently from daa9ca6 to 28cca67 Compare November 16, 2022 19:11
@karthikjeeyar
Copy link
Contributor Author

karthikjeeyar commented Nov 16, 2022

Rebased, Updated Icons and fixed the size issues in other visualisations.

Comment on lines 87 to 89
if (fitToScreen) {
controller.getGraph().fit(90);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see fitToScreen being used by any caller of this function.

Furthermore if fitToScreen changes, this effect does a whole lot more than what's needed to fit to screen.

If you still need this prop, move this to a separate effect.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed it as it is not used in other graphs

export const commitComponentFactory: ComponentFactory = (kind: ModelKind, type: string) => {
switch (kind) {
case ModelKind.graph:
return withPanZoom()(GraphComponent);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pan zoom is fine for now until UX gives a final decision if this needs to be removed in lieu of scroll bars.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent with the application overview graph. Whichever way is finally decided, these should be made consistent.

Comment on lines 150 to 178
: (resources as []).filter((r) => {
return !get(r, runAfterResourceKey);
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r is of type never here.
Avoid casting [] by doing proper checks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typescript throws an error when we use Union of array types for methods like filter(), find(), every() and there is an open issue on Typescript to provide a fix for this. :(

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah that's too bad :(
Ok work around is fine for now. Thanks!

(bp) => bp.metadata.labels[PipelineRunLabel.COMMIT_COMPONENT_LABEL],
);

const commitWorkflowData: { [key: string]: any } = components.reduce(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's opportunity to memoize some values here such that we don't need to recompute everything if only a single value changes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That being said, it's something that can be improved on in future PRs and not needed right away.

@karthikjeeyar karthikjeeyar force-pushed the commit-visualization branch 2 times, most recently from 188a7e5 to 78e758c Compare November 17, 2022 10:51
@codecov
Copy link

codecov bot commented Nov 17, 2022

Codecov Report

Merging #254 (b551da6) into main (4fc123e) will increase coverage by 0.47%.
The diff coverage is 87.20%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #254      +/-   ##
==========================================
+ Coverage   73.27%   73.74%   +0.47%     
==========================================
  Files         421      426       +5     
  Lines        8651     8933     +282     
  Branches     2253     2366     +113     
==========================================
+ Hits         6339     6588     +249     
- Misses       2180     2211      +31     
- Partials      132      134       +2     
Impacted Files Coverage Δ
...mponents/Commits/__data__/pipeline-with-commits.ts 100.00% <ø> (ø)
...rc/hacbs/components/topology/utils/create-utils.ts 100.00% <ø> (ø)
...mits/tabs/CommitDetails/CommitComponentFactory.tsx 21.05% <21.05%> (ø)
...s/overview/visualization/utils/node-icon-utils.tsx 95.23% <50.00%> (-4.77%) ⬇️
...Commits/tabs/CommitDetails/CommitVisualization.tsx 60.00% <60.00%> (ø)
...verview/visualization/nodes/CommitWorkflowNode.tsx 69.23% <69.23%> (ø)
...rview/visualization/hooks/useCommitWorkflowData.ts 93.39% <93.39%> (ø)
...verview/visualization/utils/visualization-utils.ts 99.24% <98.93%> (+3.79%) ⬆️
...view/visualization/hooks/__data__/workflow-data.ts 100.00% <100.00%> (ø)
...cationDetails/tabs/overview/visualization/types.ts 100.00% <100.00%> (ø)
... and 13 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4fc123e...b551da6. Read the comment docs.

@karthikjeeyar karthikjeeyar force-pushed the commit-visualization branch 3 times, most recently from 5b29354 to 252ca84 Compare November 18, 2022 11:43
layoutFactory={layoutFactory}
model={model}
fullHeight
controlBar={(controller) => (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely a bit odd that the commits overview graph has the control bar whereas the application overview graph does not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, waiting on UX for final update on this and pan zoom feature as well.

import { layoutFactory, PipelineLayout, VisualizationFactory } from '../../../topology/factories';
//
import './CommitVisualization.scss';
import { commitComponentFactory } from './CommitComponentFactory';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonder why the linter didn't pickup the import order here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed it.

@karthikjeeyar
Copy link
Contributor Author

/retest

@karthikjeeyar karthikjeeyar force-pushed the commit-visualization branch 2 times, most recently from 8eb9afc to f949036 Compare November 21, 2022 07:27
@karthikjeeyar
Copy link
Contributor Author

/retest

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Nov 21, 2022

@karthikjeeyar: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@christianvogt
Copy link
Contributor

/approve

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 21, 2022
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Nov 22, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Nov 22, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: christianvogt, jeff-phillips-18, karthikjeeyar

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit 246735e into openshift:main Nov 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. hacbs lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants