Skip to content

Commit

Permalink
Merge branch 'main' into CHARTS-10652
Browse files Browse the repository at this point in the history
  • Loading branch information
DaryaLari authored Dec 5, 2024
2 parents e52607b + a9cf3fe commit 7f4505f
Show file tree
Hide file tree
Showing 66 changed files with 914 additions and 150 deletions.
2 changes: 1 addition & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ component/general:
- package.json
- package-lock.json

type/chore:
type/deps:
- changed-files:
- any-glob-to-any-file:
- package.json
Expand Down
5 changes: 3 additions & 2 deletions scripts/e2e/us-dump.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ if [ $CONNECTION_CHECK_RESULT_STATUS_CODE -ne 0 ]; then
exit 1
fi

DUMP_CMD="pg_dump --dbname=$US_CONNECTION --column-inserts -a -t workbooks -t entries -t revisions -t links"
docker exec -it $US_CONTAINER_ID /bin/sh -c "$DUMP_CMD" | grep -Ev "^(--|SET|SELECT pg_catalog.set_config)" >$DUMP_TMP
DUMP_CMD="pg_dump --dbname=$US_CONNECTION --disable-triggers --column-inserts -a -t collections -t workbooks -t entries -t revisions -t links"
docker exec -it $US_CONTAINER_ID /bin/sh -c "$DUMP_CMD" |
tee >(grep -Ev "^(--|SET|SELECT pg_catalog.set_config|pg_dump:)" >$DUMP_TMP) | grep "pg_dump:"
DUMP_RESULT_STATUS_CODE=$?

if [ $DUMP_RESULT_STATUS_CODE -ne 0 ]; then
Expand Down
3 changes: 2 additions & 1 deletion src/i18n-keysets/collections/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"action_add-learning-materials-workbook": "Add learning materials",
"action_cancel": "Cancel",
"action_clear-filters": "Reset filters",
"action_connect-your-data": "Connect your data",
"action_copy": "Copy",
"action_create": "Create",
"action_create-collection": "Collection",
Expand All @@ -24,6 +25,6 @@
"label_not-found": "No results",
"label_root-title": "Collections and workbooks",
"label_title": "Name",
"section_create-first": "Start building your resource hierarchy: create a workbook or other resource",
"section_create-first": "You can create a workbook and connect your data",
"section_incorrect-filters": "Try other values in filters"
}
3 changes: 2 additions & 1 deletion src/i18n-keysets/collections/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"action_add-learning-materials-workbook": "Добавить учебные материалы",
"action_cancel": "Отменить",
"action_clear-filters": "Очистить фильтры",
"action_connect-your-data": "Подключить свои данные",
"action_copy": "Копировать",
"action_create": "Создать",
"action_create-collection": "Коллекцию",
Expand All @@ -24,6 +25,6 @@
"label_not-found": "Ничего не найдено",
"label_root-title": "Коллекции и воркбуки",
"label_title": "Название",
"section_create-first": "Начните выстраивать иерархию ресурсов, например, с воркбука",
"section_create-first": "Вы можете создать воркбук и подключить свои данные",
"section_incorrect-filters": "Попробуйте указать другие значения в фильтрах"
}
2 changes: 2 additions & 0 deletions src/shared/constants/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ export const TIME_FORMAT_24 = 'HH:mm';

export const UPDATE_STATE_DEBOUNCE_TIME = 1000;

export const SCROLL_TITLE_DEBOUNCE_TIME = 400;

export const SHARED_URL_OPTIONS = {
SAFE_CHART: '_safe_chart',
WITHOUT_UI_SANDBOX_LIMIT: '_without_sandbox_time_limit',
Expand Down
6 changes: 6 additions & 0 deletions src/shared/constants/qa/collections.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export const enum CollectionContentTableQa {
Table = 'coll-content-table',
CollectionLinkRow = 'coll-content-table-coll-link-row',
WorkbookLinkRow = 'coll-content-table-workbook-link-row',
CollectionTitleCell = 'coll-content-table-coll-title-cell',
}
5 changes: 5 additions & 0 deletions src/shared/constants/qa/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,8 @@ export enum DatalensTabs {
Item = 'dash-tab-item',
SwitcherItem = 'dash-tab-switcher-item',
}

export enum DatalensHeaderQa {
DesktopContainer = 'datalens-header-desktop-container',
MobileContainer = 'datalens-header-mobile-container',
}
6 changes: 6 additions & 0 deletions src/shared/constants/qa/dash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export enum DashEntryQa {
export enum TableOfContentQa {
TableOfContent = 'table-of-content',
CloseBtn = 'table-of-content-close',
MobileTableOfContent = 'mobile-table-of-content',
}

export enum DashMetaQa {
Expand Down Expand Up @@ -101,6 +102,11 @@ export enum DashBodyQa {
ContentWrapper = 'dash-body-content-wrapper',
}

export enum FixedHeaderQa {
Container = 'dash-fixed-header-containter',
Controls = 'dash-fixed-header-controls',
}

export enum DashTabsQA {
Root = 'dash-tabs',
}
17 changes: 9 additions & 8 deletions src/shared/constants/qa/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
export {VisualizationsQa} from './visualization';
export * from './chart';
export * from './collections';
export * from './components';
export * from './connections';
export * from './chart';
export * from './editor';
export * from './datasets';
export * from './control';
export * from './dash';
export * from './datasets';
export * from './dl-navigation';
export * from './wizard';
export * from './control';
export * from './ql';
export * from './editor';
export * from './field-editor';
export {VisualizationsQa} from './visualization';
export * from './uikit';
export * from './ql';
export * from './settings';
export * from './uikit';
export * from './wizard';
3 changes: 2 additions & 1 deletion src/shared/constants/qa/workbooks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export enum WorkbookPage {
export enum WorkbookPageQa {
ListItem = 'workbook-page-list-item',
MenuDropDownBtn = 'workbook-page-list-item-menu-btn',
MenuItemDuplicate = 'workbook-page-list-item-menu-item-duplicate',
Filters = 'workbook-page-filters',
}
14 changes: 10 additions & 4 deletions src/ui/components/CollectionsStructure/CreateWorkbookDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ export type OpenDialogCreateWorkbookArgs = {
type Props = {
collectionId: string | null;
open: boolean;
dialogTitle?: string;
defaultWorkbookTitle?: string;
onClose: () => void;
onApply?: (result: CreateWorkbookResponse | null) => void;
onApply?: (result: CreateWorkbookResponse | null) => void | Promise<void>;
};

export const CreateWorkbookDialog: React.FC<Props> = (props) => {
const dispatch: AppDispatch = useDispatch();
const {open, onClose} = props;
const {open, dialogTitle, defaultWorkbookTitle, onClose} = props;

const handleApply = async ({title, description}: {title: string; description?: string}) => {
const {collectionId, onApply} = props;
Expand All @@ -43,7 +45,10 @@ export const CreateWorkbookDialog: React.FC<Props> = (props) => {
);

if (onApply) {
onApply(result);
const promise = onApply(result);
if (promise) {
await promise;
}
}

return result;
Expand All @@ -53,10 +58,11 @@ export const CreateWorkbookDialog: React.FC<Props> = (props) => {

return (
<WorkbookDialog
title={i18n('action_create-workbook')}
title={dialogTitle ?? i18n('action_create-workbook')}
textButtonApply={i18n('action_create')}
open={open}
isLoading={isLoading}
titleValue={defaultWorkbookTitle}
onApply={handleApply}
onClose={onClose}
titleAutoFocus
Expand Down
13 changes: 10 additions & 3 deletions src/ui/components/DashKit/DashKit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import pluginControl from './plugins/Control/Control';
import pluginGroupControl from './plugins/GroupControl/GroupControl';
import {pluginImage} from './plugins/Image/Image';
import textPlugin from './plugins/Text/Text';
import pluginTitle from './plugins/Title/Title';
import titlePlugin from './plugins/Title/Title';
import widgetPlugin from './plugins/Widget/WidgetPlugin';

let isConfigured = false;
Expand All @@ -33,8 +33,15 @@ const wrapPlugins = (plugins: Plugin[], pluginDefaultsGetter?: typeof currentDef
});
};

export const getConfiguredDashKit = (pluginDefaultsGetter: typeof currentDefaultsGetter = null) => {
export const getConfiguredDashKit = (
pluginDefaultsGetter: typeof currentDefaultsGetter = null,
options?: {disableHashNavigation?: boolean},
) => {
if (currentDefaultsGetter !== pluginDefaultsGetter || !isConfigured) {
const titleSettings = {
hideAnchor: options?.disableHashNavigation,
};

const textSettings = {
apiHandler: MarkdownProvider.getMarkdown,
};
Expand All @@ -45,7 +52,7 @@ export const getConfiguredDashKit = (pluginDefaultsGetter: typeof currentDefault

const plugins = wrapPlugins(
[
pluginTitle,
titlePlugin.setSettings(titleSettings),
textPlugin.setSettings(textSettings),
pluginControl.setSettings(controlSettings),
pluginGroupControl.setSettings(controlSettings),
Expand Down
11 changes: 10 additions & 1 deletion src/ui/components/DashKit/helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ interface DashkitWrapperProps extends DashKitProps {
hideErrorDetails?: boolean;
// Extended headers context for widgets
dataProviderContextGetter?: () => DashChartRequestContext;
setWidgetCurrentTab?: (payload: {widgetId: string; tabId: string}) => void;
}

export const DashkitWrapper: React.FC<
Expand All @@ -124,7 +125,13 @@ export const DashkitWrapper: React.FC<
)
> = React.forwardRef(
(
{skipReload = false, isNewRelations = false, dataProviderContextGetter, ...props},
{
skipReload = false,
isNewRelations = false,
dataProviderContextGetter,
setWidgetCurrentTab,
...props
},
ref: React.ForwardedRef<DashKit>,
) => {
const contextValue = React.useMemo(() => {
Expand All @@ -133,6 +140,7 @@ export const DashkitWrapper: React.FC<
defaultGlobalParams: props.defaultGlobalParams,
skipReload,
isNewRelations,
setWidgetCurrentTab,
dataProviderContextGetter,
hideErrorDetails: props.hideErrorDetails,
};
Expand All @@ -141,6 +149,7 @@ export const DashkitWrapper: React.FC<
props.defaultGlobalParams,
skipReload,
isNewRelations,
setWidgetCurrentTab,
dataProviderContextGetter,
props.hideErrorDetails,
]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import '../mixins.scss';

.dashkit-plugin-container {
&__wrapper {
height: 100%;
Expand All @@ -10,16 +12,27 @@
background-color: var(--g-color-base-float);
}

.dashkit-grid-item__item_editMode &_text,
.dashkit-grid-item__item_editMode &_title {
background-color: var(--g-color-base-float);
}

&_title {
overflow: hidden;
scroll-margin-left: calc(24px + var(--gn-aside-header-size, 0px));
overflow: clip;
display: flex;
align-items: center;
max-height: 100%;
}

.dashkit-grid-item__item_editMode &_text,
.dashkit-grid-item__item_editMode &_title {
background-color: var(--g-color-base-float);
&_title:hover {
.dashkit-plugin-title-container__anchor {
opacity: 1;
}

.dashkit-plugin-title-container_with-absolute-anchor::after {
@include with-fade-effect;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,28 @@ type RendererProps = {
nodeRef?: React.RefObject<HTMLDivElement>;
classMod?: string;
style?: React.CSSProperties;
beforeContentNode?: React.ReactNode;
};

export const RendererWrapper: React.FC<RendererProps> = React.memo(
({children, type, nodeRef, classMod, ...props}) => {
({children, type, nodeRef, classMod, beforeContentNode, ...props}) => {
const innerNodeRef = React.useRef(null);
useWidgetContext(props.id, nodeRef || innerNodeRef);

return (
<div
ref={nodeRef || innerNodeRef}
className={b('wrapper', {
[type]: Boolean(type),
[String(classMod)]: Boolean(classMod),
})}
{...props}
>
{children}
</div>
<React.Fragment>
{beforeContentNode}
<div
ref={nodeRef || innerNodeRef}
className={b('wrapper', {
[type]: Boolean(type),
[String(classMod)]: Boolean(classMod),
})}
{...props}
>
{children}
</div>
</React.Fragment>
);
},
);
Expand Down
43 changes: 43 additions & 0 deletions src/ui/components/DashKit/plugins/Title/AnchorLink/AnchorLink.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import React from 'react';

import type {PluginTitleProps} from '@gravity-ui/dashkit';
import block from 'bem-cn-lite';
import {useLocation} from 'react-router';
import {Link} from 'react-router-dom';
import {DL} from 'ui/constants';

import '../Title.scss';

const b = block('dashkit-plugin-title-container');

interface AnchorLinkProps {
size: PluginTitleProps['data']['size'];
to: string;
show?: boolean;
absolute?: boolean;
top: number;
}

export const AnchorLink = ({size, to, show, absolute, top}: AnchorLinkProps) => {
const location = useLocation();
const hash = `#${encodeURIComponent(to)}`;

const link = {...location, hash};

if (DL.IS_MOBILE || !show) {
return null;
}

return (
<Link
className={b('anchor', {
size,
absolute,
})}
to={link}
style={{top}}
>
#
</Link>
);
};
Loading

0 comments on commit 7f4505f

Please sign in to comment.