Skip to content

Commit e12efd5

Browse files
committed
fix: review fixes
1 parent 86bbf6f commit e12efd5

File tree

5 files changed

+156
-298
lines changed

5 files changed

+156
-298
lines changed

src/containers/Tenant/i18n/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"actions.copied": "The path is copied to the clipboard",
2626
"actions.notCopied": "Couldn’t copy the path",
2727
"actions.copyPath": "Copy path",
28+
"actions.dropIndex": "Drop index",
2829
"actions.openPreview": "Open preview",
2930
"actions.createTable": "Create table...",
3031
"actions.createExternalTable": "Create external table...",

src/containers/Tenant/utils/newSQLQueryActions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import {
2727
selectQueryTemplate,
2828
updateTableTemplate,
2929
upsertQueryTemplate,
30-
} from './newSQLQueryTemplates';
30+
} from './schemaQueryTemplates';
3131

3232
export const bindActions = (dispatch: React.Dispatch<any>) => {
3333
const inputQuery = (query: () => string) => () => {

src/containers/Tenant/utils/newSQLQueryTemplates.ts

Lines changed: 0 additions & 258 deletions
This file was deleted.

src/containers/Tenant/utils/schemaActions.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import createToast from '../../../utils/createToast';
99
import {transformPath} from '../ObjectSummary/transformPath';
1010
import i18n from '../i18n';
1111

12+
import type {SchemaQueryParams} from './schemaQueryTemplates';
1213
import {
1314
addTableIndex,
1415
alterAsyncReplicationTemplate,
@@ -22,6 +23,7 @@ import {
2223
createViewTemplate,
2324
dropAsyncReplicationTemplate,
2425
dropExternalTableTemplate,
26+
dropTableIndex,
2527
dropTopicTemplate,
2628
dropViewTemplate,
2729
selectQueryTemplate,
@@ -35,28 +37,28 @@ interface ActionsAdditionalEffects {
3537
}
3638

3739
const bindActions = (
38-
{path, relativePath}: {path: string; relativePath: string},
40+
schemaQueryParams: SchemaQueryParams,
3941
dispatch: React.Dispatch<any>,
4042
additionalEffects: ActionsAdditionalEffects,
4143
) => {
4244
const {setActivePath, updateQueryExecutionSettings, showCreateDirectoryDialog} =
4345
additionalEffects;
4446

45-
const inputQuery = (tmpl: (path: string) => string, mode?: QueryMode) => () => {
47+
const inputQuery = (tmpl: (params?: SchemaQueryParams) => string, mode?: QueryMode) => () => {
4648
if (mode) {
4749
updateQueryExecutionSettings({queryMode: mode});
4850
}
4951

50-
dispatch(changeUserInput({input: tmpl(relativePath)}));
52+
dispatch(changeUserInput({input: tmpl(schemaQueryParams)}));
5153
dispatch(setTenantPage(TENANT_PAGES_IDS.query));
5254
dispatch(setQueryTab(TENANT_QUERY_TABS_ID.newQuery));
53-
setActivePath(path);
55+
setActivePath(schemaQueryParams.path);
5456
};
5557

5658
return {
5759
createDirectory: showCreateDirectoryDialog
5860
? () => {
59-
showCreateDirectoryDialog(path);
61+
showCreateDirectoryDialog(schemaQueryParams.path);
6062
}
6163
: undefined,
6264
createTable: inputQuery(createTableTemplate, 'script'),
@@ -75,10 +77,11 @@ const bindActions = (
7577
dropTopic: inputQuery(dropTopicTemplate, 'script'),
7678
createView: inputQuery(createViewTemplate, 'script'),
7779
dropView: inputQuery(dropViewTemplate, 'script'),
80+
dropIndex: inputQuery(dropTableIndex, 'script'),
7881
addTableIndex: inputQuery(addTableIndex, 'script'),
7982
copyPath: () => {
8083
try {
81-
copy(relativePath);
84+
copy(schemaQueryParams.relativePath);
8285
createToast({
8386
name: 'Copied',
8487
title: i18n('actions.copied'),
@@ -170,6 +173,10 @@ export const getActions =
170173
],
171174
];
172175

176+
const INDEX_SET: ActionsSet = [
177+
[copyItem, {text: i18n('actions.dropIndex'), action: actions.dropIndex}],
178+
];
179+
173180
const JUST_COPY: ActionsSet = [copyItem];
174181

175182
// verbose mapping to guarantee a correct actions set for new node types
@@ -187,7 +194,7 @@ export const getActions =
187194
topic: TOPIC_SET,
188195
stream: JUST_COPY,
189196

190-
index: JUST_COPY,
197+
index: INDEX_SET,
191198

192199
external_table: EXTERNAL_TABLE_SET,
193200
external_data_source: EXTERNAL_DATA_SOURCE_SET,

0 commit comments

Comments
 (0)