-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
chore(explore): Visual updates to explore datasource panel #20317
Changes from 3 commits
bd3b6a9
64f4181
7c07534
6fab57f
31dfdd2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ | |
*/ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { t, styled, withTheme } from '@superset-ui/core'; | ||
import { t, styled, withTheme, isValidDatasourceType } from '@superset-ui/core'; | ||
import { getUrlParam } from 'src/utils/urlUtils'; | ||
|
||
import { AntdDropdown } from 'src/components'; | ||
|
@@ -97,7 +97,7 @@ const Styles = styled.div` | |
white-space: nowrap; | ||
overflow: hidden; | ||
} | ||
.dataset-svg { | ||
.datasource-svg { | ||
margin-right: ${({ theme }) => 2 * theme.gridUnit}px; | ||
flex: none; | ||
} | ||
|
@@ -244,9 +244,23 @@ class DatasourceControl extends React.PureComponent { | |
return ( | ||
<Styles data-test="datasource-control" className="DatasourceControl"> | ||
<div className="data-container"> | ||
<Icons.DatasetPhysical className="dataset-svg" /> | ||
{/* Add a tooltip only for long dataset names */} | ||
{!isMissingDatasource && datasource.name.length > 25 ? ( | ||
{isValidDatasourceType ? ( | ||
<Icons.ConsoleSqlOutlined className="datasource-svg" /> | ||
) : ( | ||
<Icons.DatasetPhysical className="datasource-svg" /> | ||
)} | ||
{isValidDatasourceType ? ( | ||
/* Add a tooltip only for long dataset names */ | ||
!isMissingDatasource && datasource.sql.length > 25 ? ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. curious here why datasource.sql.length have to be greater than 25? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was how it was initially set, I just added the query route. I'm also not sure why 25 haha. It's for long dataset names to get a tooltip. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we make this value a constant then? |
||
<Tooltip title={datasource.sql}> | ||
<span className="title-select">{datasource.sql}</span> | ||
</Tooltip> | ||
) : ( | ||
<span title={datasource.sql} className="title-select"> | ||
{datasource.sql} | ||
</span> | ||
) | ||
) : !isMissingDatasource && datasource.name.length > 25 ? ( | ||
<Tooltip title={datasource.name}> | ||
<span className="title-select">{datasource.name}</span> | ||
</Tooltip> | ||
|
@@ -268,12 +282,10 @@ class DatasourceControl extends React.PureComponent { | |
trigger={['click']} | ||
data-test="datasource-menu" | ||
> | ||
<Tooltip title={t('More dataset related options')}> | ||
<Icons.MoreVert | ||
className="datasource-modal-trigger" | ||
data-test="datasource-menu-trigger" | ||
/> | ||
</Tooltip> | ||
<Icons.MoreVert | ||
className="datasource-modal-trigger" | ||
data-test="datasource-menu-trigger" | ||
/> | ||
</AntdDropdown> | ||
</div> | ||
{/* missing dataset */} | ||
|
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.
we need to check if the datasource.type is
DatasourceType.Query
here, if so then show the image in sql as the nameThere 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.
I changed this to be a strict check for just Query in
this commit
😁