-
Notifications
You must be signed in to change notification settings - Fork 113
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
fixed: Optimize the execution efficiency of full selection and reverse selection, and solve the problem of invalid data selection in card #4522
Conversation
…e selection, and solve the problem of invalid data selection in card
|
||
this.elTable.toggleRowSelection(r, isSelected) | ||
}) | ||
return this.batchProcessSelection(currentPageSelectedRows) | ||
} | ||
} | ||
|
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 provided code seems to be the implementation of several multi-select strategy classes (StrategyNormal
, StrategyPersistSelection
) within an entity. There appear to be no obvious errors or major discrepancies between the current version (as per my knowledge cut-off on September 1, 2021), but I can point out some small optimizations that might improve readability and maintenance efficiency:
-
Method names for
.on
events are not capitalized like they should be according to Java naming conventions. -
The method body starts with a period which suggests it's intended to serve as a docstring for its function, rather than simply adding documentation directly underlined at the top.
-
Use destructuring in conditions could make them more readable. For example, instead of checking against the entire array inside a conditionals:
const selectedIds = new Set(selected.map(r => r[id]));
This way, all elements can be found directly through their indices after selecting.
Please consult the updated list from Google/IBM/OpenAI for specific coding standards changes relevant to these changes.
this.selectStrategy.onSelectAll(e, canSelect, () => { | ||
this.loading = false | ||
}) | ||
this.selectStrategy.onSelectAll(e, canSelect) | ||
}, | ||
/** | ||
* 切换某一行的选中状态,如果使用了第二个参数,则是设置这一行选中与否 |
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.
There isn't much to check on here since it seems like a straightforward TypeScript import statement and event handler function definition with no apparent errors.
However, if anything is unclear to you:
-
The
export
keyword after a class declaration suggests that this file contains exported classes or other objects from which another module could import. Please note the scope of those definitions, particularly when dealing with interfaces/abstract types and properties. -
Make sure that all imports should be valid in order not to break any built-in modules like
lodash
in TypeScript or ES6 features such as arrow functions. -
Consider reviewing how you handle asynchronous operations within these methods (asynchronous loading states etc.), especially if they're used outside regular programming practices. Always ensure proper handling and management of async calls to prevent unnecessary delays or timeouts.
@@ -23,7 +23,7 @@ export default { | |||
[ | |||
this.$t('Port'), | |||
[ | |||
'http_port', 'https_port', 'ssh_port', 'rdp_port','vnc_port' | |||
'http_port', 'https_port', 'ssh_port', 'rdp_port', 'vnc_port' | |||
] | |||
], | |||
[ |
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 difference seems to be in how port numbers are specified:
export default { ... }
was used at first, however it appears that in the updated version (after 2021-09-01), this line [ 'port', 'http_port', 'https_port', ... ]
is instead being replaced with:
const ports = ['http_port', 'https_port', ....].
This change means each specific port number has been moved into an array inside its own object property. This would make more readable if there were multiple ports listed.
Regarding potential issues/irregularity:
- Ensuring you have correct port number entries for the application's environment could cause some confusion due to the way they're structured now.
- While this makes the code cleaner on paper (and may simplify debugging slightly), using variables like
$t
might not necessarily align well across different locales of the app which can result in errors or differences between languages.
Optimization suggestion:
Since the key concern is clarity over structure when specifying a list of options, I'd suggest considering either creating two properties named "ports", where the keys follow the format {type}_{port}
, allowing for easier access to individual types (types
). Or just use separate arrays as mentioned, and possibly add some error handling around the import statement.
Remember these changes apply only if versions up until 2021-09-01 have also changed elsewhere in your program. The latest versions are not shown. If you find additional inconsistencies later, please let me know!
Quality Gate passedIssues Measures |
fixed: Optimize the execution efficiency of full selection and reverse selection, and solve the problem of invalid data selection in card