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
Fixes #24629: Score details columns in node tables cannot be saved #5566
base: branches/rudder/8.1
Are you sure you want to change the base?
Conversation
PR updated with a new commit |
return c !== null | ||
&& ( | ||
allColumnsKeys.includes(c.title) | ||
|| (c.data !== undefined && c.title.startsWith("Software")) | ||
|| c.title.startsWith("Property") | ||
// it is possible that the column data is no longer found in scoresList (e.g. CVE plugin is uninstalled but CVE Score column is saved in cache) | ||
|| (c.value !== undefined && !!scoreList.find(({ id }) => c.title.endsWith("Score") && c.value === id)) | ||
) | ||
}) | ||
|
||
columns = cache.map(function(c) { | ||
if (c.title.startsWith("Property")) { | ||
return allColumns.Property(c.value,c.inherited); | ||
} else { if (c.data.startsWith("software")) { | ||
} else { if (c.data?.startsWith("software")) { | ||
return allColumns.Software(c.value); | ||
} else if (/^.+\sScore$/.test(c.title)) { | ||
return allColumns["Score details"](c.value); |
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.
Specifically parse the score details columns from the localstorage, it was just forgotten in previous PRs for score details
async function reloadTable(gridId) { | ||
var table = $('#'+gridId).DataTable(); | ||
table.destroy(); | ||
createNodeTable(gridId, function(){reloadTable(gridId)}) | ||
await createNodeTable(gridId, function(){reloadTable(gridId)}) | ||
} |
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.
Rewriting to async/await is not necessary here but still a good practice since later we would be able to "await" the reload of the table
PR rebased |
1cf4faa
to
bcedc5d
Compare
I want to take some time to review it, to think whether it is the right tool you are using. I have not forgotten it but i need some time !! |
We can do without adding async/await and keep it simpler : #5643 score details was not managed correctly when reloading columns cache |
https://issues.rudder.io/issues/24629
We also need to await the the ajax for the score list have finished, before parsing the columns data from the cache. So, we just change the
createNodeTable
function to an async one (which is widely browser-compatible)