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()) { if (!parsedQuery.hasStarInSelect()) {
basicActions.push({ basicActions.push(
icon: IconNames.EDIT, {
title: `Rename column`, icon: IconNames.EDIT,
onAction: () => { title: 'Rename column',
setRenamingColumn(headerIndex); 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)!; return basicActionsToMenu(basicActions)!;
} else { } else {
const orderByExpression = SqlRef.column(header); const orderByExpression = SqlRef.column(header);

View File

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