fix(sql lab): replace the output column in the query history table (#19370)

* fix(sql lab): replace the output column in the query history table

* improvements
This commit is contained in:
Diego Medina 2022-04-13 12:22:03 -04:00 committed by GitHub
parent b81982d8f3
commit d4e7c65f6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 10 deletions

View File

@ -61,7 +61,7 @@ const QueryHistory = ({
'progress',
'rows',
'sql',
'output',
'results',
'actions',
]}
queries={queries}

View File

@ -35,10 +35,12 @@ import ResultSet from '../ResultSet';
import HighlightedSql from '../HighlightedSql';
import { StaticPosition, verticalAlign, StyledTooltip } from './styles';
interface QueryTableQuery extends Omit<Query, 'state' | 'sql' | 'progress'> {
interface QueryTableQuery
extends Omit<Query, 'state' | 'sql' | 'progress' | 'results'> {
state?: Record<string, any>;
sql?: Record<string, any>;
progress?: Record<string, any>;
results?: Record<string, any>;
}
interface QueryTableProps {
@ -227,12 +229,12 @@ const QueryTable = ({
</Card>
);
if (q.resultsKey) {
q.output = (
q.results = (
<ModalTrigger
className="ResultsModal"
triggerNode={
<Label type="info" className="pointer">
{t('View results')}
{t('View')}
</Label>
}
modalTitle={t('Data preview')}
@ -252,13 +254,8 @@ const QueryTable = ({
responsive
/>
);
} else {
// if query was run using ctas and force_ctas_schema was set
// tempTable will have the schema
const schemaUsed =
q.ctas && q.tempTable && q.tempTable.includes('.') ? '' : q.schema;
q.output = [schemaUsed, q.tempTable].filter(v => v).join('.');
}
q.progress =
state === 'success' ? (
<ProgressBar