Skip to content
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

fix(KFLUXUI-301): remove workspace dependency from Secrets #113

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

StanislavJochman
Copy link
Contributor

Fixes

Description

Type of change

  • Feature
  • Bugfix
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

Screen shots / Gifs for design review

How to test or reproduce?

Browser conformance:

  • Chrome
  • Firefox
  • Safari
  • Edge

@StanislavJochman StanislavJochman marked this pull request as draft February 11, 2025 15:13
Copy link

codecov bot commented Feb 11, 2025

Codecov Report

Attention: Patch coverage is 88.13559% with 7 lines in your changes missing coverage. Please review.

Project coverage is 80.03%. Comparing base (591f649) to head (f01a64c).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...View/tabs/TaskRunSecurityEnterpriseContractTab.tsx 0.00% 2 Missing ⚠️
...s/Commits/CommitDetails/tabs/CommitOverviewTab.tsx 0.00% 1 Missing ⚠️
src/components/GithubRedirect/GithubRedirect.tsx 0.00% 1 Missing ⚠️
.../PipelineRunDetailsView/PipelineRunDetailsView.tsx 0.00% 1 Missing ⚠️
...elineRunDetailsView/tabs/PipelineRunDetailsTab.tsx 0.00% 1 Missing ⚠️
...PipelineRunDetailsView/tabs/PipelineRunLogsTab.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #113      +/-   ##
==========================================
- Coverage   80.10%   80.03%   -0.08%     
==========================================
  Files         577      544      -33     
  Lines       21495    21132     -363     
  Branches     5064     5061       -3     
==========================================
- Hits        17219    16913     -306     
+ Misses       4252     4195      -57     
  Partials       24       24              
Flag Coverage Δ
unittests 80.03% <88.13%> (-0.08%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...mponents/ApplicationDetails/ApplicationDetails.tsx 83.33% <ø> (ø)
.../visualization/hooks/useAppApplicationTestNodes.ts 89.47% <ø> (-0.36%) ⬇️
...s/overview/visualization/hooks/useAppBuildNodes.ts 91.93% <100.00%> (-0.26%) ⬇️
...rview/visualization/hooks/useAppComponentsNodes.ts 89.58% <ø> (-0.42%) ⬇️
src/components/Applications/ApplicationListRow.tsx 92.30% <100.00%> (ø)
...onents/Commits/CommitDetails/CommitDetailsView.tsx 97.82% <ø> (ø)
...mmits/CommitDetails/tabs/CommitsPipelineRunTab.tsx 85.29% <100.00%> (ø)
...mmitDetails/visualization/useCommitWorkflowData.ts 91.95% <100.00%> (ø)
src/components/Commits/commit-status.ts 95.65% <100.00%> (ø)
...nents/ComponentRelation/ComponentRelationModal.tsx 91.48% <100.00%> (ø)
... and 43 more

... and 34 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

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

@StanislavJochman StanislavJochman requested review from sahil143 and CryptoRodeo and removed request for sahil143 February 12, 2025 16:02
@StanislavJochman StanislavJochman self-assigned this Feb 12, 2025
@StanislavJochman StanislavJochman marked this pull request as ready for review February 12, 2025 16:03
Copy link
Contributor

@JoaoPedroPP JoaoPedroPP left a comment

Choose a reason for hiding this comment

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

Please remove the comments that were left behind. Beside that I left three questions why we use workspace dependency in some parts of the code.

This PR will probably be affected by #111 and the path for Namespace dependency will to update.

src/components/Applications/ApplicationListRow.tsx Outdated Show resolved Hide resolved
src/components/Commits/commit-status.ts Outdated Show resolved Hide resolved
src/components/Secrets/SecretsForm/ComponentDropdown.tsx Outdated Show resolved Hide resolved
src/hooks/useComponents.ts Outdated Show resolved Hide resolved
src/utils/tekton-results.ts Outdated Show resolved Hide resolved
@@ -63,7 +64,7 @@ const ComponentNudgesSVG: React.FC<ComponentNudgesSVGprops> = ({
{relatedComponents.map((comp, i) => (
<li key={i} data-test="nudges-connector">
<Link
to={`/workspaces/${workspace}/applications/${comp.spec?.application}/components/${comp.metadata.name}`}
to={`/workspaces/${namespace}/applications/${comp.spec?.application}/components/${comp.metadata.name}`}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also should not be this like:

to={${APPLICATION_DETAILS_PATH.createPath({ workspaceName: namespace, applicationName: comp?.spec?.application, componentName: comp.metadata.name})}/} or something similar @JoaoPedroPP @CryptoRodeo

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice catch!

Yeah, it should be the same

@testcara
Copy link
Contributor

@StanislavJochman , could you help to attach screenshots or recordings? For me, it seems the patch fixed more than its required. The screenshots or recordings are helpful for general review.

Comment on lines 6 to 8
jest.mock('../../../Workspace/useWorkspaceInfo', () => ({
useWorkspaceInfo: jest.fn(() => ({ namespace: 'test-ns', workspace: 'test-ws' })),
}));
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we remove this?

Comment on lines +307 to +317
export const createUseNamespaceMock = (namespace: string = 'test-ns'): jest.Mock => {
const mockFn = jest.fn().mockReturnValue(namespace);

jest.spyOn(NameSpaceUtils, 'useNamespace').mockImplementation(mockFn);

beforeEach(() => {
mockFn.mockReturnValue(namespace);
});

return mockFn;
};
Copy link
Contributor

@JoaoPedroPP JoaoPedroPP Feb 13, 2025

Choose a reason for hiding this comment

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

There is a similar function in ./src/unit-test-utils/mock-namespace, please use mockUseNamespaceHook function.

@@ -60,7 +59,7 @@ const CustomizeAllPipelines: React.FC<React.PropsWithChildren<Props>> = ({
component={(props) => (
<Link
{...props}
to={`/workspaces/${workspace}/import?application=${applicationName}`}
to={`${IMPORT_PATH.createPath({ workspaceName: namespace })}?application=${applicationName}`}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
to={`${IMPORT_PATH.createPath({ workspaceName: namespace })}?application=${applicationName}`}
to={APPLICATION_DETAILS_PATH.createPath({ workspaceName: namespace, applicationName })}

@@ -10,11 +10,11 @@ import {
} from '@patternfly/react-core';
import { useComponents } from '../../hooks/useComponents';
import { ComponentModel } from '../../models';
import { IMPORT_PATH } from '../../routes/paths';
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
import { IMPORT_PATH } from '../../routes/paths';
import { APPLICATION_DETAILS_PATH } from '../../routes/paths';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants