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

[Research] OUI Compliance audit of the inspector plugin #4084

Open
BSFishy opened this issue May 22, 2023 · 3 comments
Open

[Research] OUI Compliance audit of the inspector plugin #4084

BSFishy opened this issue May 22, 2023 · 3 comments
Assignees
Labels
good first issue Good for newcomers OUI compliance Issues and PRs to maximize OUI usage and remove style and component hacks OUI Issues that require migration to OUI

Comments

@BSFishy
Copy link
Contributor

BSFishy commented May 22, 2023

Tracking issue for OUI compliance audit of the inspector plugin.

Follow the steps in #3945 to complete the audit, then open another issue with findings. Once the work of performing the audit is done, this issue can be closed.

Related files
size (bytes) file notes
262 src/plugins/inspector/public/views/requests/_requests.scss
230 src/plugins/inspector/public/ui/inspector_panel.scss
164 src/plugins/inspector/public/views/data/_data_table.scss
52 src/plugins/inspector/public/views/_index.scss
24 src/plugins/inspector/public/views/data/_index.scss
23 src/plugins/inspector/public/index.scss
22 src/plugins/inspector/public/views/requests/_index.scss

If this issue isn't already assigned to someone and you'd like to take on this work, please ping @BSFishy in the comments and I can assign it to you.

@BSFishy BSFishy added OUI Issues that require migration to OUI and removed untriaged labels May 22, 2023
@seanneumann seanneumann moved this to Todo in Look & Feel May 23, 2023
@BSFishy BSFishy added the good first issue Good for newcomers label May 24, 2023
@nurSaadat
Copy link

nurSaadat commented May 31, 2023

src/plugins/inspector/public/views/_index.scss imports styles from src/plugins/inspector/public/views/data/_index.scss and
src/plugins/inspector/public/views/requests/_index.scss.

src/plugins/inspector/public/views/data/_index.scss imports styles from src/plugins/inspector/public/views/data/_data_table.scss.

src/plugins/inspector/public/index.scss imports styles from src/plugins/inspector/public/views/_index.scss.

src/plugins/inspector/public/views/requests/_index.scss imports styles from src/plugins/inspector/public/views/requests/_requests.scss.

As a dependency graph, it looks like this:

  graph TD;
      public/index.scss-->public/views/_index.scss;
      public/views/_index.scss-->public/views/data/_index.scss;
      public/views/_index.scss-->public/views/requests/_index.scss;
      public/views/data/_index.scss-->public/views/data/_data_table.scss;
      public/views/requests/_index.scss-->public/views/requests/_requests.scss;
Loading

Therefore, the main files to look at are _requests.scss, inspector_panel.scss and _data_table.scss.

data.table.scss

_data_table.scss has only two custom classes insDataTableFormat__filter and insDataTableFormat__table. They are used to change the visibility of a EuiButtonIcon by changing its opacity on focus or on hover of a table row

.insDataTableFormat__filter {
opacity: 0;
}
.insDataTableFormat__filter:focus,
.insDataTableFormat__table tr:hover .insDataTableFormat__filter {
opacity: 1;
}

I think, those properties are still needed, as OUI doesn't currently allow this type of behaviour for a button icon.

Example can be seen here
button-icon-on-hover

data_table.tsx relies mostly on EUI components. The only component which is not from '@elastic/eui' is FormattedMessage.

requests.scss

_requests.scss contains three custom classes, all of them use euiSize variables to define properties.

.insRequestDetailsStats__icon {
margin-right: $euiSizeS;
}
.insRequestSelector__singleRequest {
height: $euiButtonHeightSmall;
padding: 0 $euiSizeS;
display: flex;
align-items: center;
}
.insRequestSelector__menuSpinner {
margin-left: $euiSizeS;
}

In request_selector.tsx file a div is styled using insRequestSelector__singleRequest custom class. That div is used for the logical expression and already wrapped by EuiFlexItem. I think it may be right to leave it as it is.

<EuiFlexItem grow={true}>
{requests.length <= 1 && (
<div
className="insRequestSelector__singleRequest"
data-test-subj="inspectorRequestName"
>
{selectedRequest.name}
</div>
)}
{requests.length > 1 && this.renderRequestDropdown()}
</EuiFlexItem>

inspector_panel.scss

inspector_panel.scss has a single class insInspectorPanel__flyoutBody and a comment

.insInspectorPanel__flyoutBody {
// TODO: EUI to allow for custom classNames to inner elements
// Or supply this as default
> div {
display: flex;
flex-direction: column;
> div {
flex-grow: 1;
}
}
}

I manually tested if something is changing when I delete that class. I suppose now it is redundant, since Flyout component behaved exactly the same way without a custom class.

Conclusion:

  • OUI components and variables mostly are used throughout the plugin
  • No need to remove custom class for EuiButtonIcon
  • Remove insInspectorPanel__flyoutBody custom class

@nurSaadat
Copy link

@BSFishy could you please assign me this issue?

@joshuarrrr joshuarrrr added the OUI compliance Issues and PRs to maximize OUI usage and remove style and component hacks label Jun 1, 2023
@joshuarrrr joshuarrrr moved this from Todo to In Progress in Look & Feel Jun 1, 2023
@joshuarrrr
Copy link
Member

@nurSaadat When you get a chance, can you just copy/paste your audit to a separate issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers OUI compliance Issues and PRs to maximize OUI usage and remove style and component hacks OUI Issues that require migration to OUI
Projects
Status: In Progress
Development

No branches or pull requests

3 participants