Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

fix: Provide prev/next step when querying step catalog to the backend #1764

Merged
merged 1 commit into from
May 9, 2023

Conversation

igarashitm
Copy link
Contributor

Fixes: #1246

@igarashitm igarashitm requested a review from a team May 8, 2023 23:24
@igarashitm igarashitm force-pushed the 1246 branch 4 times, most recently from d4b740c to 8c31a59 Compare May 8, 2023 23:50
@igarashitm igarashitm changed the title fix: Provide prev/next when querying step catalog to the backend fix: Provide prev/next step when querying step catalog to the backend May 8, 2023
@codecov
Copy link

codecov bot commented May 8, 2023

Codecov Report

Merging #1764 (8915ab6) into main (e1911c1) will decrease coverage by 0.17%.
The diff coverage is 73.84%.

❗ Current head 8915ab6 differs from pull request most recent head c3657af. Consider uploading reports for the commit c3657af to get more accurate results

@@            Coverage Diff             @@
##             main    #1764      +/-   ##
==========================================
- Coverage   66.05%   65.89%   -0.17%     
==========================================
  Files          75       74       -1     
  Lines        2180     2193      +13     
  Branches      485      505      +20     
==========================================
+ Hits         1440     1445       +5     
- Misses        695      703       +8     
  Partials       45       45              
Impacted Files Coverage Δ
src/api/apiService.ts 28.42% <0.00%> (-1.25%) ⬇️
src/types/index.ts 100.00% <ø> (ø)
src/components/PlusButtonEdge.tsx 29.72% <20.00%> (-2.63%) ⬇️
src/components/PrependStepButton.tsx 50.00% <40.00%> (-16.67%) ⬇️
src/components/Catalog.tsx 89.58% <71.42%> (+0.45%) ⬆️
src/components/MiniCatalog.tsx 75.86% <77.77%> (+0.42%) ⬆️
src/components/AppendStepButton.tsx 100.00% <100.00%> (ø)
src/components/SettingsModal.tsx 55.17% <100.00%> (+0.11%) ⬆️
src/components/VisualizationStep.tsx 62.19% <100.00%> (-0.46%) ⬇️
src/services/stepsService.ts 77.41% <100.00%> (+1.14%) ⬆️
... and 1 more

lordrip
lordrip previously approved these changes May 9, 2023
Copy link
Collaborator

@lordrip lordrip left a comment

Choose a reason for hiding this comment

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

LGTM.

PS: The differences between Import sorting and code formatting from IntelliJ and VSCode makes me cry 😭

const showBranchesTab = VisualizationService.showBranchesTab(data.step);
const showStepsTab = VisualizationService.showStepsTab(data);
const supportsBranching = StepsService.supportsBranching(data.step);
const parentStepId = data.branchInfo?.parentStepUuid ?? undefined;
Copy link
Collaborator

Choose a reason for hiding this comment

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

[curious-question] shouldn't this be undefined if branchInfo is undefined? Maybe we don't need the ?? undefined part

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixned 👍

if (!stepUuid) return undefined;
const currentStepIdx = this.findStepIdxWithUUID(stepUuid);
const steps = useIntegrationJsonStore.getState().integrationJson.steps;
return currentStepIdx !== -1 && steps.length > currentStepIdx + 1
Copy link
Collaborator

Choose a reason for hiding this comment

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

[side-comment] At the beginning I thought that we needed steps.length >= currentStepIdx + 1 but after calculation, I think that it's ok 😄

I went through this thought process:

Having this array: [ 'a', 'b' ]
Case A: Using index=0 meaning 'a', for the condition steps.length > currentStepIdx + 1 this would be 2 > 0 + 1 so yeah, 2 > 1.

Case B: Taking 'b', then it will be 2 > 1 + 1, which is not true and it's ok since there's no additional step 🙆‍♂️

Comment on lines 176 to 177
'previous-step'?: string;
'following-step'?: string;
Copy link
Collaborator

Choose a reason for hiding this comment

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

What are your thoughts about renaming these properties to the following? I think that would be easier to write a camel-cased version, there's an optional backend pull request if you want to do it: kaoto-archive/kaoto-backend#643

Suggested change
'previous-step'?: string;
'following-step'?: string;
'previousStep'?: string;
'followingStep'?: string;

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 👍

@Delawen Delawen added this to the 1.1.0 milestone May 9, 2023
@igarashitm igarashitm force-pushed the 1246 branch 2 times, most recently from 8915ab6 to 6067ee5 Compare May 9, 2023 15:38
Comment on lines +26 to +28
const parentStepId = data.branchInfo?.parentStepUuid
? stepsService.findStepWithUUID(data.branchInfo.parentStepUuid)?.id ?? undefined
: undefined;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lordrip so I was using UUID before and getting 400 error. Now this gets the parent step ID successfully.

@sonarqubecloud
Copy link

sonarqubecloud bot commented May 9, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
1.6% 1.6% Duplication

@igarashitm igarashitm merged commit 05365fe into kaoto-archive:main May 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add more context to mini-catalog calls.
3 participants