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

Fixes #24629: Score details columns in node tables cannot be saved #5566

Open
wants to merge 1 commit into
base: branches/rudder/8.1
Choose a base branch
from

Conversation

clarktsiory
Copy link
Contributor

@clarktsiory clarktsiory commented Apr 2, 2024

https://issues.rudder.io/issues/24629

Peek 2024-04-02 16-00

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)

@clarktsiory
Copy link
Contributor Author

PR updated with a new commit

Comment on lines +1425 to +1441
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);
Copy link
Contributor Author

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

Comment on lines +1353 to 1357
async function reloadTable(gridId) {
var table = $('#'+gridId).DataTable();
table.destroy();
createNodeTable(gridId, function(){reloadTable(gridId)})
await createNodeTable(gridId, function(){reloadTable(gridId)})
}
Copy link
Contributor Author

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

@clarktsiory
Copy link
Contributor Author

PR rebased

@VinceMacBuche
Copy link
Member

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 !!

@VinceMacBuche
Copy link
Member

We can do without adding async/await and keep it simpler : #5643

score details was not managed correctly when reloading columns cache

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