-
Notifications
You must be signed in to change notification settings - Fork 392
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
CB-5391 remove controller from the plugin-connections-administration #2876
Conversation
} | ||
|
||
export const Connection = observer<Props>(function Connection({ connectionKey, connection, projectName }) { | ||
const driversResource = useService(DBDriverResource); | ||
export const Connection = observer<Props>(function Connection({ connectionKey, connection, projectName, icon }) { |
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.
please remove DBDriverResource
import
@@ -44,16 +30,17 @@ export const ConnectionsTable = observer<Props>(function ConnectionsTable({ keys | |||
<TableColumnHeader min /> | |||
<TableColumnHeader>{translate('connections_connection_name')}</TableColumnHeader> | |||
<TableColumnHeader>{translate('connections_connection_address')}</TableColumnHeader> | |||
{displayProjects && <TableColumnHeader>{translate('connections_connection_project')}</TableColumnHeader>} | |||
{state.shouldDisplayProjects && <TableColumnHeader>{translate('connections_connection_project')}</TableColumnHeader>} |
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.
It is bad practice to move all logic to a single place instead of splitting it between places where you use it. shouldDisplayProjects
is not used outside of this component, but you keep it in a state
shared among different components. Now, look at useConnectionsTable
. It's almost 200 rows of code.
It's always better to keep non-reused code close to its uses. This will reduce the amount of logic in single logical units and improve the readability of code.
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.
same situation with getProjectName
and getConnectionIcon
@@ -9,30 +9,30 @@ import { action, computed, makeObservable, observable } from 'mobx'; | |||
|
|||
import { Executor, IExecutor } from '@cloudbeaver/core-executor'; | |||
|
|||
type Key = string | string[]; | |||
type Key = any; |
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.
please lets do proper types if possible. it would make debug easier if something about to happen here
No description provided.