mirror of
https://github.com/apache/superset.git
synced 2026-05-09 09:55:19 +00:00
feat: Improves key expiration handling in Explore (#18624)
* feat: Improves key expiration handling in Explore * Sets use_slice_data equals true * Shows toast when recovering
This commit is contained in:
committed by
GitHub
parent
bcad1acec2
commit
f03b4dbedb
@@ -20,6 +20,7 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { t, styled, supersetTheme } from '@superset-ui/core';
|
||||
import { getUrlParam } from 'src/utils/urlUtils';
|
||||
|
||||
import { Dropdown, Menu } from 'src/common/components';
|
||||
import { Tooltip } from 'src/components/Tooltip';
|
||||
@@ -32,6 +33,7 @@ import { postForm } from 'src/explore/exploreUtils';
|
||||
import Button from 'src/components/Button';
|
||||
import ErrorAlert from 'src/components/ErrorMessage/ErrorAlert';
|
||||
import WarningIconWithTooltip from 'src/components/WarningIconWithTooltip';
|
||||
import { URL_PARAMS } from 'src/constants';
|
||||
|
||||
const propTypes = {
|
||||
actions: PropTypes.object.isRequired,
|
||||
@@ -182,6 +184,14 @@ class DatasourceControl extends React.PureComponent {
|
||||
const { showChangeDatasourceModal, showEditDatasourceModal } = this.state;
|
||||
const { datasource, onChange } = this.props;
|
||||
const isMissingDatasource = datasource.id == null;
|
||||
let isMissingParams = false;
|
||||
if (isMissingDatasource) {
|
||||
const datasetId = getUrlParam(URL_PARAMS.datasetId);
|
||||
const sliceId = getUrlParam(URL_PARAMS.sliceId);
|
||||
if (!datasetId && !sliceId) {
|
||||
isMissingParams = true;
|
||||
}
|
||||
}
|
||||
|
||||
const isSqlSupported = datasource.type === 'table';
|
||||
|
||||
@@ -244,7 +254,25 @@ class DatasourceControl extends React.PureComponent {
|
||||
</Dropdown>
|
||||
</div>
|
||||
{/* missing dataset */}
|
||||
{isMissingDatasource && (
|
||||
{isMissingDatasource && isMissingParams && (
|
||||
<div className="error-alert">
|
||||
<ErrorAlert
|
||||
level="warning"
|
||||
title={t('Missing URL parameters')}
|
||||
source="explore"
|
||||
subtitle={
|
||||
<>
|
||||
<p>
|
||||
{t(
|
||||
'The URL is missing the dataset_id or slice_id parameters.',
|
||||
)}
|
||||
</p>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
{isMissingDatasource && !isMissingParams && (
|
||||
<div className="error-alert">
|
||||
<ErrorAlert
|
||||
level="warning"
|
||||
|
||||
Reference in New Issue
Block a user