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

[Console][Multiple Datasource]Fine tuned dev tool datasource selector UI #3806

Merged
merged 2 commits into from
Apr 14, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 34 additions & 45 deletions src/plugins/dev_tools/public/application.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,51 +154,40 @@ function DevToolsWrapper({

return (
<main className="devApp">
<div>
<EuiFlexGroup gutterSize="none">
<EuiFlexItem>
<EuiTabs>
{devTools.map((currentDevTool) => (
<EuiToolTip content={currentDevTool.tooltipContent} key={currentDevTool.id}>
<EuiTab
disabled={currentDevTool.isDisabled()}
isSelected={currentDevTool === activeDevTool}
onClick={() => {
if (!currentDevTool.isDisabled()) {
updateRoute(`/${currentDevTool.id}`);
}
}}
>
{currentDevTool.title}
</EuiTab>
</EuiToolTip>
))}
</EuiTabs>
</EuiFlexItem>
{dataSourceEnabled ? (
<EuiFlexItem grow={false} className="dataSourceSelector">
<EuiComboBox
aria-label={i18n.translate('devTool.devToolWrapper.DataSourceComboBoxAriaLabel', {
defaultMessage: 'Select a Data Source',
})}
placeholder={i18n.translate(
'devTool.devToolWrapper.DataSourceComboBoxPlaceholder',
{
defaultMessage: 'Select a Data Source',
}
)}
singleSelection={{ asPlainText: true }}
options={dataSources}
selectedOptions={selectedOptions}
onChange={onChange}
prepend="DataSource"
compressed
isDisabled={!dataSourceEnabled}
/>
</EuiFlexItem>
) : null}
</EuiFlexGroup>
</div>
<EuiTabs className="devAppTabs">
{devTools.map((currentDevTool) => (
<EuiToolTip content={currentDevTool.tooltipContent} key={currentDevTool.id}>
<EuiTab
disabled={currentDevTool.isDisabled()}
isSelected={currentDevTool === activeDevTool}
onClick={() => {
if (!currentDevTool.isDisabled()) {
updateRoute(`/${currentDevTool.id}`);
}
}}
>
{currentDevTool.title}
</EuiTab>
</EuiToolTip>
))}
<div className="devAppDataSourcePicker">
<EuiComboBox
aria-label={i18n.translate('devTool.devToolWrapper.DataSourceComboBoxAriaLabel', {
defaultMessage: 'Select a Data Source',
})}
placeholder={i18n.translate('devTool.devToolWrapper.DataSourceComboBoxPlaceholder', {
defaultMessage: 'Select a Data Source',
})}
singleSelection={{ asPlainText: true }}
options={dataSources}
selectedOptions={selectedOptions}
onChange={onChange}
prepend="DataSource"
compressed
isDisabled={!dataSourceEnabled}
/>
</div>
joshuarrrr marked this conversation as resolved.
Show resolved Hide resolved
</EuiTabs>

<div
className="devApp__container"
Expand Down
10 changes: 8 additions & 2 deletions src/plugins/dev_tools/public/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@
flex-grow: 1;
}

.dataSourceSelector {
margin: 5px 10px 5px 5px;
.devAppDataSourcePicker {
margin: 7px 8px 0 0;
min-width: 400px;
}

.devAppTabs {
display: flex;
flex-flow: row wrap;
justify-content: space-between;
}
Comment on lines +30 to +34
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain more about why this wasn't achievable with EuiFlexGroup and EuiFlexItem as in the previous code? Because it likely means we need to open an issue in OUI to figure out how to address the need here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's an issue with EuiFlexGroup or EuiFlexItem. Previously when we use FlexGroup to have 2 flex item, one is EuiTabs, one is datasourcePicker, then there's this ugly line cut-off(comes with EuiTab). We want the line to stretch all the way to be under the DataSourcePicker.

Reason for the cut-off is that we have 2 flexItem. But we want it to look better to avoid the cut-off, and the solution in this PR is by making DataSourePicker within EuiTab component, while removing the FlexGroup and FlexItem. But since EuiTabs itself is not inherently a flex component, I need to achieve that in CSS.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked into this a bit - I think that the fundamental issue is that the current usage or EuiTabs here is not really the best component for the way we want the top of the page to work (EuiPageHeader with tabs and rightSideItems is more of what we want. But I think it makes the most sense to go forward with this hack for now, and then refactor it a part of a larger effort to convert the dev_tools and console plugins to be fully built with OUI components.