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

CB-5391 remove controller from the plugin-connections-administration #2876

Merged
merged 7 commits into from
Sep 16, 2024

Conversation

devnaumov
Copy link
Member

No description provided.

@devnaumov devnaumov self-assigned this Aug 28, 2024
@devnaumov devnaumov requested a review from Wroud August 29, 2024 13:20
@devnaumov devnaumov marked this pull request as ready for review August 29, 2024 13:20
}

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 }) {
Copy link
Contributor

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>}
Copy link
Member

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.

Copy link
Member

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;
Copy link
Contributor

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

@Wroud Wroud merged commit 03d0f26 into devel Sep 16, 2024
7 checks passed
@Wroud Wroud deleted the CB-5391-remove-controller-api branch September 16, 2024 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants