-
Notifications
You must be signed in to change notification settings - Fork 0
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
PLT-7646 Fix progress % values for properties in the Timeline-View grid #21
Conversation
…iew grid when Finished
WalkthroughThis comprehensive update focuses on enhancing the user interface, improving performance, and refining error handling. Key changes include consolidation of font styles, simplification of routing structure, introduction of new components like Changes
TipsChat with CodeRabbit Bot (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Files selected for processing (3)
- src/pages/certification/Certification.helper.tsx (2 hunks)
- src/pages/certification/certification-result/CertificationResult.tsx (5 hunks)
- src/pages/certification/components/TimelineView/TimelineView.tsx (10 hunks)
Files skipped from review due to trivial changes (1)
- src/pages/certification/Certification.helper.tsx
Additional comments (Suppressed): 15
src/pages/certification/certification-result/CertificationResult.tsx (5)
1-4: The
useRef
hook has been added to the import statement from 'react'. Ensure that this new hook is being used correctly in the component.21-27: A new helper function
isTaskSuccess
and a new constanttaskKeys
have been imported fromCertification.helper
. Make sure these are defined and exported correctly in the helper file.32-38: Two new
useRef
hooks have been introduced:propertyBasedTestProgressTotal
andcurrentPropertyBasedTestProgress
. These hooks are used to store mutable values which can persist across re-renders without causing additional renders when their values change. This seems to be an appropriate use ofuseRef
.55-70: The logic for processing the result JSON has been updated. Now, it not only processes the finished JSON but also calculates the progress of property-based testing. The calculation is based on the success status of each task in the result JSON. This seems like a reasonable approach to calculate the progress, but ensure that the
isTaskSuccess
function correctly determines the success status of a task.114-120: The
ProgressCard
component is now being rendered with dynamic values forcurrentValue
andtotalValue
, which are derived from the refscurrentPropertyBasedTestProgress
andpropertyBasedTestProgressTotal
. This is a good improvement as it allows the progress bar to reflect the actual progress of property-based testing.src/pages/certification/components/TimelineView/TimelineView.tsx (10)
1-4: The
useRef
hook is imported from React but it's not used in the old hunk. Ensure that this new import is necessary and used appropriately in other parts of the code.15-23: The
ICertificationTask
andisTaskSuccess
are newly imported fromCertification.helper
. Make sure these imports are used correctly in the updated code.34-38: A new property
key
has been added to thePlanObj
interface. Ensure that this change doesn't break any existing functionality wherePlanObj
is used.66-70: The
useRef
hook is used to createcurrentPropertyBasedTestProgress
. This is a new addition to the component state. Make sure its usage aligns with the intended behavior of the component.91-104: The logic for setting
plannedTestingTasks
has been modified. The new logic includes a check forTaskConfig
before returning an object. This is a good practice as it prevents potential errors ifTaskConfig
is undefined.123-129: The function
recalculateTestTaskProgress
is called when a task succeeds. This is a new addition to the code. Ensure that this function call doesn't introduce any unexpected side effects.137-141: The function
recalculateTestTaskProgress
is defined here. It adds the name of the task tocurrentPropertyBasedTestProgress
if it's not already present. This seems to be a part of the new logic for tracking progress.268-281: The
ProgressCard
component is now rendered with dynamic values forcurrentValue
andtotalValue
. This is a significant improvement over the commented-out static values in the old hunk.294-300: The
index
parameter is added to the map function. Ensure that this new parameter is used correctly in the updated code.307-328: The logic for rendering the progress of each task has been updated. The new logic includes checks for the run status and task progress, and renders different components based on these checks. This seems to be a part of the new logic for tracking progress.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Files selected for processing (1)
- src/pages/certification/certification-result/fullReportTable.css (1 hunks)
Files skipped from review due to trivial changes (1)
- src/pages/certification/certification-result/fullReportTable.css
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Files selected for processing (2)
- src/hooks/useLocalStorage.ts (1 hunks)
- src/hooks/useLogs.ts (2 hunks)
Files skipped from review due to trivial changes (2)
- src/hooks/useLocalStorage.ts
- src/hooks/useLogs.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 3
Files selected for processing (2)
- src/components/LogsView/LogsView.tsx (1 hunks)
- src/pages/certification/components/TimelineView/TimelineView.tsx (10 hunks)
Additional comments (Suppressed): 11
src/components/LogsView/LogsView.tsx (2)
12-19: The new prop
latestTestingProgress
is introduced in the function signature. Ensure that all calls to this component throughout the codebase have been updated to match the new signature if necessary.70-78: This block of code introduces a new logic to handle the progress of property-based tests. It checks if the
latestTestingProgress
function is provided, and if the current log entry is the second last one with "run-certify" in its source. If these conditions are met, it parses the text of the log entry as JSON and passes it to thelatestTestingProgress
function. This seems like a specific use case, so ensure that it doesn't interfere with other uses of theLogsView
component.src/pages/certification/components/TimelineView/TimelineView.tsx (9)
4-4: The
useRef
hook is imported but not used in the old hunk. Ensure that it's necessary for the new code.15-21: The import statement has been expanded to include
ICertificationTask
andisTaskSuccess
. Make sure these are being used in the new code.34-38: A new property
key
has been added to thePlanObj
interface. Confirm that this change doesn't break any existing functionality wherePlanObj
is used.66-67: The
currentPropertyBasedTestProgress
state variable has been introduced usinguseRef
. This seems to be a new addition to manage the progress of the current property-based test.83-112: The
assignProgressToTasks
function has been introduced to assign progress to tasks based on the received progress data. It updates theplannedTestingTasks
state with the calculated progress. This is a significant change from the previous logic, which directly updated theplannedTestingTasks
state inside thehandleTestingTimelineDetails
function.145-149: The
recalculateTestTaskProgress
function has been introduced to update thecurrentPropertyBasedTestProgress
ref with the name of the completed task. This seems to be a new feature for tracking the progress of property-based tests.192-195: The
processLatestTestingProgressFromLogs
function has been introduced to process the latest testing progress from logs and assign it to tasks. This seems to be a new feature for updating task progress based on log data.292-292: The
ProgressCard
component is now being used with dynamic values forcurrentValue
andtotalValue
. Ensure that these values are calculated correctly and the component displays the expected progress.311-312: The
index
parameter has been added to the map function. Make sure this doesn't break any existing functionality where the map function is used.
src/pages/certification/components/TimelineView/TimelineView.tsx
Outdated
Show resolved
Hide resolved
src/pages/certification/components/TimelineView/TimelineView.tsx
Outdated
Show resolved
Hide resolved
@RSoulatIOHK Resolved the calculations within the progress% in TimelineView ; and added the Property Based Testing progress card in both Timeline View and Full Report View when run is finished. Calculations are updated here - https://input-output.atlassian.net/browse/PLT-7646?focusedCommentId=217176 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 4
Files selected for processing (6)
- src/components/LogsView/LogsView.tsx (1 hunks)
- src/components/RepoAccessStatus/repoAccessStatus.config.ts (1 hunks)
- src/pages/certification/Certification.helper.tsx (3 hunks)
- src/pages/certification/certification-result/CertificationResult.tsx (5 hunks)
- src/pages/certification/components/AuditorRunTestForm/AuditorRunTestForm.tsx (6 hunks)
- src/pages/certification/components/TimelineView/TimelineView.tsx (8 hunks)
Files skipped from review due to trivial changes (2)
- src/components/RepoAccessStatus/repoAccessStatus.config.ts
- src/pages/certification/components/AuditorRunTestForm/AuditorRunTestForm.tsx
Additional comments (Suppressed): 16
src/pages/certification/certification-result/CertificationResult.tsx (5)
1-4: The
useRef
hook is imported but not used in the old hunk. Ensure that this new import is necessary for the changes made in the new hunks.21-27: New functions and types are imported from
Certification.helper
. Make sure these are implemented correctly and used as intended in the new code.32-39: A new state variable
testTaskProgress
is introduced using theuseRef
hook. This seems to be used for storing progress information of tasks.54-80: The logic for processing the result JSON has been significantly expanded. It now includes a loop over the keys of the result JSON, where each key is matched with a task configuration. If a match is found and the corresponding value in the result JSON is truthy, a new object is created and pushed into
testTaskProgress.current
. This seems to be part of the new progress calculation logic.124-134: The
ProgressCard
component is now rendered with dynamic values forcurrentValue
andtotalValue
, calculated by the newly imported functionscalculateCurrentProgress
andcalculateExpectedProgress
. This should provide a more accurate representation of the progress based on the actual data.- {/* <ProgressCard title={"Property Based Testing"} currentValue={100} totalValue={1000} /> */} + <ProgressCard + title={"Property Based Testing"} + currentValue={calculateCurrentProgress(testTaskProgress.current)} + totalValue={calculateExpectedProgress(testTaskProgress.current)} + />src/pages/certification/Certification.helper.tsx (2)
1-53: The new hunk introduces several interfaces to define the structure of certification tasks, testing progress, and planned tasks. This is a good practice as it improves code readability and maintainability by providing clear definitions of the data structures used in the code. The
CertificationTasks
array has been updated to use the newly introducedICertificationTask
interface.152-176: New utility functions
parseTestCount
,calculateCurrentProgress
, andcalculateExpectedProgress
have been added. These functions seem to be well-implemented and should improve the modularity and readability of the code.src/pages/certification/components/TimelineView/TimelineView.tsx (8)
1-4: The
useRef
hook has been added to the import statement from React. Ensure that this new hook is used appropriately in the code and that its implications are understood.14-29: Several new imports have been added, including
calculateCurrentProgress
,calculateExpectedProgress
,getProgressCardInfo
,ICertificationTask
,IFinishedTestingTaskDetails
,ITestingProgress
,PlanObj
, andisTaskSuccess
. Make sure these new imports are used correctly and efficiently in the code.32-40: A new component
StatusIcon
has been imported and two new constantsPROGRESS_PASS
andPROGRESS_FAIL
have been defined. Ensure that these changes align with the intended functionality of the code.89-144: The logic for setting planned testing tasks has been significantly updated. The new logic seems more comprehensive and handles different scenarios more accurately. However, it's important to verify that these changes don't introduce any unexpected behavior or bugs.
- item.progress = Math.trunc( - ((currentProgressStats["successes"] + - currentProgressStats["failures"]) / - currentProgressStats["expected"]) * - 100 - ); + item.progress = currentProgressStats["expected"] ? Math.trunc( + ((currentProgressStats["successes"] + currentProgressStats["failures"]) / + (currentProgressStats["expected"] - currentProgressStats["discarded"])) * 100 + ) : "On Going";In the old hunk, the progress was calculated as a percentage of successes and failures over expected. In the new hunk, discarded tests are subtracted from the expected total before calculating the percentage. This seems to be a more accurate way of calculating progress, but it's important to verify that this change doesn't have any unintended side effects.
183-205: A new function
processLatestTestingProgressFromLogs
has been introduced. This function updates the planned testing tasks based on the latest testing progress from logs. It appears to handle different scenarios correctly, but it's important to verify that it works as expected in all cases.207-220: The
getTaskProgress
function has been introduced to determine the progress of each task. It uses theStatusIcon
component to display the status of each task. Ensure that this function is working as expected and that it accurately reflects the status of each task.302-324: The
FileCoverageContainer
andProgressCard
components are now conditionally rendered based on whether the run status is "finished". ThecalculateCurrentProgress
andcalculateExpectedProgress
functions are used to calculate the current and total values for theProgressCard
component. Make sure these changes work as expected and improve the user experience.- {/* <ProgressCard title={"Property Based Testing"} currentValue={100} totalValue={1000}/> */} + <ProgressCard + title={"Property Based Testing"} + currentValue={calculateCurrentProgress(plannedTestingTasks)} + totalValue={calculateExpectedProgress(plannedTestingTasks)} + />
- 338-344: > Note: This review was outside of the patch, so it was mapped to the patch with the greatest overlap. Original lines [338-357]
The logic for displaying task progress in the table has been updated. Instead of using an image to indicate complete progress, the
getTaskProgress
function is now used. This should provide a more consistent and flexible way of displaying task progress.- {task.progress === 100 ? ( - <img - className="image" - src="/images/status-check.svg" - alt="complete" - /> - ) : ( - <span>{task.progress}%</span> - )} + {getTaskProgress(task, index)}src/components/LogsView/LogsView.tsx (1)
- 7-13: The
LogsView
component now accepts an additional proplatestTestingProgress
. This function is expected to be called with the second last log entry when polling ends and the source of the log entry contains 'run-certify'. Ensure that this new prop is correctly passed wherever this component is used.
https://input-output.atlassian.net/browse/PLT-7646
BE PR input-output-hk/dapps-certification#90
Summary by CodeRabbit
CircularProgressBar
andProgressCard
components for better progress visualization.RepoAccessStatus
component to display repository access status.StatusIcon
component for displaying various status icons.App.tsx
and removed unused imports and components.Button
component to support passing an icon element.TextArea
component with onBlur validation and floating label functionality.TableComponent
to support collapsible rows and show/hide column functionality.ColViz
component for better visual presentation and interaction.useLocalStorage
hook for better error handling and value type flexibility.repoAccessStatus.config.ts
.LogsView
component.