mirror of
https://github.com/apache/superset.git
synced 2026-04-22 09:35:23 +00:00
feat(trino): support early cancellation of queries (#22498)
This commit is contained in:
@@ -16,13 +16,13 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import React, { useState, useEffect, useCallback } from 'react';
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
import { useDispatch } from 'react-redux';
|
||||
import ButtonGroup from 'src/components/ButtonGroup';
|
||||
import Alert from 'src/components/Alert';
|
||||
import Button from 'src/components/Button';
|
||||
import shortid from 'shortid';
|
||||
import { styled, t, QueryResponse } from '@superset-ui/core';
|
||||
import { QueryResponse, QueryState, styled, t } from '@superset-ui/core';
|
||||
import { usePrevious } from 'src/hooks/usePrevious';
|
||||
import ErrorMessageWithStackTrace from 'src/components/ErrorMessage/ErrorMessageWithStackTrace';
|
||||
import {
|
||||
@@ -43,9 +43,9 @@ import CopyToClipboard from 'src/components/CopyToClipboard';
|
||||
import { addDangerToast } from 'src/components/MessageToasts/actions';
|
||||
import { prepareCopyToClipboardTabularData } from 'src/utils/common';
|
||||
import {
|
||||
CtasEnum,
|
||||
clearQueryResults,
|
||||
addQueryEditor,
|
||||
clearQueryResults,
|
||||
CtasEnum,
|
||||
fetchQueryResults,
|
||||
reFetchQueryResults,
|
||||
reRunQuery,
|
||||
@@ -387,8 +387,8 @@ const ResultSet = ({
|
||||
let trackingUrl;
|
||||
if (
|
||||
query.trackingUrl &&
|
||||
query.state !== 'success' &&
|
||||
query.state !== 'fetching'
|
||||
query.state !== QueryState.SUCCESS &&
|
||||
query.state !== QueryState.FETCHING
|
||||
) {
|
||||
trackingUrl = (
|
||||
<Button
|
||||
@@ -397,7 +397,9 @@ const ResultSet = ({
|
||||
href={query.trackingUrl}
|
||||
target="_blank"
|
||||
>
|
||||
{query.state === 'running' ? t('Track job') : t('See query details')}
|
||||
{query.state === QueryState.RUNNING
|
||||
? t('Track job')
|
||||
: t('See query details')}
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
@@ -406,11 +408,11 @@ const ResultSet = ({
|
||||
sql = <HighlightedSql sql={query.sql} />;
|
||||
}
|
||||
|
||||
if (query.state === 'stopped') {
|
||||
if (query.state === QueryState.STOPPED) {
|
||||
return <Alert type="warning" message={t('Query was stopped')} />;
|
||||
}
|
||||
|
||||
if (query.state === 'failed') {
|
||||
if (query.state === QueryState.FAILED) {
|
||||
return (
|
||||
<ResultlessStyles>
|
||||
<ErrorMessageWithStackTrace
|
||||
@@ -426,7 +428,7 @@ const ResultSet = ({
|
||||
);
|
||||
}
|
||||
|
||||
if (query.state === 'success' && query.ctas) {
|
||||
if (query.state === QueryState.SUCCESS && query.ctas) {
|
||||
const { tempSchema, tempTable } = query;
|
||||
let object = 'Table';
|
||||
if (query.ctas_method === CtasEnum.VIEW) {
|
||||
@@ -465,7 +467,7 @@ const ResultSet = ({
|
||||
);
|
||||
}
|
||||
|
||||
if (query.state === 'success' && query.results) {
|
||||
if (query.state === QueryState.SUCCESS && query.results) {
|
||||
const { results } = query;
|
||||
// Accounts for offset needed for height of ResultSetRowsReturned component if !limitReached
|
||||
const rowMessageHeight = !limitReached ? 32 : 0;
|
||||
@@ -508,7 +510,7 @@ const ResultSet = ({
|
||||
}
|
||||
}
|
||||
|
||||
if (query.cached || (query.state === 'success' && !query.results)) {
|
||||
if (query.cached || (query.state === QueryState.SUCCESS && !query.results)) {
|
||||
if (query.isDataPreview) {
|
||||
return (
|
||||
<Button
|
||||
|
||||
Reference in New Issue
Block a user