-
Notifications
You must be signed in to change notification settings - Fork 11
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
Implement Migration Complexity Explanation providing the summary and rationale for reported complexity #2166
Conversation
…nd rationalte for complexity reported
|
||
// ======================================= Migration Complexity Explanation ========================================== | ||
|
||
const explainTemplateHTML = ` |
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.
Would like to avoid having HTML in multiple places. It should all ideally be in the template file. Morevoer, field AssessmentReport.MigrationComplexityExplanation
having HTML would be weird.
But I get why you did this. (because json and HTML have different requirements).
Here's one way to do this:
- in
AssessmentReport
, instead of storing just the final string inMigrationComplexityExplanation
, store the actualExplanationData
struct. - in HTML template, you have all the necessary information to build the table there.
- for json, just exclude the summaries from it. (in fact there's no harm in even keeping it tbh).
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.
Agree to this, we should keep all the HTML code in that template
for json, just exclude the summaries from it. (in fact there's no harm in even keeping it tbh).
yes we can keep it in JSON as well, in case of tests and all you are anyways ignoring it
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.
added a TODO comment
var err error | ||
assessmentReport.MigrationComplexityExplanation, err = buildMigrationComplexityExplanation(source.DBType, assessmentReport, "") | ||
if err != nil { | ||
utils.PrintAndLog("ERROR: unable to build migration complexity explanation for json report: %v", err) |
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.
why utils.PrintAndLog
, use return fmt.Errorf(..)
?
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.
I was thinking of showing something on console also for users to know that explanation is not there for xyz reason
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.
The top level functions which is calling the generateAssessmentReportJson
must be printing the error on console for users so it will come eventually right?
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.
will this not look good? any suggestions?
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.
The top level functions which is calling the generateAssessmentReportJson must be printing the error on console for users so it will come eventually right?
No, what i did was to not error out the cmd if building explanation fails...
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.
are you suggesting to error out in this scenario?
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.
Oh, I see. Ideally, we should return the error,and mostly the errors occur while buildMigrationComplexityExplanation
is generating HTML string, etc.
For the case, we should fail the command for this new addition, we can use env var approach and if user faces any blocker we can always ask them to disable it.
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.
hmm makes sense, this is the standard code - creating template and executing it.
Should not be error here ideally.
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.
done
|
||
// TODO: discuss if the html should be in main report or here | ||
const explainTemplateHTML = ` | ||
<p>Below is a detailed breakdown of issues by category, showing the count for each impact level.</p> |
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.
How about Below is a breakdown of the issues detected in different categories for each impact level
?
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.
yeah better.
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.
LGTM
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.
LGTM
|
||
var result []MigrationComplexityCategorySummary | ||
for _, summary := range summaryMap { | ||
summary.Category = utils.SnakeCaseToTitleCase(summary.Category) |
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.
Instead of using this function we can get the Feature heading for that Enum to be consistent with the heading in report.
but given that we are anyways changing the UI, we can revisit it later so okay for now.
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.
yeah lets revisit this. The category here is being fetched from the analyze schema issue.
I see the same issues of formatting in schema reports. We need to fix the root.
Describe the changes in this pull request
Different explanation in case of html and json. Html also includes the summary about categories and issues count.
https://yugabyte.atlassian.net/browse/DB-14717
Describe if there are any user-facing changes
MigrationComplexityExplanation
Sample HTML Report
Sample JSON Report
How was this pull request tested?
Manually.
This is a new field in the assessment report which we plan to add to test later with other UI changes.
Also have to modified the upgrade unit test for the new field.
Does your PR have changes that can cause upgrade issues?