don't show transform actions on * queries (#13005)

This commit is contained in:
Vadim Ogievetsky 2022-08-30 21:54:18 -07:00 committed by GitHub
parent 48ceab2153
commit 054688528f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 26 deletions

View File

@ -152,23 +152,24 @@ export const QueryOutput = React.memo(function QueryOutput(props: QueryOutputPro
}
if (!parsedQuery.hasStarInSelect()) {
basicActions.push({
icon: IconNames.EDIT,
title: `Rename column`,
onAction: () => {
setRenamingColumn(headerIndex);
basicActions.push(
{
icon: IconNames.EDIT,
title: 'Rename column',
onAction: () => {
setRenamingColumn(headerIndex);
},
},
});
{
icon: IconNames.CROSS,
title: 'Remove column',
onAction: () => {
onQueryAction(q => q.removeOutputColumn(header));
},
},
);
}
basicActions.push({
icon: IconNames.CROSS,
title: `Remove column`,
onAction: () => {
onQueryAction(q => q.removeOutputColumn(header));
},
});
return basicActionsToMenu(basicActions)!;
} else {
const orderByExpression = SqlRef.column(header);

View File

@ -244,7 +244,7 @@ export const ResultTablePane = React.memo(function ResultTablePane(props: Result
}
// JSON hint
if (column.nativeType === 'COMPLEX<json>') {
if (selectExpression && column.nativeType === 'COMPLEX<json>') {
const paths = getJsonPaths(
filterMap(queryResult.rows, row => {
const v = row[headerIndex];
@ -319,7 +319,7 @@ export const ResultTablePane = React.memo(function ResultTablePane(props: Result
}
}
if (!parsedQuery.hasStarInSelect()) {
if (noStar) {
menuItems.push(
<MenuItem
key="edit_column"
@ -487,16 +487,18 @@ export const ResultTablePane = React.memo(function ResultTablePane(props: Result
}
}
menuItems.push(
<MenuItem
key="remove_column"
icon={IconNames.CROSS}
text="Remove column"
onClick={() => {
onQueryAction(q => q.removeOutputColumn(header));
}}
/>,
);
if (noStar) {
menuItems.push(
<MenuItem
key="remove_column"
icon={IconNames.CROSS}
text="Remove column"
onClick={() => {
onQueryAction(q => q.removeOutputColumn(header));
}}
/>,
);
}
} else {
menuItems.push(
<MenuItem