Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(QueryEditor): rename query modes #449

Merged
merged 2 commits into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@
}

&__mode-selector {
&__popup {
width: 120px;
}
$b: &;

&__button {
width: 120px;
width: 189px;
margin-left: 2px;
}

Expand All @@ -38,7 +36,24 @@
justify-content: space-between;
align-items: center;

width: 100px;
width: 163px;
}

&__popup {
width: 189px;

&_extended {
width: 241px;
}
}

&_extended {
#{$b}__button {
width: 241px;
}
#{$b}__button-content {
width: 215px;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ const queryModeSelectorPopupQa = 'query-mode-selector-popup';
const b = block('ydb-query-editor-controls');

const OldQueryModeSelectorTitles = {
[QUERY_MODES.script]: 'Script',
[QUERY_MODES.script]: 'YQL Script',
[QUERY_MODES.scan]: 'Scan',
} as const;

const QueryModeSelectorTitles = {
[QUERY_MODES.script]: 'Script',
[QUERY_MODES.script]: 'YQL Script',
[QUERY_MODES.scan]: 'Scan',
[QUERY_MODES.data]: 'Data',
[QUERY_MODES.query]: 'Query',
[QUERY_MODES.query]: 'YQL - QueryService',
} as const;

interface QueryEditorControlsProps {
Expand Down Expand Up @@ -102,23 +102,31 @@ export const QueryEditorControls = ({
>
Explain
</Button>
<DropdownMenu
items={querySelectorMenuItems}
popupProps={{
className: b('mode-selector__popup'),
qa: queryModeSelectorPopupQa,
}}
switcher={
<Button className={b('mode-selector__button')} qa={queryModeSelectorQa}>
<span className={b('mode-selector__button-content')}>
{`${i18n('controls.query-mode-selector_type')} ${
QueryModeSelectorTitles[queryMode]
}`}
<Icon name="chevron-down" width={16} height={16} />
</span>
</Button>
}
/>
<div
className={b('mode-selector', {
extended: enableAdditionalQueryModes,
})}
>
<DropdownMenu
items={querySelectorMenuItems}
popupProps={{
className: b('mode-selector__popup', {
extended: enableAdditionalQueryModes,
}),
qa: queryModeSelectorPopupQa,
}}
switcher={
<Button className={b('mode-selector__button')} qa={queryModeSelectorQa}>
<span className={b('mode-selector__button-content')}>
{`${i18n('controls.query-mode-selector_type')} ${
QueryModeSelectorTitles[queryMode]
}`}
<Icon name="chevron-down" width={16} height={16} />
</span>
</Button>
}
/>
</div>
</div>
<SaveQuery
savedQueries={savedQueries}
Expand Down
2 changes: 1 addition & 1 deletion src/containers/Tenant/Query/i18n/en.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"controls.query-mode-selector_type": "Type:",
"controls.query-mode-selector_type": "Query type:",
"tabs.newQuery": "New query",
"tabs.history": "History",
"tabs.saved": "Saved",
Expand Down
2 changes: 1 addition & 1 deletion src/containers/Tenant/Query/i18n/ru.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"controls.query-mode-selector_type": "Тип:",
"controls.query-mode-selector_type": "Тип запроса:",
"tabs.newQuery": "Новый запрос",
"tabs.history": "История",
"tabs.saved": "Сохраненные",
Expand Down
2 changes: 1 addition & 1 deletion src/containers/UserSettings/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
"settings.useNodesEndpoint.popover": "Use /viewer/json/nodes endpoint for Nodes Tab in diagnostics. It returns incorrect data on versions before 23-1",

"settings.enableAdditionalQueryModes.title": "Enable additional query modes",
"settings.enableAdditionalQueryModes.popover": "Adds 'Data' and 'Query' modes. May not work on some versions"
"settings.enableAdditionalQueryModes.popover": "Adds 'Data' and 'YQL - QueryService' modes. May not work on some versions"
}
2 changes: 1 addition & 1 deletion src/containers/UserSettings/i18n/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
"settings.useNodesEndpoint.popover": "Использовать эндпоинт /viewer/json/nodes для вкладки Nodes в диагностике. Может возвращать некорректные данные на версиях до 23-1",

"settings.enableAdditionalQueryModes.title": "Включить дополнительные режимы выполнения запросов",
"settings.enableAdditionalQueryModes.popover": "Добавляет режимы 'Data' и 'Query'. Может работать некорректно на некоторых версиях"
"settings.enableAdditionalQueryModes.popover": "Добавляет режимы 'Data' и 'YQL - QueryService'. Может работать некорректно на некоторых версиях"
}
2 changes: 1 addition & 1 deletion tests/suites/tenant/queryEditor/QueryEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {Locator, Page} from '@playwright/test';
import {BaseModel} from '../../../models/BaseModel';
import {selectContentTable} from '../../../utils/selectContentTable';

type QueryMode = 'Script' | 'Scan';
type QueryMode = 'YQL Script' | 'Scan';
type ExplainResultType = 'Schema' | 'JSON' | 'AST';

const queryModeSelectorQa = 'query-mode-selector';
Expand Down
4 changes: 2 additions & 2 deletions tests/suites/tenant/queryEditor/queryEditor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ test.describe('Test Query Editor', async () => {

test('Can run scipt', async ({page}) => {
const queryEditor = new QueryEditor(page);
await queryEditor.run(testQuery, 'Script');
await queryEditor.run(testQuery, 'YQL Script');

await expect(queryEditor.getRunResultTable()).toBeVisible();
});
Expand All @@ -35,7 +35,7 @@ test.describe('Test Query Editor', async () => {

test('Can get explain script', async ({page}) => {
const queryEditor = new QueryEditor(page);
await queryEditor.explain(testQuery, 'Script');
await queryEditor.explain(testQuery, 'YQL Script');

const explainSchema = await queryEditor.getExplainResult('Schema');
await expect(explainSchema).toBeVisible();
Expand Down