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

#211 - Add the ability to attach files to YQL queries in Query Tracker UI. #236

Merged
merged 2 commits into from
Dec 13, 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
9 changes: 9 additions & 0 deletions packages/ui/src/ui/components/ButtonPopup/ButtonPopup.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.button-popup {
min-width: 620px;
padding: 16px 20px;

&__top-row {
display: flex;
justify-content: space-between;
}
}
45 changes: 45 additions & 0 deletions packages/ui/src/ui/components/ButtonPopup/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import React, {useRef, useState} from 'react';
import {Button, Icon, IconData, Popup, Text} from '@gravity-ui/uikit';
import closeIcon from '@gravity-ui/icons/svgs/xmark.svg';

import cn from 'bem-cn-lite';
import './ButtonPopup.scss';

const b = cn('button-popup');

type ButtonPopupProps = {
icon: IconData;
header: React.ReactNode;
children: React.ReactNode;
counter?: number;
};

export const ButtonWithPopup = ({icon, header, children, counter}: ButtonPopupProps) => {
const btnRef = useRef(null);
const [open, setOpen] = useState(false);
const toggle = () => setOpen(!open);
return (
<>
<Button ref={btnRef} onClick={toggle} view="outlined" size="l">
<Icon data={icon} size={16} />
{counter ? <Text>{counter}</Text> : undefined}
</Button>
<Popup
open={open}
anchorRef={btnRef}
placement={'bottom-start'}
onOutsideClick={toggle}
>
<div className={b()}>
<div className={b('top-row')}>
{header}
<Button onClick={toggle} view="flat">
<Icon data={closeIcon} />
</Button>
</div>
{children}
</div>
</Popup>
</>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
isQueryExecuted,
isQueryLoading,
} from '../module/query/selectors';
import {SET_QUERY_PATCH, runQuery} from '../module/query/actions';
import {runQuery, updateQueryDraft} from '../module/query/actions';
import FlexSplitPane from '../../../components/FlexSplitPane/FlexSplitPane';
import {QueryResults} from '../QueryResults';
import SquareIcon from '@gravity-ui/icons/svgs/square.svg';
Expand Down Expand Up @@ -106,7 +106,7 @@ const QueryEditorView = React.memo(function QueryEditorView({
const dispatch = useDispatch();
const upadteQueryText = useCallback(
function (text: string) {
dispatch({type: SET_QUERY_PATCH, data: {query: text, error: undefined}});
dispatch(updateQueryDraft({query: text, error: undefined}));
},
[dispatch],
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
.query-files-popup {
width: 640px;
&__header {
display: flex;
align-items: center;
gap: 5px;
}
&__footer {
display: flex;
gap: 10px;
}

&__file-list {
display: flex;
flex-direction: column;
gap: 10px;
padding-bottom: 10px;
}

&__file-item {
padding: 10px 0;
width: 100%;
height: 48px;
display: grid;
grid-template-columns: 1fr min-content;
align-items: center;
gap: 10px;
&-icon {
min-width: fit-content;
}
&-body,&-controls {
min-width: 0;
height: 100%;
display: flex;
align-items: center;
gap: 10px;
}
&-body_edit {
align-items: flex-start;
}
&-controls_edit {
align-items: flex-start;
padding-top: 5px;
}
&-body_deleted>:last-child {
flex-shrink: 0;
}
}
}
Loading
Loading